1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 18 package com.android.internal.widget; 19 20 import android.animation.Animator; 21 import android.content.Context; 22 import android.graphics.drawable.Drawable; 23 import android.os.Parcelable; 24 import android.util.SparseArray; 25 import android.view.Menu; 26 import android.view.View; 27 import android.view.ViewGroup; 28 import android.view.Window; 29 import android.widget.AdapterView; 30 import android.widget.SpinnerAdapter; 31 32 import com.android.internal.view.menu.MenuBuilder; 33 import com.android.internal.view.menu.MenuPresenter; 34 35 /** 36 * Common interface for a toolbar that sits as part of the window decor. 37 * Layouts that control window decor use this as a point of interaction with different 38 * bar implementations. 39 * 40 * @hide 41 */ 42 public interface DecorToolbar { getViewGroup()43 ViewGroup getViewGroup(); getContext()44 Context getContext(); isSplit()45 boolean isSplit(); hasExpandedActionView()46 boolean hasExpandedActionView(); collapseActionView()47 void collapseActionView(); setWindowCallback(Window.Callback cb)48 void setWindowCallback(Window.Callback cb); setWindowTitle(CharSequence title)49 void setWindowTitle(CharSequence title); getTitle()50 CharSequence getTitle(); setTitle(CharSequence title)51 void setTitle(CharSequence title); getSubtitle()52 CharSequence getSubtitle(); setSubtitle(CharSequence subtitle)53 void setSubtitle(CharSequence subtitle); initProgress()54 void initProgress(); initIndeterminateProgress()55 void initIndeterminateProgress(); canSplit()56 boolean canSplit(); setSplitView(ViewGroup splitView)57 void setSplitView(ViewGroup splitView); setSplitToolbar(boolean split)58 void setSplitToolbar(boolean split); setSplitWhenNarrow(boolean splitWhenNarrow)59 void setSplitWhenNarrow(boolean splitWhenNarrow); hasIcon()60 boolean hasIcon(); hasLogo()61 boolean hasLogo(); setIcon(int resId)62 void setIcon(int resId); setIcon(Drawable d)63 void setIcon(Drawable d); setLogo(int resId)64 void setLogo(int resId); setLogo(Drawable d)65 void setLogo(Drawable d); canShowOverflowMenu()66 boolean canShowOverflowMenu(); isOverflowMenuShowing()67 boolean isOverflowMenuShowing(); isOverflowMenuShowPending()68 boolean isOverflowMenuShowPending(); showOverflowMenu()69 boolean showOverflowMenu(); hideOverflowMenu()70 boolean hideOverflowMenu(); setMenuPrepared()71 void setMenuPrepared(); setMenu(Menu menu, MenuPresenter.Callback cb)72 void setMenu(Menu menu, MenuPresenter.Callback cb); dismissPopupMenus()73 void dismissPopupMenus(); 74 getDisplayOptions()75 int getDisplayOptions(); setDisplayOptions(int opts)76 void setDisplayOptions(int opts); setEmbeddedTabView(ScrollingTabContainerView tabView)77 void setEmbeddedTabView(ScrollingTabContainerView tabView); hasEmbeddedTabs()78 boolean hasEmbeddedTabs(); isTitleTruncated()79 boolean isTitleTruncated(); setCollapsible(boolean collapsible)80 void setCollapsible(boolean collapsible); setHomeButtonEnabled(boolean enable)81 void setHomeButtonEnabled(boolean enable); getNavigationMode()82 int getNavigationMode(); setNavigationMode(int mode)83 void setNavigationMode(int mode); setDropdownParams(SpinnerAdapter adapter, AdapterView.OnItemSelectedListener listener)84 void setDropdownParams(SpinnerAdapter adapter, AdapterView.OnItemSelectedListener listener); setDropdownSelectedPosition(int position)85 void setDropdownSelectedPosition(int position); getDropdownSelectedPosition()86 int getDropdownSelectedPosition(); getDropdownItemCount()87 int getDropdownItemCount(); setCustomView(View view)88 void setCustomView(View view); getCustomView()89 View getCustomView(); animateToVisibility(int visibility)90 void animateToVisibility(int visibility); setupAnimatorToVisibility(int visibility, long duration)91 Animator setupAnimatorToVisibility(int visibility, long duration); setNavigationIcon(Drawable icon)92 void setNavigationIcon(Drawable icon); setNavigationIcon(int resId)93 void setNavigationIcon(int resId); setNavigationContentDescription(CharSequence description)94 void setNavigationContentDescription(CharSequence description); setNavigationContentDescription(int resId)95 void setNavigationContentDescription(int resId); setDefaultNavigationContentDescription(int defaultNavigationContentDescription)96 void setDefaultNavigationContentDescription(int defaultNavigationContentDescription); setDefaultNavigationIcon(Drawable icon)97 void setDefaultNavigationIcon(Drawable icon); saveHierarchyState(SparseArray<Parcelable> toolbarStates)98 void saveHierarchyState(SparseArray<Parcelable> toolbarStates); restoreHierarchyState(SparseArray<Parcelable> toolbarStates)99 void restoreHierarchyState(SparseArray<Parcelable> toolbarStates); setBackgroundDrawable(Drawable d)100 void setBackgroundDrawable(Drawable d); getHeight()101 int getHeight(); setVisibility(int visible)102 void setVisibility(int visible); getVisibility()103 int getVisibility(); setMenuCallbacks(MenuPresenter.Callback presenterCallback, MenuBuilder.Callback menuBuilderCallback)104 void setMenuCallbacks(MenuPresenter.Callback presenterCallback, 105 MenuBuilder.Callback menuBuilderCallback); getMenu()106 Menu getMenu(); 107 } 108