mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-19 07:23:56 +00:00
fix: only save when clicked save
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user