kopia lustrzana https://github.com/ge0rg/aprsdroid
added options menu
rodzic
e95a3cadd6
commit
75ddb66cc2
|
@ -0,0 +1,8 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/preferences"
|
||||
android:title="@string/preferences"
|
||||
android:icon="@android:drawable/ic_menu_preferences" />
|
||||
<item android:id="@+id/quit"
|
||||
android:title="Quit"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
</menu>
|
|
@ -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)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue