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 * 4913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an 5013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity's window when the activity uses the system's {@link 5113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. 5213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * You may otherwise add the action bar by calling {@link 5313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a 54e9fa476efa74bbcf2b10f82ba23ace88a4cd1e38Ben Murdoch * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. 5513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </p> 569dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 5713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Beginning with Android L (API level 21), the action bar may be represented by any 5813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Toolbar widget within the application layout. The application may signal to the Activity 5913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * which Toolbar should be treated as the Activity's action bar. Activities that use this 6013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * feature should use one of the supplied <code>.NoActionBar</code> themes, set the 61e9fa476efa74bbcf2b10f82ba23ace88a4cd1e38Ben Murdoch * {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code> 6213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * or otherwise not request the window feature.</p> 6320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 6413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>By adjusting the window features requested by the theme and the layouts used for 6513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * an Activity's content view, an app can use the standard system action bar on older platform 6613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * releases and the newer inline toolbars on newer platform releases. The <code>ActionBar</code> 6713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * object obtained from the Activity can be used to control either configuration transparently.</p> 6813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 6913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>When using the Holo themes the action bar shows the application icon on 70bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the left, followed by the activity title. If your activity has an options menu, you can make 71bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * select items accessible directly from the action bar as "action items". You can also 72bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modify various characteristics of the action bar or remove it completely.</p> 7320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 7413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>When using the Material themes (default in API 21 or newer) the navigation button 7513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * (formerly "Home") takes over the space previously occupied by the application icon. 7613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Apps wishing to express a stronger branding should use their brand colors heavily 7713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in the action bar and other application chrome or use a {@link #setLogo(int) logo} 7813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in place of their standard title text.</p> 7913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 80bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 8113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * android.app.Activity#getActionBar getActionBar()}.</p> 8220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 83bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 8413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in 8513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * your activity, you can enable an action mode that offers actions specific to the selected 8613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 8713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for 8813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link ActionBar}.</p> 8920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 90bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <div class="special reference"> 91bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <h3>Developer Guides</h3> 92bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>For information about how to use the action bar, including how to add action items, navigation 93bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 9413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Bar</a> developer guide.</p> 95bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * </div> 96bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 97bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellpublic abstract class ActionBar { 9820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 99b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye /** @hide */ 100b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Retention(RetentionPolicy.SOURCE) 10113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 10213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public @interface NavigationMode {} 103b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye 104bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 10513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Standard navigation mode. Consists of either a logo or icon 10613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and title text with an optional subtitle. Clicking any of these elements 10713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will dispatch onOptionsItemSelected to the host Activity with 10813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a MenuItem with item ID android.R.id.home. 10913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 11013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 11113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 11213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 11313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 114bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 115bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 116bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 117bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 11813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * List navigation mode. Instead of static title text this mode 11913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * presents a list menu for navigation within the activity. 12013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * e.g. this might be presented to the user as a dropdown list. 12113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 12213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 12313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 12413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 12513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 126bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 127bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_LIST = 1; 128bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 129bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 13013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Tab navigation mode. Instead of static title text this mode 13113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * presents a series of tabs for navigation within the activity. 13213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 13313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 13413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 13513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 13613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 137bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 138bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 139bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 140b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye /** @hide */ 141b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @IntDef(flag=true, value={ 142b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_USE_LOGO, 143b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_HOME, 144b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_HOME_AS_UP, 145b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_TITLE, 146b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye DISPLAY_SHOW_CUSTOM 147b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye }) 148b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Retention(RetentionPolicy.SOURCE) 14913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public @interface DisplayOptions {} 150b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye 151bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 15213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Use logo instead of icon if available. This flag will cause appropriate 15313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation modes to use a wider logo in place of the standard icon. 154bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 156bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 157bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 158bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 159bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 160bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 16113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Show 'home' elements in this action bar, leaving more space for other 16213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation elements. This includes logo and icon. 163bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 164bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 165bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 166bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 167bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 168bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 169bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 17013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Display the 'home' element such that it appears as an 'up' affordance. 17113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * e.g. show an arrow to the left indicating the action that will be taken. 172bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 17313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set this flag if selecting the 'home' button in the action bar to return 17413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * up by a single level in your UI rather than back to the top level or front page. 175bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 17613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Setting this option will implicitly enable interaction with the home/up 17713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * button. See {@link #setHomeButtonEnabled(boolean)}. 178bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 179bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 180bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the activity title and subtitle, if present. 186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 188bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 189bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 191bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 192bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 193bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 197bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the custom view if one has been set. 19820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setCustomView(View) 200bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 201bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 202bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 203bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 204bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 205bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 20613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 20713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 208bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 20913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Custom navigation views appear between the application icon and 21013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 21113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 21213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 213bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes. 214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 215bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom navigation view to place in the ActionBar. 216bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 217bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view); 218bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 219bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 22013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 22113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 222bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Custom navigation views appear between the application icon and 22413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 22513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 22613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 227bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 228bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 23013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the custom view to be displayed.</p> 231bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 23213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param view Custom navigation view to place in the ActionBar. 233bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutParams How this custom view should layout in the bar. 23413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 235bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 236bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 238bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 239bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 24013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar into custom navigation mode, supplying a view 24113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * for custom navigation. 242bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Custom navigation views appear between the application icon and 24413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * any action buttons and may use any space available there. Common 24513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * use cases for custom navigation views might include an auto-suggesting 24613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * address bar for a browser or other navigation mechanisms that do not 247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 248bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 25013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the custom view to be displayed.</p> 251bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 252bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 25313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 254bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 255bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 25613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setCustomView(int resId); 257bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 258bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 25913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the icon to display in the 'home' section of the action bar. 26013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use an icon specified by its style or the 26113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity icon by default. 262bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 26313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 26413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 266bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as an icon. 26713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 268bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 269bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 270bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 271b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setIcon(@DrawableRes int resId); 272bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 273bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 27413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the icon to display in the 'home' section of the action bar. 27513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use an icon specified by its style or the 27613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity icon by default. 277bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 27813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 27913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 280bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 281bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon Drawable to show as an icon. 28213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 283bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 284bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 285bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 286bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setIcon(Drawable icon); 287bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 288bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 28913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the logo to display in the 'home' section of the action bar. 29013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use a logo specified by its style or the 29113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity logo by default. 292bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 29313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 29413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 296bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as a logo. 29713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 298bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 299bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 300bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 301b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setLogo(@DrawableRes int resId); 302bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 303bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 30413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the logo to display in the 'home' section of the action bar. 30513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar will use a logo specified by its style or the 30613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * activity logo by default. 307bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 30813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Whether the home section shows an icon or logo is controlled 30913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * by the display option {@link #DISPLAY_USE_LOGO}. 310bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 311bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param logo Drawable to show as a logo. 31213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 314bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 315bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 316bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setLogo(Drawable logo); 317bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 318bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 319bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the adapter and navigation callback for list navigation mode. 320bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The supplied adapter will provide views for the expanded list as well as 32213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the currently selected item. (These may be displayed differently.) 323bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The supplied OnNavigationListener will alert the application when the user 32513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * changes the current list selection. 326bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param adapter An adapter that will provide views both to display 32813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the current navigation selection and populate views 32913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * within the dropdown navigation menu. 33013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param callback An OnNavigationListener that will receive events when the user 33113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * selects a navigation item. 33213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 33313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 33413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 33513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 33613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 337bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 338bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 339bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell OnNavigationListener callback); 340bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 341bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 342bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the selected navigation item in list or tabbed navigation modes. 343bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 344bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the item to select. 34513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 34613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 34713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 34813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 34913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 351bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSelectedNavigationItem(int position); 352bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 353bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 354bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 355bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 356bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Position of the selected item. 35713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 35813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 35913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 36013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 36113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 362bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 363bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getSelectedNavigationIndex(); 364bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the number of navigation items present in the current navigation mode. 367bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 368bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Number of navigation items. 36913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 37013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 37113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 37213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 37313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 374bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 375bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationItemCount(); 376bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 377bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 37813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's title. This will only be displayed if 37913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 380bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 381bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param title Title to set 38213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 383bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 384bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 385bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 386bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setTitle(CharSequence title); 387bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 388bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 38913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's title. This will only be displayed if 39013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 391bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 392bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of title string to set 39313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 394bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 395bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 396bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 397b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setTitle(@StringRes int resId); 398bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 399bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 40013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's subtitle. This will only be displayed if 40113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 40213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * subtitle entirely. 403bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 404bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param subtitle Subtitle to set 40513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 406bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 407bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 408bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 40913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setSubtitle(CharSequence subtitle); 410bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 411bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 41213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the action bar's subtitle. This will only be displayed if 41313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_TITLE} is set. 414bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 415bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of subtitle string to set 41613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 417bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 418bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 419bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 42013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setSubtitle(int resId); 421bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 422bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 42313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set display options. This changes all display option bits at once. To change 42413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 425bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 42613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param options A combination of the bits defined by the DISPLAY_ constants 42713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * defined in ActionBar. 428bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 429b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 430bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 431bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 43213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set selected display options. Only the options specified by mask will be changed. 43313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 434bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 43513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 43613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #DISPLAY_SHOW_HOME} option. 43713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 43813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 439bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 44013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param options A combination of the bits defined by the DISPLAY_ constants 44113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * defined in ActionBar. 44213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param mask A bit mask declaring which display options should be changed. 443bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 44413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 445bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 446bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 44713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether to display the activity logo rather than the activity icon. 44813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A logo is often a wider, more detailed image. 449bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 450bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 451bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 452bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 45313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 454bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 455bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 456bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 457bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 458bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 459bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 46013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether to include the application home affordance in the action bar. 46113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Home is presented as either an activity icon or logo. 462bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 463bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 464bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 465bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showHome true to show home, false otherwise. 46613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 467bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 468bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 469bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 470bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 471bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 472bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 47313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set whether home should be displayed as an "up" affordance. 47413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set this to true if selecting "home" returns up by a single level in your UI 47513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * rather than back to the top level or front page. 476bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 477bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 478bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 47913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param showHomeAsUp true to show the user that selecting home will return one 48013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * level up rather than to the top level of the app. 48113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 482bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 483bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 484bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 485bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 486bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 487bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 488bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether an activity title/subtitle should be displayed. 489bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 490bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 491bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 492bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showTitle true to display a title/subtitle if present. 493bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 494bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 495bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 496bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 497bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 498bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 499bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether a custom view should be displayed, if set. 500bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 501bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 502bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 50313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param showCustom true if the currently set custom view should be displayed, false otherwise. 50413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 505bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 506bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 507bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 508bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 509bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 510bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 51113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's background. This will be used for the primary 51213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * action bar. 513bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 514bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable 515bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 516bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 517bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 51813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract void setBackgroundDrawable(@Nullable Drawable d); 519bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 520bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 52113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's stacked background. This will appear 52213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * in the second row/stacked bar on some devices and configurations. 523bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 524bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the stacked row 525bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 52613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setStackedBackgroundDrawable(Drawable d) { } 527bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 528bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 52913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the ActionBar's split background. This will appear in 53013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the split action bar containing menu-provided action buttons 53113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * on some devices and configurations. 532bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 533bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 534bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the split bar 535bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 53613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setSplitBackgroundDrawable(Drawable d) { } 537bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 538bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 539bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current custom view. 540bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 541bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 542bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 543bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 54413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the current ActionBar title in standard mode. 54513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns null if {@link #getNavigationMode()} would not return 54613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #NAVIGATION_MODE_STANDARD}. 547bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 548bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar title or null. 549bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 550b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 551bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getTitle(); 552bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 553bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 55413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the current ActionBar subtitle in standard mode. 55513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns null if {@link #getNavigationMode()} would not return 55613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #NAVIGATION_MODE_STANDARD}. 557bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 558bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar subtitle or null. 559bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 560b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 561bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getSubtitle(); 562bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 563bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 564bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the current navigation mode. The result will be one of: 56513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <ul> 56613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 567bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 56813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <li>{@link #NAVIGATION_MODE_TABS}</li> 56913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </ul> 570bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 571bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current navigation mode. 57213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 57313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 57413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 57513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 57613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 577bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 578b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @NavigationMode 579bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationMode(); 580bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 581bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 582bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the current navigation mode. 583bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 584bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param mode The new mode to set. 585bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_STANDARD 586bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_LIST 587bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_TABS 58813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 58913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 59013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 59113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 59213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 593bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 594b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 595bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 596bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 597bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current set of display options. 598bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 599b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @DisplayOptions 600bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getDisplayOptions(); 601bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 602bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 60313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Create and return a new {@link Tab}. 60413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This tab will not be included in the action bar until it is added. 605bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 60613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Very often tabs will be used to switch between {@link Fragment} 60713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * objects. Here is a typical implementation of such tabs:</p> 608bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 609bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 61013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * complete} 611bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 612bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A new Tab 61313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 614bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #addTab(Tab) 61513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 61613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 61713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 61813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 61913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 620bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 621bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab newTab(); 622bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 623bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 62413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 62513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If this is the first tab to be added it will become the selected tab. 626bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 627bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to add 62813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 62913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 63013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 63113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 63213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 633bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 634bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab); 635bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 636bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 637bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 638bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 63913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab Tab to add 640bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 64113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 64213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 64313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 64413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 64513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 646bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 647bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, boolean setSelected); 648bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 649bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 650bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 65113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <code>position</code>. If this is the first tab to be added it will become 65213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the selected tab. 653bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 65413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab The tab to add 655bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position The new position of the tab 65613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 65713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 65813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 65913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 66013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 661bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 662bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position); 663bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 664bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 665bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 666bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <code>position</code>. 667bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 66813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param tab The tab to add 66913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param position The new position of the tab 670bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 67113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 67213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 67313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 67413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 67513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 676bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 677bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 678bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 679bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 68013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a tab from the action bar. If the removed tab was selected it will be deselected 68113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and another tab will be selected if present. 682bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 683bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab to remove 68413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 68513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 68613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 68713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 68813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 689bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 690bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTab(Tab tab); 691bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 692bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 69313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a tab from the action bar. If the removed tab was selected it will be deselected 69413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * and another tab will be selected if present. 695bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 696bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the tab to remove 69713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 69813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 69913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 70013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 70113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 702bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 703bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTabAt(int position); 704bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 705bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 706bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Remove all tabs from the action bar and deselect the current tab. 70713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 70813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 70913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 71013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 71113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 712bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 713bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeAllTabs(); 714bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 715bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 716bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 717bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 718bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 719bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 720bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to select 72113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 72213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 72313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 72413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 72513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 726bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 727bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void selectTab(Tab tab); 728bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 729bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 73013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns the currently selected tab if in tabbed navigation mode and there is at least 73113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * one tab present. 732bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 733bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The currently selected tab or null 73413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 73513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 73613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 73713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 73813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 739bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 740b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye @Nullable 741bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getSelectedTab(); 742bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 743bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 744bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the tab at the specified index. 745bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 746bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param index Index value in the range 0-get 74713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return 74813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 74913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 75013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 75113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 75213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 753bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 754bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getTabAt(int index); 755bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 756bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 757bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the number of tabs currently registered with the action bar. 75820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 759bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Tab count 76013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 76113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 76213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 76313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 76413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 765bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 766bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getTabCount(); 767bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 768bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 769bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve the current height of the ActionBar. 770bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 771bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The ActionBar's height 772bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 773bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getHeight(); 774bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 775bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 77613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Show the ActionBar if it is not currently showing. 77713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If the window hosting the ActionBar does not have the feature 77813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 779bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * content to fit the new space available. 780bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 78113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>If you are hiding the ActionBar through 78213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 78313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * you should not call this function directly. 784bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 785bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void show(); 786bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 787bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 78813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Hide the ActionBar if it is currently showing. 78913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If the window hosting the ActionBar does not have the feature 79013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 79113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * content to fit the new space available. 792bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 79313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Instead of calling this function directly, you can also cause an 79413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * ActionBar using the overlay feature to hide through 79513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 79613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Hiding the ActionBar through this system UI flag allows you to more 79713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * seamlessly hide it in conjunction with other screen decorations. 798bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 799bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void hide(); 800bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 801bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 802bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 803bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 804bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract boolean isShowing(); 805bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 806bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 807bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a listener that will respond to menu visibility change events. 808bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 809bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener The new listener to add 810bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 811bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 812bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 813bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 81413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Remove a menu visibility listener. This listener will no longer receive menu 81513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * visibility change events. 816bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 817bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener A listener to remove that was previously added 818bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 819bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 820bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 821bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 82213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Enable or disable the "home" button in the corner of the action bar. (Note that this 82313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * is the application home/up affordance on the action bar, not the systemwide home 82413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * button.) 825bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 82613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>This defaults to true for packages targeting < API 14. For packages targeting 82713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * API 14 or greater, the application should call this method to enable interaction 82813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * with the home/up affordance. 829bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 83013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 83113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * the home button. 832bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 833bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param enabled true to enable the home button, false to disable the home button. 834bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 83513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHomeButtonEnabled(boolean enabled) { } 836bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 837bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 83813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns a {@link Context} with an appropriate theme for creating views that 83913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will appear in the action bar. If you are inflating or instantiating custom views 84013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * that will appear in an action bar, you should use the Context returned by this method. 84113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * (This includes adapters used for list navigation mode.) 84213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This will ensure that views contrast properly against the action bar. 843bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 844bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A themed Context for creating views 845bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 84620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public Context getThemedContext() { 84720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns return null; 84820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 849bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 850bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 85113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Returns true if the Title field has been truncated during layout for lack 85213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * of available space. 85313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 85413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return true if the Title field has been truncated 85513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @hide pending API approval 85613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 85713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean isTitleTruncated() { return false; } 85813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 85913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 860f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 861f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 862f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 863f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 864f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>null</code> to this method, the default drawable from the theme 865f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 866f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 867f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 868f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 869f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 870f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 871f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param indicator A drawable to use for the up indicator, or null to use the theme's default 872f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 873f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 874f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 875f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 876f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 877b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeAsUpIndicator(@Nullable Drawable indicator) {} 878f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 879f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 880f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 881f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 882f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 883f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 884f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>0</code> to this method, the default drawable from the theme 885f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 886f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 887f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 888f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 889f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 890f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 891b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye * @param resId Resource ID of a drawable to use for the up indicator, or 0 892f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to use the theme's default 893f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 894f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 895f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 896f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 897f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 898b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeAsUpIndicator(@DrawableRes int resId) {} 899f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 900f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 901f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 902f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 903f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 904f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 905f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 906f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 907f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 908f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 909f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 910f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 911f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>null</code> will use the system default description.</p> 912f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 913f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param description New description for the Home action when enabled 914f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 915f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 916f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 917b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeActionContentDescription(@Nullable CharSequence description) {} 918f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 919f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 920f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 921f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 922f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 923f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 924f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 925f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 926f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 927f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 928f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 929f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 930f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>0</code> will use the system default description.</p> 931f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 932f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param resId Resource ID of a string to use as the new description 933f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * for the Home action when enabled 934f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 935f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 936f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 937b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public void setHomeActionContentDescription(@StringRes int resId) {} 938f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 939f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 94013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Enable hiding the action bar on content scroll. 94113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 94213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>If enabled, the action bar will scroll out of sight along with a 943e9fa476efa74bbcf2b10f82ba23ace88a4cd1e38Ben Murdoch * {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content. 94413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode} 94513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * to enable hiding on content scroll.</p> 94613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 94713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>When partially scrolled off screen the action bar is considered 94813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view. 94913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * </p> 95013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param hideOnContentScroll true to enable hiding on content scroll. 95113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 95213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) { 95313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes if (hideOnContentScroll) { 95413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes throw new UnsupportedOperationException("Hide on content scroll is not supported in " + 95513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes "this action bar configuration."); 95613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 95713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 95813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 95913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 96013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Return whether the action bar is configured to scroll out of sight along with 96113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}. 9629dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 96313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return true if hide-on-content-scroll is enabled 96413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @see #setHideOnContentScrollEnabled(boolean) 965bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 96613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean isHideOnContentScrollEnabled() { 96713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 96813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 96913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 97013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 97113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Return the current vertical offset of the action bar. 97213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 97313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The action bar's current hide offset is the distance that the action bar is currently 97413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 97513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * current measured {@link #getHeight() height} (fully invisible).</p> 97613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 97713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @return The action bar's offset toward its fully hidden state in pixels 97813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 97913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public int getHideOffset() { 98013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return 0; 98113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 98213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 98313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 98413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the current hide offset of the action bar. 98513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 98613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>The action bar's current hide offset is the distance that the action bar is currently 98713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 98813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * current measured {@link #getHeight() height} (fully invisible).</p> 98913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 99013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param offset The action bar's offset toward its fully hidden state in pixels. 99113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 99213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setHideOffset(int offset) { 99313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes if (offset != 0) { 99413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes throw new UnsupportedOperationException("Setting an explicit action bar hide offset " + 99513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes "is not supported in this action bar configuration."); 99613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 99713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 99813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 99949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 100049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Set the Z-axis elevation of the action bar in pixels. 100149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 100249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 100349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * values are closer to the user.</p> 100449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 100549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param elevation Elevation value in pixels 100649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 100749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setElevation(float elevation) { 100849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes if (elevation != 0) { 100949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes throw new UnsupportedOperationException("Setting a non-zero elevation is " + 101049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes "not supported in this action bar configuration."); 101149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 101249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 101349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 101449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 101549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Get the Z-axis elevation of the action bar in pixels. 101649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 101749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 101849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * values are closer to the user.</p> 101949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 102049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return Elevation value in pixels 102149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 102249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getElevation() { 102349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return 0; 102449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 102549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 102613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 102713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { 102813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 102913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 103013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 103113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void setShowHideAnimationEnabled(boolean enabled) { 103213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 103313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 103413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 103513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void onConfigurationChanged(Configuration config) { 103613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 103713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 103813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 103913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public void dispatchMenuVisibilityChanged(boolean visible) { 104013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 104113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 104213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 104313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public ActionMode startActionMode(ActionMode.Callback callback) { 104413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return null; 104513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 104620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 104713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 104813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean openOptionsMenu() { 104913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 105013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 105113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 105213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 105313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean invalidateOptionsMenu() { 105413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 105513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 105613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 105713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 105813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean onMenuKeyEvent(KeyEvent event) { 105913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 106013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 106113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 1062d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes /** @hide **/ 1063d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes public boolean onKeyShortcut(int keyCode, KeyEvent ev) { 1064d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes return false; 1065d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes } 1066d15ee7df01f2f48b536a610c4739f33b226d3f81Chris Banes 106713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** @hide */ 106813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public boolean collapseActionView() { 106913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes return false; 107013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes } 107113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes 1072ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes /** @hide */ 1073ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes public void setWindowTitle(CharSequence title) { 1074ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes } 1075ca58f2ce7cd9f0e0f2c4a46c3bcc98013209f6b3Chris Banes 107613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes /** 107713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Listener interface for ActionBar navigation events. 107813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * 107913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 108013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 108113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 108213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 108313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes */ 108413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public interface OnNavigationListener { 1085bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 108613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * This method is called whenever a navigation item in your action bar 108713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * is selected. 1088bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1089bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param itemPosition Position of the item clicked. 109013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param itemId ID of the item clicked. 1091bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return True if the event was handled, false otherwise. 1092bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1093bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 1094bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1095bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1096bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 109713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Listener for receiving events when action bar menus are shown or hidden. 1098bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1099bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface OnMenuVisibilityListener { 110020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1101bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 110213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Called when an action bar menu is shown or hidden. Applications may want to use 110313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 110413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * gameplay, or other activity within the main content area. 1105bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 110613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param isVisible True if an action bar menu is now visible, false if no action bar 110713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * menus are visible. 1108bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1109bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 1110bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1111bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1112bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 111313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * A tab in the action bar. 1114bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 111513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <p>Tabs manage the hiding and showing of {@link Fragment}s. 11169dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 111713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 111813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 111913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 112013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 1121bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1122bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static abstract class Tab { 112320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1124bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1125bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * An invalid position for a tab. 1126bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1127bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getPosition() 1128bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1129bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int INVALID_POSITION = -1; 1130bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1131bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1132bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the current position of this tab in the action bar. 1133bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1134bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 1135bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the action bar. 1136bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1137bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getPosition(); 1138bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1139bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1140bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the icon associated with this tab. 1141bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1142bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's icon 1143bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1144bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Drawable getIcon(); 1145bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1146bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1147bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the text of this tab. 1148bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1149bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's text 1150bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1151bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getText(); 1152bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1153bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1154bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 1155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1156bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon The drawable to use as an icon 1157bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1158bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1159bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setIcon(Drawable icon); 1160bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1161bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1162bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 1163bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1164bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID referring to the drawable to use as an icon 1165bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1166bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1167b933f9c89bbe890ff6753559b83c0ecf236472ddTor Norbye public abstract Tab setIcon(@DrawableRes int resId); 1168bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1169bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 117013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the text displayed on this tab. Text may be truncated if there is not 117113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * room to display the entire string. 1172bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1173bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param text The text to display 1174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1175bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1176bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setText(CharSequence text); 1177bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1178bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 117913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the text displayed on this tab. Text may be truncated if there is not 118013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * room to display the entire string. 1181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the text that should be displayed 1183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 118513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setText(int resId); 1186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 118813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a custom view to be used for this tab. This overrides values set by 118913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1191bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom view to be used as a tab. 1192bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1193bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setCustomView(View view); 1195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 119713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a custom view to be used for this tab. This overrides values set by 119813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1200bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 1201bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1202bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 120313ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setCustomView(int layoutResId); 1204bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1205bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1206bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve a previously set custom view for this tab. 1207bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1208bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The custom view set by {@link #setCustomView(View)}. 1209bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1210bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 1211bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1212bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1213bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Give this Tab an arbitrary object to hold for later use. 1214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1215bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param obj Object to store 1216bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1217bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1218bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTag(Object obj); 1219bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1220bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1221bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return This Tab's tag object. 1222bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1223bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Object getTag(); 1224bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1225bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 122613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set the {@link TabListener} that will handle switching to and from this tab. 122713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * All tabs must have a TabListener set before being added to the ActionBar. 1228bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1229bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener Listener to handle tab selection events 1230bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1231bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1232bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTabListener(TabListener listener); 1233bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1234bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1235bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1236bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void select(); 1238bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1239bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 124013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a description of this tab's content for use in accessibility support. 124113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If no content description is provided the title will be used. 1242bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1243bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the description text 1244bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1245bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 1246bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 1247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 124813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public abstract Tab setContentDescription(int resId); 1249bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1250bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 125113ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Set a description of this tab's content for use in accessibility support. 125213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * If no content description is provided the title will be used. 1253bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1254bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param contentDesc Description of this tab's content 1255bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 1256bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 1257bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 1258bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1259bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 1260bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1262bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 1263bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1264bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Description of this tab's content 1265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 1266bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 1267bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1268bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getContentDescription(); 1269bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1270bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1271bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 127213ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Callback interface invoked when a tab is focused, unfocused, added, or removed. 12739dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 127413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @deprecated Action bar navigation modes are deprecated and not supported by inline 127513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * toolbar action bars. Consider using other 127613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * <a href="http://developer.android.com/design/patterns/navigation.html">common 127713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * navigation patterns</a> instead. 1278bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1279bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface TabListener { 128020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1281bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1282bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab enters the selected state. 1283bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1284bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was selected 128513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 128613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * during a tab switch. The previous tab's unselect and this tab's select will be 128713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * executed in a single transaction. This FragmentTransaction does not support 128813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * being added to the back stack. 1289bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1290bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 1291bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1292bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1293bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab exits the selected state. 1294bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was unselected 129613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 129713ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * during a tab switch. This tab's unselect and the newly selected tab's select 129813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * will be executed in a single transaction. This FragmentTransaction does not 129913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * support being added to the back stack. 1300bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1301bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 1302bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1303bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 130413ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Called when a tab that is already selected is chosen again by the user. 130513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * Some applications may use this action to return to the top level of a category. 1306bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1307bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was reselected. 130813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 130913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * once this method returns. This FragmentTransaction does not support 131013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes * being added to the back stack. 1311bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1312bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 1313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1314bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1315bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1316bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Per-child layout information associated with action bar custom views. 1317bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 131813ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public static class LayoutParams extends ViewGroup.MarginLayoutParams { 1319bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1320bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gravity for the view associated with these LayoutParams. 1321bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1322bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see android.view.Gravity 1323bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 132449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public int gravity = Gravity.NO_GRAVITY; 1325bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 132613ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes public LayoutParams(@NonNull Context c, AttributeSet attrs) { 1327bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(c, attrs); 1328bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 132913ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.ActionBarLayout); 133013ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, Gravity.NO_GRAVITY); 1331bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell a.recycle(); 1332bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1333bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1334bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height) { 1335bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 133649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes this.gravity = Gravity.CENTER_VERTICAL | GravityCompat.START; 1337bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1338bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1339bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height, int gravity) { 1340bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 1341bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = gravity; 1342bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1343bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1344bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int gravity) { 134513ab4aa8a1d337c414c887a81b9829f2286cdd37Chris Banes this(WRAP_CONTENT, MATCH_PARENT, gravity); 1346bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1347bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1348bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(LayoutParams source) { 1349bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1351bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = source.gravity; 1352bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1353bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1354bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(ViewGroup.LayoutParams source) { 1355bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1356bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1357bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1358bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1359bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1360bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Interface implemented by entities such as Activities that host action bars. 1361bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1362bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell interface Callback { 136320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1364bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell FragmentManager getSupportFragmentManager(); 1365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell} 1367