Make Cached playlist optional (#11)
This commit is contained in:
@@ -321,39 +321,41 @@ fun HomeScreen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
if (preferences.isCachedPlaylistShown) {
|
||||||
Box(
|
item {
|
||||||
modifier = Modifier
|
Box(
|
||||||
.padding(all = 8.dp)
|
modifier = Modifier
|
||||||
.clickable(
|
.padding(all = 8.dp)
|
||||||
indication = rememberRipple(bounded = true),
|
.clickable(
|
||||||
interactionSource = remember { MutableInteractionSource() },
|
indication = rememberRipple(bounded = true),
|
||||||
onClick = {
|
interactionSource = remember { MutableInteractionSource() },
|
||||||
builtInPlaylistRoute(BuiltInPlaylist.Cached)
|
onClick = {
|
||||||
}
|
builtInPlaylistRoute(BuiltInPlaylist.Cached)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.background(colorPalette.lightBackground)
|
||||||
|
.size(108.dp)
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(R.drawable.download),
|
||||||
|
contentDescription = null,
|
||||||
|
colorFilter = ColorFilter.tint(colorPalette.blue),
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.Center)
|
||||||
|
.size(24.dp)
|
||||||
)
|
)
|
||||||
.background(colorPalette.lightBackground)
|
|
||||||
.size(108.dp)
|
|
||||||
) {
|
|
||||||
Image(
|
|
||||||
painter = painterResource(R.drawable.download),
|
|
||||||
contentDescription = null,
|
|
||||||
colorFilter = ColorFilter.tint(colorPalette.blue),
|
|
||||||
modifier = Modifier
|
|
||||||
.align(Alignment.Center)
|
|
||||||
.size(24.dp)
|
|
||||||
)
|
|
||||||
|
|
||||||
BasicText(
|
BasicText(
|
||||||
text = "Cached",
|
text = "Cached",
|
||||||
style = typography.xxs.semiBold,
|
style = typography.xxs.semiBold,
|
||||||
maxLines = 2,
|
maxLines = 2,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.align(Alignment.BottomStart)
|
.align(Alignment.BottomStart)
|
||||||
.padding(horizontal = 8.dp, vertical = 4.dp)
|
.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,18 @@ fun AppearanceSettingsScreen() {
|
|||||||
preferences.thumbnailRoundness = it
|
preferences.thumbnailRoundness = it
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SettingsEntryGroupText(title = "OTHER")
|
||||||
|
|
||||||
|
SwitchSettingEntry(
|
||||||
|
title = "Cached playlist",
|
||||||
|
text = "Display a playlist whose songs can be played offline",
|
||||||
|
isChecked = preferences.isCachedPlaylistShown,
|
||||||
|
onCheckedChange = {
|
||||||
|
preferences.isCachedPlaylistShown = it
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class Preferences(
|
|||||||
initialVolumeNormalization: Boolean,
|
initialVolumeNormalization: Boolean,
|
||||||
initialPersistentQueue: Boolean,
|
initialPersistentQueue: Boolean,
|
||||||
initialIsInvincibilityEnabled: Boolean,
|
initialIsInvincibilityEnabled: Boolean,
|
||||||
|
initialIsCachedPlaylistShown: Boolean,
|
||||||
) {
|
) {
|
||||||
constructor(preferences: SharedPreferences) : this(
|
constructor(preferences: SharedPreferences) : this(
|
||||||
edit = { action: SharedPreferences.Editor.() -> Unit ->
|
edit = { action: SharedPreferences.Editor.() -> Unit ->
|
||||||
@@ -44,6 +45,7 @@ class Preferences(
|
|||||||
initialVolumeNormalization = preferences.getBoolean(Keys.volumeNormalization, false),
|
initialVolumeNormalization = preferences.getBoolean(Keys.volumeNormalization, false),
|
||||||
initialPersistentQueue = preferences.getBoolean(Keys.persistentQueue, false),
|
initialPersistentQueue = preferences.getBoolean(Keys.persistentQueue, false),
|
||||||
initialIsInvincibilityEnabled = preferences.getBoolean(Keys.isInvincibilityEnabled, false),
|
initialIsInvincibilityEnabled = preferences.getBoolean(Keys.isInvincibilityEnabled, false),
|
||||||
|
initialIsCachedPlaylistShown = preferences.getBoolean(Keys.isCachedPlaylistShown, false),
|
||||||
)
|
)
|
||||||
|
|
||||||
var isFirstLaunch = initialIsFirstLaunch
|
var isFirstLaunch = initialIsFirstLaunch
|
||||||
@@ -85,6 +87,9 @@ class Preferences(
|
|||||||
var isInvincibilityEnabled = initialIsInvincibilityEnabled
|
var isInvincibilityEnabled = initialIsInvincibilityEnabled
|
||||||
set(value) = edit { putBoolean(Keys.isInvincibilityEnabled, value) }
|
set(value) = edit { putBoolean(Keys.isInvincibilityEnabled, value) }
|
||||||
|
|
||||||
|
var isCachedPlaylistShown = initialIsCachedPlaylistShown
|
||||||
|
set(value) = edit { putBoolean(Keys.isCachedPlaylistShown, value) }
|
||||||
|
|
||||||
object Keys {
|
object Keys {
|
||||||
const val isFirstLaunch = "isFirstLaunch"
|
const val isFirstLaunch = "isFirstLaunch"
|
||||||
const val songSortOrder = "songSortOrder"
|
const val songSortOrder = "songSortOrder"
|
||||||
@@ -99,6 +104,7 @@ class Preferences(
|
|||||||
const val volumeNormalization = "volumeNormalization"
|
const val volumeNormalization = "volumeNormalization"
|
||||||
const val persistentQueue = "persistentQueue"
|
const val persistentQueue = "persistentQueue"
|
||||||
const val isInvincibilityEnabled = "isInvincibilityEnabled"
|
const val isInvincibilityEnabled = "isInvincibilityEnabled"
|
||||||
|
const val isCachedPlaylistShown = "isCachedPlaylistShown"
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
Reference in New Issue
Block a user