diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-01-30 22:54:56 -0700 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-01-30 22:54:56 -0700 |
commit | c849913fba3f5b692309570415f85e9bdb8cceeb (patch) | |
tree | 6f088be443dd2f272c764fcdc18319fda7864414 | |
parent | dc10be031f58a334dbf67c8a904d03e302304d42 (diff) |
Beginnings of a Dashboard Activity
Matching layout and menu XML
And don't forget strings
-rw-r--r-- | res/layout/client_dashboard.xml | 56 | ||||
-rw-r--r-- | res/menu/client_dashboard.xml | 10 | ||||
-rwxr-xr-x | res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/se/leap/leapclient/Dashboard.java | 71 |
4 files changed, 139 insertions, 0 deletions
diff --git a/res/layout/client_dashboard.xml b/res/layout/client_dashboard.xml new file mode 100644 index 0000000..599a097 --- /dev/null +++ b/res/layout/client_dashboard.xml @@ -0,0 +1,56 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/dashboardLayout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:context=".Dashboard" > + + <LinearLayout + android:id="@+id/providerLine" + android:layout_width="match_parent" + android:layout_height="40dp" + android:background="?android:attr/selectableItemBackground" > + + <LinearLayout + android:id="@+id/providerLabelWrapper" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center_vertical" + android:orientation="vertical" + android:paddingLeft="10dp" > + + <TextView + android:id="@+id/providerLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="marquee" + android:fadingEdge="horizontal" + android:singleLine="true" + android:text="@string/provider_label" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textSize="24sp" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/providerNameWrapper" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_vertical" + android:orientation="vertical" + android:paddingLeft="15dp" > + + <TextView + android:id="@+id/providerName" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="marquee" + android:fadingEdge="horizontal" + android:singleLine="true" + android:text="@string/provider_label_none" + android:textAppearance="?android:attr/textAppearanceMedium" /> + + </LinearLayout> + </LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/res/menu/client_dashboard.xml b/res/menu/client_dashboard.xml new file mode 100644 index 0000000..cafeb15 --- /dev/null +++ b/res/menu/client_dashboard.xml @@ -0,0 +1,10 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android" > + + <item + android:id="@+id/menu_settings" + android:orderInCategory="100" + android:showAsAction="never" + android:title="@string/menu_settings"/> + <item android:id="@+id/legacy_interface" android:title="ICS OpenVPN Interface" android:orderInCategory="500" /> + +</menu>
\ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 87b395c..606cb3b 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -255,5 +255,7 @@ <string name="state_nonetwork">Waiting for usable network</string> <string name="menu_settings">Settings</string> <string name="title_activity_dashboard">LEAP Dashboard</string> + <string name="provider_label">Provider:</string> + <string name="provider_label_none">No provider configured</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 e69de29..50c267b 100644 --- a/src/se/leap/leapclient/Dashboard.java +++ b/src/se/leap/leapclient/Dashboard.java @@ -0,0 +1,71 @@ +package se.leap.leapclient; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import se.leap.openvpn.AboutFragment; +import se.leap.openvpn.MainActivity; +import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentTransaction; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.res.AssetManager; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewStub; +import android.widget.CompoundButton; +import android.widget.Switch; +import android.widget.TextView; + +public class Dashboard extends Activity { + + private static SharedPreferences preferences; + private static Provider provider; + + private TextView providerNameTV; + private TextView eipTypeTV; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.client_dashboard); + + preferences = getPreferences(MODE_PRIVATE); + + // Get our provider + provider = Provider.getInstance(preferences); + + // Set provider name in textview + providerNameTV = (TextView) findViewById(R.id.providerName); + providerNameTV.setText(provider.getName()); + providerNameTV.setTextSize(28); // TODO maybe to some calculating, or a marquee? + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.client_dashboard, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item){ + Intent intent; + // Handle item selection + switch (item.getItemId()){ + case R.id.legacy_interface: + // TODO call se.leap.openvpn.MainActivity + intent = new Intent(this,MainActivity.class); + startActivity(intent); + return true; + default: + return super.onOptionsItemSelected(item); + } + + } + +} |