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) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
setupOptionsMenu() setupOptionsMenu()
refreshMenuItems()
} }
override fun onResume() { 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() { private fun setupOptionsMenu() {
settings_toolbar.setOnMenuItemClickListener { menuItem -> settings_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) { when (menuItem.itemId) {
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
R.id.about -> launchAbout() R.id.about -> launchAbout()
else -> return@setOnMenuItemClickListener false else -> return@setOnMenuItemClickListener false
} }

View File

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