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