Example usage for android.content.pm ActivityInfo UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW

List of usage examples for android.content.pm ActivityInfo UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW

Introduction

In this page you can find the example usage for android.content.pm ActivityInfo UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.

Prototype

int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW

To view the source code for android.content.pm ActivityInfo UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.

Click Source Link

Document

Flag for use with #uiOptions .

Usage

From source file:de.vanita5.twittnuker.activity.support.HomeActivity.java

private void setUiOptions(final Window window) {
    if (FlymeUtils.hasSmartBar()) {
        if (mBottomComposeButton) {
            window.setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
        } else {/*from  w  w  w.  j  a  v  a  2  s.  c  om*/
            window.setUiOptions(0);
        }
    }
}

From source file:com.android.settings.HWSettings.java

@Override
public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes, int shortTitleRes) {
    Intent intent = super.onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes);

    // Some fragments want split ActionBar; these should stay in sync with
    // uiOptions for fragments also defined as activities in manifest.
    if (WifiSettings.class.getName().equals(fragmentName)
            || WifiP2pSettings.class.getName().equals(fragmentName)
            || BluetoothSettings.class.getName().equals(fragmentName)
            || DreamSettings.class.getName().equals(fragmentName)
            || LocationSettings.class.getName().equals(fragmentName)
            || ToggleAccessibilityServicePreferenceFragment.class.getName().equals(fragmentName)
            || PrintSettingsFragment.class.getName().equals(fragmentName)
            || PrintServiceSettingsFragment.class.getName().equals(fragmentName)) {
        intent.putExtra(EXTRA_UI_OPTIONS, ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
    }/*from  ww  w. ja v a  2 s . c o  m*/

    if ((mActionBar.getSelectedTab().getPosition() == TAB_INDEX_NETWORKS)
            && DisplaySettings.class.getName().equals(fragmentName)) {
        intent.putExtra("onlyforfontsettings", true);
    }

    intent.setClass(this, SubSettings.class);

    return intent;
}

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

private void installDecor() {
    if (DEBUG)/*from   w w  w.j av a2s. c o  m*/
        Log.d(TAG, "[installDecor]");

    if (mDecor == null) {
        mDecor = (ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
    }
    if (mContentParent == null) {
        //Since we are not operating at the window level we need to take
        //into account the fact that the true decor may have already been
        //initialized and had content attached to it. If that is the case,
        //copy over its children to our new content container.
        List<View> views = null;
        if (mDecor.getChildCount() > 0) {
            views = new ArrayList<View>(1); //Usually there's only one child
            for (int i = 0, children = mDecor.getChildCount(); i < children; i++) {
                View child = mDecor.getChildAt(0);
                mDecor.removeView(child);
                views.add(child);
            }
        }

        mContentParent = generateLayout();

        //Copy over the old children. See above for explanation.
        if (views != null) {
            for (View child : views) {
                mContentParent.addView(child);
            }
        }

        mTitleView = (TextView) mDecor.findViewById(android.R.id.title);
        if (mTitleView != null) {
            if (hasFeature(Window.FEATURE_NO_TITLE)) {
                mTitleView.setVisibility(View.GONE);
                if (mContentParent instanceof FrameLayout) {
                    ((FrameLayout) mContentParent).setForeground(null);
                }
            } else {
                mTitleView.setText(mTitle);
            }
        } else {
            wActionBar = (ActionBarView) mDecor.findViewById(R.id.abs__action_bar);
            if (wActionBar != null) {
                wActionBar.setWindowCallback(this);
                if (wActionBar.getTitle() == null) {
                    wActionBar.setWindowTitle(mActivity.getTitle());
                }
                if (hasFeature(Window.FEATURE_PROGRESS)) {
                    wActionBar.initProgress();
                }
                if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
                    wActionBar.initIndeterminateProgress();
                }

                //Since we don't require onCreate dispatching, parse for uiOptions here
                int uiOptions = loadUiOptionsFromManifest(mActivity);
                if (uiOptions != 0) {
                    mUiOptions = uiOptions;
                }

                boolean splitActionBar = false;
                final boolean splitWhenNarrow = (mUiOptions
                        & ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) != 0;
                if (splitWhenNarrow) {
                    splitActionBar = getResources_getBoolean(mActivity, R.bool.abs__split_action_bar_is_narrow);
                } else {
                    splitActionBar = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme)
                            .getBoolean(R.styleable.SherlockTheme_windowSplitActionBar, false);
                }
                final ActionBarContainer splitView = (ActionBarContainer) mDecor
                        .findViewById(R.id.abs__split_action_bar);
                if (splitView != null) {
                    wActionBar.setSplitView(splitView);
                    wActionBar.setSplitActionBar(splitActionBar);
                    wActionBar.setSplitWhenNarrow(splitWhenNarrow);

                    mActionModeView = (ActionBarContextView) mDecor.findViewById(R.id.abs__action_context_bar);
                    mActionModeView.setSplitView(splitView);
                    mActionModeView.setSplitActionBar(splitActionBar);
                    mActionModeView.setSplitWhenNarrow(splitWhenNarrow);
                } else if (splitActionBar) {
                    Log.e(TAG, "Requested split action bar with incompatible window decor! Ignoring request.");
                }

                // Post the panel invalidate for later; avoid application onCreateOptionsMenu
                // being called in the middle of onCreate or similar.
                mDecor.post(new Runnable() {
                    @Override
                    public void run() {
                        //Invalidate if the panel menu hasn't been created before this.
                        if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
                            dispatchInvalidateOptionsMenu();
                        }
                    }
                });
            }
        }
    }
}