mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Added more size options
This commit is contained in:
parent
5a3012f0f1
commit
54200a0181
3 changed files with 38 additions and 24 deletions
|
|
@ -204,11 +204,11 @@ class UIUtils(private val context: Context) {
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
fun setClockSize(clock: TextClock) {
|
fun setClockSize(clock: TextClock) {
|
||||||
setTextSize(clock, sharedPreferenceManager.getClockSize(), 58F, 70F, 78F)
|
setTextSize(clock, sharedPreferenceManager.getClockSize(), 48F, 58F, 70F, 78F, 82F, 84F)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDateSize(dateText: TextClock) {
|
fun setDateSize(dateText: TextClock) {
|
||||||
setTextSize(dateText, sharedPreferenceManager.getDateSize(), 17F, 20F, 23F)
|
setTextSize(dateText, sharedPreferenceManager.getDateSize(), 14F, 17F, 20F, 23F, 26F, 29F)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setShortcutsSize(shortcuts: LinearLayout) {
|
fun setShortcutsSize(shortcuts: LinearLayout) {
|
||||||
|
|
@ -220,13 +220,20 @@ class UIUtils(private val context: Context) {
|
||||||
setShortcutSize(it, size)
|
setShortcutSize(it, size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setShortcutSize(shortcut: TextView, size: String?) {
|
private fun setShortcutSize(shortcut: TextView, size: String?) {
|
||||||
try {
|
try {
|
||||||
when (size) {
|
when (size) {
|
||||||
|
"tiny" -> {
|
||||||
|
shortcut.setAutoSizeTextTypeUniformWithConfiguration(
|
||||||
|
5, // Min text size in SP
|
||||||
|
20, // Max text size in SP
|
||||||
|
2, // Step granularity in SP
|
||||||
|
TypedValue.COMPLEX_UNIT_SP // Unit of measurement
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
"small" -> {
|
"small" -> {
|
||||||
shortcut.setAutoSizeTextTypeUniformWithConfiguration(
|
shortcut.setAutoSizeTextTypeUniformWithConfiguration(
|
||||||
5, // Min text size in SP
|
5, // Min text size in SP
|
||||||
|
|
@ -262,6 +269,15 @@ class UIUtils(private val context: Context) {
|
||||||
TypedValue.COMPLEX_UNIT_SP // Unit of measurement
|
TypedValue.COMPLEX_UNIT_SP // Unit of measurement
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"huge" -> {
|
||||||
|
shortcut.setAutoSizeTextTypeUniformWithConfiguration(
|
||||||
|
5, // Min text size in SP
|
||||||
|
40, // Max text size in SP
|
||||||
|
2, // Step granularity in SP
|
||||||
|
TypedValue.COMPLEX_UNIT_SP // Unit of measurement
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch(_: Exception) {}
|
} catch(_: Exception) {}
|
||||||
}
|
}
|
||||||
|
|
@ -272,28 +288,34 @@ class UIUtils(private val context: Context) {
|
||||||
regionText: TextView? = null
|
regionText: TextView? = null
|
||||||
) {
|
) {
|
||||||
val size = sharedPreferenceManager.getAppSize()
|
val size = sharedPreferenceManager.getAppSize()
|
||||||
setTextSize(textView, size, 24F, 27F, 30F)
|
setTextSize(textView, size, 21F, 24F, 27F, 30F, 33F, 36F)
|
||||||
if (editText != null) {
|
if (editText != null) {
|
||||||
setTextSize(editText, size, 24F, 27F, 30F)
|
setTextSize(editText, size, 21F, 24F, 27F, 30F, 33F, 36F)
|
||||||
}
|
}
|
||||||
if (regionText != null) {
|
if (regionText != null) {
|
||||||
setTextSize(regionText, size, 14F, 17F, 20F)
|
setTextSize(regionText, size, 11F, 14F, 17F, 20F, 23F, 26F)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setSearchSize(searchView: TextInputEditText) {
|
fun setSearchSize(searchView: TextInputEditText) {
|
||||||
setTextSize(searchView, sharedPreferenceManager.getSearchSize(), 21F, 25F, 27F)
|
setTextSize(searchView, sharedPreferenceManager.getSearchSize(), 18F, 21F, 25F, 27F, 30F, 33F)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setTextSize(view: TextView, size: String?, s: Float, m: Float, l: Float) {
|
private fun setTextSize(view: TextView, size: String?, t: Float, s: Float, m: Float, l: Float, x: Float, h: Float) {
|
||||||
try {
|
try {
|
||||||
view.textSize = when (size) {
|
view.textSize = when (size) {
|
||||||
|
"tiny" -> t
|
||||||
|
|
||||||
"small" -> s
|
"small" -> s
|
||||||
|
|
||||||
"medium" -> m
|
"medium" -> m
|
||||||
|
|
||||||
"large" -> l
|
"large" -> l
|
||||||
|
|
||||||
|
"extra" -> x
|
||||||
|
|
||||||
|
"huge" -> h
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
0F
|
0F
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,29 +80,21 @@
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="size_options">
|
<string-array name="size_options">
|
||||||
<item>Small</item>
|
<item>Tiny</item>
|
||||||
<item>Medium</item>
|
|
||||||
<item>Large</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="size_values">
|
|
||||||
<item>small</item>
|
|
||||||
<item>medium</item>
|
|
||||||
<item>large</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="shortcut_size_options">
|
|
||||||
<item>Small</item>
|
<item>Small</item>
|
||||||
<item>Medium</item>
|
<item>Medium</item>
|
||||||
<item>Large</item>
|
<item>Large</item>
|
||||||
<item>Extra Large</item>
|
<item>Extra Large</item>
|
||||||
|
<item>Huge</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="shortcut_size_values">
|
<string-array name="size_values">
|
||||||
|
<item>tiny</item>
|
||||||
<item>small</item>
|
<item>small</item>
|
||||||
<item>medium</item>
|
<item>medium</item>
|
||||||
<item>large</item>
|
<item>large</item>
|
||||||
<item>extra</item>
|
<item>extra</item>
|
||||||
|
<item>huge</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="shortcut_spacing_options">
|
<string-array name="shortcut_spacing_options">
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:defaultValue="medium"
|
app:defaultValue="medium"
|
||||||
app:entries="@array/shortcut_size_options"
|
app:entries="@array/size_options"
|
||||||
app:entryValues="@array/shortcut_size_values"
|
app:entryValues="@array/size_values"
|
||||||
app:key="shortcutSize"
|
app:key="shortcutSize"
|
||||||
app:title="Shortcut Size"
|
app:title="Shortcut Size"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue