From de822857d764b7f08b2805ab1576f59da8d81813 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 18 Sep 2019 12:35:26 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/main/MainActivity.kt | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index eea51eb6e..bcd3fd017 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -13,15 +13,15 @@ import io.legado.app.base.VMBaseActivity import io.legado.app.constant.Bus import io.legado.app.help.permission.Permissions import io.legado.app.help.permission.PermissionsCompat +import io.legado.app.lib.dialogs.alert +import io.legado.app.lib.dialogs.noButton +import io.legado.app.lib.dialogs.yesButton import io.legado.app.lib.theme.ATH import io.legado.app.ui.main.bookshelf.BookshelfFragment import io.legado.app.ui.main.explore.ExploreFragment import io.legado.app.ui.main.my.MyFragment import io.legado.app.ui.main.rss.RssFragment -import io.legado.app.utils.getPrefInt -import io.legado.app.utils.getViewModel -import io.legado.app.utils.observeEvent -import io.legado.app.utils.putPrefInt +import io.legado.app.utils.* import kotlinx.android.synthetic.main.activity_main.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.launch @@ -58,11 +58,17 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), private fun importYueDu() { launch { if (withContext(IO) { App.db.bookDao().allBookCount == 0 }) { - PermissionsCompat.Builder(this@MainActivity) - .addPermissions(*Permissions.Group.STORAGE) - .rationale(R.string.tip_perm_request_storage) - .onGranted { viewModel.restore() } - .request() + alert(title = "导入") { + message = "是否导入旧版本数据" + yesButton { + PermissionsCompat.Builder(this@MainActivity) + .addPermissions(*Permissions.Group.STORAGE) + .rationale(R.string.tip_perm_request_storage) + .onGranted { viewModel.restore() } + .request() + } + noButton { } + }.show().applyTint() } } }