diff --git a/app/src/main/java/io/legado/app/help/BookHelp.kt b/app/src/main/java/io/legado/app/help/BookHelp.kt index 8d93877bc..1cdb6e570 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -21,7 +21,10 @@ object BookHelp { fun formatAuthor(author: String?): String { - return author?.replace("作\\s*者[\\s::]*".toRegex(), "")?.replace("\\s+".toRegex(), " ")?.trim { it <= ' ' } + return author + ?.replace("作\\s*者[\\s::]*".toRegex(), "") + ?.replace("\\s+".toRegex(), " ") + ?.trim { it <= ' ' } ?: "" } diff --git a/app/src/main/java/io/legado/app/ui/read/ReadViewModel.kt b/app/src/main/java/io/legado/app/ui/read/ReadViewModel.kt index 098ad52d7..4528e2d1a 100644 --- a/app/src/main/java/io/legado/app/ui/read/ReadViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/read/ReadViewModel.kt @@ -1,8 +1,20 @@ package io.legado.app.ui.read import android.app.Application +import android.content.Intent +import androidx.lifecycle.MutableLiveData import io.legado.app.base.BaseViewModel +import io.legado.app.data.entities.Book class ReadViewModel(application: Application) : BaseViewModel(application) { + val bookData = MutableLiveData() + + fun initData(intent: Intent) { + val bookUrl = intent.getStringExtra("bookUrl") + if (!bookUrl.isNullOrEmpty()) { + + } + } + } \ No newline at end of file