mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
fix: watch positions can't be reset
This commit is contained in:
parent
2940f4a6f9
commit
db91919cb6
@ -1,13 +1,13 @@
|
||||
package com.github.libretube.ui.preferences
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.Preference
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.db.DatabaseHolder.Database
|
||||
import com.github.libretube.ui.base.BasePreferenceFragment
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@ -53,15 +53,15 @@ class HistorySettings : BasePreferenceFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showClearDialog(title: Int, action: suspend () -> Unit) {
|
||||
private fun showClearDialog(title: Int, actionOnConfirm: suspend () -> Unit) {
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(title)
|
||||
.setMessage(R.string.irreversible)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.okay) { _, _ ->
|
||||
// clear the selected preference preferences
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
action()
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
actionOnConfirm.invoke()
|
||||
}
|
||||
}
|
||||
.show()
|
||||
|
Loading…
Reference in New Issue
Block a user