pull/801/head
gedoor 4 years ago
parent f852c094ab
commit 7137f594da
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt
  3. 6
      app/src/main/res/layout/view_read_menu.xml

@ -776,7 +776,9 @@ class ReadBookActivity : ReadBookBaseActivity(),
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == Activity.RESULT_OK) {
when (requestCode) {
requestCodeEditSource -> viewModel.upBookSource()
requestCodeEditSource -> viewModel.upBookSource() {
upView()
}
requestCodeChapterList ->
data?.getIntExtra("index", ReadBook.durChapterIndex)?.let { index ->
if (index != ReadBook.durChapterIndex) {

@ -271,13 +271,15 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
}
}
fun upBookSource() {
fun upBookSource(success: (() -> Unit)?) {
execute {
ReadBook.book?.let { book ->
App.db.bookSourceDao.getBookSource(book.origin)?.let {
ReadBook.webBook = WebBook(it)
}
}
}.onSuccess {
success?.invoke()
}
}

@ -51,10 +51,14 @@
app:layout_constraintRight_toLeftOf="@+id/tv_login"
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_name" />
<TextView
<io.legado.app.ui.widget.text.AccentBgTextView
android:id="@+id/tv_login"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/login"
app:layout_constraintBottom_toBottomOf="@+id/tv_chapter_url"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Loading…
Cancel
Save