Search in sources :

Example 1 with ActionBarContainer

use of android.support.v7.internal.widget.ActionBarContainer in project HoloEverywhere by Prototik.

the class ActionBarActivityDelegateBase method ensureSubDecor.

final void ensureSubDecor() {
    if (mHasActionBar && !mSubDecorInstalled) {
        if (mOverlayActionBar) {
            mActivity.superSetContentView(R.layout.abc_action_bar_decor_overlay);
        } else {
            mActivity.superSetContentView(R.layout.abc_action_bar_decor);
        }
        mActionBarView = (ActionBarView) mActivity.findViewById(R.id.action_bar);
        mActionBarView.setWindowCallback(mActivity);
        /**
             * Progress Bars
             */
        if (mFeatureProgress) {
            mActionBarView.initProgress();
        }
        if (mFeatureIndeterminateProgress) {
            mActionBarView.initIndeterminateProgress();
        }
        /**
             * Split Action Bar
             */
        boolean splitWhenNarrow = UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata());
        boolean splitActionBar;
        if (splitWhenNarrow) {
            splitActionBar = mActivity.getResources().getBoolean(R.bool.abc_split_action_bar_is_narrow);
        } else {
            TypedArray a = mActivity.obtainStyledAttributes(R.styleable.ActionBarWindow);
            splitActionBar = a.getBoolean(R.styleable.ActionBarWindow_windowSplitActionBar, false);
            a.recycle();
        }
        final ActionBarContainer splitView = (ActionBarContainer) mActivity.findViewById(R.id.split_action_bar);
        if (splitView != null) {
            mActionBarView.setSplitView(splitView);
            mActionBarView.setSplitActionBar(splitActionBar);
            mActionBarView.setSplitWhenNarrow(splitWhenNarrow);
            final ActionBarContextView cab = (ActionBarContextView) mActivity.findViewById(R.id.action_context_bar);
            cab.setSplitView(splitView);
            cab.setSplitActionBar(splitActionBar);
            cab.setSplitWhenNarrow(splitWhenNarrow);
        }
        mSubDecorInstalled = true;
        supportInvalidateOptionsMenu();
    }
}
Also used : ActionBarContainer(android.support.v7.internal.widget.ActionBarContainer) TypedArray(android.content.res.TypedArray) ActionBarContextView(android.support.v7.internal.widget.ActionBarContextView)

Example 2 with ActionBarContainer

use of android.support.v7.internal.widget.ActionBarContainer in project HoloEverywhere by Prototik.

the class ActionBarImplBase method init.

private void init(ActionBarActivity activity) {
    mOverlayLayout = (ActionBarOverlayLayout) activity.findViewById(R.id.action_bar_overlay_layout);
    if (mOverlayLayout != null) {
        mOverlayLayout.setActionBar(this);
    }
    mActionView = (ActionBarView) activity.findViewById(R.id.action_bar);
    mContextView = (ActionBarContextView) activity.findViewById(R.id.action_context_bar);
    mContainerView = (ActionBarContainer) activity.findViewById(R.id.action_bar_container);
    mTopVisibilityView = (ViewGroup) activity.findViewById(R.id.top_action_bar);
    if (mTopVisibilityView == null) {
        mTopVisibilityView = mContainerView;
    }
    mSplitView = (ActionBarContainer) activity.findViewById(R.id.split_action_bar);
    if (mActionView == null || mContextView == null || mContainerView == null) {
        throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + "with a compatible window decor layout");
    }
    mActionView.setContextView(mContextView);
    mContextDisplayMode = mActionView.isSplitActionBar() ? CONTEXT_DISPLAY_SPLIT : CONTEXT_DISPLAY_NORMAL;
    // This was initially read from the action bar style
    final int current = mActionView.getDisplayOptions();
    final boolean homeAsUp = (current & DISPLAY_HOME_AS_UP) != 0;
    if (homeAsUp) {
        mDisplayHomeAsUpSet = true;
    }
    ActionBarPolicy abp = ActionBarPolicy.get(mContext);
    setHomeButtonEnabled(abp.enableHomeButtonByDefault() || homeAsUp);
    setHasEmbeddedTabs(abp.hasEmbeddedTabs());
    setTitle(mActivity.getTitle());
}
Also used : ActionBarPolicy(android.support.v7.internal.view.ActionBarPolicy)

Aggregations

TypedArray (android.content.res.TypedArray)1 ActionBarPolicy (android.support.v7.internal.view.ActionBarPolicy)1 ActionBarContainer (android.support.v7.internal.widget.ActionBarContainer)1 ActionBarContextView (android.support.v7.internal.widget.ActionBarContextView)1