diff --git a/app/src/main/java/com/github/apognu/otter/activities/MainActivity.kt b/app/src/main/java/com/github/apognu/otter/activities/MainActivity.kt
index a3154e1..68f29b3 100644
--- a/app/src/main/java/com/github/apognu/otter/activities/MainActivity.kt
+++ b/app/src/main/java/com/github/apognu/otter/activities/MainActivity.kt
@@ -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)
}
diff --git a/app/src/main/java/com/github/apognu/otter/utils/Util.kt b/app/src/main/java/com/github/apognu/otter/utils/Util.kt
index 3bb02d9..bc0597c 100644
--- a/app/src/main/java/com/github/apognu/otter/utils/Util.kt
+++ b/app/src/main/java/com/github/apognu/otter/utils/Util.kt
@@ -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")
}
diff --git a/app/src/main/res/menu/toolbar.xml b/app/src/main/res/menu/toolbar.xml
index 5255ee2..689c1d7 100644
--- a/app/src/main/res/menu/toolbar.xml
+++ b/app/src/main/res/menu/toolbar.xml
@@ -21,6 +21,12 @@
android:title="@string/toolbar_search"
app:showAsAction="ifRoom" />
+
+
- %1$d piste • %2$s
- %1$d pistes • %2$s
+ Ma musique seulement
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fdb0a61..eb6c01c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -96,4 +96,5 @@
- %1$d track • %2$s"
- %1$d tracks • %2$s"
+ Only my music