From 88d1f29fe24a8a3cd8131d947d2a68aad39c2895 Mon Sep 17 00:00:00 2001 From: inorichi Date: Sat, 18 Nov 2017 14:09:28 +0100 Subject: [PATCH] Move page indicator to bottom center, and use a shadow instead of a background. Other category in catalogue list is now placed at the end --- .../eu/kanade/tachiyomi/source/LocalSource.kt | 2 +- .../ui/catalogue/main/CatalogueMainPresenter.kt | 9 ++++++++- .../ui/reader/PageIndicatorTextView.kt | 17 +++++++++++++++++ .../tachiyomi/ui/reader/ReaderActivity.kt | 5 ----- .../kanade/tachiyomi/widget/PTSansTextView.kt | 6 +++--- app/src/main/res/layout/reader_activity.xml | 13 +++++++++---- 6 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/reader/PageIndicatorTextView.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt index a7cf4b656d..d46370e7c9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt @@ -56,7 +56,7 @@ class LocalSource(private val context: Context) : CatalogueSource { } override val id = ID - override val name = "LocalSource" + override val name = context.getString(R.string.local_source) override val lang = "" override val supportsLatest = true diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/main/CatalogueMainPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/main/CatalogueMainPresenter.kt index 2ce3f0a4f8..a0745a26a3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/main/CatalogueMainPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/main/CatalogueMainPresenter.kt @@ -51,7 +51,14 @@ class CatalogueMainPresenter( fun loadSources() { sourceSubscription?.unsubscribe() - val map = TreeMap> { d1, d2 -> d1.compareTo(d2) } + val map = TreeMap> { d1, d2 -> + // Catalogues without a lang defined will be placed at the end + when { + d1 == "" && d2 != "" -> 1 + d2 == "" && d1 != "" -> -1 + else -> d1.compareTo(d2) + } + } val byLang = sources.groupByTo(map, { it.lang }) val sourceItems = byLang.flatMap { val langItem = LangItem(it.key) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/PageIndicatorTextView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/PageIndicatorTextView.kt new file mode 100644 index 0000000000..7aff4c97e2 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/PageIndicatorTextView.kt @@ -0,0 +1,17 @@ +package eu.kanade.tachiyomi.ui.reader + +import android.content.Context +import android.graphics.Canvas +import android.support.v7.widget.AppCompatTextView +import android.util.AttributeSet + +class PageIndicatorTextView(context: Context, attrs: AttributeSet? = null) : + AppCompatTextView(context, attrs) { + + override fun onDraw(canvas: Canvas) { + // We want the shadow to look like an outline + for (i in 0..5) { + super.onDraw(canvas) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 3e4e3ebf33..1bf2b378ef 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -8,7 +8,6 @@ import android.graphics.Color import android.os.Build import android.os.Build.VERSION_CODES.KITKAT import android.os.Bundle -import android.support.v4.content.ContextCompat import android.view.* import android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS import android.view.animation.Animation @@ -513,12 +512,8 @@ class ReaderActivity : BaseRxActivity() { val rootView = window.decorView.rootView if (theme == BLACK_THEME) { rootView.setBackgroundColor(Color.BLACK) - page_number.setTextColor(ContextCompat.getColor(this, R.color.textColorPrimaryDark)) - page_number.setBackgroundColor(ContextCompat.getColor(this, R.color.pageNumberBackgroundDark)) } else { rootView.setBackgroundColor(Color.WHITE) - page_number.setTextColor(ContextCompat.getColor(this, R.color.textColorPrimaryLight)) - page_number.setBackgroundColor(ContextCompat.getColor(this, R.color.pageNumberBackgroundLight)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/PTSansTextView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/PTSansTextView.kt index f813f799c7..4152f17670 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/PTSansTextView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/PTSansTextView.kt @@ -38,10 +38,10 @@ class PTSansTextView @JvmOverloads constructor(context: Context, attrs: Attribut } } - override fun draw(canvas: Canvas) { + override fun onDraw(canvas: Canvas) { // Draw two times for a more visible shadow around the text - super.draw(canvas) - super.draw(canvas) + super.onDraw(canvas) + super.onDraw(canvas) } } diff --git a/app/src/main/res/layout/reader_activity.xml b/app/src/main/res/layout/reader_activity.xml index 84a2c66551..b1040c4d43 100644 --- a/app/src/main/res/layout/reader_activity.xml +++ b/app/src/main/res/layout/reader_activity.xml @@ -23,14 +23,19 @@ android:layout_height="wrap_content" android:layout_gravity="center"/> - + android:layout_gravity="bottom|center_horizontal" + android:padding="4dp" + android:textColor="@color/md_white_1000" + android:textStyle="bold" + android:shadowRadius="3" + android:shadowDy="0" + android:shadowDx="0" + android:shadowColor="@color/md_black_1000"/>