diff --git a/res/menu/options.xml b/res/menu/options.xml new file mode 100644 index 0000000..91bdd28 --- /dev/null +++ b/res/menu/options.xml @@ -0,0 +1,8 @@ +
diff --git a/src/APRSdroid.scala b/src/APRSdroid.scala index fc388e2..1a7c4c6 100644 --- a/src/APRSdroid.scala +++ b/src/APRSdroid.scala @@ -7,7 +7,7 @@ import _root_.android.os.Bundle import _root_.android.preference.PreferenceManager import _root_.java.text.SimpleDateFormat import _root_.android.util.Log -import _root_.android.view.View +import _root_.android.view.{Menu, MenuItem, View} import _root_.android.view.View.OnClickListener import _root_.android.widget.Button import _root_.android.widget.TextView @@ -86,6 +86,11 @@ class APRSdroid extends Activity with OnClickListener { new Intent(action, null, this, classOf[AprsService]) } + override def onCreateOptionsMenu(menu : Menu) : Boolean = { + getMenuInflater().inflate(R.menu.options, menu); + true + } + def setupButtons(running : Boolean) { singleBtn.setEnabled(!running) if (running) { @@ -95,6 +100,19 @@ class APRSdroid extends Activity with OnClickListener { } } + override def onOptionsItemSelected(mi : MenuItem) : Boolean = { + mi.getItemId match { + case R.id.preferences => + startActivity(new Intent(this, classOf[PrefsAct])); + true + case R.id.quit => + stopService(serviceIntent(AprsService.SERVICE)) + finish(); + true + case _ => false + } + } + override def onClick(view : View) { Log.d(TAG, "onClick: " + view + "/" + view.getId)