diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt index fd06b1c873..d8414da1f2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt @@ -91,7 +91,7 @@ class SearchController( ) return MaterialDialog(activity!!) - .message(R.string.migration_dialog_what_to_include) + .title(R.string.migration_dialog_what_to_include) .listItemsMultiChoice( items = MigrationFlags.titles.map { resources?.getString(it) as CharSequence }, initialSelection = preselected.toIntArray() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt index 13e0b22f0f..9b97372b5e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt @@ -10,7 +10,6 @@ import android.view.View import android.view.ViewPropertyAnimator import androidx.core.content.ContextCompat import androidx.core.view.isVisible -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation import kotlin.math.abs @@ -34,7 +33,7 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) viewPropertyAnimator = animate() .alpha(1f) - .setDuration(1000L) + .setDuration(FADE_DURATION) .withStartAction { isVisible = true } @@ -44,6 +43,8 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) viewPropertyAnimator?.start() } + private val regionPaint = Paint() + private val textPaint = Paint().apply { textAlign = Paint.Align.CENTER color = Color.WHITE @@ -62,16 +63,14 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) if (navigation == null) return navigation?.regions?.forEach { region -> - - val paint = paintForRegion(region.type) - val rect = region.rectF canvas?.save() // Scale rect from 1f,1f to screen width and height canvas?.scale(width.toFloat(), height.toFloat()) - canvas?.drawRect(rect, paint) + regionPaint.color = ContextCompat.getColor(context, region.type.colorRes) + canvas?.drawRect(rect, regionPaint) canvas?.restore() // Don't want scale anymore because it messes with drawText @@ -86,42 +85,20 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) // Calculate center of rect height on screen val y = height * (abs(rect.top - rect.bottom) / 2) - canvas?.drawText(region.type.name, x, y, textBorderPaint) - canvas?.drawText(region.type.name, x, y, textPaint) + canvas?.drawText(context.getString(region.type.nameRes), x, y, textBorderPaint) + canvas?.drawText(context.getString(region.type.nameRes), x, y, textPaint) canvas?.restore() } } - private fun paintForRegion(type: ViewerNavigation.NavigationRegion): Paint { - return Paint().apply { - when (type) { - ViewerNavigation.NavigationRegion.NEXT -> { - color = ContextCompat.getColor(context, R.color.navigation_next) - } - ViewerNavigation.NavigationRegion.PREV -> { - color = ContextCompat.getColor(context, R.color.navigation_prev) - } - ViewerNavigation.NavigationRegion.MENU -> { - color = ContextCompat.getColor(context, R.color.navigation_menu) - } - ViewerNavigation.NavigationRegion.RIGHT -> { - color = ContextCompat.getColor(context, R.color.navigation_right) - } - ViewerNavigation.NavigationRegion.LEFT -> { - color = ContextCompat.getColor(context, R.color.navigation_left) - } - } - } - } - override fun performClick(): Boolean { super.performClick() if (viewPropertyAnimator == null && isVisible) { viewPropertyAnimator = animate() .alpha(0f) - .setDuration(1000L) + .setDuration(FADE_DURATION) .withEndAction { isVisible = false viewPropertyAnimator = null @@ -138,3 +115,5 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) return super.onTouchEvent(event) } } + +private const val FADE_DURATION = 1000L diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt index c46035c53d..6e07758208 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt @@ -2,13 +2,19 @@ package eu.kanade.tachiyomi.ui.reader.viewer import android.graphics.PointF import android.graphics.RectF +import androidx.annotation.StringRes +import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferenceValues import eu.kanade.tachiyomi.util.lang.invert abstract class ViewerNavigation { - enum class NavigationRegion { - NEXT, PREV, MENU, RIGHT, LEFT + sealed class NavigationRegion(@StringRes val nameRes: Int, val colorRes: Int) { + object MENU : NavigationRegion(R.string.action_menu, R.color.navigation_menu) + object PREV : NavigationRegion(R.string.nav_zone_prev, R.color.navigation_prev) + object NEXT : NavigationRegion(R.string.nav_zone_next, R.color.navigation_next) + object LEFT : NavigationRegion(R.string.nav_zone_left, R.color.navigation_left) + object RIGHT : NavigationRegion(R.string.nav_zone_right, R.color.navigation_right) } data class Region( diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d26dc8e4d2..9c2ea94546 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -253,7 +253,7 @@ Fullscreen Show navigation layout overlay - Show overlay when reader is opened + Briefly show tap zones when reader is opened Dual page split (ALPHA) Invert dual page split placement If the placement of the dual page split doesn\'t match reading direction @@ -300,6 +300,10 @@ Kindle-ish Edge Right and Left + Prev + Next + Left + Right Left to right Right to left Vertical