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
|
media?.isListPrivate = checked
|
||||||
}
|
}
|
||||||
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
|
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
|
||||||
|
var remove = false
|
||||||
binding.mediaListShow.isChecked = media?.id in removeList
|
binding.mediaListShow.isChecked = media?.id in removeList
|
||||||
binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
|
binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
|
||||||
if (checked) {
|
remove = checked
|
||||||
PrefManager.setCustomVal("removeList", removeList.plus(media?.id))
|
|
||||||
} else {
|
|
||||||
PrefManager.setCustomVal("removeList", removeList.minus(media?.id))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
media?.userRepeat?.apply {
|
media?.userRepeat?.apply {
|
||||||
binding.mediaListRewatch.setText(this.toString())
|
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()
|
Refresh.all()
|
||||||
snackString(getString(R.string.list_updated))
|
snackString(getString(R.string.list_updated))
|
||||||
dismissAllowingStateLoss()
|
dismissAllowingStateLoss()
|
||||||
|
@ -284,6 +286,7 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PrefManager.setCustomVal("removeList", removeList.minus(media?.id))
|
||||||
}
|
}
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
Refresh.all()
|
Refresh.all()
|
||||||
|
|
|
@ -172,13 +172,11 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
|
||||||
media.isListPrivate = checked
|
media.isListPrivate = checked
|
||||||
}
|
}
|
||||||
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
|
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 ->
|
binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
|
||||||
if (checked) {
|
remove = checked
|
||||||
PrefManager.setCustomVal("removeList", removeList.plus(media.id))
|
|
||||||
} else {
|
|
||||||
PrefManager.setCustomVal("removeList", removeList.minus(media.id))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
binding.mediaListSave.setOnClickListener {
|
binding.mediaListSave.setOnClickListener {
|
||||||
scope.launch {
|
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()
|
Refresh.all()
|
||||||
snackString(getString(R.string.list_updated))
|
snackString(getString(R.string.list_updated))
|
||||||
dismissAllowingStateLoss()
|
dismissAllowingStateLoss()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue