Fixed multi pane menu

pull/147/head
M66B 6 years ago
parent ad6711ccb1
commit 617c2cc18e

@ -118,13 +118,22 @@ public class FragmentEx extends Fragment {
super.onDestroy(); super.onDestroy();
} }
@Override
public void setHasOptionsMenu(boolean hasMenu) {
super.setHasOptionsMenu(!isPane() && hasMenu);
}
private void updateSubtitle() { private void updateSubtitle() {
AppCompatActivity activity = (AppCompatActivity) getActivity(); AppCompatActivity activity = (AppCompatActivity) getActivity();
Bundle args = getArguments(); if (activity != null && !isPane()) {
if (activity != null && (args == null || !args.getBoolean("pane"))) {
ActionBar actionbar = activity.getSupportActionBar(); ActionBar actionbar = activity.getSupportActionBar();
if (actionbar != null) if (actionbar != null)
actionbar.setSubtitle(subtitle); actionbar.setSubtitle(subtitle);
} }
} }
private boolean isPane() {
Bundle args = getArguments();
return (args != null && args.getBoolean("pane"));
}
} }

Loading…
Cancel
Save