public static void setSystemBarVisible(final Activity context,
boolean visible) {
int flag = context.getWindow().getDecorView().getSystemUiVisibility();
// int fullScreen = View.SYSTEM_UI_FLAG_SHOW_FULLSCREEN;
int fullScreen = 0x8;
if (visible) {
if ((flag & fullScreen) != 0) {
context.getWindow().getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
} else {
if ((flag & fullScreen) == 0) {
context.getWindow().getDecorView()
.setSystemUiVisibility(flag | fullScreen);
}
}
}