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

This commit is contained in:
inorichi 2017-11-18 14:09:28 +01:00
parent c437a33f2a
commit 88d1f29fe2
6 changed files with 38 additions and 14 deletions

View File

@ -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

View File

@ -51,7 +51,14 @@ class CatalogueMainPresenter(
fun loadSources() {
sourceSubscription?.unsubscribe()
val map = TreeMap<String, MutableList<CatalogueSource>> { d1, d2 -> d1.compareTo(d2) }
val map = TreeMap<String, MutableList<CatalogueSource>> { 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)

View File

@ -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)
}
}
}

View File

@ -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<ReaderPresenter>() {
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))
}
}

View File

@ -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)
}
}

View File

@ -23,14 +23,19 @@
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<TextView
<eu.kanade.tachiyomi.ui.reader.PageIndicatorTextView
android:id="@+id/page_number"
style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:background="?android:attr/colorBackground"
android:padding="8dp"/>
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"/>
</FrameLayout>