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

The following examples show how to use android.view.Menu#hasVisibleItems() . 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: FormRecordListActivity.java    From commcare-android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    MenuItem quarantine = menu.findItem(MENU_SUBMIT_QUARANTINE_REPORT);
    if (quarantine != null) {
        quarantine.setVisible(FormRecordFilter.Limbo.equals(adapter.getFilter()));
    }

    MenuItem downloadFormsFromServer = menu.findItem(DOWNLOAD_FORMS_FROM_SERVER);
    if (downloadFormsFromServer != null) {
        downloadFormsFromServer.setVisible(!FormRecordFilter.Incomplete.equals(adapter.getFilter()));
    }

    MenuItem downloadFormsFromFile = menu.findItem(DOWNLOAD_FORMS_FROM_FILE);
    if (downloadFormsFromFile != null) {
        downloadFormsFromFile.setVisible(!FormRecordFilter.Incomplete.equals(adapter.getFilter()));
    }

    return menu.hasVisibleItems();
}
 
Example 2
Source File: Dialog.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * @see Activity#onPreparePanel(int, View, Menu)
 */
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (featureId == Window.FEATURE_OPTIONS_PANEL && menu != null) {
        return onPrepareOptionsMenu(menu) && menu.hasVisibleItems();
    }
    return true;
}
 
Example 3
Source File: Dialog.java    From PreferenceFragment with Apache License 2.0 5 votes vote down vote up
/**
 * @see Activity#onPreparePanel(int, View, Menu)
 */
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (featureId == Window.FEATURE_OPTIONS_PANEL && menu != null) {
        boolean goforit = onPrepareOptionsMenu(menu);
        return goforit && menu.hasVisibleItems();
    }
    return true;
}