Skip to content

Commit

Permalink
release-y version for camp'15
Browse files Browse the repository at this point in the history
  • Loading branch information
eqvinox committed Aug 9, 2015
1 parent 4eb433a commit 6c38994
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 12 deletions.
2 changes: 1 addition & 1 deletion android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tf.nox.wifisetup" android:installLocation="auto" android:versionCode="20150801" android:versionName="0.16">
package="tf.nox.wifisetup" android:installLocation="auto" android:versionCode="20150809" android:versionName="0.17">
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="21"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<uses-feature android:name="android.hardware.wifi" android:required="true"/>
Expand Down
47 changes: 43 additions & 4 deletions android/res/layout/logon.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<ViewFlipper
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".WiFiEduroam"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".WiFiEduroam"
android:id="@+id/viewflipper"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/FirstView"
>

<LinearLayout
Expand All @@ -20,8 +27,15 @@
android:scaleType="fitStart"
android:contentDescription="@string/CAMP_LOGO"
android:src="@drawable/cccamp2015"
android:padding="20dp" />

android:padding="20dp" />

<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:autoLink="web"
android:layout_marginTop="15dp"
android:text="@string/twitter"/>

<CheckBox android:id="@+id/check5g"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -79,3 +93,28 @@
/>
</LinearLayout>
</ScrollView>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/logonLayout"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:id="@+id/resulttitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:textAlignment="center"
android:textSize="24dp"
/>
<TextView
android:id="@+id/result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:textAlignment="center"
/>
</LinearLayout>
</ViewFlipper>
2 changes: 2 additions & 0 deletions android/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<string name="Password">password</string>
<string name="Logon">Create connection entry</string>

<string name="twitter">https://twitter.com/c3noc</string>

<string name="c5ghz">This device supports the 5GHz band</string>
<string name="l5ghz">(Unfortunately, autodetecting 5GHz support is broken...)</string>

Expand Down
25 changes: 18 additions & 7 deletions android/src/tf/nox/wifisetup/WifiSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.CheckBox;
import android.widget.ViewFlipper;

// API level 18 and up
import android.net.wifi.WifiEnterpriseConfig;
Expand Down Expand Up @@ -121,7 +122,7 @@ public class WifiSetup extends Activity {
private int logoclicks = 0;
private String s_username;
private String s_password;

private ViewFlipper flipper;

private void toastText(final String text) {
if (toast != null)
Expand All @@ -146,6 +147,7 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.logon);

flipper = (ViewFlipper) findViewById(R.id.viewflipper);
username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password);

Expand Down Expand Up @@ -196,10 +198,9 @@ public void onClick(View _v) {
@Override
public void run() {
try {
updateStatus("Installing WiFi profile...");
if (android.os.Build.VERSION.SDK_INT >= 18) {
saveWifiConfig();
updateStatus("All done!");
resultStatus(true, "You should now have a wifi connection entry with correct security settings and certificate verification.\n\nMake sure to actually use it!");
// Clear the password field in the UI thread
/*
mHandler.post(new Runnable() {
Expand All @@ -213,7 +214,7 @@ public void run() {
throw new RuntimeException("What version is this?! API Mismatch");
}
} catch (RuntimeException e) {
updateStatus("Runtime Error: " + e.getMessage());
resultStatus(false, "Something went wrong: " + e.getMessage());
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -396,15 +397,25 @@ public boolean onOptionsItemSelected(MenuItem item){


/* Update the status in the main thread */
protected void updateStatus(final String text) {
protected void resultStatus(final boolean success, final String text) {
mHandler.post(new Runnable() {
@Override
public void run() {
TextView res_title = (TextView) findViewById(R.id.resulttitle);
TextView res_text = (TextView) findViewById(R.id.result);

System.out.println(text);
res_text.setText(text);
if (success)
res_title.setText("Success!");
else
res_title.setText("ERROR!");

if (toast != null)
toast.cancel();
toast = Toast.makeText(getBaseContext(), text, Toast.LENGTH_LONG);
toast.show();
/* toast = Toast.makeText(getBaseContext(), text, Toast.LENGTH_LONG);
toast.show(); */
flipper.showNext();
};
});
}
Expand Down

0 comments on commit 6c38994

Please sign in to comment.