ActionBar.java revision d805095048f6be52cddbd572ee343c4639ba8187
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 19bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.content.Context; 2049c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.content.res.Configuration; 21bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.content.res.TypedArray; 22bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.graphics.drawable.Drawable; 2349c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.support.annotation.DrawableRes; 2449c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.support.annotation.IntDef; 2513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banesimport android.support.annotation.NonNull; 26b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbyeimport android.support.annotation.Nullable; 27b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbyeimport android.support.annotation.StringRes; 28b79bd8bd1afdf165068ddafdc5fa0667f7ec4a70Jeff Brownimport android.support.v4.app.Fragment; 29da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownimport android.support.v4.app.FragmentManager; 30da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownimport android.support.v4.app.FragmentTransaction; 3149c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport android.support.v4.view.GravityCompat; 32da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownimport android.support.v7.appcompat.R; 3313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banesimport android.support.v7.view.ActionMode; 34bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.util.AttributeSet; 35bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.Gravity; 3613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banesimport android.view.KeyEvent; 37bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.View; 38bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.ViewGroup; 39bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.Window; 40bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.widget.SpinnerAdapter; 41bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 4249c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.lang.annotation.Retention; 4349c78900da0d43140fb602431fb93212bd7f6c70Chris Banesimport java.lang.annotation.RetentionPolicy; 4449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 45bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/** 4613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A primary toolbar within the activity that may display the activity title, application-level 4713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation affordances, and other interactive items. 4820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 49d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>The action bar appears at the top of an activity's window when the activity uses the 50d25af35061a9f20d59b25329d613c62c20184dadChris Banes * AppCompat's {@link R.style#Theme_AppCompat AppCompat} theme (or one of its descendant themes). 5113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * You may otherwise add the action bar by calling {@link 52d25af35061a9f20d59b25329d613c62c20184dadChris Banes * AppCompatDelegate#requestWindowFeature(int) requestFeature(FEATURE_SUPPORT_ACTION_BAR)} or by 53a777694569b333a4459606db6bc94a9e80fd25f3Chris Banes * declaring it in a custom theme with the 54a777694569b333a4459606db6bc94a9e80fd25f3Chris Banes * {@link R.styleable#AppCompatTheme_windowActionBar windowActionBar} property.</p> 559dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 56d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>The action bar may be represented by any Toolbar widget within the application layout. 57d25af35061a9f20d59b25329d613c62c20184dadChris Banes * The application may signal to the Activity which Toolbar should be treated as the Activity's 58d25af35061a9f20d59b25329d613c62c20184dadChris Banes * action bar. Activities that use this feature should use one of the supplied 59d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <code>.NoActionBar</code> themes, set the 60a777694569b333a4459606db6bc94a9e80fd25f3Chris Banes * {@link R.styleable#AppCompatTheme_windowActionBar windowActionBar} attribute to 61a777694569b333a4459606db6bc94a9e80fd25f3Chris Banes * <code>false</code> or otherwise not request the window feature.</p> 6220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 63d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>If your activity has an options menu, you can make select items accessible directly from the 64d25af35061a9f20d59b25329d613c62c20184dadChris Banes * action bar as "action items". You can also modify various characteristics of the action bar or 65d25af35061a9f20d59b25329d613c62c20184dadChris Banes * remove it completely.</p> 6613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 67d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>The navigation button (formerly "Home") takes over the space previously occupied by the 68d25af35061a9f20d59b25329d613c62c20184dadChris Banes * application icon. Apps wishing to express a stronger branding should use their brand colors 69d25af35061a9f20d59b25329d613c62c20184dadChris Banes * heavily in the action bar and other application chrome or use a {@link #setLogo(int) logo} 7013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in place of their standard title text.</p> 7113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 72bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 73d25af35061a9f20d59b25329d613c62c20184dadChris Banes * AppCompatActivity#getSupportActionBar()} getSupportActionBar()}.</p> 7420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 75bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 76d25af35061a9f20d59b25329d613c62c20184dadChris Banes * using an {@link ActionMode}. For example, when the user selects one or more items in 7713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * your activity, you can enable an action mode that offers actions specific to the selected 7813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 79d25af35061a9f20d59b25329d613c62c20184dadChris Banes * same space, the {@link ActionMode} APIs are distinct and independent from those for 8013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link ActionBar}.</p> 8120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 82bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <div class="special reference"> 83bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <h3>Developer Guides</h3> 84bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>For information about how to use the action bar, including how to add action items, navigation 85bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 8613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Bar</a> developer guide.</p> 87bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * </div> 88bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 89bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellpublic abstract class ActionBar { 9020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 91b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye /** @hide */ 92b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Retention(RetentionPolicy.SOURCE) 9313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 9413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public @interface NavigationMode {} 95b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye 96bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 9713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Standard navigation mode. Consists of either a logo or icon 9813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and title text with an optional subtitle. Clicking any of these elements 9913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will dispatch onOptionsItemSelected to the host Activity with 10013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a MenuItem with item ID android.R.id.home. 10113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 10213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 10313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 10413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 10513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 106bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 107d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 108bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 109bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 110bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 11113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * List navigation mode. Instead of static title text this mode 11213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * presents a list menu for navigation within the activity. 11313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * e.g. this might be presented to the user as a dropdown list. 11413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 11513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 11613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 11713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 11813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 119bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 120d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 121bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_LIST = 1; 122bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 123bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 12413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Tab navigation mode. Instead of static title text this mode 12513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * presents a series of tabs for navigation within the activity. 12613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 12713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 12813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 12913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 13013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 131bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 132d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 133bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 134bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 135b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye /** @hide */ 136b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @IntDef(flag=true, value={ 137b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_USE_LOGO, 138b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_HOME, 139b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_HOME_AS_UP, 140b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_TITLE, 141b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_CUSTOM 142b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye }) 143b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Retention(RetentionPolicy.SOURCE) 14413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public @interface DisplayOptions {} 145b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye 146bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 14713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Use logo instead of icon if available. This flag will cause appropriate 14813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation modes to use a wider logo in place of the standard icon. 149bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 150bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 151bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 152bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 153bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 154bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 15613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Show 'home' elements in this action bar, leaving more space for other 15713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation elements. This includes logo and icon. 158bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 159bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 160bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 161bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 162bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 163bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 164bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 16513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Display the 'home' element such that it appears as an 'up' affordance. 16613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * e.g. show an arrow to the left indicating the action that will be taken. 167bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 16813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set this flag if selecting the 'home' button in the action bar to return 16913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * up by a single level in your UI rather than back to the top level or front page. 170bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 17113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Setting this option will implicitly enable interaction with the home/up 17213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * button. See {@link #setHomeButtonEnabled(boolean)}. 173bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 175bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 176bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 177bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 178bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 179bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 180bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the activity title and subtitle, if present. 181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 188bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 189bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 191bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 192bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the custom view if one has been set. 19320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setCustomView(View) 195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 197bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 198bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 200bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 20113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 20213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 203bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 20413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Custom navigation views appear between the application icon and 20513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 20613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 20713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 208bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes. 209bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 210bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom navigation view to place in the ActionBar. 211bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 212bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view); 213bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 21513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 21613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 217bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 21813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Custom navigation views appear between the application icon and 21913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 22013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 22113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 222bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 223bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 22513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the custom view to be displayed.</p> 226bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param view Custom navigation view to place in the ActionBar. 228bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutParams How this custom view should layout in the bar. 22913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 230bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 231bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 232bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 233bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 234bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 23513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 23613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 23813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Custom navigation views appear between the application icon and 23913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 24013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 24113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 242bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 243bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 24513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the custom view to be displayed.</p> 246bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 24813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 249bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 250bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 25113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setCustomView(int resId); 252bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 253bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 25413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the icon to display in the 'home' section of the action bar. 25513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use an icon specified by its style or the 25613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity icon by default. 257bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 25813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 25913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 260bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as an icon. 26213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 263bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 264bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 266b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setIcon(@DrawableRes int resId); 267bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 268bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 26913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the icon to display in the 'home' section of the action bar. 27013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use an icon specified by its style or the 27113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity icon by default. 272bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 27313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 27413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 275bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 276bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon Drawable to show as an icon. 27713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 278bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 279bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 280bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 281bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setIcon(Drawable icon); 282bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 283bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 28413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the logo to display in the 'home' section of the action bar. 28513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use a logo specified by its style or the 28613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity logo by default. 287bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 28813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 28913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 290bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 291bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as a logo. 29213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 293bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 294bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 296b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setLogo(@DrawableRes int resId); 297bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 298bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 29913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the logo to display in the 'home' section of the action bar. 30013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use a logo specified by its style or the 30113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity logo by default. 302bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 30313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 30413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 305bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 306bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param logo Drawable to show as a logo. 30713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 308bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 309bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 310bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 311bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setLogo(Drawable logo); 312bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 314bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the adapter and navigation callback for list navigation mode. 315bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 31613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The supplied adapter will provide views for the expanded list as well as 31713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the currently selected item. (These may be displayed differently.) 318bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 31913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The supplied OnNavigationListener will alert the application when the user 32013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * changes the current list selection. 321bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param adapter An adapter that will provide views both to display 32313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the current navigation selection and populate views 32413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * within the dropdown navigation menu. 32513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param callback An OnNavigationListener that will receive events when the user 32613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * selects a navigation item. 32713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 32813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 32913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 33013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 33113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 332bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 333d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 334bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 335bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell OnNavigationListener callback); 336bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 337bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 338bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the selected navigation item in list or tabbed navigation modes. 339bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 340bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the item to select. 34113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 34213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 34313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 34413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 34513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 346bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 347d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 348bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSelectedNavigationItem(int position); 349bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 351bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 352bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 353bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Position of the selected item. 35413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 35513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 35613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 35713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 35813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 359bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 360d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 361bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getSelectedNavigationIndex(); 362bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 363bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 364bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the number of navigation items present in the current navigation mode. 365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Number of navigation items. 36713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 36813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 36913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 37013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 37113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 372bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 373d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 374bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationItemCount(); 375bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 376bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 37713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's title. This will only be displayed if 37813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 379bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 380bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param title Title to set 38113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 382bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 383bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 384bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 385bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setTitle(CharSequence title); 386bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 387bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 38813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's title. This will only be displayed if 38913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 390bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 391bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of title string to set 39213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 393bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 394bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 395bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 396b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setTitle(@StringRes int resId); 397bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 398bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 39913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's subtitle. This will only be displayed if 40013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 40113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * subtitle entirely. 402bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 403bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param subtitle Subtitle to set 40413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 405bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 406bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 407bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 40813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setSubtitle(CharSequence subtitle); 409bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 410bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 41113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's subtitle. This will only be displayed if 41213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 413bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 414bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of subtitle string to set 41513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 416bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 417bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 418bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 41913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setSubtitle(int resId); 420bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 421bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 42213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set display options. This changes all display option bits at once. To change 42313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 424bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 42513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param options A combination of the bits defined by the DISPLAY_ constants 42613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * defined in ActionBar. 427bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 428b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 429bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 430bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 43113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set selected display options. Only the options specified by mask will be changed. 43213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 433bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 43413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 43513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_HOME} option. 43613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 43713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 438bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 43913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param options A combination of the bits defined by the DISPLAY_ constants 44013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * defined in ActionBar. 44113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param mask A bit mask declaring which display options should be changed. 442bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 44313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 444bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 445bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 44613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether to display the activity logo rather than the activity icon. 44713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A logo is often a wider, more detailed image. 448bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 449bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 450bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 451bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 45213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 453bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 454bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 455bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 456bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 457bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 458bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 45913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether to include the application home affordance in the action bar. 46013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Home is presented as either an activity icon or logo. 461bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 462bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 463bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 464bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showHome true to show home, false otherwise. 46513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 466bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 467bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 468bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 469bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 470bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 471bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 47213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether home should be displayed as an "up" affordance. 47313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set this to true if selecting "home" returns up by a single level in your UI 47413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * rather than back to the top level or front page. 475bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 476bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 477bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 47813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param showHomeAsUp true to show the user that selecting home will return one 47913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * level up rather than to the top level of the app. 48013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 481bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 482bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 483bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 484bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 485bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 486bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 487bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether an activity title/subtitle should be displayed. 488bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 489bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 490bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 491bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showTitle true to display a title/subtitle if present. 492bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 493bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 494bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 495bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 496bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 497bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 498bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether a custom view should be displayed, if set. 499bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 500bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 501bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 50213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param showCustom true if the currently set custom view should be displayed, false otherwise. 50313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 504bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 505bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 506bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 507bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 508bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 509bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 51013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's background. This will be used for the primary 51113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * action bar. 512bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 513bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable 514bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 515bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 516bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 51713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setBackgroundDrawable(@Nullable Drawable d); 518bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 519bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 52013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's stacked background. This will appear 52113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in the second row/stacked bar on some devices and configurations. 522bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 523bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the stacked row 524bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 52513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setStackedBackgroundDrawable(Drawable d) { } 526bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 527bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 52813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's split background. This will appear in 52913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the split action bar containing menu-provided action buttons 53013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * on some devices and configurations. 531bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 532bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 533bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the split bar 534bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 53513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setSplitBackgroundDrawable(Drawable d) { } 536bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 537bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 538bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current custom view. 539bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 540bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 541bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 542bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 54313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the current ActionBar title in standard mode. 54413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns null if {@link #getNavigationMode()} would not return 54513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #NAVIGATION_MODE_STANDARD}. 546bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 547bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar title or null. 548bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 549b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 550bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getTitle(); 551bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 552bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 55313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the current ActionBar subtitle in standard mode. 55413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns null if {@link #getNavigationMode()} would not return 55513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #NAVIGATION_MODE_STANDARD}. 556bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 557bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar subtitle or null. 558bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 559b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 560bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getSubtitle(); 561bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 562bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 563bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the current navigation mode. The result will be one of: 56413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <ul> 56513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 566bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 56713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <li>{@link #NAVIGATION_MODE_TABS}</li> 56813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </ul> 569bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 570bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current navigation mode. 57113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 57213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 57313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 57413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 57513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 576bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 577d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 578b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @NavigationMode 579bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationMode(); 580bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 581bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 582bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the current navigation mode. 583bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 584bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param mode The new mode to set. 585bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_STANDARD 586bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_LIST 587bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_TABS 58813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 58913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 59013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 59113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 59213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 593bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 594d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 595b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 596bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 597bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 598bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current set of display options. 599bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 600b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @DisplayOptions 601bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getDisplayOptions(); 602bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 603bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 60413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Create and return a new {@link Tab}. 60513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This tab will not be included in the action bar until it is added. 606bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 60713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Very often tabs will be used to switch between {@link Fragment} 60813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * objects. Here is a typical implementation of such tabs:</p> 609bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 610bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 61113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * complete} 612bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 613bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A new Tab 61413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 615bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #addTab(Tab) 61613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 61713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 61813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 61913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 62013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 621bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 622d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 623bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab newTab(); 624bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 625bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 62613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 62713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If this is the first tab to be added it will become the selected tab. 628bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 629bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to add 63013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 63113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 63213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 63313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 63413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 635bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 636d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 637bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab); 638bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 639bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 640bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 641bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 64213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab Tab to add 643bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 64413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 64513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 64613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 64713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 64813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 649bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 650d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 651bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, boolean setSelected); 652bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 653bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 654bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 65513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <code>position</code>. If this is the first tab to be added it will become 65613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the selected tab. 657bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 65813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab The tab to add 659bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position The new position of the tab 66013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 66113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 66213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 66313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 66413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 665bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 666d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 667bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position); 668bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 669bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 670bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 671bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <code>position</code>. 672bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 67313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab The tab to add 67413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param position The new position of the tab 675bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 67613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 67713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 67813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 67913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 68013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 681bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 682d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 683bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 684bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 685bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 68613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a tab from the action bar. If the removed tab was selected it will be deselected 68713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and another tab will be selected if present. 688bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 689bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab to remove 69013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 69113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 69213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 69313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 69413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 695bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 696d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 697bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTab(Tab tab); 698bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 699bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 70013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a tab from the action bar. If the removed tab was selected it will be deselected 70113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and another tab will be selected if present. 702bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 703bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the tab to remove 70413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 70513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 70613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 70713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 70813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 709bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 710d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 711bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTabAt(int position); 712bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 713bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 714bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Remove all tabs from the action bar and deselect the current tab. 71513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 71613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 71713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 71813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 71913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 720bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 721d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 722bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeAllTabs(); 723bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 724bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 725bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 726bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 727bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 728bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 729bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to select 73013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 73113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 73213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 73313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 73413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 735bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 736d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 737bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void selectTab(Tab tab); 738bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 739bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 74013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the currently selected tab if in tabbed navigation mode and there is at least 74113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * one tab present. 742bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 743bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The currently selected tab or null 74413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 74513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 74613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 74713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 74813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 749bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 750d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 751b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 752bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getSelectedTab(); 753bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 754bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 755bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the tab at the specified index. 756bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 757bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param index Index value in the range 0-get 75813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return 75913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 76013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 76113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 76213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 76313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 764bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 765d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 766bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getTabAt(int index); 767bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 768bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 769bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the number of tabs currently registered with the action bar. 77020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 771bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Tab count 77213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 77313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 77413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 77513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 77613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 777bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 778d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 779bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getTabCount(); 780bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 781bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 782bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve the current height of the ActionBar. 783bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 784bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The ActionBar's height 785bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 786bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getHeight(); 787bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 788bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 78913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Show the ActionBar if it is not currently showing. 79013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If the window hosting the ActionBar does not have the feature 79113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 792bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * content to fit the new space available. 793bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 79413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>If you are hiding the ActionBar through 79513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 79613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * you should not call this function directly. 797bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 798bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void show(); 799bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 800bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 80113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Hide the ActionBar if it is currently showing. 80213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If the window hosting the ActionBar does not have the feature 80313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 80413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * content to fit the new space available. 805bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 80613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Instead of calling this function directly, you can also cause an 80713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * ActionBar using the overlay feature to hide through 80813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 80913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Hiding the ActionBar through this system UI flag allows you to more 81013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * seamlessly hide it in conjunction with other screen decorations. 811bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 812bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void hide(); 813bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 814bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 815bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 816bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 817bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract boolean isShowing(); 818bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 819bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 820bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a listener that will respond to menu visibility change events. 821bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 822bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener The new listener to add 823bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 824bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 825bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 826bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 82713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a menu visibility listener. This listener will no longer receive menu 82813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * visibility change events. 829bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 830bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener A listener to remove that was previously added 831bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 832bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 833bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 834bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 83513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Enable or disable the "home" button in the corner of the action bar. (Note that this 83613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * is the application home/up affordance on the action bar, not the systemwide home 83713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * button.) 838bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 83913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>This defaults to true for packages targeting < API 14. For packages targeting 84013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * API 14 or greater, the application should call this method to enable interaction 84113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * with the home/up affordance. 842bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 84313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 84413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the home button. 845bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 846bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param enabled true to enable the home button, false to disable the home button. 847bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 84813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHomeButtonEnabled(boolean enabled) { } 849bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 850bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 85113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns a {@link Context} with an appropriate theme for creating views that 85213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will appear in the action bar. If you are inflating or instantiating custom views 85313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * that will appear in an action bar, you should use the Context returned by this method. 85413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * (This includes adapters used for list navigation mode.) 85513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This will ensure that views contrast properly against the action bar. 856bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 857bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A themed Context for creating views 858bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 85920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public Context getThemedContext() { 86020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns return null; 86120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 862bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 863bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 86413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns true if the Title field has been truncated during layout for lack 86513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * of available space. 86613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 86713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return true if the Title field has been truncated 86813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @hide pending API approval 86913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 87013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean isTitleTruncated() { return false; } 87113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 87213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 873f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 874f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 875f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 876f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 877f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>null</code> to this method, the default drawable from the theme 878f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 879f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 880f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 881f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 882f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 883f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 884f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param indicator A drawable to use for the up indicator, or null to use the theme's default 885f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 886f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 887f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 888f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 889f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 890b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeAsUpIndicator(@Nullable Drawable indicator) {} 891f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 892f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 893f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 894f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 895f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 896f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 897f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>0</code> to this method, the default drawable from the theme 898f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 899f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 900f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 901f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 902f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 903f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 904b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye * @param resId Resource ID of a drawable to use for the up indicator, or 0 905f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to use the theme's default 906f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 907f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 908f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 909f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 910f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 911b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeAsUpIndicator(@DrawableRes int resId) {} 912f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 913f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 914f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 915f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 916f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 917f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 918f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 919f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 920f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 921f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 922f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 923f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 924f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>null</code> will use the system default description.</p> 925f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 926f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param description New description for the Home action when enabled 927f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 928f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 929f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 930b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeActionContentDescription(@Nullable CharSequence description) {} 931f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 932f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 933f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 934f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 935f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 936f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 937f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 938f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 939f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 940f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 941f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 942f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 943f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>0</code> will use the system default description.</p> 944f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 945f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param resId Resource ID of a string to use as the new description 946f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * for the Home action when enabled 947f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 948f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 949f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 950b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeActionContentDescription(@StringRes int resId) {} 951f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 952f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 95313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Enable hiding the action bar on content scroll. 95413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 95513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>If enabled, the action bar will scroll out of sight along with a 956e9fa476efa74bbcf2b10f82ba23ace88a4cd1e38Ben Murdoch * {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content. 95713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode} 95813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * to enable hiding on content scroll.</p> 95913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 96013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>When partially scrolled off screen the action bar is considered 96113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view. 96213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </p> 96313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param hideOnContentScroll true to enable hiding on content scroll. 96413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 96513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) { 96613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes if (hideOnContentScroll) { 96713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes throw new UnsupportedOperationException("Hide on content scroll is not supported in " + 96813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes "this action bar configuration."); 96913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 97013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 97113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 97213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 97313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Return whether the action bar is configured to scroll out of sight along with 97413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}. 9759dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 97613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return true if hide-on-content-scroll is enabled 97713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @see #setHideOnContentScrollEnabled(boolean) 978bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 97913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean isHideOnContentScrollEnabled() { 98013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 98113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 98213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 98313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 98413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Return the current vertical offset of the action bar. 98513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 98613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The action bar's current hide offset is the distance that the action bar is currently 98713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 98813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * current measured {@link #getHeight() height} (fully invisible).</p> 98913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 99013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return The action bar's offset toward its fully hidden state in pixels 99113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 99213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public int getHideOffset() { 99313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return 0; 99413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 99513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 99613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 99713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the current hide offset of the action bar. 99813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 99913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The action bar's current hide offset is the distance that the action bar is currently 100013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 100113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * current measured {@link #getHeight() height} (fully invisible).</p> 100213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 100313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param offset The action bar's offset toward its fully hidden state in pixels. 100413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 100513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHideOffset(int offset) { 100613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes if (offset != 0) { 100713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes throw new UnsupportedOperationException("Setting an explicit action bar hide offset " + 100813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes "is not supported in this action bar configuration."); 100913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 101013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 101113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 101249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 101349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Set the Z-axis elevation of the action bar in pixels. 101449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 101549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 101649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * values are closer to the user.</p> 101749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 101849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param elevation Elevation value in pixels 101949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 102049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setElevation(float elevation) { 102149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes if (elevation != 0) { 102249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes throw new UnsupportedOperationException("Setting a non-zero elevation is " + 102349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "not supported in this action bar configuration."); 102449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 102549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 102649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 102749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 102849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Get the Z-axis elevation of the action bar in pixels. 102949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 103049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 103149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * values are closer to the user.</p> 103249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 103349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return Elevation value in pixels 103449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 103549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getElevation() { 103649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return 0; 103749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 103849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 103913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 104013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { 104113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 104213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 104313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 104413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setShowHideAnimationEnabled(boolean enabled) { 104513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 104613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 104713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 104813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void onConfigurationChanged(Configuration config) { 104913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 105013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 105113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 105213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void dispatchMenuVisibilityChanged(boolean visible) { 105313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 105413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 105513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 105613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public ActionMode startActionMode(ActionMode.Callback callback) { 105713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return null; 105813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 105920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 106013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 106113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean openOptionsMenu() { 106213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 106313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 106413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 106513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 106613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean invalidateOptionsMenu() { 106713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 106813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 106913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 107013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 107113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean onMenuKeyEvent(KeyEvent event) { 107213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 107313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 107413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 1075d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes /** @hide **/ 1076d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes public boolean onKeyShortcut(int keyCode, KeyEvent ev) { 1077d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes return false; 1078d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes } 1079d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes 108013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 108113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean collapseActionView() { 108213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 108313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 108413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 1085ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes /** @hide */ 1086ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes public void setWindowTitle(CharSequence title) { 1087ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes } 1088ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes 108913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 1090a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * Attempts to move focus to the ActionBar if it does not already contain the focus. 1091a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * 1092a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * @return {@code true} if focus changes or {@code false} if focus doesn't change. 1093a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount */ 1094a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount boolean requestFocus() { 1095a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount return false; 1096a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount } 1097a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount 1098a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount /** 1099733d0b2acb07ede7455b9d020901a10586053923Chris Banes * Clean up any resources 1100733d0b2acb07ede7455b9d020901a10586053923Chris Banes */ 1101733d0b2acb07ede7455b9d020901a10586053923Chris Banes void onDestroy() { 1102733d0b2acb07ede7455b9d020901a10586053923Chris Banes } 1103733d0b2acb07ede7455b9d020901a10586053923Chris Banes 1104733d0b2acb07ede7455b9d020901a10586053923Chris Banes /** 110513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Listener interface for ActionBar navigation events. 110613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 110713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 110813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 110913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 111013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 111113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 1112d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 111313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public interface OnNavigationListener { 1114bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 111513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This method is called whenever a navigation item in your action bar 111613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * is selected. 1117bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1118bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param itemPosition Position of the item clicked. 111913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param itemId ID of the item clicked. 1120bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return True if the event was handled, false otherwise. 1121bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1122bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 1123bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1124bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1125bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 112613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Listener for receiving events when action bar menus are shown or hidden. 1127bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1128bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface OnMenuVisibilityListener { 112920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1130bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 113113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Called when an action bar menu is shown or hidden. Applications may want to use 113213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 113313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * gameplay, or other activity within the main content area. 1134bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 113513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param isVisible True if an action bar menu is now visible, false if no action bar 113613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * menus are visible. 1137bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1138bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 1139bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1140bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1141bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 114213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A tab in the action bar. 1143bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 114413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Tabs manage the hiding and showing of {@link Fragment}s. 11459dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 114613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 114713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 114813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 114913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 1150bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1151d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 1152bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static abstract class Tab { 115320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1154bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * An invalid position for a tab. 1156bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1157bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getPosition() 1158bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1159bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int INVALID_POSITION = -1; 1160bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1161bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1162bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the current position of this tab in the action bar. 1163bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1164bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 1165bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the action bar. 1166bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1167bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getPosition(); 1168bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1169bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1170bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the icon associated with this tab. 1171bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1172bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's icon 1173bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Drawable getIcon(); 1175bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1176bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1177bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the text of this tab. 1178bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1179bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's text 1180bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getText(); 1182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 1185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon The drawable to use as an icon 1187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1188bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1189bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setIcon(Drawable icon); 1190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1191bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1192bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 1193bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID referring to the drawable to use as an icon 1195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1197b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract Tab setIcon(@DrawableRes int resId); 1198bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 120013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the text displayed on this tab. Text may be truncated if there is not 120113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * room to display the entire string. 1202bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1203bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param text The text to display 1204bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1205bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1206bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setText(CharSequence text); 1207bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1208bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 120913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the text displayed on this tab. Text may be truncated if there is not 121013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * room to display the entire string. 1211bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1212bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the text that should be displayed 1213bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 121513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setText(int resId); 1216bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1217bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 121813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a custom view to be used for this tab. This overrides values set by 121913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1220bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1221bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom view to be used as a tab. 1222bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1223bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1224bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setCustomView(View view); 1225bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1226bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 122713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a custom view to be used for this tab. This overrides values set by 122813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1229bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1230bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 1231bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1232bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 123313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setCustomView(int layoutResId); 1234bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1235bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1236bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve a previously set custom view for this tab. 1237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1238bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The custom view set by {@link #setCustomView(View)}. 1239bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1240bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 1241bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1242bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1243bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Give this Tab an arbitrary object to hold for later use. 1244bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1245bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param obj Object to store 1246bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1248bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTag(Object obj); 1249bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1250bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1251bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return This Tab's tag object. 1252bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1253bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Object getTag(); 1254bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1255bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 125613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the {@link TabListener} that will handle switching to and from this tab. 125713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * All tabs must have a TabListener set before being added to the ActionBar. 1258bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1259bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener Listener to handle tab selection events 1260bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1262bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTabListener(TabListener listener); 1263bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1264bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1266bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1267bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void select(); 1268bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1269bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 127013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a description of this tab's content for use in accessibility support. 127113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If no content description is provided the title will be used. 1272bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1273bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the description text 1274bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1275bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 1276bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 1277bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 127813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setContentDescription(int resId); 1279bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1280bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 128113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a description of this tab's content for use in accessibility support. 128213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If no content description is provided the title will be used. 1283bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1284bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param contentDesc Description of this tab's content 1285bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1286bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 1287bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 1288bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1289bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 1290bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1291bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1292bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 1293bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1294bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Description of this tab's content 1295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 1296bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 1297bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1298bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getContentDescription(); 1299bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1300bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1301bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 130213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Callback interface invoked when a tab is focused, unfocused, added, or removed. 13039dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 130413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 130513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 130613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 130713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 1308bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1309d805095048f6be52cddbd572ee343c4639ba8187Alan Viverette @Deprecated 1310bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface TabListener { 131120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1312bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab enters the selected state. 1314bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1315bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was selected 131613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 131713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * during a tab switch. The previous tab's unselect and this tab's select will be 131813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * executed in a single transaction. This FragmentTransaction does not support 131913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * being added to the back stack. 1320bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1321bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 1322bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1323bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1324bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab exits the selected state. 1325bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1326bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was unselected 132713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 132813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * during a tab switch. This tab's unselect and the newly selected tab's select 132913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will be executed in a single transaction. This FragmentTransaction does not 133013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * support being added to the back stack. 1331bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1332bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 1333bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1334bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 133513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Called when a tab that is already selected is chosen again by the user. 133613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Some applications may use this action to return to the top level of a category. 1337bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1338bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was reselected. 133913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 134013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * once this method returns. This FragmentTransaction does not support 134113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * being added to the back stack. 1342bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1343bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 1344bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1345bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1346bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1347bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Per-child layout information associated with action bar custom views. 1348bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 134913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public static class LayoutParams extends ViewGroup.MarginLayoutParams { 1350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1351bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gravity for the view associated with these LayoutParams. 1352bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1353bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see android.view.Gravity 1354bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 135549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public int gravity = Gravity.NO_GRAVITY; 1356bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 135713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public LayoutParams(@NonNull Context c, AttributeSet attrs) { 1358bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(c, attrs); 1359bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 136013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.ActionBarLayout); 136113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, Gravity.NO_GRAVITY); 1362bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell a.recycle(); 1363bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1364bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height) { 1366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 136749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes this.gravity = Gravity.CENTER_VERTICAL | GravityCompat.START; 1368bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1369bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1370bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height, int gravity) { 1371bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 1372bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = gravity; 1373bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1374bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1375bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int gravity) { 137613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes this(WRAP_CONTENT, MATCH_PARENT, gravity); 1377bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1378bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1379bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(LayoutParams source) { 1380bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1381bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1382bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = source.gravity; 1383bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1384bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1385bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(ViewGroup.LayoutParams source) { 1386bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1387bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1388bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1389bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell} 1390