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.toolbarBottom,
|
||||||
binding.leftChapter,
|
binding.leftChapter,
|
||||||
binding.readerSeekbar,
|
binding.readerSeekbar,
|
||||||
binding.rightChapter
|
binding.rightChapter,
|
||||||
|
// SY -->
|
||||||
|
binding.pageSeekbarVert,
|
||||||
|
binding.aboveChapter,
|
||||||
|
binding.belowChapter
|
||||||
|
// SY <--
|
||||||
).forEach {
|
).forEach {
|
||||||
it.backgroundTintMode = PorterDuff.Mode.DST_IN
|
it.backgroundTintMode = PorterDuff.Mode.DST_IN
|
||||||
it.backgroundTintList = ColorStateList.valueOf(toolbarColor)
|
it.backgroundTintList = ColorStateList.valueOf(toolbarColor)
|
||||||
@ -1072,6 +1077,8 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
binding.leftChapter.setTooltip(R.string.action_previous_chapter)
|
binding.leftChapter.setTooltip(R.string.action_previous_chapter)
|
||||||
binding.rightChapter.setTooltip(R.string.action_next_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.isVisible = true
|
||||||
binding.pleaseWait.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in_long))
|
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) {
|
if (leftChapterObject == null && rightChapterObject == null) {
|
||||||
binding.leftChapter.isVisible = false
|
binding.leftChapter.isVisible = false
|
||||||
binding.rightChapter.isVisible = false
|
binding.rightChapter.isVisible = false
|
||||||
|
binding.aboveChapter.isVisible = false
|
||||||
|
binding.belowChapter.isVisible = false
|
||||||
} else {
|
} else {
|
||||||
binding.leftChapter.isEnabled = leftChapterObject != null
|
binding.leftChapter.isEnabled = leftChapterObject != null
|
||||||
binding.leftChapter.imageAlpha = if (leftChapterObject != null) ENABLED_BUTTON_IMAGE_ALPHA else DISABLED_BUTTON_IMAGE_ALPHA
|
binding.leftChapter.imageAlpha = if (leftChapterObject != null) ENABLED_BUTTON_IMAGE_ALPHA else DISABLED_BUTTON_IMAGE_ALPHA
|
||||||
|
|
||||||
binding.rightChapter.isEnabled = rightChapterObject != null
|
binding.rightChapter.isEnabled = rightChapterObject != null
|
||||||
binding.rightChapter.imageAlpha = if (rightChapterObject != null) ENABLED_BUTTON_IMAGE_ALPHA else DISABLED_BUTTON_IMAGE_ALPHA
|
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
|
// Invalidate menu to show proper chapter bookmark state
|
||||||
|
@ -380,7 +380,7 @@ class ReaderPresenter(
|
|||||||
.also(::add)
|
.also(::add)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadNewChapterFromSheet(chapter: Chapter) {
|
fun loadNewChapterFromDialog(chapter: Chapter) {
|
||||||
val newChapter = chapterList.firstOrNull { it.chapter.id == chapter.id } ?: return
|
val newChapter = chapterList.firstOrNull { it.chapter.id == chapter.id } ?: return
|
||||||
loadAdjacent(newChapter)
|
loadAdjacent(newChapter)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class ReaderChapterDialog(private val activity: ReaderActivity) : ReaderChapterA
|
|||||||
val item = adapter?.getItem(position)
|
val item = adapter?.getItem(position)
|
||||||
if (item != null && item.id != presenter.getCurrentChapter()?.chapter?.id) {
|
if (item != null && item.id != presenter.getCurrentChapter()?.chapter?.id) {
|
||||||
dismiss()
|
dismiss()
|
||||||
presenter.loadNewChapterFromSheet(item)
|
presenter.loadNewChapterFromDialog(item)
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
field = value
|
field = value
|
||||||
if (value) {
|
if (value) {
|
||||||
awaitingIdleViewerChapters?.let {
|
awaitingIdleViewerChapters?.let {
|
||||||
setChaptersInternal(it)
|
setChaptersDoubleShift(it)
|
||||||
awaitingIdleViewerChapters = null
|
awaitingIdleViewerChapters = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
*/
|
*/
|
||||||
override fun setChapters(chapters: ViewerChapters) {
|
override fun setChapters(chapters: ViewerChapters) {
|
||||||
if (isIdle) {
|
if (isIdle) {
|
||||||
setChaptersInternal(chapters)
|
setChaptersDoubleShift(chapters)
|
||||||
} else {
|
} else {
|
||||||
awaitingIdleViewerChapters = chapters
|
awaitingIdleViewerChapters = chapters
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:orientation="horizontal"
|
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_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/above_guideline"
|
app:layout_constraintTop_toBottomOf="@id/above_guideline"
|
||||||
@ -277,14 +277,6 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</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
|
<LinearLayout
|
||||||
android:id="@+id/reader_menu_bottom"
|
android:id="@+id/reader_menu_bottom"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user