diff options
-rw-r--r-- | res/menu/main.xml | 7 | ||||
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | src/net/hoopajoo/android/SoftKeys/Keys.java | 31 |
3 files changed, 40 insertions, 1 deletions
diff --git a/res/menu/main.xml b/res/menu/main.xml new file mode 100644 index 0000000..6344a33 --- /dev/null +++ b/res/menu/main.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@+id/menu_help" + android:title="@string/help" /> + <item android:id="@+id/menu_settings" + android:title="@string/settings" /> +</menu> diff --git a/res/values/strings.xml b/res/values/strings.xml index 36cde24..a3e9fb4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2,6 +2,9 @@ <resources> <string name="app_name">SoftKeys</string> + <string name="help">Help</string> + <string name="settings">Settings</string> + <string name="recent_tasks_title">Recent Tasks:</string> <string name="quickdoc_exit">Close</string> diff --git a/src/net/hoopajoo/android/SoftKeys/Keys.java b/src/net/hoopajoo/android/SoftKeys/Keys.java index 2724451..3a30985 100644 --- a/src/net/hoopajoo/android/SoftKeys/Keys.java +++ b/src/net/hoopajoo/android/SoftKeys/Keys.java @@ -40,6 +40,9 @@ import android.os.Handler; import android.preference.PreferenceManager; import android.util.Log; import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; @@ -374,7 +377,31 @@ public class Keys extends Activity implements OnClickListener, OnLongClickListen } } - + @Override + public boolean onCreateOptionsMenu( Menu menu ) { + getMenuInflater().inflate( R.menu.main, menu ); + return true; + } + + @Override + public boolean onOptionsItemSelected( MenuItem item ) { + // Handle item selection + switch( item.getItemId() ) { + case R.id.menu_help: + Intent intent = new Intent( this, QuickDoc.class ); + intent.putExtra( "type", "help" ); + startActivity( intent ); + return true; + + case R.id.menu_settings: + generic_click( R.id.settings, false ); + return true; + + default: + return super.onOptionsItemSelected( item ); + } + } + @Override public void onNewIntent( Intent i ) { Globals app = (Globals)getApplication(); @@ -641,10 +668,12 @@ public class Keys extends Activity implements OnClickListener, OnLongClickListen @Override public boolean onKeyDown( int code, KeyEvent k ) { + /* let menu be menu if( code == KeyEvent.KEYCODE_MENU ) { generic_click( R.id.settings, false ); return true; } + */ return super.onKeyDown( code, k ); } |