pull/68/head^2
kunfei 5 years ago
parent 3178d9b893
commit ecc11a5847
  1. 8
      app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt
  2. 6
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt

@ -34,10 +34,10 @@ import kotlin.coroutines.CoroutineContext
class WebDavConfigFragment : PreferenceFragmentCompat(), class WebDavConfigFragment : PreferenceFragmentCompat(),
Preference.OnPreferenceChangeListener, Preference.OnPreferenceChangeListener,
CoroutineScope { CoroutineScope {
lateinit var job: Job private lateinit var job: Job
private val oldDataRequestCode = 23156 private val oldDataRequestCode = 11
private val backupSelectRequestCode = 4567489 private val backupSelectRequestCode = 22
private val restoreSelectRequestCode = 654872 private val restoreSelectRequestCode = 33
override val coroutineContext: CoroutineContext override val coroutineContext: CoroutineContext
get() = job + Dispatchers.Main get() = job + Dispatchers.Main

@ -39,8 +39,8 @@ import org.jetbrains.anko.toast
class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main), class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
BottomNavigationView.OnNavigationItemSelectedListener, BottomNavigationView.OnNavigationItemSelectedListener,
ViewPager.OnPageChangeListener by ViewPager.SimpleOnPageChangeListener() { ViewPager.OnPageChangeListener by ViewPager.SimpleOnPageChangeListener() {
private val backupSelectRequestCode = 4567489 private val backupSelectRequestCode = 11
private val restoreSelectRequestCode = 654872 private val restoreSelectRequestCode = 22
override val viewModel: MainViewModel override val viewModel: MainViewModel
get() = getViewModel(MainViewModel::class.java) get() = getViewModel(MainViewModel::class.java)
@ -195,7 +195,7 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE) val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
startActivityForResult(intent, backupSelectRequestCode) startActivityForResult(intent, backupSelectRequestCode)
} catch (e: java.lang.Exception) { } catch (e: Exception) {
PermissionsCompat.Builder(this) PermissionsCompat.Builder(this)
.addPermissions(*Permissions.Group.STORAGE) .addPermissions(*Permissions.Group.STORAGE)
.rationale(R.string.tip_perm_request_storage) .rationale(R.string.tip_perm_request_storage)

Loading…
Cancel
Save