From 95c028ad81fa48a63f3ad3178409b86281625aac Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Wed, 17 Dec 2014 16:46:02 -0500 Subject: [PATCH] add an options menu to access the future settings activity --- NOTES | 9 ++++++--- res/menu/main_menu.xml | 9 +++++++++ src/org/galexander/sshd/SimpleSSHD.java | 23 +++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 res/menu/main_menu.xml diff --git a/NOTES b/NOTES index f11afab..9488a14 100644 --- a/NOTES +++ b/NOTES @@ -72,11 +72,14 @@ it uses select(), I'm not sure how I would honor Thread.interrupt() or whatever. It's not guaranteed to interrupt select(), and I'm not keen on adding an arbitrary timeout/polling feature to it. -XXX - allow user to specify parameters for dropbear -XXX - convert UI to use proper preferences templates, and have ...->settings instead of putting it on the home screen -XXX - draw icon and 1024x512 display image +XXX - allow user to specify extra commandline for dropbear +XXX - convert UI to use proper preferences template XXX - main screen should show dropbear.err contents XXX - scp XXX - zlib XXX - rsync + +XXX - draw icon and 1024x512 display image +XXX - document (ga.org/software/simplesshd/) +XXX - upload diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml new file mode 100644 index 0000000..222d17c --- /dev/null +++ b/res/menu/main_menu.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/src/org/galexander/sshd/SimpleSSHD.java b/src/org/galexander/sshd/SimpleSSHD.java index f9220db..c81a501 100644 --- a/src/org/galexander/sshd/SimpleSSHD.java +++ b/src/org/galexander/sshd/SimpleSSHD.java @@ -9,6 +9,9 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.Button; import android.view.View; +import android.view.Menu; +import android.view.MenuItem; +import android.net.Uri; public class SimpleSSHD extends Activity { @@ -42,6 +45,26 @@ public class SimpleSSHD extends Activity super.onPause(); } + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.main_menu, menu); + return true; + } + + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.settings: + /* XXX - launch settings activity */ + return true; + case R.id.about: { + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse("http://www.galexander.org/software/simplesshd")); + startActivity(i); + } return true; + default: + return super.onOptionsItemSelected(item); + } + } + public void update_startstop() { if (SimpleSSHDService.is_started()) { startstop_view.setText("STOP");