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")
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?
@Insert(onConflict = OnConflictStrategy.REPLACE)

@ -18,7 +18,6 @@ import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.utils.*
import splitties.init.appCtx
import java.io.*
import java.net.URLEncoder
import java.util.regex.Pattern
/**
@ -275,7 +274,6 @@ object LocalBook {
fileName: String
): Boolean {
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
private fun upPath() {
binding.tvGoBack.isEnabled = viewModel.subDocs.isNotEmpty()
viewModel.rootDoc?.let {
scanDocJob?.cancel()
upDocs(it)

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

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

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

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

Loading…
Cancel
Save