Example usage for android.view Window FEATURE_OPTIONS_PANEL

List of usage examples for android.view Window FEATURE_OPTIONS_PANEL

Introduction

In this page you can find the example usage for android.view Window FEATURE_OPTIONS_PANEL.

Prototype

int FEATURE_OPTIONS_PANEL

To view the source code for android.view Window FEATURE_OPTIONS_PANEL.

Click Source Link

Document

Flag for the "options panel" feature.

Usage

From source file:com.egoclean.testpregnancy.util.ActivityHelper.java

public void onPostCreate(Bundle savedInstanceState) {
    // Create the action bar
    SimpleMenu menu = new SimpleMenu(mActivity);
    mActivity.onCreatePanelMenu(Window.FEATURE_OPTIONS_PANEL, menu);
    // TODO: call onPreparePanelMenu here as well
    for (int i = 0; i < menu.size(); i++) {
        MenuItem item = menu.getItem(i);
        addActionButtonCompatFromMenuItem(item);
    }/*  w  w  w .j a v a2s . com*/
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockNative.java

@Override
public void dispatchInvalidateOptionsMenu() {
    if (DEBUG)//from w  w  w .  java  2  s  .  c  o  m
        Log.d(TAG, "[dispatchInvalidateOptionsMenu]");

    mActivity.getWindow().invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);
}

From source file:android.support.v4.app._ActionBarSherlockTrojanHorse.java

@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
    if (DEBUG)/*from  ww  w  .ja va  2s. c o m*/
        Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);

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

        MenuInflater inflater = getSupportMenuInflater();
        boolean show = false;
        ArrayList<Fragment> newMenus = null;
        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 OnCreateOptionsMenuListener) {
                    show = true;
                    ((OnCreateOptionsMenuListener) f).onCreateOptionsMenu(menu, inflater);
                    if (newMenus == null) {
                        newMenus = new ArrayList<Fragment>();
                    }
                    newMenus.add(f);
                }
            }
        }

        if (mCreatedMenus != null) {
            for (int i = 0; i < mCreatedMenus.size(); i++) {
                Fragment f = mCreatedMenus.get(i);
                if (newMenus == null || !newMenus.contains(f)) {
                    f.onDestroyOptionsMenu();
                }
            }
        }

        mCreatedMenus = newMenus;

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

        if (DEBUG)
            Log.d(TAG, "[onCreatePanelMenu] returning " + result);
        return result;
    }
    return false;
}

From source file:android.support.v7.app.ActionBarActivity.java

@Override
public View onCreatePanelView(int featureId) {
    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        return mImpl.onCreatePanelView(featureId);
    } else {// w w w  .j  ava  2  s.co  m
        return super.onCreatePanelView(featureId);
    }
}

From source file:lewa.support.v7.app.ActionBarActivity.java

@Override
public View onCreatePanelView(int featureId) {
    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        return getDelegate().onCreatePanelView(featureId);
    } else {//from w  w  w  . j  a  v a2 s  . com
        return super.onCreatePanelView(featureId);
    }
}

From source file:android.support.v4.app._ActionBarSherlockTrojanHorse.java

@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (DEBUG)// w ww. j a  va 2s .co  m
        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;
}

From source file:android.support.v7.app.ActionBarActivityDelegateICS.java

@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_OPTIONS_PANEL || featureId == Window.FEATURE_ACTION_BAR) {
        if (mMenu == null) {
            mMenu = MenuWrapperFactory.createMenuWrapper(menu);
        }//  w w w . ja  v a 2 s  .  c om
        return mActivity.superOnCreatePanelMenu(featureId, mMenu);
    }
    return mActivity.superOnCreatePanelMenu(featureId, menu);
}

From source file:com.android.browser.BrowserActivity.java

@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (Window.FEATURE_OPTIONS_PANEL == featureId) {
        mController.onMenuOpened(featureId, menu);
    }//  ww  w. ja v a 2  s. com
    return true;
}

From source file:android.support.v7.app.ActionBarActivityDelegateICS.java

@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (featureId == Window.FEATURE_OPTIONS_PANEL || featureId == Window.FEATURE_ACTION_BAR) {
        return mActivity.superOnPreparePanel(featureId, view, mMenu);
    }// w  ww.java2 s  .  c o m
    return mActivity.superOnPreparePanel(featureId, view, menu);
}

From source file:com.actionbarsherlock.app.SherlockFragmentActivity.java

@Override
public final boolean onCreatePanelMenu(int featureId, android.view.Menu menu) {
    if (DEBUG)/*from  w w  w  .  j a v a2s. c o m*/
        Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeCreate) {
        mIgnoreNativeCreate = true;
        boolean result = getSherlock().dispatchCreateOptionsMenu(menu);
        mIgnoreNativeCreate = false;

        if (DEBUG)
            Log.d(TAG, "[onCreatePanelMenu] returning " + result);
        return result;
    }
    return super.onCreatePanelMenu(featureId, menu);
}