mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
Fix incorrect behaviour of favorites in menu
This commit is contained in:
parent
750a08ee67
commit
fc0b87c9a7
@ -66,8 +66,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
restartActivity()
|
restartActivity()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidateOptionsMenu()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
@ -89,9 +87,12 @@ 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)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
|
||||||
val favorites = config.favorites
|
val favorites = config.favorites
|
||||||
menu.apply {
|
menu!!.apply {
|
||||||
findItem(R.id.add_favorite).isVisible = !favorites.contains(fragment.currentPath)
|
findItem(R.id.add_favorite).isVisible = !favorites.contains(fragment.currentPath)
|
||||||
findItem(R.id.remove_favorite).isVisible = favorites.contains(fragment.currentPath)
|
findItem(R.id.remove_favorite).isVisible = favorites.contains(fragment.currentPath)
|
||||||
findItem(R.id.go_to_favorite).isVisible = favorites.isNotEmpty()
|
findItem(R.id.go_to_favorite).isVisible = favorites.isNotEmpty()
|
||||||
@ -180,7 +181,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(fragment_holder as ItemsFragment).openPath(newPath)
|
(fragment_holder as ItemsFragment).openPath(newPath)
|
||||||
invalidateOptionsMenu()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
@ -213,12 +213,10 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun addFavorite() {
|
private fun addFavorite() {
|
||||||
config.addFavorite(fragment.currentPath)
|
config.addFavorite(fragment.currentPath)
|
||||||
invalidateOptionsMenu()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeFavorite() {
|
private fun removeFavorite() {
|
||||||
config.removeFavorite(fragment.currentPath)
|
config.removeFavorite(fragment.currentPath)
|
||||||
invalidateOptionsMenu()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun goToFavorite() {
|
private fun goToFavorite() {
|
||||||
@ -256,7 +254,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
private fun toggleTemporarilyShowHidden(show: Boolean) {
|
private fun toggleTemporarilyShowHidden(show: Boolean) {
|
||||||
config.temporarilyShowHidden = show
|
config.temporarilyShowHidden = show
|
||||||
openPath(fragment.currentPath)
|
openPath(fragment.currentPath)
|
||||||
invalidateOptionsMenu()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun launchAbout() {
|
private fun launchAbout() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user