Java Code Examples for com.actionbarsherlock.view.Menu#hasVisibleItems()

The following examples show how to use com.actionbarsherlock.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: Watson.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        boolean result = onPrepareOptionsMenu(menu);
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);

        boolean show = false;
        if (mFragments.mAdded != null) {
            for (int i = 0; i < mFragments.mAdded.size(); i++) {
                Fragment f = mFragments.mAdded.get(i);
                if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
                    show = true;
                    ((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
                }
            }
        }

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
        result |= show;

        result &= menu.hasVisibleItems();
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
        return result;
    }
    return false;
}
 
Example 2
Source File: _ActionBarSherlockTrojanHorse.java    From android-apps with MIT License 5 votes vote down vote up
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        boolean result = onPrepareOptionsMenu(menu);
        if (DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);

        boolean show = false;
        if (mFragments.mActive != null) {
            for (int i = 0; i < mFragments.mAdded.size(); i++) {
                Fragment f = mFragments.mAdded.get(i);
                if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
                    show = true;
                    ((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
                }
            }
        }

        if (DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
        result |= show;

        result &= menu.hasVisibleItems();
        if (DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
        return result;
    }
    return false;
}
 
Example 3
Source File: Watson.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        boolean result = onPrepareOptionsMenu(menu);
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);

        boolean show = false;
        if (mFragments.mAdded != null) {
            for (int i = 0; i < mFragments.mAdded.size(); i++) {
                Fragment f = mFragments.mAdded.get(i);
                if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
                    show = true;
                    ((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
                }
            }
        }

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
        result |= show;

        result &= menu.hasVisibleItems();
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
        return result;
    }
    return false;
}
 
Example 4
Source File: Watson.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        boolean result = onPrepareOptionsMenu(menu);
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);

        boolean show = false;
        if (mFragments.mAdded != null) {
            for (int i = 0; i < mFragments.mAdded.size(); i++) {
                Fragment f = mFragments.mAdded.get(i);
                if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
                    show = true;
                    ((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
                }
            }
        }

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
        result |= show;

        result &= menu.hasVisibleItems();
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
        return result;
    }
    return false;
}
 
Example 5
Source File: Watson.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        boolean result = onPrepareOptionsMenu(menu);
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);

        boolean show = false;
        if (mFragments.mAdded != null) {
            for (int i = 0; i < mFragments.mAdded.size(); i++) {
                Fragment f = mFragments.mAdded.get(i);
                if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
                    show = true;
                    ((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
                }
            }
        }

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
        result |= show;

        result &= menu.hasVisibleItems();
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
        return result;
    }
    return false;
}