fix: something

This commit is contained in:
aayush262 2024-05-05 00:00:13 +05:30
parent f86086cc7a
commit aae80f6493
2 changed files with 8 additions and 9 deletions

View file

@ -189,7 +189,7 @@ 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 var remove: Boolean? = null
binding.mediaListShow.isChecked = media?.id in removeList binding.mediaListShow.isChecked = media?.id in removeList
binding.mediaListShow.setOnCheckedChangeListener { _, checked -> binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
remove = checked remove = checked
@ -259,10 +259,10 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
) )
} }
} }
if (remove) { if (remove == true) {
PrefManager.setCustomVal("removeList", removeList.plus(media?.id)) PrefManager.setCustomVal("removeList", removeList.plus(media!!.id))
} else { } else if (remove == false) {
PrefManager.setCustomVal("removeList", removeList.minus(media?.id)) PrefManager.setCustomVal("removeList", removeList.minus(media!!.id))
} }
Refresh.all() Refresh.all()
snackString(getString(R.string.list_updated)) snackString(getString(R.string.list_updated))

View file

@ -172,11 +172,10 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
media.isListPrivate = checked media.isListPrivate = checked
} }
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>()) val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
var remove = false var remove: Boolean? = null
binding.mediaListShow.isChecked = media.id in removeList binding.mediaListShow.isChecked = media.id in removeList
binding.mediaListShow.setOnCheckedChangeListener { _, checked -> binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
remove = checked remove = checked
} }
binding.mediaListSave.setOnClickListener { binding.mediaListSave.setOnClickListener {
scope.launch { scope.launch {
@ -205,9 +204,9 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
) )
} }
} }
if (remove) { if (remove == true) {
PrefManager.setCustomVal("removeList", removeList.plus(media.id)) PrefManager.setCustomVal("removeList", removeList.plus(media.id))
} else { } else if (remove == false) {
PrefManager.setCustomVal("removeList", removeList.minus(media.id)) PrefManager.setCustomVal("removeList", removeList.minus(media.id))
} }
Refresh.all() Refresh.all()