diff --git a/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt index b269f7a95..446c93f68 100644 --- a/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt @@ -34,10 +34,10 @@ import kotlin.coroutines.CoroutineContext class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener, CoroutineScope { - lateinit var job: Job - private val oldDataRequestCode = 23156 - private val backupSelectRequestCode = 4567489 - private val restoreSelectRequestCode = 654872 + private lateinit var job: Job + private val oldDataRequestCode = 11 + private val backupSelectRequestCode = 22 + private val restoreSelectRequestCode = 33 override val coroutineContext: CoroutineContext get() = job + Dispatchers.Main 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 80db372ca..30e72a0dd 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 @@ -39,8 +39,8 @@ import org.jetbrains.anko.toast class MainActivity : VMBaseActivity(R.layout.activity_main), BottomNavigationView.OnNavigationItemSelectedListener, ViewPager.OnPageChangeListener by ViewPager.SimpleOnPageChangeListener() { - private val backupSelectRequestCode = 4567489 - private val restoreSelectRequestCode = 654872 + private val backupSelectRequestCode = 11 + private val restoreSelectRequestCode = 22 override val viewModel: MainViewModel get() = getViewModel(MainViewModel::class.java) @@ -195,7 +195,7 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) startActivityForResult(intent, backupSelectRequestCode) - } catch (e: java.lang.Exception) { + } catch (e: Exception) { PermissionsCompat.Builder(this) .addPermissions(*Permissions.Group.STORAGE) .rationale(R.string.tip_perm_request_storage)