diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt index 5abc75684..cf5f05486 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt @@ -213,8 +213,12 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity } @Synchronized - override fun nextDoc(doc: DocumentFile) { - subDocs.add(doc) + override fun nextDoc(uri: Uri) { + if (uri.toString().isContentPath()) { + subDocs.add(DocumentFile.fromSingleUri(this, uri)!!) + } else { + path = uri.toString() + } upPath() } diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt index 153356754..3e7ab7097 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt @@ -1,7 +1,7 @@ package io.legado.app.ui.book.local import android.content.Context -import androidx.documentfile.provider.DocumentFile +import android.net.Uri import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter @@ -101,7 +101,7 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) : holder.itemView.onClick { getItem(holder.layoutPosition)?.let { if (it.isDir) { - callBack.nextDoc(DocumentFile.fromSingleUri(context, it.uri)!!) + callBack.nextDoc(it.uri) } else if (!bookshelf.contains(it.uri.toString())) { if (!selectedUris.contains(it.uri.toString())) { selectedUris.add(it.uri.toString()) @@ -116,7 +116,7 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) : } interface CallBack { - fun nextDoc(doc: DocumentFile) + fun nextDoc(uri: Uri) fun upCountView() }