skydoves / PowerMenu

:fire: Powerful and modernized popup menu with fully customizable animations.
Apache License 2.0
1.19k stars 175 forks source link

Add setBackgroundSystemUiVisibility in builders support #56

Closed ssaqua closed 5 years ago

ssaqua commented 5 years ago

Types of changes

👋 Addresses issue #53 by adding support for custom system UI visibility flags for the background view.

The default is View.SYSTEM_UI_FLAG_VISIBLE with value: 0

If users of this library use custom visibility flags on their views, they can fix it by passing the same flags down to PowerMenu.

For example:

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  int visibility = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                 | View.SYSTEM_UI_FLAG_FULLSCREEN
                 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                 | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
  getWindow().getDecorView().setSystemUiVisibility(visibility);
  setContentView(R.layout.activity_main);

  new PowerMenu.Builder(this)
    ...
    .setBackgroundSystemUiVisibility(getWindow().getDecorView().getSystemUiVisibility())
    ...
    .build();
}