public static void setNavBarForeground(boolean light, Activity activity, View view){
try {
if (!light) {//make buttons dark to be more visible
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
WindowInsetsController windowInsetController = activity.getWindow().getInsetsController();
if (windowInsetController != null)
windowInsetController.setSystemBarsAppearance(WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS, WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
} else { //make buttons light to be more visible
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
WindowInsetsController windowInsetController = activity.getWindow().getInsetsController();
if (windowInsetController != null)
windowInsetController.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
view.setSystemUiVisibility(0);
}
}
}
catch (Exception e){
Logger.log(e);
}
}