阅读界面显示书源名称,登陆和购买移到书源菜单中
This commit is contained in:
@@ -84,6 +84,8 @@ class ReadMenu @JvmOverloads constructor(
|
||||
inflate(R.menu.book_read_source)
|
||||
setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_login -> callBack.showLogin()
|
||||
R.id.menu_chapter_pay -> callBack.payAction()
|
||||
R.id.menu_edit_source -> callBack.openSourceEditActivity()
|
||||
R.id.menu_disable_source -> callBack.disableSource()
|
||||
}
|
||||
@@ -93,11 +95,9 @@ class ReadMenu @JvmOverloads constructor(
|
||||
}
|
||||
private val menuInListener = object : Animation.AnimationListener {
|
||||
override fun onAnimationStart(animation: Animation) {
|
||||
binding.tvSourceAction.text =
|
||||
ReadBook.bookSource?.bookSourceName ?: context.getString(R.string.book_source)
|
||||
binding.tvSourceAction.isGone = ReadBook.isLocalBook
|
||||
binding.tvLogin.isGone = ReadBook.bookSource?.loginUrl.isNullOrEmpty()
|
||||
binding.tvPay.isGone = ReadBook.bookSource?.loginUrl.isNullOrEmpty()
|
||||
|| ReadBook.curTextChapter?.isVip != true
|
||||
|| ReadBook.curTextChapter?.isPay == true
|
||||
callBack.upSystemUiVisibility()
|
||||
binding.llBrightness.visible(showBrightnessView)
|
||||
}
|
||||
@@ -335,16 +335,14 @@ class ReadMenu @JvmOverloads constructor(
|
||||
tvChapterName.setOnLongClickListener(chapterViewLongClickListener)
|
||||
tvChapterUrl.setOnClickListener(chapterViewClickListener)
|
||||
tvChapterUrl.setOnLongClickListener(chapterViewLongClickListener)
|
||||
//登录
|
||||
tvLogin.setOnClickListener {
|
||||
callBack.showLogin()
|
||||
}
|
||||
//购买
|
||||
tvPay.setOnClickListener {
|
||||
callBack.payAction()
|
||||
}
|
||||
//书源操作
|
||||
tvSourceAction.onClick {
|
||||
sourceMenu.menu.findItem(R.id.menu_login).isVisible =
|
||||
!ReadBook.bookSource?.loginUrl.isNullOrEmpty()
|
||||
sourceMenu.menu.findItem(R.id.menu_chapter_pay).isVisible =
|
||||
!ReadBook.bookSource?.loginUrl.isNullOrEmpty()
|
||||
&& ReadBook.curTextChapter?.isVip == true
|
||||
&& ReadBook.curTextChapter?.isPay != true
|
||||
sourceMenu.show()
|
||||
}
|
||||
//亮度跟随
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
android:singleLine="true"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tv_login"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tv_source_action"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
@@ -47,53 +47,23 @@
|
||||
android:singleLine="true"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tv_login"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tv_source_action"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_name" />
|
||||
|
||||
<io.legado.app.ui.widget.text.AccentBgTextView
|
||||
android:id="@+id/tv_login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="1dp"
|
||||
android:gravity="center"
|
||||
android:maxWidth="80dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:text="@string/login"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_chapter_url"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tv_pay"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:radius="1dp" />
|
||||
|
||||
<io.legado.app.ui.widget.text.AccentBgTextView
|
||||
android:id="@+id/tv_pay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="1dp"
|
||||
android:gravity="center"
|
||||
android:maxWidth="80dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:text="@string/chapter_pay"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_chapter_url"
|
||||
app:layout_constraintRight_toLeftOf="@id/tv_source_action"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:radius="1dp" />
|
||||
|
||||
<io.legado.app.ui.widget.text.AccentBgTextView
|
||||
android:id="@+id/tv_source_action"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="1dp"
|
||||
android:gravity="center"
|
||||
android:maxWidth="80dp"
|
||||
android:maxWidth="120dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:text="@string/book_source"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_chapter_url"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:radius="1dp" />
|
||||
app:radius="2dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
tools:context=".ui.main.MainActivity"
|
||||
tools:ignore="AlwaysShowAction">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_login"
|
||||
android:title="@string/login"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_chapter_pay"
|
||||
android:title="@string/chapter_pay"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_edit_source"
|
||||
android:title="@string/edit_book_source"
|
||||
|
||||
Reference in New Issue
Block a user