ActionBar.java revision 0dbe090bba314e72d65d5404c9fb15b7550a698d
1bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/* 2bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Copyright (C) 2012 The Android Open Source Project 3bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 4bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * you may not use this file except in compliance with the License. 6bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * You may obtain a copy of the License at 7bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 8bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * http://www.apache.org/licenses/LICENSE-2.0 9bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 10bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Unless required by applicable law or agreed to in writing, software 11bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * See the License for the specific language governing permissions and 14bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * limitations under the License. 15bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 16bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 17da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownpackage android.support.v7.app; 18bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 198e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikasimport static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP; 208e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas 21bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.content.Context; 2249c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.content.res.Configuration; 23bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.content.res.TypedArray; 24bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.graphics.drawable.Drawable; 2549c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.support.annotation.DrawableRes; 2649c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.support.annotation.IntDef; 2713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banesimport android.support.annotation.NonNull; 28b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbyeimport android.support.annotation.Nullable; 29c39d9c75590eca86a5e7e32a8824ba04a0d42e9bAlan Viveretteimport android.support.annotation.RestrictTo; 30b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbyeimport android.support.annotation.StringRes; 31b79bd8bd1afdf165068ddafdc5fa0667f7ec4a70Jeff Brownimport android.support.v4.app.Fragment; 32da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownimport android.support.v4.app.FragmentTransaction; 3349c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.support.v4.view.GravityCompat; 34da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownimport android.support.v7.appcompat.R; 3513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banesimport android.support.v7.view.ActionMode; 36bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.util.AttributeSet; 37bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.Gravity; 3813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banesimport android.view.KeyEvent; 39bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.View; 40bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.ViewGroup; 41bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.Window; 42bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.widget.SpinnerAdapter; 43bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 4449c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.lang.annotation.Retention; 4549c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.lang.annotation.RetentionPolicy; 4649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 47bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/** 4813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A primary toolbar within the activity that may display the activity title, application-level 4913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation affordances, and other interactive items. 5020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 51d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>The action bar appears at the top of an activity's window when the activity uses the 52d25af35061a9f20d59b25329d613c62c20184dadChris Banes * AppCompat's {@link R.style#Theme_AppCompat AppCompat} theme (or one of its descendant themes). 5313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * You may otherwise add the action bar by calling {@link 54d25af35061a9f20d59b25329d613c62c20184dadChris Banes * AppCompatDelegate#requestWindowFeature(int) requestFeature(FEATURE_SUPPORT_ACTION_BAR)} or by 55a777694569b333a4459606db6bc94a9e80fd25f3Chris Banes * declaring it in a custom theme with the 56a777694569b333a4459606db6bc94a9e80fd25f3Chris Banes * {@link R.styleable#AppCompatTheme_windowActionBar windowActionBar} property.</p> 579dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 58d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>The action bar may be represented by any Toolbar widget within the application layout. 59d25af35061a9f20d59b25329d613c62c20184dadChris Banes * The application may signal to the Activity which Toolbar should be treated as the Activity's 60d25af35061a9f20d59b25329d613c62c20184dadChris Banes * action bar. Activities that use this feature should use one of the supplied 61d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <code>.NoActionBar</code> themes, set the 62a777694569b333a4459606db6bc94a9e80fd25f3Chris Banes * {@link R.styleable#AppCompatTheme_windowActionBar windowActionBar} attribute to 63a777694569b333a4459606db6bc94a9e80fd25f3Chris Banes * <code>false</code> or otherwise not request the window feature.</p> 6420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 65d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>If your activity has an options menu, you can make select items accessible directly from the 66d25af35061a9f20d59b25329d613c62c20184dadChris Banes * action bar as "action items". You can also modify various characteristics of the action bar or 67d25af35061a9f20d59b25329d613c62c20184dadChris Banes * remove it completely.</p> 6813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 69d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>The navigation button (formerly "Home") takes over the space previously occupied by the 70d25af35061a9f20d59b25329d613c62c20184dadChris Banes * application icon. Apps wishing to express a stronger branding should use their brand colors 71d25af35061a9f20d59b25329d613c62c20184dadChris Banes * heavily in the action bar and other application chrome or use a {@link #setLogo(int) logo} 7213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in place of their standard title text.</p> 7313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 74bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 75d25af35061a9f20d59b25329d613c62c20184dadChris Banes * AppCompatActivity#getSupportActionBar()} getSupportActionBar()}.</p> 7620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 77bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 78d25af35061a9f20d59b25329d613c62c20184dadChris Banes * using an {@link ActionMode}. For example, when the user selects one or more items in 7913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * your activity, you can enable an action mode that offers actions specific to the selected 8013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 81d25af35061a9f20d59b25329d613c62c20184dadChris Banes * same space, the {@link ActionMode} APIs are distinct and independent from those for 8213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link ActionBar}.</p> 8320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 84bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <div class="special reference"> 85bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <h3>Developer Guides</h3> 86bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>For information about how to use the action bar, including how to add action items, navigation 87bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 8813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Bar</a> developer guide.</p> 89bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * </div> 90bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 91bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellpublic abstract class ActionBar { 9220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 93b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye /** @hide */ 948e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 95b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Retention(RetentionPolicy.SOURCE) 9613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 9713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public @interface NavigationMode {} 98b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye 99bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 10013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Standard navigation mode. Consists of either a logo or icon 10113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and title text with an optional subtitle. Clicking any of these elements 10213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will dispatch onOptionsItemSelected to the host Activity with 10313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a MenuItem with item ID android.R.id.home. 10413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 10513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 10613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 10713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 10813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 109bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 110d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 111bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 112bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 113bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 11413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * List navigation mode. Instead of static title text this mode 11513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * presents a list menu for navigation within the activity. 11613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * e.g. this might be presented to the user as a dropdown list. 11713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 11813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 11913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 12013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 12113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 122bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 123d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 124bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_LIST = 1; 125bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 126bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 12713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Tab navigation mode. Instead of static title text this mode 12813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * presents a series of tabs for navigation within the activity. 12913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 13013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 13113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 13213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 13313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 134bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 135d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 136bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 137bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 138b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye /** @hide */ 1398e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 140b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @IntDef(flag=true, value={ 141b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_USE_LOGO, 142b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_HOME, 143b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_HOME_AS_UP, 144b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_TITLE, 145b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_CUSTOM 146b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye }) 147b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Retention(RetentionPolicy.SOURCE) 14813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public @interface DisplayOptions {} 149b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye 150bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 15113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Use logo instead of icon if available. This flag will cause appropriate 15213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation modes to use a wider logo in place of the standard icon. 153bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 154bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 156bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 157bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 158bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 159bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 16013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Show 'home' elements in this action bar, leaving more space for other 16113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation elements. This includes logo and icon. 162bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 163bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 164bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 165bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 166bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 167bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 168bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 16913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Display the 'home' element such that it appears as an 'up' affordance. 17013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * e.g. show an arrow to the left indicating the action that will be taken. 171bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 17213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set this flag if selecting the 'home' button in the action bar to return 17313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * up by a single level in your UI rather than back to the top level or front page. 174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 17513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Setting this option will implicitly enable interaction with the home/up 17613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * button. See {@link #setHomeButtonEnabled(boolean)}. 177bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 178bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 179bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 180bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the activity title and subtitle, if present. 185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 188bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 189bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 191bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 192bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 193bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the custom view if one has been set. 19720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 198bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setCustomView(View) 199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 200bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 201bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 202bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 203bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 204bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 20513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 20613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 207bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 20813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Custom navigation views appear between the application icon and 20913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 21013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 21113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 212bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes. 213bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom navigation view to place in the ActionBar. 215bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 216bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view); 217bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 218bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 21913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 22013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 221bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Custom navigation views appear between the application icon and 22313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 22413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 22513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 226bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 227bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 22913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the custom view to be displayed.</p> 230bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 23113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param view Custom navigation view to place in the ActionBar. 232bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutParams How this custom view should layout in the bar. 23313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 234bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 235bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 236bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 238bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 23913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 24013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 241bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Custom navigation views appear between the application icon and 24313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 24413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 24513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 246bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 24913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the custom view to be displayed.</p> 250bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 251bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 25213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 253bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 254bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 25513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setCustomView(int resId); 256bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 257bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 25813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the icon to display in the 'home' section of the action bar. 25913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use an icon specified by its style or the 26013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity icon by default. 261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 26213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 26313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 264bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as an icon. 26613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 267bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 268bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 269bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 270b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setIcon(@DrawableRes int resId); 271bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 272bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 27313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the icon to display in the 'home' section of the action bar. 27413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use an icon specified by its style or the 27513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity icon by default. 276bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 27713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 27813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 279bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 280bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon Drawable to show as an icon. 28113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 282bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 283bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 284bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 285bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setIcon(Drawable icon); 286bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 287bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 28813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the logo to display in the 'home' section of the action bar. 28913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use a logo specified by its style or the 29013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity logo by default. 291bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 29213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 29313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 294bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as a logo. 29613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 297bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 298bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 299bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 300b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setLogo(@DrawableRes int resId); 301bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 302bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 30313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the logo to display in the 'home' section of the action bar. 30413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use a logo specified by its style or the 30513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity logo by default. 306bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 30713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 30813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 309bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 310bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param logo Drawable to show as a logo. 31113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 312bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 314bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 315bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setLogo(Drawable logo); 316bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 317bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 318bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the adapter and navigation callback for list navigation mode. 319bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The supplied adapter will provide views for the expanded list as well as 32113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the currently selected item. (These may be displayed differently.) 322bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The supplied OnNavigationListener will alert the application when the user 32413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * changes the current list selection. 325bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param adapter An adapter that will provide views both to display 32713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the current navigation selection and populate views 32813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * within the dropdown navigation menu. 32913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param callback An OnNavigationListener that will receive events when the user 33013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * selects a navigation item. 33113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 33213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 33313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 33413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 33513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 336bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 337d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 338bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 339bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell OnNavigationListener callback); 340bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 341bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 342bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the selected navigation item in list or tabbed navigation modes. 343bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 344bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the item to select. 34513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 34613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 34713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 34813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 34913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 351d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 352bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSelectedNavigationItem(int position); 353bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 354bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 355bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 356bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 357bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Position of the selected item. 35813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 35913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 36013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 36113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 36213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 363bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 364d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getSelectedNavigationIndex(); 366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 367bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 368bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the number of navigation items present in the current navigation mode. 369bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 370bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Number of navigation items. 37113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 37213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 37313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 37413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 37513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 376bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 377d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 378bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationItemCount(); 379bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 380bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 38113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's title. This will only be displayed if 38213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 383bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 384bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param title Title to set 38513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 386bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 387bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 388bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 389bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setTitle(CharSequence title); 390bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 391bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 39213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's title. This will only be displayed if 39313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 394bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 395bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of title string to set 39613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 397bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 398bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 399bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 400b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setTitle(@StringRes int resId); 401bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 402bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 40313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's subtitle. This will only be displayed if 40413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 40513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * subtitle entirely. 406bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 407bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param subtitle Subtitle to set 40813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 409bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 410bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 411bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 41213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setSubtitle(CharSequence subtitle); 413bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 414bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 41513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's subtitle. This will only be displayed if 41613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 417bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 418bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of subtitle string to set 41913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 420bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 421bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 422bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 42313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setSubtitle(int resId); 424bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 425bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 42613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set display options. This changes all display option bits at once. To change 42713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 428bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 42913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param options A combination of the bits defined by the DISPLAY_ constants 43013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * defined in ActionBar. 431bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 432b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 433bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 434bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 43513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set selected display options. Only the options specified by mask will be changed. 43613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 437bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 43813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 43913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_HOME} option. 44013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 44113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 442bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 44313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param options A combination of the bits defined by the DISPLAY_ constants 44413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * defined in ActionBar. 44513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param mask A bit mask declaring which display options should be changed. 446bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 44713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 448bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 449bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 45013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether to display the activity logo rather than the activity icon. 45113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A logo is often a wider, more detailed image. 452bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 453bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 454bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 455bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 45613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 457bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 458bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 459bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 460bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 461bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 462bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 46313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether to include the application home affordance in the action bar. 46413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Home is presented as either an activity icon or logo. 465bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 466bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 467bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 468bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showHome true to show home, false otherwise. 46913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 470bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 471bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 472bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 473bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 474bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 475bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 47613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether home should be displayed as an "up" affordance. 47713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set this to true if selecting "home" returns up by a single level in your UI 47813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * rather than back to the top level or front page. 479bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 480bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 481bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 48213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param showHomeAsUp true to show the user that selecting home will return one 48313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * level up rather than to the top level of the app. 48413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 485bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 486bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 487bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 488bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 489bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 490bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 491bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether an activity title/subtitle should be displayed. 492bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 493bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 494bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 495bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showTitle true to display a title/subtitle if present. 496bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 497bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 498bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 499bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 500bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 501bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 502bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether a custom view should be displayed, if set. 503bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 504bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 505bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 50613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param showCustom true if the currently set custom view should be displayed, false otherwise. 50713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 508bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 509bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 510bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 511bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 512bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 513bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 51413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's background. This will be used for the primary 51513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * action bar. 516bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 517bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable 518bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 519bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 520bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 52113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setBackgroundDrawable(@Nullable Drawable d); 522bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 523bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 52413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's stacked background. This will appear 52513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in the second row/stacked bar on some devices and configurations. 526bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 527bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the stacked row 528bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 52913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setStackedBackgroundDrawable(Drawable d) { } 530bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 531bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 53213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's split background. This will appear in 53313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the split action bar containing menu-provided action buttons 53413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * on some devices and configurations. 535bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 536bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 537bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the split bar 538bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 53913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setSplitBackgroundDrawable(Drawable d) { } 540bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 541bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 542bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current custom view. 543bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 544bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 545bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 546bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 54713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the current ActionBar title in standard mode. 54813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns null if {@link #getNavigationMode()} would not return 54913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #NAVIGATION_MODE_STANDARD}. 550bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 551bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar title or null. 552bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 553b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 554bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getTitle(); 555bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 556bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 55713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the current ActionBar subtitle in standard mode. 55813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns null if {@link #getNavigationMode()} would not return 55913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #NAVIGATION_MODE_STANDARD}. 560bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 561bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar subtitle or null. 562bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 563b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 564bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getSubtitle(); 565bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 566bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 567bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the current navigation mode. The result will be one of: 56813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <ul> 56913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 570bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 57113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <li>{@link #NAVIGATION_MODE_TABS}</li> 57213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </ul> 573bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 574bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current navigation mode. 57513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 57613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 57713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 57813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 57913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 580bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 581d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 582b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @NavigationMode 583bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationMode(); 584bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 585bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 586bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the current navigation mode. 587bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 588bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param mode The new mode to set. 589bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_STANDARD 590bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_LIST 591bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_TABS 59213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 59313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 59413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 59513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 59613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 597bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 598d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 599b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 600bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 601bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 602bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current set of display options. 603bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 604b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @DisplayOptions 605bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getDisplayOptions(); 606bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 607bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 60813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Create and return a new {@link Tab}. 60913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This tab will not be included in the action bar until it is added. 610bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 611bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A new Tab 61213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 613bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #addTab(Tab) 61413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 61513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 61613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 61713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 61813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 619bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 620d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 621bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab newTab(); 622bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 623bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 62413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 62513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If this is the first tab to be added it will become the selected tab. 626bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 627bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to add 62813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 62913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 63013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 63113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 63213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 633bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 634d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 635bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab); 636bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 637bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 638bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 639bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 64013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab Tab to add 641bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 64213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 64313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 64413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 64513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 64613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 647bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 648d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 649bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, boolean setSelected); 650bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 651bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 652bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 65313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <code>position</code>. If this is the first tab to be added it will become 65413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the selected tab. 655bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 65613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab The tab to add 657bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position The new position of the tab 65813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 65913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 66013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 66113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 66213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 663bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 664d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 665bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position); 666bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 667bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 668c9a859537b0871f84afeeb706a5b425fe3f2b4ddAurimas Liutikas * Add a tab for use in tabbed navigation mode. The tab will be inserted at 669bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <code>position</code>. 670bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 67113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab The tab to add 67213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param position The new position of the tab 673bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 67413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 67513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 67613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 67713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 67813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 679bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 680d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 681bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 682bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 683bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 68413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a tab from the action bar. If the removed tab was selected it will be deselected 68513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and another tab will be selected if present. 686bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 687bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab to remove 68813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 68913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 69013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 69113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 69213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 693bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 694d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 695bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTab(Tab tab); 696bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 697bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 69813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a tab from the action bar. If the removed tab was selected it will be deselected 69913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and another tab will be selected if present. 700bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 701bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the tab to remove 70213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 70313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 70413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 70513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 70613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 707bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 708d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 709bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTabAt(int position); 710bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 711bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 712bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Remove all tabs from the action bar and deselect the current tab. 71313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 71413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 71513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 71613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 71713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 718bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 719d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 720bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeAllTabs(); 721bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 722bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 723bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 724bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 725bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 726bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 727bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to select 72813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 72913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 73013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 73113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 73213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 733bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 734d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 735bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void selectTab(Tab tab); 736bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 737bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 73813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the currently selected tab if in tabbed navigation mode and there is at least 73913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * one tab present. 740bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 741bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The currently selected tab or null 74213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 74313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 74413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 74513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 74613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 747bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 748d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 749b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 750bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getSelectedTab(); 751bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 752bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 753bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the tab at the specified index. 754bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 755bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param index Index value in the range 0-get 75613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return 75713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 75813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 75913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 76013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 76113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 762bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 763d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 764bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getTabAt(int index); 765bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 766bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 767bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the number of tabs currently registered with the action bar. 76820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 769bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Tab count 77013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 77113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 77213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 77313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 77413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 775bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 776d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 777bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getTabCount(); 778bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 779bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 780bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve the current height of the ActionBar. 781bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 782bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The ActionBar's height 783bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 784bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getHeight(); 785bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 786bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 78713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Show the ActionBar if it is not currently showing. 78813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If the window hosting the ActionBar does not have the feature 78913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 790bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * content to fit the new space available. 791bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 79213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>If you are hiding the ActionBar through 79313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 79413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * you should not call this function directly. 795bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 796bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void show(); 797bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 798bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 79913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Hide the ActionBar if it is currently showing. 80013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If the window hosting the ActionBar does not have the feature 80113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 80213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * content to fit the new space available. 803bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 80413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Instead of calling this function directly, you can also cause an 80513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * ActionBar using the overlay feature to hide through 80613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 80713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Hiding the ActionBar through this system UI flag allows you to more 80813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * seamlessly hide it in conjunction with other screen decorations. 809bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 810bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void hide(); 811bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 812bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 813bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 814bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 815bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract boolean isShowing(); 816bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 817bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 818bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a listener that will respond to menu visibility change events. 819bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 820bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener The new listener to add 821bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 822bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 823bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 824bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 82513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a menu visibility listener. This listener will no longer receive menu 82613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * visibility change events. 827bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 828bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener A listener to remove that was previously added 829bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 830bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 831bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 832bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 83313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Enable or disable the "home" button in the corner of the action bar. (Note that this 834c9a859537b0871f84afeeb706a5b425fe3f2b4ddAurimas Liutikas * is the application home/up affordance on the action bar, not the system wide home 83513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * button.) 836bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 83713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>This defaults to true for packages targeting < API 14. For packages targeting 83813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * API 14 or greater, the application should call this method to enable interaction 83913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * with the home/up affordance. 840bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 84113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 84213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the home button. 843bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 844bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param enabled true to enable the home button, false to disable the home button. 845bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 84613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHomeButtonEnabled(boolean enabled) { } 847bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 848bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 84913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns a {@link Context} with an appropriate theme for creating views that 85013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will appear in the action bar. If you are inflating or instantiating custom views 85113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * that will appear in an action bar, you should use the Context returned by this method. 85213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * (This includes adapters used for list navigation mode.) 85313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This will ensure that views contrast properly against the action bar. 854bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 855bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A themed Context for creating views 856bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 85720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public Context getThemedContext() { 85820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns return null; 85920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 860bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 861bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 86213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns true if the Title field has been truncated during layout for lack 86313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * of available space. 86413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 86513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return true if the Title field has been truncated 86613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @hide pending API approval 86713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 8688e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 86913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean isTitleTruncated() { return false; } 87013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 87113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 872f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 873f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 874f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 875f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 876f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>null</code> to this method, the default drawable from the theme 877f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 878f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 879f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 880f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 881f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 882f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 883f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param indicator A drawable to use for the up indicator, or null to use the theme's default 884f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 885f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 886f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 887f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 888f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 889b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeAsUpIndicator(@Nullable Drawable indicator) {} 890f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 891f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 892f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 893f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 894f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 895f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 896f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>0</code> to this method, the default drawable from the theme 897f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 898f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 899f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 900f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 901f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 902f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 9030dbe090bba314e72d65d5404c9fb15b7550a698dAndrei Stingaceanu * @param resId Resource ID of a drawable to use for the up indicator, or null 904f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to use the theme's default 905f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 906f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 907f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 908f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 909f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 910b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeAsUpIndicator(@DrawableRes int resId) {} 911f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 912f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 913f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 914f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 915f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 916f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 917f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 918f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 919f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 920f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 921f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 922f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 923f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>null</code> will use the system default description.</p> 924f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 925f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param description New description for the Home action when enabled 926f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 927f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 928f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 929b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeActionContentDescription(@Nullable CharSequence description) {} 930f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 931f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 932f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 933f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 934f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 935f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 936f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 937f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 938f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 939f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 940f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 941f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 942f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>0</code> will use the system default description.</p> 943f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 944f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param resId Resource ID of a string to use as the new description 945f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * for the Home action when enabled 946f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 947f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 948f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 949b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeActionContentDescription(@StringRes int resId) {} 950f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 951f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 95213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Enable hiding the action bar on content scroll. 95313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 95413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>If enabled, the action bar will scroll out of sight along with a 955e9fa476efa74bbcf2b10f82ba23ace88a4cd1e38Ben Murdoch * {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content. 95613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode} 95713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * to enable hiding on content scroll.</p> 95813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 95913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>When partially scrolled off screen the action bar is considered 96013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view. 96113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </p> 96213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param hideOnContentScroll true to enable hiding on content scroll. 96313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 96413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) { 96513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes if (hideOnContentScroll) { 96613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes throw new UnsupportedOperationException("Hide on content scroll is not supported in " + 96713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes "this action bar configuration."); 96813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 96913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 97013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 97113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 97213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Return whether the action bar is configured to scroll out of sight along with 97313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}. 9749dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 97513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return true if hide-on-content-scroll is enabled 97613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @see #setHideOnContentScrollEnabled(boolean) 977bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 97813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean isHideOnContentScrollEnabled() { 97913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 98013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 98113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 98213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 98313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Return the current vertical offset of the action bar. 98413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 98513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The action bar's current hide offset is the distance that the action bar is currently 98613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 98713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * current measured {@link #getHeight() height} (fully invisible).</p> 98813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 98913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return The action bar's offset toward its fully hidden state in pixels 99013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 99113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public int getHideOffset() { 99213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return 0; 99313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 99413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 99513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 99613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the current hide offset of the action bar. 99713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 99813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The action bar's current hide offset is the distance that the action bar is currently 99913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 100013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * current measured {@link #getHeight() height} (fully invisible).</p> 100113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 100213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param offset The action bar's offset toward its fully hidden state in pixels. 100313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 100413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHideOffset(int offset) { 100513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes if (offset != 0) { 100613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes throw new UnsupportedOperationException("Setting an explicit action bar hide offset " + 100713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes "is not supported in this action bar configuration."); 100813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 100913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 101013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 101149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 101249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Set the Z-axis elevation of the action bar in pixels. 101349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 101449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 101549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * values are closer to the user.</p> 101649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 101749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param elevation Elevation value in pixels 101849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 101949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setElevation(float elevation) { 102049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes if (elevation != 0) { 102149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes throw new UnsupportedOperationException("Setting a non-zero elevation is " + 102249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "not supported in this action bar configuration."); 102349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 102449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 102549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 102649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 102749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Get the Z-axis elevation of the action bar in pixels. 102849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 102949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 103049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * values are closer to the user.</p> 103149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 103249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return Elevation value in pixels 103349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 103449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getElevation() { 103549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return 0; 103649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 103749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 103813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10398e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 104013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { 104113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 104213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 104313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10448e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 104513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setShowHideAnimationEnabled(boolean enabled) { 104613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 104713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 104813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10498e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 105013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void onConfigurationChanged(Configuration config) { 105113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 105213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 105313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10548e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 105513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void dispatchMenuVisibilityChanged(boolean visible) { 105613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 105713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 105813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10598e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 106013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public ActionMode startActionMode(ActionMode.Callback callback) { 106113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return null; 106213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 106320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 106413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10658e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 106613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean openOptionsMenu() { 106713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 106813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 106913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 107013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10718e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 107213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean invalidateOptionsMenu() { 107313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 107413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 107513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 107613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10778e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 107813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean onMenuKeyEvent(KeyEvent event) { 107913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 108013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 108113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 1082d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes /** @hide **/ 10838e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 1084d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes public boolean onKeyShortcut(int keyCode, KeyEvent ev) { 1085d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes return false; 1086d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes } 1087d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes 108813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 10898e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 109013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean collapseActionView() { 109113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 109213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 109313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 1094ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes /** @hide */ 10958e10080c914d1ad0784394fa3026b85535535847Aurimas Liutikas @RestrictTo(LIBRARY_GROUP) 1096ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes public void setWindowTitle(CharSequence title) { 1097ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes } 1098ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes 109913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 1100a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * Attempts to move focus to the ActionBar if it does not already contain the focus. 1101a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * 1102a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * @return {@code true} if focus changes or {@code false} if focus doesn't change. 11030dbe090bba314e72d65d5404c9fb15b7550a698dAndrei Stingaceanu * @hide 1104a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount */ 11050dbe090bba314e72d65d5404c9fb15b7550a698dAndrei Stingaceanu @RestrictTo(LIBRARY_GROUP) 1106a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount boolean requestFocus() { 1107a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount return false; 1108a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount } 1109a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount 1110a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount /** 1111733d0b2acb07ede7455b9d020901a10586053923Chris Banes * Clean up any resources 1112733d0b2acb07ede7455b9d020901a10586053923Chris Banes */ 1113733d0b2acb07ede7455b9d020901a10586053923Chris Banes void onDestroy() { 1114733d0b2acb07ede7455b9d020901a10586053923Chris Banes } 1115733d0b2acb07ede7455b9d020901a10586053923Chris Banes 1116733d0b2acb07ede7455b9d020901a10586053923Chris Banes /** 111713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Listener interface for ActionBar navigation events. 111813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 111913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 112013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 112113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 112213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 112313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 1124d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 112513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public interface OnNavigationListener { 1126bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 112713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This method is called whenever a navigation item in your action bar 112813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * is selected. 1129bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1130bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param itemPosition Position of the item clicked. 113113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param itemId ID of the item clicked. 1132bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return True if the event was handled, false otherwise. 1133bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1134bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 1135bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1136bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1137bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 113813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Listener for receiving events when action bar menus are shown or hidden. 1139bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1140bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface OnMenuVisibilityListener { 114120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1142bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 114313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Called when an action bar menu is shown or hidden. Applications may want to use 114413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 114513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * gameplay, or other activity within the main content area. 1146bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 114713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param isVisible True if an action bar menu is now visible, false if no action bar 114813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * menus are visible. 1149bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1150bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 1151bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1152bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1153bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 115413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A tab in the action bar. 1155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 115613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Tabs manage the hiding and showing of {@link Fragment}s. 11579dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 115813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 115913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 116013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 116113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 1162bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1163d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 1164bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static abstract class Tab { 116520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1166bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1167bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * An invalid position for a tab. 1168bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1169bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getPosition() 1170bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1171bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int INVALID_POSITION = -1; 1172bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1173bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the current position of this tab in the action bar. 1175bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1176bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 1177bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the action bar. 1178bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1179bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getPosition(); 1180bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the icon associated with this tab. 1183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's icon 1185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Drawable getIcon(); 1187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1188bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1189bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the text of this tab. 1190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1191bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's text 1192bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1193bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getText(); 1194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 1197bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1198bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon The drawable to use as an icon 1199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1200bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1201bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setIcon(Drawable icon); 1202bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1203bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1204bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 1205bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1206bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID referring to the drawable to use as an icon 1207bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1208bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1209b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract Tab setIcon(@DrawableRes int resId); 1210bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1211bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 121213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the text displayed on this tab. Text may be truncated if there is not 121313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * room to display the entire string. 1214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1215bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param text The text to display 1216bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1217bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1218bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setText(CharSequence text); 1219bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1220bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 122113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the text displayed on this tab. Text may be truncated if there is not 122213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * room to display the entire string. 1223bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1224bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the text that should be displayed 1225bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1226bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 122713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setText(int resId); 1228bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1229bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 123013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a custom view to be used for this tab. This overrides values set by 123113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1232bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1233bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom view to be used as a tab. 1234bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1235bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1236bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setCustomView(View view); 1237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1238bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 123913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a custom view to be used for this tab. This overrides values set by 124013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1241bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1242bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 1243bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1244bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 124513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setCustomView(int layoutResId); 1246bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1248bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve a previously set custom view for this tab. 1249bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1250bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The custom view set by {@link #setCustomView(View)}. 1251bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1252bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 1253bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1254bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1255bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Give this Tab an arbitrary object to hold for later use. 1256bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1257bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param obj Object to store 1258bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1259bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1260bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTag(Object obj); 1261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1262bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1263bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return This Tab's tag object. 1264bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Object getTag(); 1266bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1267bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 126813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the {@link TabListener} that will handle switching to and from this tab. 126913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * All tabs must have a TabListener set before being added to the ActionBar. 1270bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1271bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener Listener to handle tab selection events 1272bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1273bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1274bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTabListener(TabListener listener); 1275bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1276bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1277bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1278bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1279bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void select(); 1280bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1281bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 128213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a description of this tab's content for use in accessibility support. 128313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If no content description is provided the title will be used. 1284bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1285bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the description text 1286bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1287bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 1288bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 1289bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 12900dbe090bba314e72d65d5404c9fb15b7550a698dAndrei Stingaceanu public abstract Tab setContentDescription(@StringRes int resId); 1291bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1292bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 129313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a description of this tab's content for use in accessibility support. 129413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If no content description is provided the title will be used. 1295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1296bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param contentDesc Description of this tab's content 1297bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1298bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 1299bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 1300bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1301bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 1302bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1303bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1304bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 1305bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1306bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Description of this tab's content 1307bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 1308bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 1309bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1310bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getContentDescription(); 1311bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1312bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 131413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Callback interface invoked when a tab is focused, unfocused, added, or removed. 13159dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 131613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 131713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 131813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 131913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 1320bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1321d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 1322bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface TabListener { 132320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1324bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1325bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab enters the selected state. 1326bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1327bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was selected 132813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 132913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * during a tab switch. The previous tab's unselect and this tab's select will be 133013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * executed in a single transaction. This FragmentTransaction does not support 133113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * being added to the back stack. 1332bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1333bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 1334bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1335bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1336bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab exits the selected state. 1337bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1338bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was unselected 133913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 134013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * during a tab switch. This tab's unselect and the newly selected tab's select 134113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will be executed in a single transaction. This FragmentTransaction does not 134213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * support being added to the back stack. 1343bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1344bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 1345bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1346bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 134713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Called when a tab that is already selected is chosen again by the user. 134813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Some applications may use this action to return to the top level of a category. 1349bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was reselected. 135113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 135213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * once this method returns. This FragmentTransaction does not support 135313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * being added to the back stack. 1354bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1355bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 1356bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1357bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1358bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1359bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Per-child layout information associated with action bar custom views. 1360bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 136113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public static class LayoutParams extends ViewGroup.MarginLayoutParams { 1362bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1363bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gravity for the view associated with these LayoutParams. 1364bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see android.view.Gravity 1366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 136749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public int gravity = Gravity.NO_GRAVITY; 1368bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 136913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public LayoutParams(@NonNull Context c, AttributeSet attrs) { 1370bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(c, attrs); 1371bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 137213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.ActionBarLayout); 137313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, Gravity.NO_GRAVITY); 1374bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell a.recycle(); 1375bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1376bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1377bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height) { 1378bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 137949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes this.gravity = Gravity.CENTER_VERTICAL | GravityCompat.START; 1380bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1381bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1382bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height, int gravity) { 1383bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 1384bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = gravity; 1385bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1386bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1387bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int gravity) { 138813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes this(WRAP_CONTENT, MATCH_PARENT, gravity); 1389bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1390bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1391bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(LayoutParams source) { 1392bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1393bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1394bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = source.gravity; 1395bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1396bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1397bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(ViewGroup.LayoutParams source) { 1398bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1399bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1400bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1401bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell} 1402