Methods Summary |
---|
public void | animateToVisibility(int visibility)
if (visibility == View.GONE) {
mToolbar.animate().alpha(0)
.setListener(new AnimatorListenerAdapter() {
private boolean mCanceled = false;
@Override
public void onAnimationEnd(Animator animation) {
if (!mCanceled) {
mToolbar.setVisibility(View.GONE);
}
}
@Override
public void onAnimationCancel(Animator animation) {
mCanceled = true;
}
});
} else if (visibility == View.VISIBLE) {
mToolbar.animate().alpha(1)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mToolbar.setVisibility(View.VISIBLE);
}
});
}
|
public boolean | canShowOverflowMenu()
return mToolbar.canShowOverflowMenu();
|
public boolean | canSplit()
return false;
|
public void | collapseActionView()
mToolbar.collapseActionView();
|
private int | detectDisplayOptions()
int opts = ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME |
ActionBar.DISPLAY_USE_LOGO;
if (mToolbar.getNavigationIcon() != null) {
opts |= ActionBar.DISPLAY_HOME_AS_UP;
mDefaultNavigationIcon = mToolbar.getNavigationIcon();
}
return opts;
|
public void | dismissPopupMenus()
mToolbar.dismissPopupMenus();
|
private void | ensureSpinner()
if (mSpinner == null) {
mSpinner = new Spinner(getContext(), null, R.attr.actionDropDownStyle);
Toolbar.LayoutParams lp = new Toolbar.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL);
mSpinner.setLayoutParams(lp);
}
|
public android.content.Context | getContext()
return mToolbar.getContext();
|
public android.view.View | getCustomView()
return mCustomView;
|
public int | getDisplayOptions()
return mDisplayOpts;
|
public int | getDropdownItemCount()
return mSpinner != null ? mSpinner.getCount() : 0;
|
public int | getDropdownSelectedPosition()
return mSpinner != null ? mSpinner.getSelectedItemPosition() : 0;
|
public int | getHeight()
return mToolbar.getHeight();
|
public android.view.Menu | getMenu()
return mToolbar.getMenu();
|
public int | getNavigationMode()
return mNavigationMode;
|
public java.lang.CharSequence | getSubtitle()
return mToolbar.getSubtitle();
|
public java.lang.CharSequence | getTitle()
return mToolbar.getTitle();
|
public android.view.ViewGroup | getViewGroup()
return mToolbar;
|
public int | getVisibility()
return mToolbar.getVisibility();
|
public boolean | hasEmbeddedTabs()
return mTabView != null;
|
public boolean | hasExpandedActionView()
return mToolbar.hasExpandedActionView();
|
public boolean | hasIcon()
return mIcon != null;
|
public boolean | hasLogo()
return mLogo != null;
|
public boolean | hideOverflowMenu()
return mToolbar.hideOverflowMenu();
|
public void | initIndeterminateProgress()
Log.i(TAG, "Progress display unsupported");
|
public void | initProgress()
Log.i(TAG, "Progress display unsupported");
|
public boolean | isOverflowMenuShowPending()
return mToolbar.isOverflowMenuShowPending();
|
public boolean | isOverflowMenuShowing()
return mToolbar.isOverflowMenuShowing();
|
public boolean | isSplit()
return false;
|
public boolean | isTitleTruncated()
return mToolbar.isTitleTruncated();
|
public void | restoreHierarchyState(android.util.SparseArray toolbarStates)
mToolbar.restoreHierarchyState(toolbarStates);
|
public void | saveHierarchyState(android.util.SparseArray toolbarStates)
mToolbar.saveHierarchyState(toolbarStates);
|
public void | setBackgroundDrawable(android.graphics.drawable.Drawable d)
//noinspection deprecation
mToolbar.setBackgroundDrawable(d);
|
public void | setCollapsible(boolean collapsible)
mToolbar.setCollapsible(collapsible);
|
public void | setCustomView(android.view.View view)
if (mCustomView != null && (mDisplayOpts & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
mToolbar.removeView(mCustomView);
}
mCustomView = view;
if (view != null && (mDisplayOpts & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
mToolbar.addView(mCustomView);
}
|
public void | setDefaultNavigationContentDescription(int defaultNavigationContentDescription)
if (defaultNavigationContentDescription == mDefaultNavigationContentDescription) {
return;
}
mDefaultNavigationContentDescription = defaultNavigationContentDescription;
if (TextUtils.isEmpty(mToolbar.getNavigationContentDescription())) {
setNavigationContentDescription(mDefaultNavigationContentDescription);
}
|
public void | setDefaultNavigationIcon(android.graphics.drawable.Drawable defaultNavigationIcon)
if (mDefaultNavigationIcon != defaultNavigationIcon) {
mDefaultNavigationIcon = defaultNavigationIcon;
updateNavigationIcon();
}
|
public void | setDisplayOptions(int newOpts)
final int oldOpts = mDisplayOpts;
final int changed = oldOpts ^ newOpts;
mDisplayOpts = newOpts;
if (changed != 0) {
if ((changed & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if ((newOpts & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
updateHomeAccessibility();
}
updateNavigationIcon();
}
if ((changed & AFFECTS_LOGO_MASK) != 0) {
updateToolbarLogo();
}
if ((changed & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
if ((newOpts & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
mToolbar.setTitle(mTitle);
mToolbar.setSubtitle(mSubtitle);
} else {
mToolbar.setTitle(null);
mToolbar.setSubtitle(null);
}
}
if ((changed & ActionBar.DISPLAY_SHOW_CUSTOM) != 0 && mCustomView != null) {
if ((newOpts & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
mToolbar.addView(mCustomView);
} else {
mToolbar.removeView(mCustomView);
}
}
}
|
public void | setDropdownParams(android.widget.SpinnerAdapter adapter, AdapterView.OnItemSelectedListener listener)
ensureSpinner();
mSpinner.setAdapter(adapter);
mSpinner.setOnItemSelectedListener(listener);
|
public void | setDropdownSelectedPosition(int position)
if (mSpinner == null) {
throw new IllegalStateException(
"Can't set dropdown selected position without an adapter");
}
mSpinner.setSelection(position);
|
public void | setEmbeddedTabView(ScrollingTabContainerView tabView)
if (mTabView != null && mTabView.getParent() == mToolbar) {
mToolbar.removeView(mTabView);
}
mTabView = tabView;
if (tabView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
mToolbar.addView(mTabView, 0);
Toolbar.LayoutParams lp = (Toolbar.LayoutParams) mTabView.getLayoutParams();
lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.START | Gravity.BOTTOM;
tabView.setAllowCollapse(true);
}
|
public void | setHomeButtonEnabled(boolean enable)
// Ignore
|
public void | setIcon(int resId)
setIcon(resId != 0 ? getContext().getDrawable(resId) : null);
|
public void | setIcon(android.graphics.drawable.Drawable d)
mIcon = d;
updateToolbarLogo();
|
public void | setLogo(int resId)
setLogo(resId != 0 ? getContext().getDrawable(resId) : null);
|
public void | setLogo(android.graphics.drawable.Drawable d)
mLogo = d;
updateToolbarLogo();
|
public void | setMenu(android.view.Menu menu, MenuPresenter.Callback cb)
if (mActionMenuPresenter == null) {
mActionMenuPresenter = new ActionMenuPresenter(mToolbar.getContext());
mActionMenuPresenter.setId(com.android.internal.R.id.action_menu_presenter);
}
mActionMenuPresenter.setCallback(cb);
mToolbar.setMenu((MenuBuilder) menu, mActionMenuPresenter);
|
public void | setMenuCallbacks(MenuPresenter.Callback presenterCallback, MenuBuilder.Callback menuBuilderCallback)
mToolbar.setMenuCallbacks(presenterCallback, menuBuilderCallback);
|
public void | setMenuPrepared()
mMenuPrepared = true;
|
public void | setNavigationContentDescription(java.lang.CharSequence description)
mHomeDescription = description;
updateHomeAccessibility();
|
public void | setNavigationContentDescription(int resId)
setNavigationContentDescription(resId == 0 ? null : getContext().getString(resId));
|
public void | setNavigationIcon(android.graphics.drawable.Drawable icon)
mNavIcon = icon;
updateNavigationIcon();
|
public void | setNavigationIcon(int resId)
setNavigationIcon(resId != 0 ? mToolbar.getContext().getDrawable(resId) : null);
|
public void | setNavigationMode(int mode)
final int oldMode = mNavigationMode;
if (mode != oldMode) {
switch (oldMode) {
case ActionBar.NAVIGATION_MODE_LIST:
if (mSpinner != null && mSpinner.getParent() == mToolbar) {
mToolbar.removeView(mSpinner);
}
break;
case ActionBar.NAVIGATION_MODE_TABS:
if (mTabView != null && mTabView.getParent() == mToolbar) {
mToolbar.removeView(mTabView);
}
break;
}
mNavigationMode = mode;
switch (mode) {
case ActionBar.NAVIGATION_MODE_STANDARD:
break;
case ActionBar.NAVIGATION_MODE_LIST:
ensureSpinner();
mToolbar.addView(mSpinner, 0);
break;
case ActionBar.NAVIGATION_MODE_TABS:
if (mTabView != null) {
mToolbar.addView(mTabView, 0);
Toolbar.LayoutParams lp = (Toolbar.LayoutParams) mTabView.getLayoutParams();
lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.START | Gravity.BOTTOM;
}
break;
default:
throw new IllegalArgumentException("Invalid navigation mode " + mode);
}
}
|
public void | setSplitToolbar(boolean split)
if (split) {
throw new UnsupportedOperationException("Cannot split an android.widget.Toolbar");
}
|
public void | setSplitView(android.view.ViewGroup splitView)
|
public void | setSplitWhenNarrow(boolean splitWhenNarrow)
// Ignore.
|
public void | setSubtitle(java.lang.CharSequence subtitle)
mSubtitle = subtitle;
if ((mDisplayOpts & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
mToolbar.setSubtitle(subtitle);
}
|
public void | setTitle(java.lang.CharSequence title)
mTitleSet = true;
setTitleInt(title);
|
private void | setTitleInt(java.lang.CharSequence title)
mTitle = title;
if ((mDisplayOpts & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
mToolbar.setTitle(title);
}
|
public void | setVisibility(int visible)
mToolbar.setVisibility(visible);
|
public void | setWindowCallback(Window.Callback cb)
mWindowCallback = cb;
|
public void | setWindowTitle(java.lang.CharSequence title)
// "Real" title always trumps window title.
if (!mTitleSet) {
setTitleInt(title);
}
|
public boolean | showOverflowMenu()
return mToolbar.showOverflowMenu();
|
private void | updateHomeAccessibility()
if ((mDisplayOpts & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if (TextUtils.isEmpty(mHomeDescription)) {
mToolbar.setNavigationContentDescription(mDefaultNavigationContentDescription);
} else {
mToolbar.setNavigationContentDescription(mHomeDescription);
}
}
|
private void | updateNavigationIcon()
if ((mDisplayOpts & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
mToolbar.setNavigationIcon(mNavIcon != null ? mNavIcon : mDefaultNavigationIcon);
} else {
mToolbar.setNavigationIcon(null);
}
|
private void | updateToolbarLogo()
Drawable logo = null;
if ((mDisplayOpts & ActionBar.DISPLAY_SHOW_HOME) != 0) {
if ((mDisplayOpts & ActionBar.DISPLAY_USE_LOGO) != 0) {
logo = mLogo != null ? mLogo : mIcon;
} else {
logo = mIcon;
}
}
mToolbar.setLogo(logo);
|