ActionBar.java revision 733d0b2acb07ede7455b9d020901a10586053923
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 53d25af35061a9f20d59b25329d613c62c20184dadChris Banes * declaring it in a custom theme with the {@link R.styleable#Theme_windowActionBar windowActionBar} 54d25af35061a9f20d59b25329d613c62c20184dadChris Banes * property. 5513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </p> 569dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 57d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>The action bar may be represented by any Toolbar widget within the application layout. 58d25af35061a9f20d59b25329d613c62c20184dadChris Banes * The application may signal to the Activity which Toolbar should be treated as the Activity's 59d25af35061a9f20d59b25329d613c62c20184dadChris Banes * action bar. Activities that use this feature should use one of the supplied 60d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <code>.NoActionBar</code> themes, set the 61d25af35061a9f20d59b25329d613c62c20184dadChris Banes * {@link R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code> 6213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * or otherwise not request the window feature.</p> 6320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 64d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>If your activity has an options menu, you can make select items accessible directly from the 65d25af35061a9f20d59b25329d613c62c20184dadChris Banes * action bar as "action items". You can also modify various characteristics of the action bar or 66d25af35061a9f20d59b25329d613c62c20184dadChris Banes * remove it completely.</p> 6713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 68d25af35061a9f20d59b25329d613c62c20184dadChris Banes * <p>The navigation button (formerly "Home") takes over the space previously occupied by the 69d25af35061a9f20d59b25329d613c62c20184dadChris Banes * application icon. Apps wishing to express a stronger branding should use their brand colors 70d25af35061a9f20d59b25329d613c62c20184dadChris Banes * heavily in the action bar and other application chrome or use a {@link #setLogo(int) logo} 7113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in place of their standard title text.</p> 7213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 73bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 74d25af35061a9f20d59b25329d613c62c20184dadChris Banes * AppCompatActivity#getSupportActionBar()} getSupportActionBar()}.</p> 7520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 76bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 77d25af35061a9f20d59b25329d613c62c20184dadChris Banes * using an {@link ActionMode}. For example, when the user selects one or more items in 7813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * your activity, you can enable an action mode that offers actions specific to the selected 7913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 80d25af35061a9f20d59b25329d613c62c20184dadChris Banes * same space, the {@link ActionMode} APIs are distinct and independent from those for 8113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link ActionBar}.</p> 8220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 83bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <div class="special reference"> 84bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <h3>Developer Guides</h3> 85bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>For information about how to use the action bar, including how to add action items, navigation 86bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 8713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Bar</a> developer guide.</p> 88bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * </div> 89bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 90bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellpublic abstract class ActionBar { 9120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 92b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye /** @hide */ 93b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Retention(RetentionPolicy.SOURCE) 9413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 9513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public @interface NavigationMode {} 96b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye 97bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 9813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Standard navigation mode. Consists of either a logo or icon 9913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and title text with an optional subtitle. Clicking any of these elements 10013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will dispatch onOptionsItemSelected to the host Activity with 10113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a MenuItem with item ID android.R.id.home. 10213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 10313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 10413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 10513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 10613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 107bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 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 */ 120bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_LIST = 1; 121bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 122bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 12313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Tab navigation mode. Instead of static title text this mode 12413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * presents a series of tabs for navigation within the activity. 12513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 12613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 12713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 12813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 12913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 130bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 131bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 132bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 133b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye /** @hide */ 134b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @IntDef(flag=true, value={ 135b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_USE_LOGO, 136b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_HOME, 137b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_HOME_AS_UP, 138b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_TITLE, 139b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_CUSTOM 140b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye }) 141b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Retention(RetentionPolicy.SOURCE) 14213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public @interface DisplayOptions {} 143b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye 144bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 14513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Use logo instead of icon if available. This flag will cause appropriate 14613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation modes to use a wider logo in place of the standard icon. 147bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 148bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 149bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 150bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 151bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 152bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 153bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 15413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Show 'home' elements in this action bar, leaving more space for other 15513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation elements. This includes logo and icon. 156bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 157bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 158bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 159bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 160bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 161bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 162bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 16313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Display the 'home' element such that it appears as an 'up' affordance. 16413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * e.g. show an arrow to the left indicating the action that will be taken. 165bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 16613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set this flag if selecting the 'home' button in the action bar to return 16713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * up by a single level in your UI rather than back to the top level or front page. 168bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 16913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Setting this option will implicitly enable interaction with the home/up 17013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * button. See {@link #setHomeButtonEnabled(boolean)}. 171bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 172bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 173bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 175bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 176bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 177bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 178bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the activity title and subtitle, if present. 179bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 180bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 188bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 189bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the custom view if one has been set. 19120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 192bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setCustomView(View) 193bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 197bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 198bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 19913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 20013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 201bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 20213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Custom navigation views appear between the application icon and 20313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 20413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 20513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 206bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes. 207bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 208bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom navigation view to place in the ActionBar. 209bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 210bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view); 211bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 212bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 21313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 21413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 215bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 21613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Custom navigation views appear between the application icon and 21713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 21813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 21913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 220bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 221bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 22313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the custom view to be displayed.</p> 224bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param view Custom navigation view to place in the ActionBar. 226bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutParams How this custom view should layout in the bar. 22713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 228bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 229bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 230bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 231bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 232bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 23313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 23413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 235bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 23613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Custom navigation views appear between the application icon and 23713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 23813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 23913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 240bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 241bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 24313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the custom view to be displayed.</p> 244bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 245bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 24613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 248bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 24913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setCustomView(int resId); 250bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 251bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 25213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the icon to display in the 'home' section of the action bar. 25313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use an icon specified by its style or the 25413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity icon by default. 255bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 25613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 25713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 258bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 259bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as an icon. 26013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 262bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 263bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 264b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setIcon(@DrawableRes int resId); 265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 266bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 26713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the icon to display in the 'home' section of the action bar. 26813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use an icon specified by its style or the 26913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity icon by default. 270bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 27113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 27213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 273bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 274bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon Drawable to show as an icon. 27513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 276bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 277bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 278bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 279bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setIcon(Drawable icon); 280bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 281bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 28213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the logo to display in the 'home' section of the action bar. 28313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use a logo specified by its style or the 28413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity logo by default. 285bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 28613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 28713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 288bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 289bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as a logo. 29013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 291bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 292bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 293bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 294b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setLogo(@DrawableRes int resId); 295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 296bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 29713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the logo to display in the 'home' section of the action bar. 29813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use a logo specified by its style or the 29913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity logo by default. 300bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 30113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 30213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 303bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 304bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param logo Drawable to show as a logo. 30513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 306bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 307bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 308bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 309bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setLogo(Drawable logo); 310bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 311bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 312bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the adapter and navigation callback for list navigation mode. 313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 31413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The supplied adapter will provide views for the expanded list as well as 31513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the currently selected item. (These may be displayed differently.) 316bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 31713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The supplied OnNavigationListener will alert the application when the user 31813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * changes the current list selection. 319bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param adapter An adapter that will provide views both to display 32113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the current navigation selection and populate views 32213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * within the dropdown navigation menu. 32313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param callback An OnNavigationListener that will receive events when the user 32413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * selects a navigation item. 32513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 32613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 32713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 32813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 32913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 330bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 331bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 332bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell OnNavigationListener callback); 333bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 334bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 335bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the selected navigation item in list or tabbed navigation modes. 336bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 337bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the item to select. 33813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 33913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 34013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 34113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 34213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 343bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 344bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSelectedNavigationItem(int position); 345bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 346bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 347bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 348bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 349bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Position of the selected item. 35013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 35113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 35213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 35313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 35413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 355bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 356bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getSelectedNavigationIndex(); 357bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 358bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 359bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the number of navigation items present in the current navigation mode. 360bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 361bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Number of navigation items. 36213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 36313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 36413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 36513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 36613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 367bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 368bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationItemCount(); 369bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 370bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 37113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's title. This will only be displayed if 37213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 373bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 374bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param title Title to set 37513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 376bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 377bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 378bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 379bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setTitle(CharSequence title); 380bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 381bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 38213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's title. This will only be displayed if 38313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 384bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 385bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of title string to set 38613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 387bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 388bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 389bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 390b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setTitle(@StringRes int resId); 391bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 392bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 39313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's subtitle. This will only be displayed if 39413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 39513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * subtitle entirely. 396bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 397bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param subtitle Subtitle to set 39813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 399bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 400bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 401bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 40213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setSubtitle(CharSequence subtitle); 403bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 404bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 40513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's subtitle. This will only be displayed if 40613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 407bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 408bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of subtitle string to set 40913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 410bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 411bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 412bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 41313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setSubtitle(int resId); 414bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 415bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 41613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set display options. This changes all display option bits at once. To change 41713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 418bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 41913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param options A combination of the bits defined by the DISPLAY_ constants 42013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * defined in ActionBar. 421bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 422b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 423bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 424bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 42513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set selected display options. Only the options specified by mask will be changed. 42613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 427bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 42813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 42913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_HOME} option. 43013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 43113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 432bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 43313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param options A combination of the bits defined by the DISPLAY_ constants 43413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * defined in ActionBar. 43513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param mask A bit mask declaring which display options should be changed. 436bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 43713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 438bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 439bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 44013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether to display the activity logo rather than the activity icon. 44113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A logo is often a wider, more detailed image. 442bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 443bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 444bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 445bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 44613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 447bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 448bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 449bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 450bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 451bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 452bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 45313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether to include the application home affordance in the action bar. 45413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Home is presented as either an activity icon or logo. 455bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 456bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 457bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 458bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showHome true to show home, false otherwise. 45913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 460bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 461bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 462bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 463bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 464bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 465bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 46613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether home should be displayed as an "up" affordance. 46713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set this to true if selecting "home" returns up by a single level in your UI 46813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * rather than back to the top level or front page. 469bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 470bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 471bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 47213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param showHomeAsUp true to show the user that selecting home will return one 47313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * level up rather than to the top level of the app. 47413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 475bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 476bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 477bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 478bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 479bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 480bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 481bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether an activity title/subtitle should be displayed. 482bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 483bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 484bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 485bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showTitle true to display a title/subtitle if present. 486bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 487bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 488bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 489bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 490bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 491bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 492bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether a custom view should be displayed, if set. 493bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 494bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 495bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 49613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param showCustom true if the currently set custom view should be displayed, false otherwise. 49713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 498bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 499bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 500bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 501bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 502bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 503bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 50413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's background. This will be used for the primary 50513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * action bar. 506bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 507bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable 508bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 509bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 510bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 51113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setBackgroundDrawable(@Nullable Drawable d); 512bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 513bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 51413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's stacked background. This will appear 51513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in the second row/stacked bar on some devices and configurations. 516bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 517bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the stacked row 518bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 51913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setStackedBackgroundDrawable(Drawable d) { } 520bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 521bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 52213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's split background. This will appear in 52313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the split action bar containing menu-provided action buttons 52413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * on some devices and configurations. 525bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 526bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 527bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the split bar 528bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 52913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setSplitBackgroundDrawable(Drawable d) { } 530bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 531bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 532bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current custom view. 533bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 534bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 535bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 536bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 53713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the current ActionBar title in standard mode. 53813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns null if {@link #getNavigationMode()} would not return 53913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #NAVIGATION_MODE_STANDARD}. 540bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 541bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar title or null. 542bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 543b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 544bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getTitle(); 545bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 546bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 54713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the current ActionBar subtitle in standard mode. 54813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns null if {@link #getNavigationMode()} would not return 54913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #NAVIGATION_MODE_STANDARD}. 550bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 551bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar subtitle or null. 552bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 553b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 554bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getSubtitle(); 555bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 556bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 557bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the current navigation mode. The result will be one of: 55813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <ul> 55913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 560bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 56113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <li>{@link #NAVIGATION_MODE_TABS}</li> 56213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </ul> 563bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 564bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current navigation mode. 56513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 56613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 56713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 56813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 56913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 570bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 571b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @NavigationMode 572bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationMode(); 573bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 574bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 575bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the current navigation mode. 576bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 577bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param mode The new mode to set. 578bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_STANDARD 579bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_LIST 580bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_TABS 58113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 58213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 58313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 58413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 58513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 586bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 587b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 588bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 589bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 590bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current set of display options. 591bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 592b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @DisplayOptions 593bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getDisplayOptions(); 594bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 595bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 59613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Create and return a new {@link Tab}. 59713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This tab will not be included in the action bar until it is added. 598bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 59913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Very often tabs will be used to switch between {@link Fragment} 60013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * objects. Here is a typical implementation of such tabs:</p> 601bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 602bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 60313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * complete} 604bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 605bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A new Tab 60613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 607bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #addTab(Tab) 60813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 60913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 61013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 61113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 61213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 613bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 614bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab newTab(); 615bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 616bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 61713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 61813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If this is the first tab to be added it will become the selected tab. 619bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 620bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to add 62113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 62213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 62313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 62413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 62513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 626bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 627bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab); 628bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 629bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 630bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 631bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 63213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab Tab to add 633bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 63413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 63513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 63613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 63713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 63813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 639bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 640bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, boolean setSelected); 641bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 642bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 643bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 64413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <code>position</code>. If this is the first tab to be added it will become 64513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the selected tab. 646bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 64713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab The tab to add 648bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position The new position of the tab 64913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 65013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 65113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 65213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 65313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 654bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 655bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position); 656bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 657bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 658bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 659bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <code>position</code>. 660bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 66113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab The tab to add 66213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param position The new position of the tab 663bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 66413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 66513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 66613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 66713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 66813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 669bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 670bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 671bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 672bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 67313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a tab from the action bar. If the removed tab was selected it will be deselected 67413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and another tab will be selected if present. 675bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 676bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab to remove 67713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 67813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 67913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 68013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 68113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 682bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 683bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTab(Tab tab); 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 position Position of 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 */ 696bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTabAt(int position); 697bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 698bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 699bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Remove all tabs from the action bar and deselect the current tab. 70013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 70113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 70213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 70313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 70413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 705bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 706bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeAllTabs(); 707bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 708bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 709bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 710bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 711bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 712bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 713bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to select 71413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 71513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 71613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 71713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 71813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 719bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 720bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void selectTab(Tab tab); 721bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 722bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 72313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the currently selected tab if in tabbed navigation mode and there is at least 72413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * one tab present. 725bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 726bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The currently selected tab or null 72713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 72813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 72913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 73013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 73113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 732bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 733b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 734bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getSelectedTab(); 735bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 736bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 737bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the tab at the specified index. 738bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 739bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param index Index value in the range 0-get 74013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return 74113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 74213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 74313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 74413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 74513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 746bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 747bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getTabAt(int index); 748bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 749bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 750bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the number of tabs currently registered with the action bar. 75120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 752bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Tab count 75313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 75413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 75513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 75613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 75713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 758bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 759bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getTabCount(); 760bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 761bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 762bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve the current height of the ActionBar. 763bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 764bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The ActionBar's height 765bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 766bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getHeight(); 767bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 768bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 76913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Show the ActionBar if it is not currently showing. 77013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If the window hosting the ActionBar does not have the feature 77113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 772bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * content to fit the new space available. 773bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 77413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>If you are hiding the ActionBar through 77513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 77613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * you should not call this function directly. 777bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 778bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void show(); 779bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 780bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 78113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Hide the ActionBar if it is currently showing. 78213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If the window hosting the ActionBar does not have the feature 78313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 78413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * content to fit the new space available. 785bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 78613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Instead of calling this function directly, you can also cause an 78713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * ActionBar using the overlay feature to hide through 78813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 78913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Hiding the ActionBar through this system UI flag allows you to more 79013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * seamlessly hide it in conjunction with other screen decorations. 791bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 792bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void hide(); 793bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 794bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 795bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 796bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 797bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract boolean isShowing(); 798bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 799bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 800bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a listener that will respond to menu visibility change events. 801bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 802bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener The new listener to add 803bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 804bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 805bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 806bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 80713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a menu visibility listener. This listener will no longer receive menu 80813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * visibility change events. 809bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 810bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener A listener to remove that was previously added 811bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 812bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 813bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 814bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 81513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Enable or disable the "home" button in the corner of the action bar. (Note that this 81613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * is the application home/up affordance on the action bar, not the systemwide home 81713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * button.) 818bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 81913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>This defaults to true for packages targeting < API 14. For packages targeting 82013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * API 14 or greater, the application should call this method to enable interaction 82113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * with the home/up affordance. 822bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 82313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 82413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the home button. 825bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 826bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param enabled true to enable the home button, false to disable the home button. 827bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 82813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHomeButtonEnabled(boolean enabled) { } 829bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 830bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 83113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns a {@link Context} with an appropriate theme for creating views that 83213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will appear in the action bar. If you are inflating or instantiating custom views 83313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * that will appear in an action bar, you should use the Context returned by this method. 83413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * (This includes adapters used for list navigation mode.) 83513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This will ensure that views contrast properly against the action bar. 836bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 837bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A themed Context for creating views 838bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 83920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public Context getThemedContext() { 84020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns return null; 84120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 842bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 843bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 84413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns true if the Title field has been truncated during layout for lack 84513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * of available space. 84613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 84713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return true if the Title field has been truncated 84813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @hide pending API approval 84913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 85013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean isTitleTruncated() { return false; } 85113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 85213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 853f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 854f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 855f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 856f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 857f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>null</code> to this method, the default drawable from the theme 858f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 859f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 860f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 861f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 862f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 863f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 864f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param indicator A drawable to use for the up indicator, or null to use the theme's default 865f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 866f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 867f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 868f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 869f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 870b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeAsUpIndicator(@Nullable Drawable indicator) {} 871f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 872f4a93d160fc696de65e103e7e078106ea8f818faChris 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>0</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 * 884b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye * @param resId Resource ID of a drawable to use for the up indicator, or 0 885f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to use the theme's default 886f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 887f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 888f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 889f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 890f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 891b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeAsUpIndicator(@DrawableRes int resId) {} 892f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 893f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 894f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 895f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 896f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 897f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 898f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 899f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 900f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 901f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 902f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 903f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 904f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>null</code> will use the system default description.</p> 905f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 906f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param description New description for the Home action when enabled 907f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 908f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 909f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 910b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeActionContentDescription(@Nullable CharSequence description) {} 911f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 912f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 913f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 914f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 915f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 916f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 917f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 918f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 919f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 920f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 921f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 922f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 923f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>0</code> will use the system default description.</p> 924f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 925f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param resId Resource ID of a string to use as the new description 926f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 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(@StringRes int resId) {} 931f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 932f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 93313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Enable hiding the action bar on content scroll. 93413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 93513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>If enabled, the action bar will scroll out of sight along with a 936e9fa476efa74bbcf2b10f82ba23ace88a4cd1e38Ben Murdoch * {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content. 93713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode} 93813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * to enable hiding on content scroll.</p> 93913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 94013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>When partially scrolled off screen the action bar is considered 94113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view. 94213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </p> 94313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param hideOnContentScroll true to enable hiding on content scroll. 94413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 94513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) { 94613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes if (hideOnContentScroll) { 94713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes throw new UnsupportedOperationException("Hide on content scroll is not supported in " + 94813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes "this action bar configuration."); 94913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 95013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 95113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 95213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 95313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Return whether the action bar is configured to scroll out of sight along with 95413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}. 9559dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 95613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return true if hide-on-content-scroll is enabled 95713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @see #setHideOnContentScrollEnabled(boolean) 958bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 95913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean isHideOnContentScrollEnabled() { 96013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 96113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 96213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 96313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 96413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Return the current vertical offset of the action bar. 96513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 96613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The action bar's current hide offset is the distance that the action bar is currently 96713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 96813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * current measured {@link #getHeight() height} (fully invisible).</p> 96913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 97013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return The action bar's offset toward its fully hidden state in pixels 97113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 97213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public int getHideOffset() { 97313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return 0; 97413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 97513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 97613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 97713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the current hide offset of the action bar. 97813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 97913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The action bar's current hide offset is the distance that the action bar is currently 98013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 98113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * current measured {@link #getHeight() height} (fully invisible).</p> 98213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 98313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param offset The action bar's offset toward its fully hidden state in pixels. 98413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 98513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHideOffset(int offset) { 98613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes if (offset != 0) { 98713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes throw new UnsupportedOperationException("Setting an explicit action bar hide offset " + 98813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes "is not supported in this action bar configuration."); 98913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 99013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 99113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 99249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 99349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Set the Z-axis elevation of the action bar in pixels. 99449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 99549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 99649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * values are closer to the user.</p> 99749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 99849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param elevation Elevation value in pixels 99949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 100049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setElevation(float elevation) { 100149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes if (elevation != 0) { 100249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes throw new UnsupportedOperationException("Setting a non-zero elevation is " + 100349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "not supported in this action bar configuration."); 100449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 100549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 100649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 100749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 100849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Get the Z-axis elevation of the action bar in pixels. 100949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 101049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 101149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * values are closer to the user.</p> 101249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 101349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return Elevation value in pixels 101449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 101549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getElevation() { 101649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return 0; 101749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 101849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 101913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 102013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { 102113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 102213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 102313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 102413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setShowHideAnimationEnabled(boolean enabled) { 102513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 102613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 102713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 102813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void onConfigurationChanged(Configuration config) { 102913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 103013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 103113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 103213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void dispatchMenuVisibilityChanged(boolean visible) { 103313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 103413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 103513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 103613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public ActionMode startActionMode(ActionMode.Callback callback) { 103713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return null; 103813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 103920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 104013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 104113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean openOptionsMenu() { 104213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 104313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 104413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 104513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 104613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean invalidateOptionsMenu() { 104713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 104813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 104913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 105013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 105113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean onMenuKeyEvent(KeyEvent event) { 105213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 105313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 105413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 1055d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes /** @hide **/ 1056d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes public boolean onKeyShortcut(int keyCode, KeyEvent ev) { 1057d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes return false; 1058d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes } 1059d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes 106013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 106113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean collapseActionView() { 106213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 106313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 106413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 1065ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes /** @hide */ 1066ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes public void setWindowTitle(CharSequence title) { 1067ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes } 1068ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes 106913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 1070a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * Attempts to move focus to the ActionBar if it does not already contain the focus. 1071a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * 1072a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount * @return {@code true} if focus changes or {@code false} if focus doesn't change. 1073a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount */ 1074a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount boolean requestFocus() { 1075a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount return false; 1076a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount } 1077a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount 1078a6d085f83e2aec7ebda1fbbc69a5fd63c5f2e235George Mount /** 1079733d0b2acb07ede7455b9d020901a10586053923Chris Banes * Clean up any resources 1080733d0b2acb07ede7455b9d020901a10586053923Chris Banes */ 1081733d0b2acb07ede7455b9d020901a10586053923Chris Banes void onDestroy() { 1082733d0b2acb07ede7455b9d020901a10586053923Chris Banes } 1083733d0b2acb07ede7455b9d020901a10586053923Chris Banes 1084733d0b2acb07ede7455b9d020901a10586053923Chris Banes /** 108513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Listener interface for ActionBar navigation events. 108613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 108713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 108813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 108913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 109013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 109113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 109213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public interface OnNavigationListener { 1093bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 109413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This method is called whenever a navigation item in your action bar 109513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * is selected. 1096bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1097bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param itemPosition Position of the item clicked. 109813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param itemId ID of the item clicked. 1099bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return True if the event was handled, false otherwise. 1100bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1101bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 1102bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1103bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1104bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 110513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Listener for receiving events when action bar menus are shown or hidden. 1106bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1107bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface OnMenuVisibilityListener { 110820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1109bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 111013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Called when an action bar menu is shown or hidden. Applications may want to use 111113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 111213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * gameplay, or other activity within the main content area. 1113bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 111413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param isVisible True if an action bar menu is now visible, false if no action bar 111513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * menus are visible. 1116bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1117bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 1118bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1119bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1120bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 112113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A tab in the action bar. 1122bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 112313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Tabs manage the hiding and showing of {@link Fragment}s. 11249dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 112513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 112613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 112713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 112813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 1129bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1130bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static abstract class Tab { 113120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1132bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1133bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * An invalid position for a tab. 1134bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1135bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getPosition() 1136bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1137bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int INVALID_POSITION = -1; 1138bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1139bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1140bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the current position of this tab in the action bar. 1141bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1142bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 1143bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the action bar. 1144bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1145bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getPosition(); 1146bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1147bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1148bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the icon associated with this tab. 1149bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1150bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's icon 1151bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1152bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Drawable getIcon(); 1153bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1154bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the text of this tab. 1156bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1157bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's text 1158bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1159bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getText(); 1160bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1161bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1162bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 1163bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1164bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon The drawable to use as an icon 1165bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1166bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1167bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setIcon(Drawable icon); 1168bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1169bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1170bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 1171bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1172bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID referring to the drawable to use as an icon 1173bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1175b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract Tab setIcon(@DrawableRes int resId); 1176bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1177bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 117813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the text displayed on this tab. Text may be truncated if there is not 117913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * room to display the entire string. 1180bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param text The text to display 1182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setText(CharSequence text); 1185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 118713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the text displayed on this tab. Text may be truncated if there is not 118813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * room to display the entire string. 1189bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the text that should be displayed 1191bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1192bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 119313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setText(int resId); 1194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 119613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a custom view to be used for this tab. This overrides values set by 119713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1198bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom view to be used as a tab. 1200bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1201bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1202bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setCustomView(View view); 1203bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1204bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 120513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a custom view to be used for this tab. This overrides values set by 120613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1207bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1208bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 1209bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1210bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 121113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setCustomView(int layoutResId); 1212bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1213bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve a previously set custom view for this tab. 1215bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1216bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The custom view set by {@link #setCustomView(View)}. 1217bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1218bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 1219bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1220bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1221bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Give this Tab an arbitrary object to hold for later use. 1222bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1223bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param obj Object to store 1224bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1225bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1226bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTag(Object obj); 1227bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1228bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1229bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return This Tab's tag object. 1230bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1231bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Object getTag(); 1232bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1233bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 123413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the {@link TabListener} that will handle switching to and from this tab. 123513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * All tabs must have a TabListener set before being added to the ActionBar. 1236bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener Listener to handle tab selection events 1238bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1239bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1240bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTabListener(TabListener listener); 1241bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1242bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1243bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1244bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1245bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void select(); 1246bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 124813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a description of this tab's content for use in accessibility support. 124913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If no content description is provided the title will be used. 1250bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1251bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the description text 1252bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1253bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 1254bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 1255bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 125613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setContentDescription(int resId); 1257bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1258bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 125913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a description of this tab's content for use in accessibility support. 126013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If no content description is provided the title will be used. 1261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1262bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param contentDesc Description of this tab's content 1263bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1264bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 1265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 1266bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1267bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 1268bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1269bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1270bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 1271bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1272bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Description of this tab's content 1273bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 1274bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 1275bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1276bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getContentDescription(); 1277bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1278bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1279bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 128013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Callback interface invoked when a tab is focused, unfocused, added, or removed. 12819dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 128213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 128313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 128413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 128513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 1286bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1287bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface TabListener { 128820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1289bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1290bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab enters the selected state. 1291bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1292bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was selected 129313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 129413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * during a tab switch. The previous tab's unselect and this tab's select will be 129513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * executed in a single transaction. This FragmentTransaction does not support 129613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * being added to the back stack. 1297bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1298bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 1299bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1300bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1301bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab exits the selected state. 1302bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1303bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was unselected 130413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 130513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * during a tab switch. This tab's unselect and the newly selected tab's select 130613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will be executed in a single transaction. This FragmentTransaction does not 130713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * support being added to the back stack. 1308bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1309bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 1310bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1311bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 131213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Called when a tab that is already selected is chosen again by the user. 131313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Some applications may use this action to return to the top level of a category. 1314bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1315bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was reselected. 131613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 131713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * once this method returns. This FragmentTransaction does not support 131813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * being added to the back stack. 1319bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1320bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 1321bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1322bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1323bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1324bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Per-child layout information associated with action bar custom views. 1325bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 132613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public static class LayoutParams extends ViewGroup.MarginLayoutParams { 1327bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1328bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gravity for the view associated with these LayoutParams. 1329bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1330bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see android.view.Gravity 1331bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 133249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public int gravity = Gravity.NO_GRAVITY; 1333bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 133413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public LayoutParams(@NonNull Context c, AttributeSet attrs) { 1335bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(c, attrs); 1336bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 133713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.ActionBarLayout); 133813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, Gravity.NO_GRAVITY); 1339bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell a.recycle(); 1340bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1341bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1342bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height) { 1343bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 134449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes this.gravity = Gravity.CENTER_VERTICAL | GravityCompat.START; 1345bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1346bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1347bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height, int gravity) { 1348bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 1349bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = gravity; 1350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1351bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1352bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int gravity) { 135313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes this(WRAP_CONTENT, MATCH_PARENT, gravity); 1354bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1355bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1356bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(LayoutParams source) { 1357bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1358bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1359bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = source.gravity; 1360bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1361bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1362bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(ViewGroup.LayoutParams source) { 1363bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1364bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell} 1367