|
|
|
@ -21,6 +21,10 @@ import java.io.File
|
|
|
|
class LocalListFragment : MangaListFragment<File>(), ActivityResultCallback<Uri> {
|
|
|
|
class LocalListFragment : MangaListFragment<File>(), ActivityResultCallback<Uri> {
|
|
|
|
|
|
|
|
|
|
|
|
private val presenter by moxyPresenter(factory = ::LocalListPresenter)
|
|
|
|
private val presenter by moxyPresenter(factory = ::LocalListPresenter)
|
|
|
|
|
|
|
|
private val importCall = registerForActivityResult(
|
|
|
|
|
|
|
|
ActivityResultContracts.OpenDocument(),
|
|
|
|
|
|
|
|
this
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
override fun onRequestMoreItems(offset: Int) {
|
|
|
|
override fun onRequestMoreItems(offset: Int) {
|
|
|
|
presenter.loadList(offset)
|
|
|
|
presenter.loadList(offset)
|
|
|
|
@ -35,8 +39,7 @@ class LocalListFragment : MangaListFragment<File>(), ActivityResultCallback<Uri>
|
|
|
|
return when (item.itemId) {
|
|
|
|
return when (item.itemId) {
|
|
|
|
R.id.action_import -> {
|
|
|
|
R.id.action_import -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
registerForActivityResult(ActivityResultContracts.OpenDocument(), this)
|
|
|
|
importCall.launch(arrayOf("*/*"))
|
|
|
|
.launch(arrayOf("*/*"))
|
|
|
|
|
|
|
|
} catch (e: ActivityNotFoundException) {
|
|
|
|
} catch (e: ActivityNotFoundException) {
|
|
|
|
if (BuildConfig.DEBUG) {
|
|
|
|
if (BuildConfig.DEBUG) {
|
|
|
|
e.printStackTrace()
|
|
|
|
e.printStackTrace()
|
|
|
|
|