mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-04 17:37:25 +00:00
Added vertical alignment options to shortcuts
This commit is contained in:
parent
77fc95b2f4
commit
f872c52893
6 changed files with 57 additions and 1 deletions
|
|
@ -200,6 +200,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
}
|
}
|
||||||
|
|
||||||
uiUtils.setShortcutsAlignment(binding.homeView)
|
uiUtils.setShortcutsAlignment(binding.homeView)
|
||||||
|
uiUtils.setShortcutsVAlignment(binding.topSpace, binding.bottomSpace)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -451,6 +452,10 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
uiUtils.setShortcutsAlignment(binding.homeView)
|
uiUtils.setShortcutsAlignment(binding.homeView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"shortcutVAlignment" -> {
|
||||||
|
uiUtils.setShortcutsVAlignment(binding.topSpace, binding.bottomSpace)
|
||||||
|
}
|
||||||
|
|
||||||
"searchAlignment" -> {
|
"searchAlignment" -> {
|
||||||
uiUtils.setSearchAlignment(searchView)
|
uiUtils.setSearchAlignment(searchView)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,10 @@ class SharedPreferenceManager (private val context: Context) {
|
||||||
return preferences.getString("shortcutAlignment", "left")
|
return preferences.getString("shortcutAlignment", "left")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getShortcutVAlignment(): String? {
|
||||||
|
return preferences.getString("shortcutVAlignment", "left")
|
||||||
|
}
|
||||||
|
|
||||||
fun getShortcutSize(): String? {
|
fun getShortcutSize(): String? {
|
||||||
return preferences.getString("shortcutSize", "medium")
|
return preferences.getString("shortcutSize", "medium")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import android.view.Window
|
||||||
import android.view.WindowInsets
|
import android.view.WindowInsets
|
||||||
import android.view.WindowInsetsController
|
import android.view.WindowInsetsController
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.Space
|
||||||
import android.widget.TextClock
|
import android.widget.TextClock
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
@ -146,6 +147,29 @@ class UIUtils(private val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setShortcutsVAlignment(topSpace: Space, bottomSpace: Space) {
|
||||||
|
val alignment = sharedPreferenceManager.getShortcutVAlignment()
|
||||||
|
val topLayoutParams = topSpace.layoutParams as LinearLayout.LayoutParams
|
||||||
|
val bottomLayoutParams = bottomSpace.layoutParams as LinearLayout.LayoutParams
|
||||||
|
|
||||||
|
when (alignment) {
|
||||||
|
"top" -> {
|
||||||
|
topLayoutParams.weight = 0.1F
|
||||||
|
bottomLayoutParams.weight = 0.42F
|
||||||
|
}
|
||||||
|
"center" -> {
|
||||||
|
topLayoutParams.weight = 0.22F
|
||||||
|
bottomLayoutParams.weight = 0.3F
|
||||||
|
}
|
||||||
|
"bottom" -> {
|
||||||
|
topLayoutParams.weight = 0.42F
|
||||||
|
bottomLayoutParams.weight = 0.1F
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
topSpace.layoutParams = topLayoutParams
|
||||||
|
bottomSpace.layoutParams = bottomLayoutParams
|
||||||
|
}
|
||||||
|
|
||||||
fun setDrawables(shortcut: TextView, alignment: String?) {
|
fun setDrawables(shortcut: TextView, alignment: String?) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,7 @@
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
|
android:id="@+id/topSpace"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="0.22" />
|
android:layout_weight="0.22" />
|
||||||
|
|
@ -387,6 +388,7 @@
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
|
android:id="@+id/bottomSpace"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="0.3" />
|
android:layout_weight="0.3" />
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,18 @@
|
||||||
<item>right</item>
|
<item>right</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="v_alignment_options">
|
||||||
|
<item>Top</item>
|
||||||
|
<item>Center</item>
|
||||||
|
<item>Bottom</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="v_alignment_values">
|
||||||
|
<item>top</item>
|
||||||
|
<item>center</item>
|
||||||
|
<item>bottom</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="size_options">
|
<string-array name="size_options">
|
||||||
<item>Tiny</item>
|
<item>Tiny</item>
|
||||||
<item>Small</item>
|
<item>Small</item>
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,16 @@
|
||||||
android:entries="@array/h_alignment_options"
|
android:entries="@array/h_alignment_options"
|
||||||
android:entryValues="@array/h_alignment_values"
|
android:entryValues="@array/h_alignment_values"
|
||||||
app:key="shortcutAlignment"
|
app:key="shortcutAlignment"
|
||||||
app:title="Shortcut Alignment"
|
app:title="Horizontal Alignment"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
<eu.ottop.yamlauncher.settings.SpinnerPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:defaultValue="center"
|
||||||
|
android:entries="@array/v_alignment_options"
|
||||||
|
android:entryValues="@array/v_alignment_values"
|
||||||
|
app:key="shortcutVAlignment"
|
||||||
|
app:title="Vertical Alignment"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
<eu.ottop.yamlauncher.settings.SpinnerPreference
|
<eu.ottop.yamlauncher.settings.SpinnerPreference
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue