Hide menu if not in developer mode

This commit is contained in:
Benoit Marty 2021-02-09 11:04:47 +01:00 committed by Benoit Marty
parent b870a8b791
commit 649edffa30
2 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.os.Parcelable
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.Toolbar
@ -362,6 +363,12 @@ class HomeActivity :
override fun getMenuRes() = R.menu.home
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
menu.findItem(R.id.menu_home_init_sync_legacy)?.isVisible = vectorPreferences.developerMode()
menu.findItem(R.id.menu_home_init_sync_optimized)?.isVisible = vectorPreferences.developerMode()
return super.onPrepareOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_home_suggestion -> {

View File

@ -21,12 +21,12 @@
<item
android:id="@+id/menu_home_init_sync_legacy"
android:title="Init sync legacy"
android:title="Do a legacy init sync"
tools:ignore="HardcodedText" />
<item
android:id="@+id/menu_home_init_sync_optimized"
android:title="Init sync optimized"
android:title="Do an optimized init sync"
tools:ignore="HardcodedText" />
<item