Files
Android/app/src/main/java/protect/card_locker/CatimaAppCompatActivity.java
Sylvia van Os 37e6782032 Temporarily re-add Android 5 support (#2925)
* Revert "Bump androidx.activity:activity-compose from 1.10.1 to 1.12.2"

This reverts commit 307f0e12bc.

* Revert "Bump androidx.compose:compose-bom from 2025.11.01 to 2025.12.01"

This reverts commit a0fea79359.

* Revert "Remove Android 5 support"

This reverts commit 23457854b7.

* Update CHANGELOG
2026-01-03 17:54:33 +01:00

73 lines
2.6 KiB
Java

package protect.card_locker;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.WindowInsetsControllerCompat;
public class CatimaAppCompatActivity extends AppCompatActivity {
protected boolean activityOverridesNavBarColor = false;
@Override
protected void attachBaseContext(Context base) {
// Apply chosen language
super.attachBaseContext(Utils.updateBaseContextLocale(base));
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
EdgeToEdge.enable(this);
super.onCreate(savedInstanceState);
Utils.patchColors(this);
}
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// material 3 designer does not consider status bar colors
// XXX changing this in onCreate causes issues with the splash screen activity, so doing this here
Window window = getWindow();
if (window != null) {
boolean darkMode = Utils.isDarkModeEnabled(this);
if (Build.VERSION.SDK_INT >= 23) {
View decorView = window.getDecorView();
WindowInsetsControllerCompat wic = new WindowInsetsControllerCompat(window, decorView);
wic.setAppearanceLightStatusBars(!darkMode);
window.setStatusBarColor(Color.TRANSPARENT);
} else {
// icons are always white back then
window.setStatusBarColor(darkMode ? Color.TRANSPARENT : Color.argb(127, 0, 0, 0));
}
}
// XXX android 9 and below has a nasty rendering bug if the theme was patched earlier
Utils.postPatchColors(this);
}
@Override
protected void onResume() {
super.onResume();
if (!activityOverridesNavBarColor) {
Utils.setNavigationBarColor(this, null, Utils.resolveBackgroundColor(this), !Utils.isDarkModeEnabled(this));
}
}
protected void enableToolbarBackButton() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
public void onMockedRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
}
}