pull/783/head
gedoor 4 years ago
parent 829f4dc164
commit 39fc040286
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 15
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  3. 46
      app/src/main/res/layout/dialog_bookmark.xml

@ -215,7 +215,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
chapterIndex = ReadBook.durChapterIndex,
chapterPos = ReadBook.durChapterPos,
chapterName = page.title,
bookText = page.text
bookText = page.text.trim()
)
showBookMark(bookmark)
}

@ -13,6 +13,7 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.Bookmark
import io.legado.app.databinding.ActivityBookReadBinding
import io.legado.app.databinding.DialogBookmarkBinding
import io.legado.app.databinding.DialogDownloadChoiceBinding
import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.help.AppConfig
@ -200,18 +201,18 @@ abstract class ReadBookBaseActivity :
@SuppressLint("InflateParams")
fun showBookMark(bookmark: Bookmark) {
val book = ReadBook.book ?: return
val textChapter = ReadBook.curTextChapter ?: return
alert(title = getString(R.string.bookmark_add)) {
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
editView.setHint(R.string.note_content)
message = bookmark.chapterName
val alertBinding = DialogBookmarkBinding.inflate(layoutInflater).apply {
editBookText.setText(bookmark.bookText)
editView.setText(bookmark.content)
}
message = bookmark.bookText
customView = alertBinding.root
yesButton {
alertBinding.editView.text?.toString()?.let { editContent ->
alertBinding.apply {
Coroutine.async {
bookmark.content = editContent
bookmark.bookText = editBookText.text.toString()
bookmark.content = editView.text.toString()
App.db.bookmarkDao.insert(bookmark)
}
}

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="48dp"
android:layout_marginBottom="48dp"
android:overScrollMode="ifContentScrolls">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<io.legado.app.ui.widget.text.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingTop="3dp"
android:paddingRight="16dp">
<io.legado.app.ui.widget.text.EditText
android:id="@+id/edit_book_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/bookmark" />
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingTop="3dp"
android:paddingRight="16dp">
<io.legado.app.ui.widget.text.EditText
android:id="@+id/edit_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/note_content" />
</io.legado.app.ui.widget.text.TextInputLayout>
</LinearLayout>
</ScrollView>
Loading…
Cancel
Save