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