pull/49/head
kunfei 5 years ago
parent 532d2b0e8d
commit 9a36c02202
  1. 32
      app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt

@ -7,9 +7,7 @@ import androidx.preference.EditTextPreference
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.permission.Permissions import io.legado.app.help.permission.Permissions
import io.legado.app.help.permission.PermissionsCompat import io.legado.app.help.permission.PermissionsCompat
import io.legado.app.help.storage.Backup import io.legado.app.help.storage.Backup
@ -22,8 +20,6 @@ import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.getPrefString import io.legado.app.utils.getPrefString
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener { class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener {
@ -103,24 +99,20 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreference
} }
private fun importOld() { private fun importOld() {
Coroutine.async { alert(title = "导入") {
if (withContext(Dispatchers.IO) { App.db.bookDao().allBookCount == 0 }) { message = "是否导入旧版本数据"
alert(title = "导入") { yesButton {
message = "是否导入旧版本数据" PermissionsCompat.Builder(this@WebDavConfigFragment)
yesButton { .addPermissions(*Permissions.Group.STORAGE)
PermissionsCompat.Builder(this@WebDavConfigFragment) .rationale(R.string.tip_perm_request_storage)
.addPermissions(*Permissions.Group.STORAGE) .onGranted {
.rationale(R.string.tip_perm_request_storage) Restore.importYueDuData(requireContext())
.onGranted {
Restore.importYueDuData(requireContext())
}
.request()
} }
noButton { .request()
}
}.show().applyTint()
} }
} noButton {
}
}.show().applyTint()
} }
} }
Loading…
Cancel
Save