mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-21 13:19:02 +00:00
fix issues with older android versions
This commit is contained in:
parent
56bc560ad9
commit
569ff7e3dd
7 changed files with 26 additions and 5 deletions
4
Habitica/res/values-night-v30/colors.xml
Normal file
4
Habitica/res/values-night-v30/colors.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="system_bars">@color/transparent</color>
|
||||
</resources>
|
||||
4
Habitica/res/values-v30/colors.xml
Normal file
4
Habitica/res/values-v30/colors.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="system_bars">@color/transparent</color>
|
||||
</resources>
|
||||
4
Habitica/res/values-v30/values.xml
Normal file
4
Habitica/res/values-v30/values.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<bool name="edge_to_edge">true</bool>
|
||||
</resources>
|
||||
|
|
@ -58,9 +58,9 @@
|
|||
<item name="alertDialogTheme">@style/AlertDialogTheme</item>
|
||||
<item name="android:windowTranslucentStatus">false</item>
|
||||
|
||||
<item name="android:statusBarColor">@color/transparent</item>
|
||||
<item name="android:navigationBarColor">@color/transparent</item>
|
||||
<item name="enableEdgeToEdge">true</item>
|
||||
<item name="android:statusBarColor">@color/system_bars</item>
|
||||
<item name="android:navigationBarColor">@color/system_bars</item>
|
||||
<item name="enableEdgeToEdge">@bool/edge_to_edge</item>
|
||||
|
||||
<item name="searchViewStyle">@style/SearchViewStyle</item>
|
||||
<item name="toolbarContentColor">@color/text_primary</item>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<bool name="edge_to_edge">true</bool>
|
||||
|
||||
<string-array name="repeatables_frequencies">
|
||||
<item>@string/repeatables_frequency_daily</item>
|
||||
<item>@string/repeatables_frequency_weekly</item>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.extensions
|
|||
|
||||
import android.os.Build
|
||||
import android.view.View
|
||||
import android.view.WindowInsets
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
|
|
@ -11,6 +12,11 @@ fun consumeWindowInsetsAbove30(insets: WindowInsetsCompat): WindowInsetsCompat {
|
|||
return insets
|
||||
}
|
||||
|
||||
fun consumeWindowInsetsAbove30(insets: WindowInsets?): WindowInsets? {
|
||||
if (Build.VERSION.SDK_INT >= 30) return WindowInsets.CONSUMED
|
||||
return insets
|
||||
}
|
||||
|
||||
fun applyScrollContentWindowInsets(view: View,
|
||||
applyTop: Boolean = false,
|
||||
applyBottom: Boolean = true,
|
||||
|
|
|
|||
|
|
@ -102,7 +102,9 @@ abstract class BaseActivity : AppCompatActivity() {
|
|||
internal var navigationBarStyle: SystemBarStyle? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge(navigationBarStyle = navigationBarStyle ?: defaultNavigationBarStyle)
|
||||
if (resources.getBoolean(R.bool.edge_to_edge)) {
|
||||
enableEdgeToEdge(navigationBarStyle = navigationBarStyle ?: defaultNavigationBarStyle)
|
||||
}
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val languageHelper = LanguageHelper(sharedPreferences.getString("language", "en"))
|
||||
resources.forceLocale(this, languageHelper.locale)
|
||||
|
|
@ -116,7 +118,6 @@ abstract class BaseActivity : AppCompatActivity() {
|
|||
loadTheme(sharedPreferences)
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
|
||||
habiticaApplication
|
||||
getLayoutResId()?.let {
|
||||
|
|
|
|||
Loading…
Reference in a new issue