pull/801/head
gedoor 4 years ago
parent ba40d55de1
commit f852c094ab
  1. 17
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  3. 88
      app/src/main/res/layout/view_read_menu.xml
  4. 8
      app/src/main/res/menu/book_read.xml

@ -171,8 +171,6 @@ class ReadBookActivity : ReadBookBaseActivity(),
R.id.menu_group_on_line_ns -> item.isVisible = onLine
R.id.menu_group_local -> item.isVisible = !onLine
R.id.menu_group_text -> item.isVisible = book.isLocalTxt()
R.id.menu_group_login ->
item.isVisible = !ReadBook.webBook?.bookSource?.loginUrl.isNullOrEmpty()
else -> when (item.itemId) {
R.id.menu_enable_replace -> item.isChecked = book.getUseReplaceRule()
R.id.menu_re_segment -> item.isChecked = book.getReSegment()
@ -245,12 +243,6 @@ class ReadBookActivity : ReadBookBaseActivity(),
supportFragmentManager,
ReadBook.book?.tocUrl
)
R.id.menu_login -> ReadBook.webBook?.bookSource?.let {
startActivity<SourceLogin>(
Pair("sourceUrl", it.bookSourceUrl),
Pair("loginUrl", it.loginUrl)
)
}
R.id.menu_set_charset -> showCharsetConfig()
R.id.menu_get_progress -> ReadBook.book?.let {
viewModel.syncBookProgress(it) { progress ->
@ -715,6 +707,15 @@ class ReadBookActivity : ReadBookBaseActivity(),
upNavigationBarColor()
}
override fun showLogin() {
ReadBook.webBook?.bookSource?.let {
startActivity<SourceLogin>(
Pair("sourceUrl", it.bookSourceUrl),
Pair("loginUrl", it.loginUrl)
)
}
}
/**
* 朗读按钮
*/

@ -140,6 +140,9 @@ class ReadMenu @JvmOverloads constructor(
tvChapterUrl.onClick {
context.openUrl(binding.tvChapterUrl.text.toString())
}
tvLogin.onClick {
callBack.showLogin()
}
ivBrightnessAuto.onClick {
context.putPrefBoolean("brightnessAuto", !brightnessAuto())
upBrightnessState()
@ -277,6 +280,7 @@ class ReadMenu @JvmOverloads constructor(
}
fun upBookView() {
binding.tvLogin.visible(!ReadBook.webBook?.bookSource?.loginUrl.isNullOrEmpty())
ReadBook.curTextChapter?.let {
binding.tvChapterName.text = it.title
binding.tvChapterName.visible()
@ -323,6 +327,7 @@ class ReadMenu @JvmOverloads constructor(
fun upSystemUiVisibility()
fun onClickReadAloud()
fun showReadMenuHelp()
fun showLogin()
}
}

@ -21,25 +21,45 @@
android:theme="?attr/actionBarStyle"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_chapter_name"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textSize="12sp"
android:visibility="gone" />
<TextView
android:id="@+id/tv_chapter_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textSize="12sp"
android:visibility="gone" />
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_chapter_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textSize="12sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tv_login"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_chapter_url"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textSize="12sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tv_login"
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_name" />
<TextView
android:id="@+id/tv_login"
android:layout_width="wrap_content"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@+id/tv_chapter_url"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</io.legado.app.ui.widget.TitleBar>
@ -48,19 +68,19 @@
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_margin="8dp"
android:orientation="vertical"
android:gravity="center_horizontal"
app:layout_constraintTop_toBottomOf="@+id/title_bar"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/bottom_menu"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/bottom_menu">
app:layout_constraintTop_toBottomOf="@+id/title_bar">
<ImageView
android:id="@+id/iv_brightness_auto"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="8dp"
android:src="@drawable/ic_brightness_auto"
android:contentDescription="@string/brightness_auto" />
android:contentDescription="@string/brightness_auto"
android:src="@drawable/ic_brightness_auto" />
<io.legado.app.ui.widget.seekbar.VerticalSeekBarWrapper
android:layout_width="wrap_content"
@ -88,8 +108,8 @@
android:id="@+id/ll_floating_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="32dp"
android:paddingEnd="32dp">
@ -187,8 +207,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background_menu"
android:orientation="vertical"
android:importantForAccessibility="no">
android:importantForAccessibility="no"
android:orientation="vertical">
<!--章节设置-->
<LinearLayout
android:layout_width="match_parent"
@ -197,8 +217,8 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal"
android:importantForAccessibility="no">
android:importantForAccessibility="no"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_pre"
@ -244,8 +264,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal"
android:importantForAccessibility="no">
android:importantForAccessibility="no"
android:orientation="horizontal">
<View
android:layout_width="0dp"
@ -281,8 +301,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp"
android:singleLine="true"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/chapter_list"
android:textColor="@color/primaryText"
android:textSize="12sp" />
@ -322,8 +342,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp"
android:singleLine="true"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/read_aloud"
android:textColor="@color/primaryText"
android:textSize="12sp" />
@ -363,8 +383,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp"
android:singleLine="true"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/interface_setting"
android:textColor="@color/primaryText"
android:textSize="12sp" />
@ -404,8 +424,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp"
android:singleLine="true"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/setting"
android:textColor="@color/primaryText"
android:textSize="12sp" />

@ -49,14 +49,6 @@
android:title="@string/bookmark_add"
app:showAsAction="never" />
<group android:id="@+id/menu_group_login">
<item
android:id="@+id/menu_login"
android:visible="false"
android:title="@string/login"
app:showAsAction="never" />
</group>
<group android:id="@+id/menu_group_on_line_ns">
<item

Loading…
Cancel
Save