From b55d394a1feba615dd6a9f50faf44e164976e335 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 5 Sep 2020 10:31:49 -0400 Subject: [PATCH] Fix text alignment in transition view when no more chapters available --- .../{TransitionView.kt => ReaderTransitionView.kt} | 11 +++++------ .../ui/reader/viewer/pager/PagerTransitionHolder.kt | 4 ++-- .../reader/viewer/webtoon/WebtoonTransitionHolder.kt | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) rename app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/{TransitionView.kt => ReaderTransitionView.kt} (91%) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/TransitionView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt similarity index 91% rename from app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/TransitionView.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt index c1751829f..5333d551a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/TransitionView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.reader.viewer import android.content.Context import android.util.AttributeSet -import android.view.Gravity import android.widget.LinearLayout import androidx.core.text.bold import androidx.core.text.buildSpannedString @@ -15,7 +14,7 @@ import kotlinx.android.synthetic.main.reader_transition_view.view.upper_text import kotlinx.android.synthetic.main.reader_transition_view.view.warning import kotlinx.android.synthetic.main.reader_transition_view.view.warning_text -class TransitionView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : +class ReaderTransitionView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout(context, attrs) { init { @@ -40,7 +39,7 @@ class TransitionView @JvmOverloads constructor(context: Context, attrs: Attribut val hasPrevChapter = prevChapter != null lower_text.isVisible = hasPrevChapter if (hasPrevChapter) { - gravity = Gravity.CENTER_VERTICAL + upper_text.textAlignment = TEXT_ALIGNMENT_TEXT_START upper_text.text = buildSpannedString { bold { append(context.getString(R.string.transition_current)) } append("\n${transition.from.chapter.name}") @@ -50,7 +49,7 @@ class TransitionView @JvmOverloads constructor(context: Context, attrs: Attribut append("\n${prevChapter!!.chapter.name}") } } else { - gravity = Gravity.CENTER + upper_text.textAlignment = TEXT_ALIGNMENT_CENTER upper_text.text = context.getString(R.string.transition_no_previous) } } @@ -64,7 +63,7 @@ class TransitionView @JvmOverloads constructor(context: Context, attrs: Attribut val hasNextChapter = nextChapter != null lower_text.isVisible = hasNextChapter if (hasNextChapter) { - gravity = Gravity.CENTER_VERTICAL + upper_text.textAlignment = TEXT_ALIGNMENT_TEXT_START upper_text.text = buildSpannedString { bold { append(context.getString(R.string.transition_finished)) } append("\n${transition.from.chapter.name}") @@ -74,7 +73,7 @@ class TransitionView @JvmOverloads constructor(context: Context, attrs: Attribut append("\n${nextChapter!!.chapter.name}") } } else { - gravity = Gravity.CENTER + upper_text.textAlignment = TEXT_ALIGNMENT_CENTER upper_text.text = context.getString(R.string.transition_no_next) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt index 7e689809a..5c3d556f4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt @@ -12,7 +12,7 @@ import androidx.appcompat.widget.AppCompatTextView import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter -import eu.kanade.tachiyomi.ui.reader.viewer.TransitionView +import eu.kanade.tachiyomi.ui.reader.viewer.ReaderTransitionView import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.widget.ViewPagerAdapter import rx.Subscription @@ -54,7 +54,7 @@ class PagerTransitionHolder( val sidePadding = 64.dpToPx setPadding(sidePadding, 0, sidePadding, 0) - val transitionView = TransitionView(context) + val transitionView = ReaderTransitionView(context) addView(transitionView) addView(pagesContainer) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt index 1af6a3054..16f08654c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt @@ -12,7 +12,7 @@ import androidx.core.view.isVisible import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter -import eu.kanade.tachiyomi.ui.reader.viewer.TransitionView +import eu.kanade.tachiyomi.ui.reader.viewer.ReaderTransitionView import eu.kanade.tachiyomi.util.system.dpToPx import rx.Subscription import rx.android.schedulers.AndroidSchedulers @@ -30,7 +30,7 @@ class WebtoonTransitionHolder( */ private var statusSubscription: Subscription? = null - private val transitionView = TransitionView(context) + private val transitionView = ReaderTransitionView(context) /** * View container of the current status of the transition page. Child views will be added