Multiple bugfixes for the reader, includes double page and chapter buttons
This commit is contained in:
parent
a6cf6ffca8
commit
33c48412be
@ -477,7 +477,12 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
binding.toolbarBottom,
|
||||
binding.leftChapter,
|
||||
binding.readerSeekbar,
|
||||
binding.rightChapter
|
||||
binding.rightChapter,
|
||||
// SY -->
|
||||
binding.pageSeekbarVert,
|
||||
binding.aboveChapter,
|
||||
binding.belowChapter
|
||||
// SY <--
|
||||
).forEach {
|
||||
it.backgroundTintMode = PorterDuff.Mode.DST_IN
|
||||
it.backgroundTintList = ColorStateList.valueOf(toolbarColor)
|
||||
@ -1072,6 +1077,8 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
binding.leftChapter.setTooltip(R.string.action_previous_chapter)
|
||||
binding.rightChapter.setTooltip(R.string.action_next_chapter)
|
||||
}
|
||||
binding.aboveChapter.setTooltip(R.string.action_previous_chapter)
|
||||
binding.belowChapter.setTooltip(R.string.action_next_chapter)
|
||||
|
||||
binding.pleaseWait.isVisible = true
|
||||
binding.pleaseWait.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in_long))
|
||||
@ -1122,12 +1129,20 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
if (leftChapterObject == null && rightChapterObject == null) {
|
||||
binding.leftChapter.isVisible = false
|
||||
binding.rightChapter.isVisible = false
|
||||
binding.aboveChapter.isVisible = false
|
||||
binding.belowChapter.isVisible = false
|
||||
} else {
|
||||
binding.leftChapter.isEnabled = leftChapterObject != null
|
||||
binding.leftChapter.imageAlpha = if (leftChapterObject != null) ENABLED_BUTTON_IMAGE_ALPHA else DISABLED_BUTTON_IMAGE_ALPHA
|
||||
|
||||
binding.rightChapter.isEnabled = rightChapterObject != null
|
||||
binding.rightChapter.imageAlpha = if (rightChapterObject != null) ENABLED_BUTTON_IMAGE_ALPHA else DISABLED_BUTTON_IMAGE_ALPHA
|
||||
|
||||
binding.aboveChapter.isEnabled = leftChapterObject != null
|
||||
binding.aboveChapter.imageAlpha = if (leftChapterObject != null) ENABLED_BUTTON_IMAGE_ALPHA else DISABLED_BUTTON_IMAGE_ALPHA
|
||||
|
||||
binding.belowChapter.isEnabled = rightChapterObject != null
|
||||
binding.belowChapter.imageAlpha = if (rightChapterObject != null) ENABLED_BUTTON_IMAGE_ALPHA else DISABLED_BUTTON_IMAGE_ALPHA
|
||||
}
|
||||
|
||||
// Invalidate menu to show proper chapter bookmark state
|
||||
|
@ -380,7 +380,7 @@ class ReaderPresenter(
|
||||
.also(::add)
|
||||
}
|
||||
|
||||
fun loadNewChapterFromSheet(chapter: Chapter) {
|
||||
fun loadNewChapterFromDialog(chapter: Chapter) {
|
||||
val newChapter = chapterList.firstOrNull { it.chapter.id == chapter.id } ?: return
|
||||
loadAdjacent(newChapter)
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class ReaderChapterDialog(private val activity: ReaderActivity) : ReaderChapterA
|
||||
val item = adapter?.getItem(position)
|
||||
if (item != null && item.id != presenter.getCurrentChapter()?.chapter?.id) {
|
||||
dismiss()
|
||||
presenter.loadNewChapterFromSheet(item)
|
||||
presenter.loadNewChapterFromDialog(item)
|
||||
}
|
||||
true
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
||||
field = value
|
||||
if (value) {
|
||||
awaitingIdleViewerChapters?.let {
|
||||
setChaptersInternal(it)
|
||||
setChaptersDoubleShift(it)
|
||||
awaitingIdleViewerChapters = null
|
||||
}
|
||||
}
|
||||
@ -239,7 +239,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
||||
*/
|
||||
override fun setChapters(chapters: ViewerChapters) {
|
||||
if (isIdle) {
|
||||
setChaptersInternal(chapters)
|
||||
setChaptersDoubleShift(chapters)
|
||||
} else {
|
||||
awaitingIdleViewerChapters = chapters
|
||||
}
|
||||
|
@ -175,7 +175,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toTopOf="@id/below_guideline"
|
||||
app:layout_constraintBottom_toTopOf="@id/reader_menu_bottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/above_guideline"
|
||||
@ -277,14 +277,6 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/below_guideline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.9"
|
||||
app:layout_constraintBottom_toTopOf="@id/reader_menu_bottom"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reader_menu_bottom"
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
x
Reference in New Issue
Block a user