properly handle menu item color updating
This commit is contained in:
parent
fcd032a403
commit
9c8bf5a16b
|
@ -20,6 +20,20 @@ class FavoritesActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
updateFavorites()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_favorites, menu)
|
||||
updateMenuItemColors(menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.add_favorite -> addFavorite()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun updateFavorites() {
|
||||
val favorites = ArrayList<String>()
|
||||
config.favorites.mapTo(favorites) { it }
|
||||
|
@ -40,19 +54,6 @@ class FavoritesActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_favorites, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.add_favorite -> addFavorite()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
updateFavorites()
|
||||
}
|
||||
|
|
|
@ -71,6 +71,11 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
searchMenuItem?.collapseActionView()
|
||||
|
@ -84,6 +89,7 @@ class MainActivity : SimpleActivity() {
|
|||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu, menu)
|
||||
setupSearch(menu)
|
||||
updateMenuItemColors(menu)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ class ReadTextActivity : SimpleActivity() {
|
|||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_editor, menu)
|
||||
setupSearch(menu)
|
||||
updateMenuItemColors(menu)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simplemobiletools.filemanager.pro.activities
|
|||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import com.simplemobiletools.commons.dialogs.ChangeDateTimeFormatDialog
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.SecurityDialog
|
||||
|
@ -39,6 +40,12 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupEnableRootAccess()
|
||||
updateTextColors(settings_holder)
|
||||
setupSectionColors()
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
updateMenuItemColors(menu)
|
||||
return super.onCreateOptionsMenu(menu)
|
||||
}
|
||||
|
||||
private fun setupSectionColors() {
|
||||
|
|
Loading…
Reference in New Issue