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