feat: 优化代码

pull/103/head
kunfei 5 years ago
parent ae69c01fff
commit 598022661b
  1. 6
      app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt
  2. 8
      app/src/main/java/io/legado/app/ui/download/DownloadActivity.kt

@ -183,12 +183,18 @@ object BackupRestoreUi {
} }
} }
2 -> { 2 -> {
PermissionsCompat.Builder(fragment)
.addPermissions(*Permissions.Group.STORAGE)
.rationale(R.string.tip_perm_request_storage)
.onGranted {
FileChooserDialog.show( FileChooserDialog.show(
fragment.childFragmentManager, fragment.childFragmentManager,
oldDataRequestCode, oldDataRequestCode,
mode = FileChooserDialog.DIRECTORY mode = FileChooserDialog.DIRECTORY
) )
} }
.request()
}
} }
} }
}.show() }.show()

@ -15,6 +15,8 @@ import io.legado.app.constant.EventBus
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookChapter
import io.legado.app.help.BookHelp import io.legado.app.help.BookHelp
import io.legado.app.help.permission.Permissions
import io.legado.app.help.permission.PermissionsCompat
import io.legado.app.service.help.Download import io.legado.app.service.help.Download
import io.legado.app.ui.filechooser.FileChooserDialog import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.utils.ACache import io.legado.app.utils.ACache
@ -145,12 +147,18 @@ class DownloadActivity : VMBaseActivity<DownloadViewModel>(R.layout.activity_dow
} }
} }
2 -> { 2 -> {
PermissionsCompat.Builder(this@DownloadActivity)
.addPermissions(*Permissions.Group.STORAGE)
.rationale(R.string.tip_perm_request_storage)
.onGranted {
FileChooserDialog.show( FileChooserDialog.show(
supportFragmentManager, supportFragmentManager,
exportRequestCode, exportRequestCode,
mode = FileChooserDialog.DIRECTORY mode = FileChooserDialog.DIRECTORY
) )
} }
.request()
}
} }
} }
}.show() }.show()

Loading…
Cancel
Save