Skip to content

Commit

Permalink
fix #4211
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Oct 15, 2024
1 parent c9e7ca1 commit f2eed33
Showing 1 changed file with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowInsetsController;
import android.view.WindowManager;
import android.widget.FrameLayout;

Expand Down Expand Up @@ -142,11 +143,33 @@ public void initStatusBarResources(View parentView) {
window.setNavigationBarColor(PreferenceUtils.getStatusColor(getPrimary()));
} else {
if (getAppTheme().equals(AppTheme.LIGHT)) {
window.setNavigationBarColor(Utils.getColor(this, android.R.color.white));
} else if (getAppTheme().equals(AppTheme.BLACK)) {
window.setNavigationBarColor(Utils.getColor(this, android.R.color.black));
// do nothing: since the default android colors were better than the ones we set.
// setting white led to usability issues too. ref: #4211
} else {
window.setNavigationBarColor(Utils.getColor(this, R.color.holo_dark_background));

if (SDK_INT >= Build.VERSION_CODES.R) {
WindowInsetsController windowInsetController = getWindow().getInsetsController();
if (windowInsetController != null)
windowInsetController.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS,
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS);

if (getAppTheme().equals(AppTheme.BLACK)) {
getWindow().setNavigationBarColor(Utils.getColor(this, android.R.color.black));
} else {
getWindow().setNavigationBarColor(Utils.getColor(this, R.color.holo_dark_background));
}

} else if (SDK_INT >= Build.VERSION_CODES.O) {
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);

if (getAppTheme().equals(AppTheme.BLACK)) {
getWindow().setNavigationBarColor(Utils.getColor(this, android.R.color.black));
} else {
getWindow().setNavigationBarColor(Utils.getColor(this, R.color.holo_dark_background));
}
}

}
}
} else if (SDK_INT == Build.VERSION_CODES.KITKAT_WATCH
Expand Down

0 comments on commit f2eed33

Please sign in to comment.