mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
修复bug
This commit is contained in:
parent
230bc50229
commit
090227d063
@ -33,7 +33,7 @@ import javax.script.SimpleBindings
|
|||||||
|
|
||||||
class CacheViewModel(application: Application) : BaseViewModel(application) {
|
class CacheViewModel(application: Application) : BaseViewModel(application) {
|
||||||
|
|
||||||
fun getExportFileName(book: Book): String {
|
private fun getExportFileName(book: Book): String {
|
||||||
val jsStr = AppConfig.bookExportFileName
|
val jsStr = AppConfig.bookExportFileName
|
||||||
if (jsStr.isNullOrBlank()) {
|
if (jsStr.isNullOrBlank()) {
|
||||||
return "${book.name} 作者:${book.getRealAuthor()}"
|
return "${book.name} 作者:${book.getRealAuthor()}"
|
||||||
@ -56,6 +56,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
}
|
}
|
||||||
}.onError {
|
}.onError {
|
||||||
finally(it.localizedMessage ?: "ERROR")
|
finally(it.localizedMessage ?: "ERROR")
|
||||||
|
it.printStackTrace()
|
||||||
}.onSuccess {
|
}.onSuccess {
|
||||||
finally(context.getString(R.string.success))
|
finally(context.getString(R.string.success))
|
||||||
}
|
}
|
||||||
@ -185,6 +186,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
}
|
}
|
||||||
}.onError {
|
}.onError {
|
||||||
finally(it.localizedMessage ?: "ERROR")
|
finally(it.localizedMessage ?: "ERROR")
|
||||||
|
it.printStackTrace()
|
||||||
}.onSuccess {
|
}.onSuccess {
|
||||||
finally(context.getString(R.string.success))
|
finally(context.getString(R.string.success))
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -10,6 +11,8 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/primaryText"
|
||||||
|
tools:text="@string/name"
|
||||||
app:layout_constraintRight_toLeftOf="@+id/iv_download"
|
app:layout_constraintRight_toLeftOf="@+id/iv_download"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent" />
|
app:layout_constraintLeft_toLeftOf="parent" />
|
||||||
@ -19,6 +22,8 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/primaryText"
|
||||||
|
tools:text="@string/author"
|
||||||
app:layout_constraintRight_toLeftOf="@+id/iv_download"
|
app:layout_constraintRight_toLeftOf="@+id/iv_download"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_name"
|
app:layout_constraintTop_toBottomOf="@+id/tv_name"
|
||||||
app:layout_constraintLeft_toLeftOf="parent" />
|
app:layout_constraintLeft_toLeftOf="parent" />
|
||||||
@ -28,6 +33,8 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/secondaryText"
|
||||||
|
tools:text="@string/action_download"
|
||||||
app:layout_constraintRight_toLeftOf="@+id/iv_download"
|
app:layout_constraintRight_toLeftOf="@+id/iv_download"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_author"
|
app:layout_constraintTop_toBottomOf="@id/tv_author"
|
||||||
app:layout_constraintLeft_toLeftOf="parent" />
|
app:layout_constraintLeft_toLeftOf="parent" />
|
||||||
@ -52,6 +59,7 @@
|
|||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/export"
|
android:text="@string/export"
|
||||||
|
android:textColor="@color/primaryText"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent" />
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
@ -51,9 +51,9 @@ public class ResourceUtil {
|
|||||||
public static Resource createPublicResource(String name, String author, String intro, String kind, String wordCount, String model, String href) {
|
public static Resource createPublicResource(String name, String author, String intro, String kind, String wordCount, String model, String href) {
|
||||||
String html = model.replace("{name}", name)
|
String html = model.replace("{name}", name)
|
||||||
.replace("{author}", author)
|
.replace("{author}", author)
|
||||||
.replace("{kind}", kind)
|
.replace("{kind}", kind == null ? "" : kind)
|
||||||
.replace("{wordCount}", wordCount)
|
.replace("{wordCount}", wordCount == null ? "" : wordCount)
|
||||||
.replace("{intro}", StringUtil.formatHtml(intro));
|
.replace("{intro}", StringUtil.formatHtml(intro == null ? "" : intro));
|
||||||
return new Resource(html.getBytes(), href);
|
return new Resource(html.getBytes(), href);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user