优化
This commit is contained in:
@@ -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:minHeight="36dp"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:elevation="1dp"
|
android:elevation="1dp"
|
||||||
android:orientation="horizontal">
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="36dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="8dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/titleBar">
|
||||||
|
|
||||||
<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>
|
||||||
|
|||||||
Reference in New Issue
Block a user