mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Fixed weather spacing
This commit is contained in:
parent
c137c68367
commit
2b9db81936
5 changed files with 33 additions and 23 deletions
|
|
@ -134,7 +134,7 @@ class AppMenuAdapter(
|
||||||
|
|
||||||
uiUtils.setAppSize(holder.textView, holder.editText)
|
uiUtils.setAppSize(holder.textView, holder.editText)
|
||||||
|
|
||||||
uiUtils.setAppSpacing(holder.textView)
|
uiUtils.setItemSpacing(holder.textView)
|
||||||
|
|
||||||
// Update the application information (allows updating apps to work)
|
// Update the application information (allows updating apps to work)
|
||||||
val appInfo = appUtils.getAppInfo(
|
val appInfo = appUtils.getAppInfo(
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class GestureAppsAdapter(
|
||||||
|
|
||||||
uiUtils.setAppSize(holder.textView)
|
uiUtils.setAppSize(holder.textView)
|
||||||
|
|
||||||
uiUtils.setAppSpacing(holder.textView)
|
uiUtils.setItemSpacing(holder.textView)
|
||||||
|
|
||||||
// Does not need to be specially updated since it's in a separate activity and thus reloads when opened again
|
// Does not need to be specially updated since it's in a separate activity and thus reloads when opened again
|
||||||
val appInfo = app.first.activityInfo.applicationInfo
|
val appInfo = app.first.activityInfo.applicationInfo
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class HiddenAppsAdapter(
|
||||||
|
|
||||||
uiUtils.setAppSize(holder.textView)
|
uiUtils.setAppSize(holder.textView)
|
||||||
|
|
||||||
uiUtils.setAppSpacing(holder.textView)
|
uiUtils.setItemSpacing(holder.textView)
|
||||||
|
|
||||||
// Separate activity from Main so does not need special update
|
// Separate activity from Main so does not need special update
|
||||||
val appInfo = app.first.activityInfo.applicationInfo
|
val appInfo = app.first.activityInfo.applicationInfo
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class LocationListAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
private val listItem: ConstraintLayout = itemView.findViewById(R.id.locationPlace)
|
val listItem: ConstraintLayout = itemView.findViewById(R.id.locationPlace)
|
||||||
val textView: TextView = listItem.findViewById(R.id.locationName)
|
val textView: TextView = listItem.findViewById(R.id.locationName)
|
||||||
val regionText: TextView = listItem.findViewById(R.id.regionName)
|
val regionText: TextView = listItem.findViewById(R.id.regionName)
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ class LocationListAdapter(
|
||||||
|
|
||||||
uiUtils.setAppSize(holder.textView, null, holder.regionText)
|
uiUtils.setAppSize(holder.textView, null, holder.regionText)
|
||||||
|
|
||||||
uiUtils.setAppSpacing(holder.textView)
|
uiUtils.setWeatherSpacing(holder.listItem)
|
||||||
|
|
||||||
holder.textView.text = location["name"]
|
holder.textView.text = location["name"]
|
||||||
holder.regionText.text = context.getString(R.string.region_text, location["region"], location["country"])
|
holder.regionText.text = context.getString(R.string.region_text, location["region"], location["country"])
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import android.view.WindowInsetsController
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextClock
|
import android.widget.TextClock
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.view.children
|
import androidx.core.view.children
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import eu.ottop.yamlauncher.settings.SharedPreferenceManager
|
import eu.ottop.yamlauncher.settings.SharedPreferenceManager
|
||||||
|
|
@ -357,22 +358,7 @@ class UIUtils(private val context: Context) {
|
||||||
} catch (_: Exception) {}
|
} catch (_: Exception) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status bar visibility
|
// Spacing
|
||||||
fun setStatusBar(window: Window) {
|
|
||||||
val windowInsetsController = window.insetsController
|
|
||||||
|
|
||||||
windowInsetsController?.let {
|
|
||||||
if (sharedPreferenceManager.isBarVisible()) {
|
|
||||||
it.show(WindowInsets.Type.statusBars())
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
it.hide(WindowInsets.Type.statusBars())
|
|
||||||
it.systemBarsBehavior =
|
|
||||||
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setShortcutsSpacing(shortcuts: LinearLayout) {
|
fun setShortcutsSpacing(shortcuts: LinearLayout) {
|
||||||
val shortcutWeight = sharedPreferenceManager.getShortcutWeight()
|
val shortcutWeight = sharedPreferenceManager.getShortcutWeight()
|
||||||
shortcuts.children.forEach {
|
shortcuts.children.forEach {
|
||||||
|
|
@ -392,11 +378,19 @@ class UIUtils(private val context: Context) {
|
||||||
shortcut.layoutParams = layoutParams
|
shortcut.layoutParams = layoutParams
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setAppSpacing(app: TextView) {
|
fun setItemSpacing(item: TextView) {
|
||||||
val spacing = sharedPreferenceManager.getAppSpacing()
|
val spacing = sharedPreferenceManager.getAppSpacing()
|
||||||
if (spacing != null) {
|
if (spacing != null) {
|
||||||
val spacingPx = dpToPx(spacing)
|
val spacingPx = dpToPx(spacing)
|
||||||
app.setPadding(app.paddingLeft, spacingPx, app.paddingRight, spacingPx)
|
item.setPadding(item.paddingLeft, spacingPx, item.paddingRight, spacingPx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setWeatherSpacing(item: ConstraintLayout) {
|
||||||
|
val spacing = sharedPreferenceManager.getAppSpacing()
|
||||||
|
if (spacing != null) {
|
||||||
|
val spacingPx = dpToPx(spacing)
|
||||||
|
item.setPadding(item.paddingLeft, spacingPx, item.paddingRight, spacingPx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -404,4 +398,20 @@ class UIUtils(private val context: Context) {
|
||||||
val density = context.resources.displayMetrics.density
|
val density = context.resources.displayMetrics.density
|
||||||
return (dp * density).toInt()
|
return (dp * density).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Status bar visibility
|
||||||
|
fun setStatusBar(window: Window) {
|
||||||
|
val windowInsetsController = window.insetsController
|
||||||
|
|
||||||
|
windowInsetsController?.let {
|
||||||
|
if (sharedPreferenceManager.isBarVisible()) {
|
||||||
|
it.show(WindowInsets.Type.statusBars())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
it.hide(WindowInsets.Type.statusBars())
|
||||||
|
it.systemBarsBehavior =
|
||||||
|
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue