pull/1994/head
kunfei 2 years ago
parent fc8375f40e
commit 890706fa34
  1. 2
      app/src/main/java/io/legado/app/data/dao/BookDao.kt
  2. 2
      app/src/main/java/io/legado/app/model/localBook/LocalBook.kt
  3. 1
      app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBook.kt
  5. 1
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt
  6. 2
      app/src/main/java/io/legado/app/ui/book/remote/manager/RemoteBookWebDav.kt
  7. 22
      app/src/main/res/layout/activity_import_book.xml

@ -88,7 +88,7 @@ interface BookDao {
@Query("select 1 from books where bookUrl = :bookUrl") @Query("select 1 from books where bookUrl = :bookUrl")
fun has(bookUrl: String): Boolean? fun has(bookUrl: String): Boolean?
@Query("select 1 from books where bookUrl like '%' || :fileName") @Query("select 1 from books where originName = :fileName")
fun hasFile(fileName: String): Boolean? fun hasFile(fileName: String): Boolean?
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)

@ -18,7 +18,6 @@ import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.utils.* import io.legado.app.utils.*
import splitties.init.appCtx import splitties.init.appCtx
import java.io.* import java.io.*
import java.net.URLEncoder
import java.util.regex.Pattern import java.util.regex.Pattern
/** /**
@ -275,7 +274,6 @@ object LocalBook {
fileName: String fileName: String
): Boolean { ): Boolean {
return appDb.bookDao.hasFile(fileName) == true return appDb.bookDao.hasFile(fileName) == true
|| appDb.bookDao.hasFile(URLEncoder.encode(fileName, "UTF-8")) == true
} }
//文件类书源 合并在线书籍信息 在线 > 本地 //文件类书源 合并在线书籍信息 在线 > 本地

@ -206,6 +206,7 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
@Synchronized @Synchronized
private fun upPath() { private fun upPath() {
binding.tvGoBack.isEnabled = viewModel.subDocs.isNotEmpty()
viewModel.rootDoc?.let { viewModel.rootDoc?.let {
scanDocJob?.cancel() scanDocJob?.cancel()
upDocs(it) upDocs(it)

@ -6,7 +6,7 @@ data class RemoteBook(
val size: Long, val size: Long,
val contentType: String, val contentType: String,
val lastModify: Long, val lastModify: Long,
var isOnBookShelf: Boolean var isOnBookShelf: Boolean = false
) { ) {
val isDir by lazy { val isDir by lazy {

@ -98,6 +98,7 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
} }
private fun upPath() { private fun upPath() {
binding.tvGoBack.isEnabled = viewModel.dirList.isNotEmpty()
var path = "books" + File.separator var path = "books" + File.separator
viewModel.dirList.forEach { viewModel.dirList.forEach {
path = path + it.filename + File.separator path = path + it.filename + File.separator

@ -47,7 +47,7 @@ object RemoteBookWebDav : RemoteBookManager() {
remoteBooks.add( remoteBooks.add(
RemoteBook( RemoteBook(
webDavFile.displayName, webDavFile.path, webDavFile.size, webDavFile.displayName, webDavFile.path, webDavFile.size,
"folder", webDavFile.lastModify, false "folder", webDavFile.lastModify
) )
) )
} else { } else {

@ -16,24 +16,24 @@
android:id="@+id/lay_top" android:id="@+id/lay_top"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/titleBar"
android:background="@color/background" android:background="@color/background"
android:elevation="1dp"
android:gravity="center_vertical"
android:minHeight="36dp" android:minHeight="36dp"
android:orientation="horizontal"
android:padding="8dp" android:padding="8dp"
android:gravity="center_vertical" app:layout_constraintTop_toBottomOf="@id/titleBar">
android:elevation="1dp"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_path" android:id="@+id/tv_path"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:focusable="true"
android:gravity="center_vertical" android:gravity="center_vertical"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/secondaryText" android:textColor="@color/secondaryText"
android:textSize="13sp" android:textSize="13sp"
android:focusable="true"
tools:text="/" /> tools:text="/" />
<io.legado.app.ui.widget.text.StrokeTextView <io.legado.app.ui.widget.text.StrokeTextView
@ -41,14 +41,14 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="4dp"
android:gravity="center" android:gravity="center"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:layout_margin="4dp"
app:cornerRadius="5dp"
android:text="@string/go_back" android:text="@string/go_back"
android:textFontWeight="800" android:textFontWeight="800"
android:textSize="14sp" android:textSize="14sp"
app:cornerRadius="5dp"
tools:ignore="UnusedAttribute" /> tools:ignore="UnusedAttribute" />
</LinearLayout> </LinearLayout>
@ -62,8 +62,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
app:layout_constraintTop_toBottomOf="@id/refresh_progress_bar" app:layout_constraintBottom_toTopOf="@id/select_action_bar"
app:layout_constraintBottom_toTopOf="@id/select_action_bar"> app:layout_constraintTop_toBottomOf="@id/refresh_progress_bar">
<io.legado.app.ui.widget.recycler.scroller.FastScrollRecyclerView <io.legado.app.ui.widget.recycler.scroller.FastScrollRecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
@ -75,11 +75,11 @@
android:id="@+id/tv_empty_msg" android:id="@+id/tv_empty_msg"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp" android:layout_margin="16dp"
android:gravity="center" android:gravity="center"
android:layout_gravity="center"
android:visibility="gone"
android:text="@string/empty_msg_import_book" android:text="@string/empty_msg_import_book"
android:visibility="gone"
tools:text="TextView" /> tools:text="TextView" />
</FrameLayout> </FrameLayout>

Loading…
Cancel
Save