adding a More Apps From Us menu butto

This commit is contained in:
tibbi 2022-11-27 23:03:44 +01:00
parent 79c1a17680
commit 790d470da7
2 changed files with 15 additions and 2 deletions

View File

@ -24,6 +24,7 @@ class SettingsActivity : SimpleActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings)
setupOptionsMenu()
refreshMenuItems()
}
override fun onResume() {
@ -63,9 +64,16 @@ class SettingsActivity : SimpleActivity() {
}
}
fun refreshMenuItems() {
settings_toolbar.menu.apply {
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
}
}
private fun setupOptionsMenu() {
settings_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
R.id.about -> launchAbout()
else -> return@setOnMenuItemClickListener false
}

View File

@ -4,8 +4,13 @@
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="AppCompatResource">
<item
android:id="@+id/about"
android:id="@+id/more_apps_from_us"
android:showAsAction="never"
android:title="@string/about"
android:title="@string/more_apps_from_us"
app:showAsAction="never" />
<item
android:id="@+id/about"
android:icon="@drawable/ic_info_vector"
android:title="@string/about"
app:showAsAction="ifRoom" />
</menu>