Improve the look of the status bar on modern Android (no shadow).

This commit is contained in:
Henrik Rydgård
2026-03-04 12:44:12 +01:00
parent 17f6583a78
commit 8045b3cf79
2 changed files with 8 additions and 5 deletions
-1
View File
@@ -6,7 +6,6 @@
<item name="android:windowNoTitle">true</item>
<item name="android:navigationBarColor">@color/black</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowTranslucentStatus">true</item>
<!-- TODO: Our rendering is not ready for these yet.
<item name="android:windowTranslucentNavigation">true</item>
-->
@@ -619,19 +619,23 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
@SuppressLint("InlinedApi")
private void updateSystemUiVisibility() {
Window window = getWindow();
int orientation = getResources().getConfiguration().orientation;
WindowInsetsControllerCompat controller = WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView());
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(0x80000000);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// Tell Android to use light icons on the bars.
controller.setAppearanceLightStatusBars(false);
controller.setAppearanceLightNavigationBars(false);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// This tells Android to not add any automatic shadows.
window.setStatusBarContrastEnforced(false);
window.setNavigationBarContrastEnforced(true); // we do want this on the nav bar, for now.
}
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(0x80000000);
controller.setSystemBarsBehavior(
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE