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

View file

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