Frontend logic for displaying only own music.
This commit is contained in:
parent
fc1419c2fb
commit
746ae8897d
|
@ -129,6 +129,10 @@ class MainActivity : AppCompatActivity() {
|
|||
|
||||
// CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.cast)
|
||||
|
||||
menu?.let {
|
||||
menu.findItem(R.id.nav_only_my_music).isChecked = Settings.getScope() == "me"
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -148,6 +152,14 @@ class MainActivity : AppCompatActivity() {
|
|||
|
||||
R.id.nav_queue -> launchDialog(QueueFragment())
|
||||
R.id.nav_search -> startActivity(Intent(this, SearchActivity::class.java))
|
||||
R.id.nav_only_my_music -> {
|
||||
item.isChecked = !item.isChecked
|
||||
|
||||
when (item.isChecked) {
|
||||
true -> PowerPreference.getDefaultFile().set("scope", "me")
|
||||
false -> PowerPreference.getDefaultFile().set("scope", "all")
|
||||
}
|
||||
}
|
||||
R.id.settings -> startActivityForResult(Intent(this, SettingsActivity::class.java), 0)
|
||||
}
|
||||
|
||||
|
|
|
@ -57,4 +57,5 @@ object Settings {
|
|||
fun getAccessToken(): String = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getString("access_token", "")
|
||||
fun isAnonymous() = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getBoolean("anonymous", false)
|
||||
fun areExperimentsEnabled() = PowerPreference.getDefaultFile().getBoolean("experiments", false)
|
||||
fun getScope() = PowerPreference.getDefaultFile().getString("scope", "all")
|
||||
}
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
android:title="@string/toolbar_search"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_only_my_music"
|
||||
android:checkable="true"
|
||||
android:title="@string/only_my_music"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:icon="@drawable/settings"
|
||||
|
|
|
@ -95,4 +95,5 @@
|
|||
<item quantity="one">%1$d piste • %2$s</item>
|
||||
<item quantity="other">%1$d pistes • %2$s</item>
|
||||
</plurals>
|
||||
<string name="only_my_music">Ma musique seulement</string>
|
||||
</resources>
|
|
@ -96,4 +96,5 @@
|
|||
<item quantity="one">%1$d track • %2$s"</item>
|
||||
<item quantity="other">%1$d tracks • %2$s"</item>
|
||||
</plurals>
|
||||
<string name="only_my_music">Only my music</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue