Skip to content

Instantly share code, notes, and snippets.

@SammyVimes
Last active September 28, 2016 15:55
Show Gist options
  • Save SammyVimes/9c120e1c1c9d6d838449f196089b5587 to your computer and use it in GitHub Desktop.
Save SammyVimes/9c120e1c1c9d6d838449f196089b5587 to your computer and use it in GitHub Desktop.
ффф
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
// логика
}
private void toggleFullscreen(final boolean fullscreen) {
getSupportActionBar().hide();
if (fullscreen) {
if (Build.VERSION.SDK_INT >= 19) {
this.getWindow().getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
} else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
} else {
if (Build.VERSION.SDK_INT >= 19) {
this.getWindow().getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment