Android: don't touch system bars colors in fullscreen

In fullscreen mode, don't try to touch the system bars
colors neither making them transparent or restoring the
default colors as it's irrelevant as the bars are not
visible.

Task-number: QTBUG-132720
Change-Id: I3b3cc604d8b1241b50555fd964a51e7836c9034c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Assam Boudjelthia 2025-01-03 17:05:21 +02:00
parent 7344d21c73
commit 9ba94b1e62

View File

@ -183,22 +183,24 @@ class QtDisplayManager {
decorView.setSystemUiVisibility(systemUiVisibility);
}
// Handle transparent status and navigation bars
if (m_expandedToCutout) {
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
} else {
// Restore theme's system bars colors
Theme theme = m_activity.getTheme();
TypedValue typedValue = new TypedValue();
if (!isFullScreen) {
// Handle transparent status and navigation bars
if (m_expandedToCutout) {
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
} else {
// Restore theme's system bars colors
Theme theme = m_activity.getTheme();
TypedValue typedValue = new TypedValue();
theme.resolveAttribute(android.R.attr.statusBarColor, typedValue, true);
int defaultStatusBarColor = typedValue.data;
window.setStatusBarColor(defaultStatusBarColor);
theme.resolveAttribute(android.R.attr.statusBarColor, typedValue, true);
int defaultStatusBarColor = typedValue.data;
window.setStatusBarColor(defaultStatusBarColor);
theme.resolveAttribute(android.R.attr.navigationBarColor, typedValue, true);
int defaultNavigationBarColor = typedValue.data;
window.setNavigationBarColor(defaultNavigationBarColor);
theme.resolveAttribute(android.R.attr.navigationBarColor, typedValue, true);
int defaultNavigationBarColor = typedValue.data;
window.setNavigationBarColor(defaultNavigationBarColor);
}
}
}