parent
9cf0be1031
commit
11d13b6b84
@ -1,2 +1,2 @@ |
|||||||
* 由于安卓的存储访问限制,阅读需要设置**公共目录下的子目录**来实现书籍拷贝、下载 |
* 由于安卓的存储访问限制,阅读需要设置**公共目录下的子目录**来实现书籍拷贝、下载,例如Documents/Books、Download/Books |
||||||
* 如不设置,可能影响本地书籍、webDav书籍的正常阅读 |
* 如不设置,将无法正常使用本地书籍、webDav书籍的相关功能 |
@ -0,0 +1,45 @@ |
|||||||
|
package io.legado.app.ui.book.import |
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel |
||||||
|
import androidx.viewbinding.ViewBinding |
||||||
|
import io.legado.app.R |
||||||
|
import io.legado.app.base.VMBaseActivity |
||||||
|
import io.legado.app.help.config.AppConfig |
||||||
|
import io.legado.app.lib.dialogs.alert |
||||||
|
import io.legado.app.ui.document.HandleFileContract |
||||||
|
|
||||||
|
abstract class BaseImportBookActivity<VB : ViewBinding, VM : ViewModel>(): VMBaseActivity<VB, VM>() { |
||||||
|
|
||||||
|
private val localBookTreeSelect = registerForActivityResult(HandleFileContract()) { |
||||||
|
it.uri?.let { treeUri -> |
||||||
|
AppConfig.defaultBookTreeUri = treeUri.toString() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 设置书籍保存位置 |
||||||
|
*/ |
||||||
|
protected fun setBookStorage() { |
||||||
|
//测试书籍保存位置是否设置 |
||||||
|
if (!AppConfig.defaultBookTreeUri.isNullOrBlank()) return |
||||||
|
//测试读写?? |
||||||
|
val storageHelp = String(assets.open("storageHelp.md").readBytes()) |
||||||
|
val hint = getString(R.string.select_book_folder) |
||||||
|
alert(hint, storageHelp) { |
||||||
|
yesButton { |
||||||
|
localBookTreeSelect.launch { |
||||||
|
title = hint |
||||||
|
mode = HandleFileContract.DIR_SYS |
||||||
|
} |
||||||
|
} |
||||||
|
noButton { |
||||||
|
finish() |
||||||
|
} |
||||||
|
onCancelled { |
||||||
|
finish() |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue