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