mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-04 17:37:25 +00:00
Updated gradle and added customization to Shortcut Spacing
This commit is contained in:
parent
b47fa4b48c
commit
e453742ce8
6 changed files with 57 additions and 1 deletions
|
|
@ -297,6 +297,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
uiUtils.setShortcutsSize(binding.homeView)
|
||||
uiUtils.setSearchSize(searchView)
|
||||
|
||||
uiUtils.setShortcutsSpacing(binding.homeView)
|
||||
|
||||
uiUtils.setStatusBar(window)
|
||||
|
||||
leftSwipeActivity = gestureUtils.getSwipeInfo(launcherApps, "left")
|
||||
|
|
@ -413,6 +415,10 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
uiUtils.setSearchSize(searchView)
|
||||
}
|
||||
|
||||
"shortcutWeight" -> {
|
||||
uiUtils.setShortcutsSpacing(binding.homeView)
|
||||
}
|
||||
|
||||
"barVisibility" -> {
|
||||
uiUtils.setStatusBar(window)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,10 @@ class SharedPreferenceManager (private val context: Context) {
|
|||
return preferences.getString("shortcutSize", "medium")
|
||||
}
|
||||
|
||||
fun getShortcutWeight(): Float? {
|
||||
return preferences.getString("shortcutWeight", "0.09")?.toFloat()
|
||||
}
|
||||
|
||||
fun isBatteryEnabled(): Boolean {
|
||||
return preferences.getBoolean("batteryEnabled", false)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,4 +316,23 @@ class UIUtils(context: Context) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setShortcutsSpacing(shortcuts: LinearLayout) {
|
||||
val shortcutWeight = sharedPreferenceManager.getShortcutWeight()
|
||||
shortcuts.children.forEach {
|
||||
if (it is TextView) {
|
||||
setShortcutSpacing(it, shortcutWeight)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setShortcutSpacing(shortcut: TextView, shortcutWeight: Float?) {
|
||||
val layoutParams = shortcut.layoutParams as LinearLayout.LayoutParams
|
||||
|
||||
if (shortcutWeight != null) {
|
||||
layoutParams.weight = shortcutWeight
|
||||
}
|
||||
|
||||
shortcut.layoutParams = layoutParams
|
||||
}
|
||||
}
|
||||
|
|
@ -105,6 +105,24 @@
|
|||
<item>extra</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="shortcut_spacing_options">
|
||||
<item>Small</item>
|
||||
<item>Medium</item>
|
||||
<item>Large</item>
|
||||
<item>Extra Large</item>
|
||||
<item>Huge</item>
|
||||
<item>Extra Huge</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="shortcut_spacing_values">
|
||||
<item>0.06</item>
|
||||
<item>0.09</item>
|
||||
<item>0.12</item>
|
||||
<item>0.15</item>
|
||||
<item>0.18</item>
|
||||
<item>0.21</item>
|
||||
</string-array>
|
||||
|
||||
<!--Weather-->
|
||||
<string-array name="temp_units">
|
||||
<item>°C</item>
|
||||
|
|
|
|||
|
|
@ -105,6 +105,15 @@
|
|||
app:key="shortcutSize"
|
||||
app:title="Shortcut Size"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<ListPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:defaultValue="0.09"
|
||||
app:entries="@array/shortcut_spacing_options"
|
||||
app:entryValues="@array/shortcut_spacing_values"
|
||||
app:key="shortcutWeight"
|
||||
app:title="Shortcut Spacing"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<SwitchPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue