diff --git a/app/src/main/java/protect/card_locker/AboutActivity.kt b/app/src/main/java/protect/card_locker/AboutActivity.kt index add6c1c07e..284d081391 100644 --- a/app/src/main/java/protect/card_locker/AboutActivity.kt +++ b/app/src/main/java/protect/card_locker/AboutActivity.kt @@ -1,7 +1,6 @@ package protect.card_locker import android.os.Bundle -import androidx.activity.ComponentActivity import androidx.activity.OnBackPressedDispatcher import androidx.activity.compose.setContent import androidx.compose.foundation.layout.Column @@ -26,12 +25,15 @@ import protect.card_locker.compose.CatimaAboutSection import protect.card_locker.compose.CatimaTopAppBar import protect.card_locker.compose.theme.CatimaTheme -class AboutActivity : ComponentActivity() { +class AboutActivity : CatimaComponentActivity() { private lateinit var content: AboutContent @OptIn(ExperimentalMaterial3Api::class) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + fixedEdgeToEdge() + content = AboutContent(this) title = content.pageTitle diff --git a/app/src/main/java/protect/card_locker/CatimaComponentActivity.kt b/app/src/main/java/protect/card_locker/CatimaComponentActivity.kt new file mode 100644 index 0000000000..5566eae26a --- /dev/null +++ b/app/src/main/java/protect/card_locker/CatimaComponentActivity.kt @@ -0,0 +1,42 @@ +package protect.card_locker + +import android.graphics.Color +import android.os.Bundle +import android.os.PersistableBundle +import androidx.activity.ComponentActivity +import androidx.activity.SystemBarStyle +import androidx.activity.enableEdgeToEdge +import androidx.appcompat.app.AppCompatDelegate +import protect.card_locker.preferences.Settings + +open class CatimaComponentActivity() : ComponentActivity() { + fun fixedEdgeToEdge() { + // Fix edge-to-edge + // When overriding onCreate this does not correctly get applied, which is why it is its own function + + // We explicitly need to set the systemBarStyle ourselves, to prevent issues where Android + // for example renders white icons on top of a white statusbar (or black on black) + val settings = Settings(this) + val systemBarStyle = when (settings.theme) { + AppCompatDelegate.MODE_NIGHT_NO -> + SystemBarStyle.light( + scrim = Color.TRANSPARENT, + darkScrim = Color.TRANSPARENT, + ) + AppCompatDelegate.MODE_NIGHT_YES -> + SystemBarStyle.dark( + scrim = Color.TRANSPARENT, + ) + else -> + SystemBarStyle.auto( + lightScrim = Color.TRANSPARENT, + darkScrim = Color.TRANSPARENT + ) + } + + enableEdgeToEdge( + statusBarStyle = systemBarStyle, + navigationBarStyle = systemBarStyle + ) + } +} \ No newline at end of file