fix: only save when clicked save
This commit is contained in:
parent
425ca158a3
commit
f86086cc7a
2 changed files with 17 additions and 11 deletions
|
@ -189,13 +189,10 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
|||
media?.isListPrivate = checked
|
||||
}
|
||||
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
|
||||
var remove = false
|
||||
binding.mediaListShow.isChecked = media?.id in removeList
|
||||
binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
|
||||
if (checked) {
|
||||
PrefManager.setCustomVal("removeList", removeList.plus(media?.id))
|
||||
} else {
|
||||
PrefManager.setCustomVal("removeList", removeList.minus(media?.id))
|
||||
}
|
||||
remove = checked
|
||||
}
|
||||
media?.userRepeat?.apply {
|
||||
binding.mediaListRewatch.setText(this.toString())
|
||||
|
@ -262,6 +259,11 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
|||
)
|
||||
}
|
||||
}
|
||||
if (remove) {
|
||||
PrefManager.setCustomVal("removeList", removeList.plus(media?.id))
|
||||
} else {
|
||||
PrefManager.setCustomVal("removeList", removeList.minus(media?.id))
|
||||
}
|
||||
Refresh.all()
|
||||
snackString(getString(R.string.list_updated))
|
||||
dismissAllowingStateLoss()
|
||||
|
@ -284,6 +286,7 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
PrefManager.setCustomVal("removeList", removeList.minus(media?.id))
|
||||
}
|
||||
if (id != null) {
|
||||
Refresh.all()
|
||||
|
|
|
@ -172,13 +172,11 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
|
|||
media.isListPrivate = checked
|
||||
}
|
||||
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
|
||||
binding.mediaListShow.isChecked = media?.id in removeList
|
||||
var remove = false
|
||||
binding.mediaListShow.isChecked = media.id in removeList
|
||||
binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
|
||||
if (checked) {
|
||||
PrefManager.setCustomVal("removeList", removeList.plus(media.id))
|
||||
} else {
|
||||
PrefManager.setCustomVal("removeList", removeList.minus(media.id))
|
||||
}
|
||||
remove = checked
|
||||
|
||||
}
|
||||
binding.mediaListSave.setOnClickListener {
|
||||
scope.launch {
|
||||
|
@ -207,6 +205,11 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
|
|||
)
|
||||
}
|
||||
}
|
||||
if (remove) {
|
||||
PrefManager.setCustomVal("removeList", removeList.plus(media.id))
|
||||
} else {
|
||||
PrefManager.setCustomVal("removeList", removeList.minus(media.id))
|
||||
}
|
||||
Refresh.all()
|
||||
snackString(getString(R.string.list_updated))
|
||||
dismissAllowingStateLoss()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue