FileDocCategorySizeDatePackage
WindowDecorActionBar.javaAPI DocAndroid 5.1 API44158Thu Mar 12 22:22:56 GMT 2015android.support.v7.internal.app

WindowDecorActionBar

public class WindowDecorActionBar extends android.support.v7.app.ActionBar implements ActionBarOverlayLayout.ActionBarVisibilityCallback
WindowDecorActionBar is the ActionBar implementation used by devices of all screen sizes as part of the window decor layout. If it detects a compatible decor, it will split contextual modes across both the ActionBarView at the top of the screen and a horizontal LinearLayout at the bottom which is normally hidden.
hide

Fields Summary
private static final String
TAG
private static final boolean
ALLOW_SHOW_HIDE_ANIMATIONS
Only allow show/hide animations on ICS+, as that is what ViewPropertyAnimatorCompat supports
private android.content.Context
mContext
private android.content.Context
mThemedContext
private android.support.v4.app.FragmentActivity
mActivity
private android.app.Dialog
mDialog
private android.support.v7.internal.widget.ActionBarOverlayLayout
mOverlayLayout
private android.support.v7.internal.widget.ActionBarContainer
mContainerView
private android.support.v7.internal.widget.DecorToolbar
mDecorToolbar
private android.support.v7.internal.widget.ActionBarContextView
mContextView
private android.support.v7.internal.widget.ActionBarContainer
mSplitView
private android.view.View
mContentView
private android.support.v7.internal.widget.ScrollingTabContainerView
mTabScrollView
private ArrayList
mTabs
private TabImpl
mSelectedTab
private int
mSavedTabPosition
private boolean
mDisplayHomeAsUpSet
ActionModeImpl
mActionMode
android.support.v7.view.ActionMode
mDeferredDestroyActionMode
ActionMode.Callback
mDeferredModeDestroyCallback
private boolean
mLastMenuVisibility
private ArrayList
mMenuVisibilityListeners
private static final int
CONTEXT_DISPLAY_NORMAL
private static final int
CONTEXT_DISPLAY_SPLIT
private static final int
INVALID_POSITION
private int
mContextDisplayMode
private boolean
mHasEmbeddedTabs
private int
mCurWindowVisibility
private boolean
mContentAnimations
private boolean
mHiddenByApp
private boolean
mHiddenBySystem
private boolean
mShowingForMode
private boolean
mNowShowing
private android.support.v7.internal.view.ViewPropertyAnimatorCompatSet
mCurrentShowAnim
private boolean
mShowHideAnimationEnabled
boolean
mHideOnContentScroll
private android.support.v7.internal.widget.TintManager
mTintManager
final android.support.v4.view.ViewPropertyAnimatorListener
mHideListener
final android.support.v4.view.ViewPropertyAnimatorListener
mShowListener
final android.support.v4.view.ViewPropertyAnimatorUpdateListener
mUpdateListener
Constructors Summary
public WindowDecorActionBar(android.support.v7.app.ActionBarActivity activity, boolean overlayMode)


         
        mActivity = activity;
        Window window = activity.getWindow();
        View decor = window.getDecorView();
        init(decor);
        if (!overlayMode) {
            mContentView = decor.findViewById(android.R.id.content);
        }
    
public WindowDecorActionBar(android.app.Dialog dialog)

        mDialog = dialog;
        init(dialog.getWindow().getDecorView());
    
public WindowDecorActionBar(android.view.View layout)
Only for edit mode.

hide

        assert layout.isInEditMode();
        init(layout);
    
Methods Summary
public voidaddOnMenuVisibilityListener(OnMenuVisibilityListener listener)

        mMenuVisibilityListeners.add(listener);
    
public voidaddTab(Tab tab)

        addTab(tab, mTabs.isEmpty());
    
public voidaddTab(Tab tab, int position)

        addTab(tab, position, mTabs.isEmpty());
    
public voidaddTab(Tab tab, boolean setSelected)

        ensureTabsExist();
        mTabScrollView.addTab(tab, setSelected);
        configureTab(tab, mTabs.size());
        if (setSelected) {
            selectTab(tab);
        }
    
public voidaddTab(Tab tab, int position, boolean setSelected)

        ensureTabsExist();
        mTabScrollView.addTab(tab, position, setSelected);
        configureTab(tab, position);
        if (setSelected) {
            selectTab(tab);
        }
    
public voidanimateToMode(boolean toActionMode)

        if (toActionMode) {
            showForActionMode();
        } else {
            hideForActionMode();
        }

        mDecorToolbar.animateToVisibility(toActionMode ? View.GONE : View.VISIBLE);
        mContextView.animateToVisibility(toActionMode ? View.VISIBLE : View.GONE);
        // mTabScrollView's visibility is not affected by action mode.
    
private static booleancheckShowingFlags(boolean hiddenByApp, boolean hiddenBySystem, boolean showingForMode)

        if (showingForMode) {
            return true;
        } else if (hiddenByApp || hiddenBySystem) {
            return false;
        } else {
            return true;
        }
    
private voidcleanupTabs()

        if (mSelectedTab != null) {
            selectTab(null);
        }
        mTabs.clear();
        if (mTabScrollView != null) {
            mTabScrollView.removeAllTabs();
        }
        mSavedTabPosition = INVALID_POSITION;
    
public booleancollapseActionView()

        if (mDecorToolbar != null && mDecorToolbar.hasExpandedActionView()) {
            mDecorToolbar.collapseActionView();
            return true;
        }
        return false;
    
voidcompleteDeferredDestroyActionMode()

        if (mDeferredModeDestroyCallback != null) {
            mDeferredModeDestroyCallback.onDestroyActionMode(mDeferredDestroyActionMode);
            mDeferredDestroyActionMode = null;
            mDeferredModeDestroyCallback = null;
        }
    
private voidconfigureTab(Tab tab, int position)

        final TabImpl tabi = (TabImpl) tab;
        final ActionBar.TabListener callback = tabi.getCallback();

        if (callback == null) {
            throw new IllegalStateException("Action Bar Tab must have a Callback");
        }

        tabi.setPosition(position);
        mTabs.add(position, tabi);

        final int count = mTabs.size();
        for (int i = position + 1; i < count; i++) {
            mTabs.get(i).setPosition(i);
        }
    
public voiddispatchMenuVisibilityChanged(boolean isVisible)

        if (isVisible == mLastMenuVisibility) {
            return;
        }
        mLastMenuVisibility = isVisible;

        final int count = mMenuVisibilityListeners.size();
        for (int i = 0; i < count; i++) {
            mMenuVisibilityListeners.get(i).onMenuVisibilityChanged(isVisible);
        }
    
public voiddoHide(boolean fromSystem)

        if (mCurrentShowAnim != null) {
            mCurrentShowAnim.cancel();
        }

        if (mCurWindowVisibility == View.VISIBLE && ALLOW_SHOW_HIDE_ANIMATIONS &&
                (mShowHideAnimationEnabled || fromSystem)) {
            ViewCompat.setAlpha(mContainerView, 1f);
            mContainerView.setTransitioning(true);
            ViewPropertyAnimatorCompatSet anim = new ViewPropertyAnimatorCompatSet();
            float endingY = -mContainerView.getHeight();
            if (fromSystem) {
                int topLeft[] = {0, 0};
                mContainerView.getLocationInWindow(topLeft);
                endingY -= topLeft[1];
            }
            ViewPropertyAnimatorCompat a = ViewCompat.animate(mContainerView).translationY(endingY);
            a.setUpdateListener(mUpdateListener);
            anim.play(a);
            if (mContentAnimations && mContentView != null) {
                anim.play(ViewCompat.animate(mContentView).translationY(endingY));
            }
            if (mSplitView != null && mSplitView.getVisibility() == View.VISIBLE) {
                ViewCompat.setAlpha(mSplitView, 1f);
                anim.play(ViewCompat.animate(mSplitView).translationY(mSplitView.getHeight()));
            }
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext,
                    android.R.anim.accelerate_interpolator));
            anim.setDuration(250);
            anim.setListener(mHideListener);
            mCurrentShowAnim = anim;
            anim.start();
        } else {
            mHideListener.onAnimationEnd(null);
        }
    
public voiddoShow(boolean fromSystem)

        if (mCurrentShowAnim != null) {
            mCurrentShowAnim.cancel();
        }
        mContainerView.setVisibility(View.VISIBLE);

        if (mCurWindowVisibility == View.VISIBLE && ALLOW_SHOW_HIDE_ANIMATIONS &&
                (mShowHideAnimationEnabled || fromSystem)) {
            // because we're about to ask its window loc
            ViewCompat.setTranslationY(mContainerView, 0f);
            float startingY = -mContainerView.getHeight();
            if (fromSystem) {
                int topLeft[] = {0, 0};
                mContainerView.getLocationInWindow(topLeft);
                startingY -= topLeft[1];
            }
            ViewCompat.setTranslationY(mContainerView, startingY);
            ViewPropertyAnimatorCompatSet anim = new ViewPropertyAnimatorCompatSet();
            ViewPropertyAnimatorCompat a = ViewCompat.animate(mContainerView).translationY(0f);
            a.setUpdateListener(mUpdateListener);
            anim.play(a);
            if (mContentAnimations && mContentView != null) {
                ViewCompat.setTranslationY(mContentView, startingY);
                anim.play(ViewCompat.animate(mContentView).translationY(0f));
            }
            if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT) {
                ViewCompat.setTranslationY(mSplitView, mSplitView.getHeight());
                mSplitView.setVisibility(View.VISIBLE);
                anim.play(ViewCompat.animate(mSplitView).translationY(0f));
            }
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext,
                    android.R.anim.decelerate_interpolator));
            anim.setDuration(250);
            // If this is being shown from the system, add a small delay.
            // This is because we will also be animating in the status bar,
            // and these two elements can't be done in lock-step.  So we give
            // a little time for the status bar to start its animation before
            // the action bar animates.  (This corresponds to the corresponding
            // case when hiding, where the status bar has a small delay before
            // starting.)
            anim.setListener(mShowListener);
            mCurrentShowAnim = anim;
            anim.start();
        } else {
            ViewCompat.setAlpha(mContainerView, 1f);
            ViewCompat.setTranslationY(mContainerView, 0);
            if (mContentAnimations && mContentView != null) {
                ViewCompat.setTranslationY(mContentView, 0);
            }
            if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT) {
                ViewCompat.setAlpha(mSplitView, 1f);
                ViewCompat.setTranslationY(mSplitView, 0);
                mSplitView.setVisibility(View.VISIBLE);
            }
            mShowListener.onAnimationEnd(null);
        }
        if (mOverlayLayout != null) {
            ViewCompat.requestApplyInsets(mOverlayLayout);
        }
    
public voidenableContentAnimations(boolean enabled)

        mContentAnimations = enabled;
    
private voidensureTabsExist()

        if (mTabScrollView != null) {
            return;
        }

        ScrollingTabContainerView tabScroller = new ScrollingTabContainerView(mContext);

        if (mHasEmbeddedTabs) {
            tabScroller.setVisibility(View.VISIBLE);
            mDecorToolbar.setEmbeddedTabView(tabScroller);
        } else {
            if (getNavigationMode() == NAVIGATION_MODE_TABS) {
                tabScroller.setVisibility(View.VISIBLE);
                if (mOverlayLayout != null) {
                    ViewCompat.requestApplyInsets(mOverlayLayout);
                }
            } else {
                tabScroller.setVisibility(View.GONE);
            }
            mContainerView.setTabContainer(tabScroller);
        }
        mTabScrollView = tabScroller;
    
public android.view.ViewgetCustomView()

        return mDecorToolbar.getCustomView();
    
private android.support.v7.internal.widget.DecorToolbargetDecorToolbar(android.view.View view)

        if (view instanceof DecorToolbar) {
            return (DecorToolbar) view;
        } else if (view instanceof Toolbar) {
            return ((Toolbar) view).getWrapper();
        } else {
            throw new IllegalStateException("Can't make a decor toolbar out of " +
                    view.getClass().getSimpleName());
        }
    
public intgetDisplayOptions()

        return mDecorToolbar.getDisplayOptions();
    
public floatgetElevation()

        return ViewCompat.getElevation(mContainerView);
    
public intgetHeight()

        return mContainerView.getHeight();
    
public intgetHideOffset()

        return mOverlayLayout.getActionBarHideOffset();
    
public intgetNavigationItemCount()

        switch (mDecorToolbar.getNavigationMode()) {
            case NAVIGATION_MODE_TABS:
                return mTabs.size();
            case NAVIGATION_MODE_LIST:
                return mDecorToolbar.getDropdownItemCount();
            default:
                return 0;
        }
    
public intgetNavigationMode()

        return mDecorToolbar.getNavigationMode();
    
public intgetSelectedNavigationIndex()

        switch (mDecorToolbar.getNavigationMode()) {
            case NAVIGATION_MODE_TABS:
                return mSelectedTab != null ? mSelectedTab.getPosition() : -1;
            case NAVIGATION_MODE_LIST:
                return mDecorToolbar.getDropdownSelectedPosition();
            default:
                return -1;
        }
    
public TabgetSelectedTab()

        return mSelectedTab;
    
public java.lang.CharSequencegetSubtitle()

        return mDecorToolbar.getSubtitle();
    
public TabgetTabAt(int index)

        return mTabs.get(index);
    
public intgetTabCount()

        return mTabs.size();
    
public android.content.ContextgetThemedContext()

        if (mThemedContext == null) {
            TypedValue outValue = new TypedValue();
            Resources.Theme currentTheme = mContext.getTheme();
            currentTheme.resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
            final int targetThemeRes = outValue.resourceId;

            if (targetThemeRes != 0) {
                mThemedContext = new ContextThemeWrapper(mContext, targetThemeRes);
            } else {
                mThemedContext = mContext;
            }
        }
        return mThemedContext;
    
android.support.v7.internal.widget.TintManagergetTintManager()

        if (mTintManager == null) {
            mTintManager = new TintManager(mContext);
        }
        return mTintManager;
    
public java.lang.CharSequencegetTitle()

        return mDecorToolbar.getTitle();
    
public booleanhasIcon()

        return mDecorToolbar.hasIcon();
    
public booleanhasLogo()

        return mDecorToolbar.hasLogo();
    
public voidhide()

        if (!mHiddenByApp) {
            mHiddenByApp = true;
            updateVisibility(false);
        }
    
private voidhideForActionMode()

        if (mShowingForMode) {
            mShowingForMode = false;
            if (mOverlayLayout != null) {
                mOverlayLayout.setShowingForActionMode(false);
            }
            updateVisibility(false);
        }
    
public voidhideForSystem()

        if (!mHiddenBySystem) {
            mHiddenBySystem = true;
            updateVisibility(true);
        }
    
private voidinit(android.view.View decor)

        mOverlayLayout = (ActionBarOverlayLayout) decor.findViewById(R.id.decor_content_parent);
        if (mOverlayLayout != null) {
            mOverlayLayout.setActionBarVisibilityCallback(this);
        }
        mDecorToolbar = getDecorToolbar(decor.findViewById(R.id.action_bar));
        mContextView = (ActionBarContextView) decor.findViewById(
                R.id.action_context_bar);
        mContainerView = (ActionBarContainer) decor.findViewById(
                R.id.action_bar_container);

         mSplitView = (ActionBarContainer) decor.findViewById(R.id.split_action_bar);

        if (mDecorToolbar == null || mContextView == null || mContainerView == null) {
            throw new IllegalStateException(getClass().getSimpleName() + " can only be used " +
                    "with a compatible window decor layout");
        }

        mContext = mDecorToolbar.getContext();
        mContextDisplayMode = mDecorToolbar.isSplit() ?
                CONTEXT_DISPLAY_SPLIT : CONTEXT_DISPLAY_NORMAL;

        // This was initially read from the action bar style
        final int current = mDecorToolbar.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());

        final TypedArray a = mContext.obtainStyledAttributes(null,
                R.styleable.ActionBar,
                R.attr.actionBarStyle, 0);
        if (a.getBoolean(R.styleable.ActionBar_hideOnContentScroll, false)) {
            setHideOnContentScrollEnabled(true);
        }
        final int elevation = a.getDimensionPixelSize(R.styleable.ActionBar_elevation, 0);
        if (elevation != 0) {
            setElevation(elevation);
        }
        a.recycle();
    
public booleanisHideOnContentScrollEnabled()

        return mOverlayLayout.isHideOnContentScrollEnabled();
    
public booleanisShowing()

        final int height = getHeight();
        // Take into account the case where the bar has a 0 height due to not being measured yet.
        return mNowShowing && (height == 0 || getHideOffset() < height);
    
public booleanisTitleTruncated()

        return mDecorToolbar != null && mDecorToolbar.isTitleTruncated();
    
public TabnewTab()

        return new TabImpl();
    
public voidonConfigurationChanged(android.content.res.Configuration newConfig)

        setHasEmbeddedTabs(ActionBarPolicy.get(mContext).hasEmbeddedTabs());
    
public voidonContentScrollStarted()

        if (mCurrentShowAnim != null) {
            mCurrentShowAnim.cancel();
            mCurrentShowAnim = null;
        }
    
public voidonContentScrollStopped()

    
public voidonWindowVisibilityChanged(int visibility)

        mCurWindowVisibility = visibility;
    
public voidremoveAllTabs()

        cleanupTabs();
    
public voidremoveOnMenuVisibilityListener(OnMenuVisibilityListener listener)

        mMenuVisibilityListeners.remove(listener);
    
public voidremoveTab(Tab tab)

        removeTabAt(tab.getPosition());
    
public voidremoveTabAt(int position)

        if (mTabScrollView == null) {
            // No tabs around to remove
            return;
        }

        int selectedTabPosition = mSelectedTab != null
                ? mSelectedTab.getPosition() : mSavedTabPosition;
        mTabScrollView.removeTabAt(position);
        TabImpl removedTab = mTabs.remove(position);
        if (removedTab != null) {
            removedTab.setPosition(-1);
        }

        final int newTabCount = mTabs.size();
        for (int i = position; i < newTabCount; i++) {
            mTabs.get(i).setPosition(i);
        }

        if (selectedTabPosition == position) {
            selectTab(mTabs.isEmpty() ? null : mTabs.get(Math.max(0, position - 1)));
        }
    
public voidselectTab(Tab tab)

        if (getNavigationMode() != NAVIGATION_MODE_TABS) {
            mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
            return;
        }

        final FragmentTransaction trans = mDecorToolbar.getViewGroup().isInEditMode() ? null :
                mActivity.getSupportFragmentManager().beginTransaction().disallowAddToBackStack();

        if (mSelectedTab == tab) {
            if (mSelectedTab != null) {
                mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
                mTabScrollView.animateToTab(tab.getPosition());
            }
        } else {
            mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
            if (mSelectedTab != null) {
                mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
            }
            mSelectedTab = (TabImpl) tab;
            if (mSelectedTab != null) {
                mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
            }
        }

        if (trans != null && !trans.isEmpty()) {
            trans.commit();
        }
    
public voidsetBackgroundDrawable(android.graphics.drawable.Drawable d)

        mContainerView.setPrimaryBackground(d);
    
public voidsetCustomView(int resId)

        setCustomView(LayoutInflater.from(getThemedContext()).inflate(resId,
                mDecorToolbar.getViewGroup(), false));
    
public voidsetCustomView(android.view.View view)

        mDecorToolbar.setCustomView(view);
    
public voidsetCustomView(android.view.View view, LayoutParams layoutParams)

        view.setLayoutParams(layoutParams);
        mDecorToolbar.setCustomView(view);
    
public voidsetDefaultDisplayHomeAsUpEnabled(boolean enable)

        if (!mDisplayHomeAsUpSet) {
            setDisplayHomeAsUpEnabled(enable);
        }
    
public voidsetDisplayHomeAsUpEnabled(boolean showHomeAsUp)

        setDisplayOptions(showHomeAsUp ? DISPLAY_HOME_AS_UP : 0, DISPLAY_HOME_AS_UP);
    
public voidsetDisplayOptions(int options)

        if ((options & DISPLAY_HOME_AS_UP) != 0) {
            mDisplayHomeAsUpSet = true;
        }
        mDecorToolbar.setDisplayOptions(options);
    
public voidsetDisplayOptions(int options, int mask)

        final int current = mDecorToolbar.getDisplayOptions();
        if ((mask & DISPLAY_HOME_AS_UP) != 0) {
            mDisplayHomeAsUpSet = true;
        }
        mDecorToolbar.setDisplayOptions((options & mask) | (current & ~mask));
    
public voidsetDisplayShowCustomEnabled(boolean showCustom)

        setDisplayOptions(showCustom ? DISPLAY_SHOW_CUSTOM : 0, DISPLAY_SHOW_CUSTOM);
    
public voidsetDisplayShowHomeEnabled(boolean showHome)

        setDisplayOptions(showHome ? DISPLAY_SHOW_HOME : 0, DISPLAY_SHOW_HOME);
    
public voidsetDisplayShowTitleEnabled(boolean showTitle)

        setDisplayOptions(showTitle ? DISPLAY_SHOW_TITLE : 0, DISPLAY_SHOW_TITLE);
    
public voidsetDisplayUseLogoEnabled(boolean useLogo)

        setDisplayOptions(useLogo ? DISPLAY_USE_LOGO : 0, DISPLAY_USE_LOGO);
    
public voidsetElevation(float elevation)

        ViewCompat.setElevation(mContainerView, elevation);
        if (mSplitView != null) {
            ViewCompat.setElevation(mSplitView, elevation);
        }
    
private voidsetHasEmbeddedTabs(boolean hasEmbeddedTabs)

        mHasEmbeddedTabs = hasEmbeddedTabs;
        // Switch tab layout configuration if needed
        if (!mHasEmbeddedTabs) {
            mDecorToolbar.setEmbeddedTabView(null);
            mContainerView.setTabContainer(mTabScrollView);
        } else {
            mContainerView.setTabContainer(null);
            mDecorToolbar.setEmbeddedTabView(mTabScrollView);
        }
        final boolean isInTabMode = getNavigationMode() == NAVIGATION_MODE_TABS;
        if (mTabScrollView != null) {
            if (isInTabMode) {
                mTabScrollView.setVisibility(View.VISIBLE);
                if (mOverlayLayout != null) {
                    ViewCompat.requestApplyInsets(mOverlayLayout);
                }
            } else {
                mTabScrollView.setVisibility(View.GONE);
            }
        }
        mDecorToolbar.setCollapsible(!mHasEmbeddedTabs && isInTabMode);
        mOverlayLayout.setHasNonEmbeddedTabs(!mHasEmbeddedTabs && isInTabMode);
    
public voidsetHideOffset(int offset)

        if (offset != 0 && !mOverlayLayout.isInOverlayMode()) {
            throw new IllegalStateException("Action bar must be in overlay mode " +
                    "(Window.FEATURE_OVERLAY_ACTION_BAR) to set a non-zero hide offset");
        }
        mOverlayLayout.setActionBarHideOffset(offset);
    
public voidsetHideOnContentScrollEnabled(boolean hideOnContentScroll)

        if (hideOnContentScroll && !mOverlayLayout.isInOverlayMode()) {
            throw new IllegalStateException("Action bar must be in overlay mode " +
                    "(Window.FEATURE_OVERLAY_ACTION_BAR) to enable hide on content scroll");
        }
        mHideOnContentScroll = hideOnContentScroll;
        mOverlayLayout.setHideOnContentScrollEnabled(hideOnContentScroll);
    
public voidsetHomeActionContentDescription(java.lang.CharSequence description)

        mDecorToolbar.setNavigationContentDescription(description);
    
public voidsetHomeActionContentDescription(int resId)

        mDecorToolbar.setNavigationContentDescription(resId);
    
public voidsetHomeAsUpIndicator(android.graphics.drawable.Drawable indicator)

        mDecorToolbar.setNavigationIcon(indicator);
    
public voidsetHomeAsUpIndicator(int resId)

        mDecorToolbar.setNavigationIcon(resId);
    
public voidsetHomeButtonEnabled(boolean enable)

        mDecorToolbar.setHomeButtonEnabled(enable);
    
public voidsetIcon(int resId)

        mDecorToolbar.setIcon(resId);
    
public voidsetIcon(android.graphics.drawable.Drawable icon)

        mDecorToolbar.setIcon(icon);
    
public voidsetListNavigationCallbacks(android.widget.SpinnerAdapter adapter, OnNavigationListener callback)

        mDecorToolbar.setDropdownParams(adapter, new NavItemSelectedListener(callback));
    
public voidsetLogo(int resId)

        mDecorToolbar.setLogo(resId);
    
public voidsetLogo(android.graphics.drawable.Drawable logo)

        mDecorToolbar.setLogo(logo);
    
public voidsetNavigationMode(int mode)

        final int oldMode = mDecorToolbar.getNavigationMode();
        switch (oldMode) {
            case NAVIGATION_MODE_TABS:
                mSavedTabPosition = getSelectedNavigationIndex();
                selectTab(null);
                mTabScrollView.setVisibility(View.GONE);
                break;
        }
        if (oldMode != mode && !mHasEmbeddedTabs) {
            if (mOverlayLayout != null) {
                ViewCompat.requestApplyInsets(mOverlayLayout);
            }
        }
        mDecorToolbar.setNavigationMode(mode);
        switch (mode) {
            case NAVIGATION_MODE_TABS:
                ensureTabsExist();
                mTabScrollView.setVisibility(View.VISIBLE);
                if (mSavedTabPosition != INVALID_POSITION) {
                    setSelectedNavigationItem(mSavedTabPosition);
                    mSavedTabPosition = INVALID_POSITION;
                }
                break;
        }
        mDecorToolbar.setCollapsible(mode == NAVIGATION_MODE_TABS && !mHasEmbeddedTabs);
        mOverlayLayout.setHasNonEmbeddedTabs(mode == NAVIGATION_MODE_TABS && !mHasEmbeddedTabs);
    
public voidsetSelectedNavigationItem(int position)

        switch (mDecorToolbar.getNavigationMode()) {
            case NAVIGATION_MODE_TABS:
                selectTab(mTabs.get(position));
                break;
            case NAVIGATION_MODE_LIST:
                mDecorToolbar.setDropdownSelectedPosition(position);
                break;
            default:
                throw new IllegalStateException(
                        "setSelectedNavigationIndex not valid for current navigation mode");
        }
    
public voidsetShowHideAnimationEnabled(boolean enabled)
Enables or disables animation between show/hide states. If animation is disabled using this method, animations in progress will be finished.

param
enabled true to animate, false to not animate.

        mShowHideAnimationEnabled = enabled;
        if (!enabled && mCurrentShowAnim != null) {
            mCurrentShowAnim.cancel();
        }
    
public voidsetSplitBackgroundDrawable(android.graphics.drawable.Drawable d)

        if (mSplitView != null) {
            mSplitView.setSplitBackground(d);
        }
    
public voidsetStackedBackgroundDrawable(android.graphics.drawable.Drawable d)

        mContainerView.setStackedBackground(d);
    
public voidsetSubtitle(int resId)

        setSubtitle(mContext.getString(resId));
    
public voidsetSubtitle(java.lang.CharSequence subtitle)

        mDecorToolbar.setSubtitle(subtitle);
    
public voidsetTitle(int resId)

        setTitle(mContext.getString(resId));
    
public voidsetTitle(java.lang.CharSequence title)

        mDecorToolbar.setTitle(title);
    
public voidsetWindowTitle(java.lang.CharSequence title)

        mDecorToolbar.setWindowTitle(title);
    
public voidshow()

        if (mHiddenByApp) {
            mHiddenByApp = false;
            updateVisibility(false);
        }
    
private voidshowForActionMode()

        if (!mShowingForMode) {
            mShowingForMode = true;
            if (mOverlayLayout != null) {
                mOverlayLayout.setShowingForActionMode(true);
            }
            updateVisibility(false);
        }
    
public voidshowForSystem()

        if (mHiddenBySystem) {
            mHiddenBySystem = false;
            updateVisibility(true);
        }
    
public android.support.v7.view.ActionModestartActionMode(ActionMode.Callback callback)

        if (mActionMode != null) {
            mActionMode.finish();
        }

        mOverlayLayout.setHideOnContentScrollEnabled(false);
        mContextView.killMode();
        ActionModeImpl mode = new ActionModeImpl(mContextView.getContext(), callback);
        if (mode.dispatchOnCreate()) {
            mode.invalidate();
            mContextView.initForMode(mode);
            animateToMode(true);
            if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT) {
                // TODO animate this
                if (mSplitView.getVisibility() != View.VISIBLE) {
                    mSplitView.setVisibility(View.VISIBLE);
                    if (mOverlayLayout != null) {
                        ViewCompat.requestApplyInsets(mOverlayLayout);
                    }
                }
            }
            mContextView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
            mActionMode = mode;
            return mode;
        }
        return null;
    
private voidupdateVisibility(boolean fromSystem)

        // Based on the current state, should we be hidden or shown?
        final boolean shown = checkShowingFlags(mHiddenByApp, mHiddenBySystem,
                mShowingForMode);

        if (shown) {
            if (!mNowShowing) {
                mNowShowing = true;
                doShow(fromSystem);
            }
        } else {
            if (mNowShowing) {
                mNowShowing = false;
                doHide(fromSystem);
            }
        }