Search in sources :

Example 1 with ActionBarPolicy

use of android.support.v7.internal.view.ActionBarPolicy in project HoloEverywhere by Prototik.

the class ScrollingTabContainerView method onConfigurationChanged.

protected void onConfigurationChanged(Configuration newConfig) {
    ActionBarPolicy abp = ActionBarPolicy.get(getContext());
    // Action bar can change size on configuration changes.
    // Reread the desired height from the theme-specified style.
    setContentHeight(abp.getTabContainerHeight());
    mStackedTabMaxWidth = abp.getStackedTabMaxWidth();
}
Also used : ActionBarPolicy(android.support.v7.internal.view.ActionBarPolicy)

Example 2 with ActionBarPolicy

use of android.support.v7.internal.view.ActionBarPolicy 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)

Example 3 with ActionBarPolicy

use of android.support.v7.internal.view.ActionBarPolicy in project HoloEverywhere by Prototik.

the class ActionMenuPresenter method initForMenu.

@Override
public void initForMenu(Context context, MenuBuilder menu) {
    super.initForMenu(context, menu);
    final Resources res = context.getResources();
    final ActionBarPolicy abp = ActionBarPolicy.get(context);
    if (!mReserveOverflowSet) {
        mReserveOverflow = abp.showsOverflowMenuButton();
    }
    if (!mWidthLimitSet) {
        mWidthLimit = abp.getEmbeddedMenuWidthLimit();
    }
    // Measure for initial configuration
    if (!mMaxItemsSet) {
        mMaxItems = abp.getMaxActionButtons();
    }
    int width = mWidthLimit;
    if (mReserveOverflow) {
        if (mOverflowButton == null) {
            mOverflowButton = new OverflowMenuButton(mSystemContext);
            final int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
            mOverflowButton.measure(spec, spec);
        }
        width -= mOverflowButton.getMeasuredWidth();
    } else {
        mOverflowButton = null;
    }
    mActionItemWidthLimit = width;
    mMinCellSize = (int) (ActionMenuView.MIN_CELL_SIZE * res.getDisplayMetrics().density);
    // Drop a scrap view as it may no longer reflect the proper context/config.
    mScrapActionButtonView = null;
}
Also used : ActionBarPolicy(android.support.v7.internal.view.ActionBarPolicy) Resources(android.content.res.Resources)

Aggregations

ActionBarPolicy (android.support.v7.internal.view.ActionBarPolicy)3 Resources (android.content.res.Resources)1