mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Added options menu for debug purposes
This commit is contained in:
1 parent
3bf511019e
commit
13ac2357ea
2 files changed
+46
No files matched your search
@@ -1,6 +1,9 @@
|
||||
package com.rtbishop.lookingsat
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
@@ -48,4 +51,25 @@ class MainActivity : AppCompatActivity() {
|
||||
val navController = findNavController(R.id.nav_host)
|
||||
return navController.navigateUp(appBarConfig) || super.onSupportNavigateUp()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.main_menu, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.fetch_trans -> Toast.makeText(
|
||||
this,
|
||||
"Fetching transmitters",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
R.id.save_to_db -> Toast.makeText(this, "Saving to DB", Toast.LENGTH_SHORT).show()
|
||||
R.id.load_from_db -> Toast.makeText(this, "Loading from DB", Toast.LENGTH_SHORT).show()
|
||||
R.id.fetch_tle -> Toast.makeText(this, "Fetching TLE", Toast.LENGTH_SHORT).show()
|
||||
R.id.load_tle -> Toast.makeText(this, "Loading TLE", Toast.LENGTH_SHORT).show()
|
||||
R.id.action_exit -> finish()
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/fetch_trans"
|
||||
android:title="Fetch Transmitters" />
|
||||
<item
|
||||
android:id="@+id/save_to_db"
|
||||
android:title="Save to DB" />
|
||||
<item
|
||||
android:id="@+id/load_from_db"
|
||||
android:title="Load from DB" />
|
||||
<item
|
||||
android:id="@+id/fetch_tle"
|
||||
android:title="Fetch TLE" />
|
||||
<item
|
||||
android:id="@+id/load_tle"
|
||||
android:title="Load TLE" />
|
||||
<item
|
||||
android:id="@+id/action_exit"
|
||||
android:title="Exit" />
|
||||
</menu>
|
||||
Reference in new issue
Block a user