Skip to content

Commit

Permalink
Display the users SSID
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjwood committed Dec 15, 2014
1 parent 3dd1692 commit 51b7467
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class MainActivity extends Activity {
private TextView macAddress;
private TextView ipAddress;
private TextView signalStrength;
private TextView ssid;

private ArrayList<String> hosts = new ArrayList<>();
private ArrayAdapter<String> adapter;
Expand All @@ -43,6 +44,7 @@ protected void onCreate(Bundle savedInstanceState) {
this.ipAddress = (TextView) findViewById(R.id.internalIpAddress);
this.signalStrength = (TextView) findViewById(R.id.signalStrength);
this.discoverHosts = (Button) findViewById(R.id.discoverHosts);
this.ssid = (TextView) findViewById(R.id.ssid);

if(savedInstanceState != null) {
this.hosts = savedInstanceState.getStringArrayList("hosts");
Expand All @@ -58,6 +60,7 @@ protected void onCreate(Bundle savedInstanceState) {

macAddress.setText(this.wifi.getMacAddress());
ipAddress.setText(internalIp);
ssid.setText(this.wifi.getSSID());

final Handler mHandler = new Handler();
mHandler.postDelayed(new Runnable() {
Expand Down
62 changes: 44 additions & 18 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">

<TextView
android:id="@+id/deviceInfoLabel"
Expand All @@ -11,7 +11,7 @@
android:paddingBottom="10dp"
android:text="@string/deviceInfoLabel"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/icsblue" />
android:textColor="@color/icsblue"/>

<TextView
android:id="@+id/deviceMacAddressLabel"
Expand All @@ -23,7 +23,7 @@
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/deviceMacLabel"
android:textColor="@color/white" />
android:textColor="@color/white"/>

<TextView
android:id="@+id/deviceMacAddress"
Expand All @@ -33,13 +33,13 @@
android:layout_below="@id/deviceInfoLabel"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:textColor="@color/icsblue" />
android:textColor="@color/icsblue"/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/deviceMacAddressLabel"
android:background="@color/icsblue" />
android:background="@color/icsblue"/>

<TextView
android:id="@+id/internalIpAddressLabel"
Expand All @@ -51,7 +51,7 @@
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/internalIpLabel"
android:textColor="@color/white" />
android:textColor="@color/white"/>

<TextView
android:id="@+id/internalIpAddress"
Expand All @@ -61,13 +61,13 @@
android:layout_below="@id/deviceMacAddress"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:textColor="@color/icsblue" />
android:textColor="@color/icsblue"/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/internalIpAddress"
android:background="@color/icsblue" />
android:background="@color/icsblue"/>

<TextView
android:id="@+id/externalIpAddressLabel"
Expand All @@ -79,7 +79,7 @@
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/externalIpLabel"
android:textColor="@color/white" />
android:textColor="@color/white"/>

<TextView
android:id="@+id/externalIpAddress"
Expand All @@ -90,14 +90,13 @@
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/externalIpAddress"
android:textColor="@color/icsblue" />
android:textColor="@color/icsblue"/>

<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/externalIpAddress"
android:background="@color/icsblue" />
android:background="@color/icsblue"/>

<TextView
android:id="@+id/signalStrengthLabel"
Expand All @@ -109,7 +108,7 @@
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/signalLabel"
android:textColor="@color/white" />
android:textColor="@color/white"/>

<TextView
android:id="@+id/signalStrength"
Expand All @@ -119,12 +118,39 @@
android:layout_below="@id/externalIpAddress"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:textColor="@color/icsblue" />
android:textColor="@color/icsblue"/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/signalStrength"
android:background="@color/icsblue"/>

<TextView
android:id="@+id/ssidLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/signalStrengthLabel"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/ssid"
android:textColor="@color/white"/>

<TextView
android:id="@+id/ssid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/signalStrength"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:textColor="@color/icsblue"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/signalStrengthLabel"
android:layout_below="@id/ssidLabel"
android:orientation="vertical">

<ListView
Expand All @@ -139,7 +165,7 @@
android:layout_height="wrap_content"
android:background="@drawable/discover_hosts_button"
android:text="@string/hostDiscovery"
android:textColor="@drawable/discover_hosts_button_text" />
android:textColor="@drawable/discover_hosts_button_text"/>
</LinearLayout>

</RelativeLayout>

0 comments on commit 51b7467

Please sign in to comment.