#52: Properly handle content filter selection and state.
This commit is contained in:
parent
ce8d956cee
commit
e60814d28f
|
@ -156,7 +156,11 @@ class MainActivity : AppCompatActivity() {
|
||||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||||
menuInflater.inflate(R.menu.toolbar, menu)
|
menuInflater.inflate(R.menu.toolbar, menu)
|
||||||
|
|
||||||
menu?.findItem(R.id.nav_all_music)?.isChecked = Settings.getScopes().contains("all")
|
menu?.findItem(R.id.nav_all_music)?.let {
|
||||||
|
it.isChecked = Settings.getScopes().contains("all")
|
||||||
|
it.isEnabled = !it.isChecked
|
||||||
|
}
|
||||||
|
|
||||||
menu?.findItem(R.id.nav_my_music)?.isChecked = Settings.getScopes().contains("me")
|
menu?.findItem(R.id.nav_my_music)?.isChecked = Settings.getScopes().contains("me")
|
||||||
menu?.findItem(R.id.nav_followed)?.isChecked = Settings.getScopes().contains("subscribed")
|
menu?.findItem(R.id.nav_followed)?.isChecked = Settings.getScopes().contains("subscribed")
|
||||||
|
|
||||||
|
@ -197,6 +201,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
R.id.nav_followed -> "subscribed"
|
R.id.nav_followed -> "subscribed"
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
menu.findItem(R.id.nav_all_music).isEnabled = false
|
||||||
menu.findItem(R.id.nav_my_music).isChecked = false
|
menu.findItem(R.id.nav_my_music).isChecked = false
|
||||||
menu.findItem(R.id.nav_followed).isChecked = false
|
menu.findItem(R.id.nav_followed).isChecked = false
|
||||||
|
|
||||||
|
@ -207,7 +212,10 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.findItem(R.id.nav_all_music).isChecked = false
|
menu.findItem(R.id.nav_all_music).let {
|
||||||
|
it.isChecked = false
|
||||||
|
it.isEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
scopes.remove("all")
|
scopes.remove("all")
|
||||||
|
|
||||||
|
@ -216,6 +224,15 @@ class MainActivity : AppCompatActivity() {
|
||||||
false -> scopes.remove(new)
|
false -> scopes.remove(new)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scopes.isEmpty()) {
|
||||||
|
menu.findItem(R.id.nav_all_music).let {
|
||||||
|
it.isChecked = true
|
||||||
|
it.isEnabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
scopes.add("all")
|
||||||
|
}
|
||||||
|
|
||||||
PowerPreference.getDefaultFile().set("scope", scopes.joinToString(","))
|
PowerPreference.getDefaultFile().set("scope", scopes.joinToString(","))
|
||||||
EventBus.send(Event.ListingsChanged)
|
EventBus.send(Event.ListingsChanged)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue