Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
8c8e4fd716
@ -2,15 +2,14 @@ package eu.kanade.tachiyomi.ui.reader
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Canvas
|
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.Paint
|
|
||||||
import androidx.appcompat.widget.AppCompatTextView
|
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
import android.text.style.ScaleXSpan
|
import android.text.style.ScaleXSpan
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.widget.AppCompatTextView
|
||||||
|
import eu.kanade.tachiyomi.widget.OutlineSpan
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page indicator found at the bottom of the reader
|
* Page indicator found at the bottom of the reader
|
||||||
@ -42,10 +41,13 @@ class PageIndicatorTextView(
|
|||||||
val currText = " $text "
|
val currText = " $text "
|
||||||
|
|
||||||
// Also add a bit of spacing between each character, as the stroke overlaps them
|
// Also add a bit of spacing between each character, as the stroke overlaps them
|
||||||
val finalText = SpannableString(currText.asIterable().joinToString("\u00A0"))
|
val finalText = SpannableString(currText.asIterable().joinToString("\u00A0")).apply {
|
||||||
|
// Apply text outline
|
||||||
|
setSpan(spanOutline, 1, length-1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
|
|
||||||
for (i in 1..finalText.lastIndex step 2) {
|
for (i in 1..lastIndex step 2) {
|
||||||
finalText.setSpan(ScaleXSpan(0.1f), i, i + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
setSpan(ScaleXSpan(0.2f), i, i + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.setText(finalText, TextView.BufferType.SPANNABLE)
|
super.setText(finalText, TextView.BufferType.SPANNABLE)
|
||||||
|
@ -69,7 +69,6 @@ class SettingsGeneralController : SettingsController() {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intListPreference {
|
intListPreference {
|
||||||
key = Keys.startScreen
|
key = Keys.startScreen
|
||||||
titleRes = R.string.pref_start_screen
|
titleRes = R.string.pref_start_screen
|
||||||
|
@ -20,7 +20,7 @@ class SettingsMainController : SettingsController() {
|
|||||||
onClick { navigateTo(SettingsGeneralController()) }
|
onClick { navigateTo(SettingsGeneralController()) }
|
||||||
}
|
}
|
||||||
preference {
|
preference {
|
||||||
iconRes = R.drawable.ic_in_library_24dp
|
iconRes = R.drawable.ic_book_black_24dp
|
||||||
iconTint = tintColor
|
iconTint = tintColor
|
||||||
titleRes = R.string.pref_category_library
|
titleRes = R.string.pref_category_library
|
||||||
onClick { navigateTo(SettingsLibraryController()) }
|
onClick { navigateTo(SettingsLibraryController()) }
|
||||||
|
57
app/src/main/java/eu/kanade/tachiyomi/widget/OutlineSpan.kt
Normal file
57
app/src/main/java/eu/kanade/tachiyomi/widget/OutlineSpan.kt
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package eu.kanade.tachiyomi.widget
|
||||||
|
|
||||||
|
import android.graphics.Canvas
|
||||||
|
import android.graphics.Paint
|
||||||
|
import android.text.style.ReplacementSpan
|
||||||
|
import androidx.annotation.ColorInt
|
||||||
|
import androidx.annotation.Dimension
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Source: https://github.com/santaevpavel
|
||||||
|
*
|
||||||
|
* A class that draws the outlines of a text when given a stroke color and stroke width.
|
||||||
|
*/
|
||||||
|
class OutlineSpan(
|
||||||
|
@ColorInt private val strokeColor: Int,
|
||||||
|
@Dimension private val strokeWidth: Float
|
||||||
|
) : ReplacementSpan() {
|
||||||
|
|
||||||
|
override fun getSize(
|
||||||
|
paint: Paint,
|
||||||
|
text: CharSequence,
|
||||||
|
start: Int,
|
||||||
|
end: Int,
|
||||||
|
fm: Paint.FontMetricsInt?
|
||||||
|
): Int {
|
||||||
|
return paint.measureText(text.toString().substring(start until end)).toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun draw(
|
||||||
|
canvas: Canvas,
|
||||||
|
text: CharSequence,
|
||||||
|
start: Int,
|
||||||
|
end: Int,
|
||||||
|
x: Float,
|
||||||
|
top: Int,
|
||||||
|
y: Int,
|
||||||
|
bottom: Int,
|
||||||
|
paint: Paint
|
||||||
|
) {
|
||||||
|
val originTextColor = paint.color
|
||||||
|
|
||||||
|
paint.apply {
|
||||||
|
color = strokeColor
|
||||||
|
style = Paint.Style.STROKE
|
||||||
|
this.strokeWidth = this@OutlineSpan.strokeWidth
|
||||||
|
}
|
||||||
|
canvas.drawText(text, start, end, x, y.toFloat(), paint)
|
||||||
|
|
||||||
|
paint.apply {
|
||||||
|
color = originTextColor
|
||||||
|
style = Paint.Style.FILL
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.drawText(text, start, end, x, y.toFloat(), paint)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -137,6 +137,19 @@
|
|||||||
<string name="pref_category_about">About</string>
|
<string name="pref_category_about">About</string>
|
||||||
|
|
||||||
<!-- General section -->
|
<!-- General section -->
|
||||||
|
<string name="pref_theme">App theme</string>
|
||||||
|
<string name="light_theme">Light</string>
|
||||||
|
<string name="dark_theme">Dark</string>
|
||||||
|
<string name="amoled_theme">AMOLED dark</string>
|
||||||
|
<string name="darkblue_theme">Dark blue</string>
|
||||||
|
<string name="system_theme">System default</string>
|
||||||
|
<string name="system_amoled_theme">System default (AMOLED dark)</string>
|
||||||
|
<string name="system_darkblue_theme">System default (Dark blue)</string>
|
||||||
|
<string name="pref_start_screen">Start screen</string>
|
||||||
|
<string name="pref_language">Language</string>
|
||||||
|
<string name="system_default">System default</string>
|
||||||
|
|
||||||
|
<!-- Library section -->
|
||||||
<string name="pref_library_columns">Library manga per row</string>
|
<string name="pref_library_columns">Library manga per row</string>
|
||||||
<string name="portrait">Portrait</string>
|
<string name="portrait">Portrait</string>
|
||||||
<string name="landscape">Landscape</string>
|
<string name="landscape">Landscape</string>
|
||||||
@ -169,17 +182,6 @@
|
|||||||
<string name="pref_skip_pre_migration_summary">Use last saved pre-migration preferences
|
<string name="pref_skip_pre_migration_summary">Use last saved pre-migration preferences
|
||||||
and sources to mass migrate</string>
|
and sources to mass migrate</string>
|
||||||
<string name="pref_ask_update_manga_sync">Confirm before updating</string>
|
<string name="pref_ask_update_manga_sync">Confirm before updating</string>
|
||||||
<string name="pref_theme">App theme</string>
|
|
||||||
<string name="light_theme">Light</string>
|
|
||||||
<string name="dark_theme">Dark</string>
|
|
||||||
<string name="amoled_theme">AMOLED dark</string>
|
|
||||||
<string name="darkblue_theme">Dark blue</string>
|
|
||||||
<string name="system_theme">System default</string>
|
|
||||||
<string name="system_amoled_theme">System default (AMOLED dark)</string>
|
|
||||||
<string name="system_darkblue_theme">System default (Dark blue)</string>
|
|
||||||
<string name="pref_start_screen">Start screen</string>
|
|
||||||
<string name="pref_language">Language</string>
|
|
||||||
<string name="system_default">System default</string>
|
|
||||||
<string name="default_category">Default category</string>
|
<string name="default_category">Default category</string>
|
||||||
<string name="default_category_summary">Always ask</string>
|
<string name="default_category_summary">Always ask</string>
|
||||||
<string name="lock_with_biometrics">Lock with biometrics</string>
|
<string name="lock_with_biometrics">Lock with biometrics</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user