Java Code Examples for android.view.Menu#setGroupEnabled()

The following examples show how to use android.view.Menu#setGroupEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Helper.java    From FairEmail with GNU General Public License v3.0 6 votes vote down vote up
static void setViewsEnabled(ViewGroup view, boolean enabled) {
    for (int i = 0; i < view.getChildCount(); i++) {
        View child = view.getChildAt(i);
        if (child instanceof Spinner ||
                child instanceof EditText ||
                child instanceof CheckBox ||
                child instanceof ImageView /* =ImageButton */ ||
                child instanceof RadioButton ||
                (child instanceof Button && "disable".equals(child.getTag())))
            child.setEnabled(enabled);
        else if (child instanceof BottomNavigationView) {
            Menu menu = ((BottomNavigationView) child).getMenu();
            menu.setGroupEnabled(0, enabled);
        } else if (child instanceof RecyclerView)
            ; // do nothing
        else if (child instanceof ViewGroup)
            setViewsEnabled((ViewGroup) child, enabled);
    }
}
 
Example 2
Source File: AbstractDrawerActivity.java    From barterli_android with Apache License 2.0 4 votes vote down vote up
private void setOptionsGroupHidden(final Menu menu, final boolean drawerOpen) {

        menu.setGroupEnabled(R.id.group_hide_on_drawer_open, !drawerOpen);
        menu.setGroupVisible(R.id.group_hide_on_drawer_open, !drawerOpen);
    }
 
Example 3
Source File: MenuActivity.java    From PTVGlass with MIT License 4 votes vote down vote up
/**
 * Sets all menu items visible and enabled state that are in the given group.
 */
private static void setOptionsMenuGroupState(Menu menu, int groupId, boolean enabled) {
    menu.setGroupVisible(groupId, enabled);
    menu.setGroupEnabled(groupId, enabled);
}
 
Example 4
Source File: MenuActivity.java    From gdk-timer-sample with Apache License 2.0 4 votes vote down vote up
/**
 * Sets all menu items visible and enabled state that are in the given group.
 */
private static void setOptionsMenuGroupState(Menu menu, int groupId, boolean enabled) {
    menu.setGroupVisible(groupId, enabled);
    menu.setGroupEnabled(groupId, enabled);
}