DecorToolbar.java revision b3813e08451b31c599f47ebaf14c9467043cedbc
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 18package android.support.v7.internal.widget; 19 20import android.content.Context; 21import android.graphics.drawable.Drawable; 22import android.os.Parcelable; 23import android.support.v7.internal.app.WindowCallback; 24import android.support.v7.internal.view.menu.MenuPresenter; 25import android.util.SparseArray; 26import android.view.Menu; 27import android.view.View; 28import android.view.ViewGroup; 29import android.widget.SpinnerAdapter; 30 31/** 32 * Common interface for a toolbar that sits as part of the window decor. 33 * Layouts that control window decor use this as a point of interaction with different 34 * bar implementations. 35 * 36 * @hide 37 */ 38public interface DecorToolbar { 39 ViewGroup getViewGroup(); 40 Context getContext(); 41 boolean isSplit(); 42 boolean hasExpandedActionView(); 43 void collapseActionView(); 44 void setWindowCallback(WindowCallback cb); 45 void setWindowTitle(CharSequence title); 46 CharSequence getTitle(); 47 void setTitle(CharSequence title); 48 CharSequence getSubtitle(); 49 void setSubtitle(CharSequence subtitle); 50 void initProgress(); 51 void initIndeterminateProgress(); 52 boolean canSplit(); 53 void setSplitView(ViewGroup splitView); 54 void setSplitToolbar(boolean split); 55 void setSplitWhenNarrow(boolean splitWhenNarrow); 56 boolean hasIcon(); 57 boolean hasLogo(); 58 void setIcon(int resId); 59 void setIcon(Drawable d); 60 void setLogo(int resId); 61 void setLogo(Drawable d); 62 boolean canShowOverflowMenu(); 63 boolean isOverflowMenuShowing(); 64 boolean isOverflowMenuShowPending(); 65 boolean showOverflowMenu(); 66 boolean hideOverflowMenu(); 67 void setMenuPrepared(); 68 void setMenu(Menu menu, MenuPresenter.Callback cb); 69 void dismissPopupMenus(); 70 71 int getDisplayOptions(); 72 void setDisplayOptions(int opts); 73 void setEmbeddedTabView(ScrollingTabContainerView tabView); 74 boolean hasEmbeddedTabs(); 75 boolean isTitleTruncated(); 76 void setCollapsible(boolean collapsible); 77 void setHomeButtonEnabled(boolean enable); 78 int getNavigationMode(); 79 void setNavigationMode(int mode); 80 void setDropdownParams(SpinnerAdapter adapter, AdapterViewCompat.OnItemSelectedListener listener); 81 void setDropdownSelectedPosition(int position); 82 int getDropdownSelectedPosition(); 83 int getDropdownItemCount(); 84 void setCustomView(View view); 85 View getCustomView(); 86 void animateToVisibility(int visibility); 87 void setNavigationIcon(Drawable icon); 88 void setNavigationIcon(int resId); 89 void setNavigationContentDescription(CharSequence description); 90 void setNavigationContentDescription(int resId); 91 void setDefaultNavigationContentDescription(int defaultNavigationContentDescription); 92 void saveHierarchyState(SparseArray<Parcelable> toolbarStates); 93 void restoreHierarchyState(SparseArray<Parcelable> toolbarStates); 94}