Ui adjustments
This commit is contained in:
@@ -20,6 +20,7 @@ class ReadingProgressDrawable(
|
|||||||
private val textColor: Int
|
private val textColor: Int
|
||||||
private val textPattern = context.getString(R.string.percent_string_pattern)
|
private val textPattern = context.getString(R.string.percent_string_pattern)
|
||||||
private val textBounds = Rect()
|
private val textBounds = Rect()
|
||||||
|
private val tempRect = Rect()
|
||||||
private val hasBackground: Boolean
|
private val hasBackground: Boolean
|
||||||
private val hasOutline: Boolean
|
private val hasOutline: Boolean
|
||||||
private val hasText: Boolean
|
private val hasText: Boolean
|
||||||
@@ -63,6 +64,8 @@ class ReadingProgressDrawable(
|
|||||||
if (autoFitTextSize) {
|
if (autoFitTextSize) {
|
||||||
val innerWidth = bounds.width() - (paint.strokeWidth * 2f)
|
val innerWidth = bounds.width() - (paint.strokeWidth * 2f)
|
||||||
paint.textSize = getTextSizeForWidth(innerWidth, "100%")
|
paint.textSize = getTextSizeForWidth(innerWidth, "100%")
|
||||||
|
paint.getTextBounds(text, 0, text.length, textBounds)
|
||||||
|
invalidateSelf()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +125,7 @@ class ReadingProgressDrawable(
|
|||||||
private fun getTextSizeForWidth(width: Float, text: String): Float {
|
private fun getTextSizeForWidth(width: Float, text: String): Float {
|
||||||
val testTextSize = 48f
|
val testTextSize = 48f
|
||||||
paint.textSize = testTextSize
|
paint.textSize = testTextSize
|
||||||
paint.getTextBounds(text, 0, text.length, textBounds)
|
paint.getTextBounds(text, 0, text.length, tempRect)
|
||||||
return testTextSize * width / textBounds.width()
|
return testTextSize * width / tempRect.width()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,6 +182,7 @@
|
|||||||
<item name="android:textColor">?android:textColorPrimary</item>
|
<item name="android:textColor">?android:textColorPrimary</item>
|
||||||
<item name="strokeWidth">3dp</item>
|
<item name="strokeWidth">3dp</item>
|
||||||
<item name="android:textSize">9sp</item>
|
<item name="android:textSize">9sp</item>
|
||||||
|
<item name="autoFitTextSize">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -32,8 +32,7 @@
|
|||||||
android:key="thumbs_cache_clear"
|
android:key="thumbs_cache_clear"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:summary="@string/computing_"
|
android:summary="@string/computing_"
|
||||||
android:title="@string/clear_thumbs_cache"
|
android:title="@string/clear_thumbs_cache" />
|
||||||
app:allowDividerAbove="true" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="pages_cache_clear"
|
android:key="pages_cache_clear"
|
||||||
@@ -45,8 +44,7 @@
|
|||||||
android:key="cookies_clear"
|
android:key="cookies_clear"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:summary="@string/clear_cookies_summary"
|
android:summary="@string/clear_cookies_summary"
|
||||||
android:title="@string/clear_cookies"
|
android:title="@string/clear_cookies" />
|
||||||
app:allowDividerAbove="true" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user