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