Merge pull request #60 from TouchInstinct/feature/invalidate_options_menu
added ability to turn off menu invalidation
This commit is contained in:
commit
45c5898f56
|
|
@ -45,6 +45,8 @@ public class SimpleActionBarDrawerToggle extends ActionBarDrawerToggle
|
|||
@NonNull
|
||||
private final View sidebar;
|
||||
|
||||
private boolean isInvalidateOptionsMenuSupported = true;
|
||||
|
||||
private boolean hamburgerShowed;
|
||||
private boolean sidebarDisabled;
|
||||
|
||||
|
|
@ -207,7 +209,9 @@ public class SimpleActionBarDrawerToggle extends ActionBarDrawerToggle
|
|||
|
||||
@Override
|
||||
public void onDrawerClosed(@NonNull final View view) {
|
||||
activity.supportInvalidateOptionsMenu();
|
||||
if (isInvalidateOptionsMenuSupported) {
|
||||
activity.supportInvalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -222,7 +226,18 @@ public class SimpleActionBarDrawerToggle extends ActionBarDrawerToggle
|
|||
@Override
|
||||
public void onDrawerOpened(@NonNull final View drawerView) {
|
||||
activity.hideSoftInput();
|
||||
activity.supportInvalidateOptionsMenu();
|
||||
if (isInvalidateOptionsMenuSupported) {
|
||||
activity.supportInvalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set turn on/off invocation of supportInvalidateOptionsMenu
|
||||
*
|
||||
* @param isInvalidateOptionsMenuSupported flag for turning on/off invocation.
|
||||
*/
|
||||
public void setInvalidateOptionsMenuSupported(final boolean isInvalidateOptionsMenuSupported) {
|
||||
this.isInvalidateOptionsMenuSupported = isInvalidateOptionsMenuSupported;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue