DecorToolbar.java revision f933672168f6deff5e3636584bec735416b5a93b
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.view.menu.MenuBuilder;
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.view.Window;
30import android.widget.AdapterView;
31import android.widget.SpinnerAdapter;
32
33/**
34 * Common interface for a toolbar that sits as part of the window decor.
35 * Layouts that control window decor use this as a point of interaction with different
36 * bar implementations.
37 *
38 * @hide
39 */
40public interface DecorToolbar {
41    ViewGroup getViewGroup();
42    Context getContext();
43    boolean isSplit();
44    boolean hasExpandedActionView();
45    void collapseActionView();
46    void setWindowCallback(Window.Callback cb);
47    void setWindowTitle(CharSequence title);
48    CharSequence getTitle();
49    void setTitle(CharSequence title);
50    CharSequence getSubtitle();
51    void setSubtitle(CharSequence subtitle);
52    void initProgress();
53    void initIndeterminateProgress();
54    boolean canSplit();
55    void setSplitView(ViewGroup splitView);
56    void setSplitToolbar(boolean split);
57    void setSplitWhenNarrow(boolean splitWhenNarrow);
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    void setNavigationIcon(Drawable icon);
90    void setNavigationIcon(int resId);
91    void setNavigationContentDescription(CharSequence description);
92    void setNavigationContentDescription(int resId);
93    void setDefaultNavigationContentDescription(int defaultNavigationContentDescription);
94    void setDefaultNavigationIcon(Drawable icon);
95    void saveHierarchyState(SparseArray<Parcelable> toolbarStates);
96    void restoreHierarchyState(SparseArray<Parcelable> toolbarStates);
97    void setBackgroundDrawable(Drawable d);
98    int getHeight();
99    void setVisibility(int visible);
100    int getVisibility();
101    void setMenuCallbacks(MenuPresenter.Callback presenterCallback,
102            MenuBuilder.Callback menuBuilderCallback);
103    Menu getMenu();
104    int getPopupTheme();
105}