diff options
-rw-r--r-- | res/layout/client_dashboard.xml | 23 | ||||
-rw-r--r-- | res/layout/eip_overview.xml | 27 | ||||
-rwxr-xr-x | res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/se/leap/leapclient/Dashboard.java | 33 |
4 files changed, 84 insertions, 0 deletions
diff --git a/res/layout/client_dashboard.xml b/res/layout/client_dashboard.xml index 599a097..9d9b7a4 100644 --- a/res/layout/client_dashboard.xml +++ b/res/layout/client_dashboard.xml @@ -53,4 +53,27 @@ </LinearLayout> </LinearLayout> + + <View + android:layout_width="wrap_content" + android:layout_height="2dp" + android:layout_marginBottom="15dp" + android:background="@android:drawable/divider_horizontal_bright" /> + + <LinearLayout + android:id="@+id/servicesCollection" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="0.11" + android:orientation="vertical" > + + <ViewStub + android:id="@+id/eipOverviewStub" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:inflatedId="@+id/eipOverview" + android:layout="@layout/eip_overview" /> + + </LinearLayout> + </LinearLayout>
\ No newline at end of file diff --git a/res/layout/eip_overview.xml b/res/layout/eip_overview.xml new file mode 100644 index 0000000..d8defcb --- /dev/null +++ b/res/layout/eip_overview.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="10dp" > + + <TextView + android:id="@+id/eipType" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentTop="true" + android:layout_marginBottom="10dp" + android:layout_marginLeft="15dp" + android:layout_toLeftOf="@+id/eipSwitch" + android:text="@string/eip_type_active" + android:textAppearance="?android:attr/textAppearanceLarge" /> + + <Switch + android:id="@+id/eipSwitch" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_alignParentTop="true" + android:layout_marginRight="10dp" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 606cb3b..f18c992 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -257,5 +257,6 @@ <string name="title_activity_dashboard">LEAP Dashboard</string> <string name="provider_label">Provider:</string> <string name="provider_label_none">No provider configured</string> + <string name="eip_type_active">EIP</string> </resources>
\ No newline at end of file diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java index cc215be..5835acb 100644 --- a/src/se/leap/leapclient/Dashboard.java +++ b/src/se/leap/leapclient/Dashboard.java @@ -47,6 +47,10 @@ public class Dashboard extends Activity { providerNameTV = (TextView) findViewById(R.id.providerName); providerNameTV.setText(provider.getName()); providerNameTV.setTextSize(28); // TODO maybe to some calculating, or a marquee? + + // TODO Inflate layout fragments for provider's services + if ( provider.hasEIP() ) + serviceItemEIP(); } // FIXME!! We don't want you around here once we have something /real/ going on @@ -96,6 +100,35 @@ public class Dashboard extends Activity { fakes.commit(); } + private void serviceItemEIP() { + // FIXME Provider service (eip/openvpn) + View eipOverview = ((ViewStub) findViewById(R.id.eipOverviewStub)).inflate(); + + // Set our EIP type title + eipTypeTV = (TextView) findViewById(R.id.eipType); + eipTypeTV.setText(provider.getEIPType()); + + // TODO Bind our switch to run our EIP + // What happens when our VPN stops running? does it call the listener? + Switch eipSwitch = (Switch) findViewById(R.id.eipSwitch); + eipSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if ( isChecked ){ + //TODO startVPN(); + } else { + //TODO stopVPN(); + } + } + }); + + //TODO write our info into the view fragment that will expand with details and a settings button + // TODO set eip overview subview + // TODO make eip type clickable, show subview + // TODO attach vpn status feedback to eip overview view + // TODO attach settings button to something + } + @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. |