ActionBar.java revision e43340c80dc66c45edc793ecd0343774aa34d108
133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/* 233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Copyright (C) 2010 The Android Open Source Project 333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * you may not use this file except in compliance with the License. 633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * You may obtain a copy of the License at 733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * http://www.apache.org/licenses/LICENSE-2.0 933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 1033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Unless required by applicable law or agreed to in writing, software 1133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * distributed under the License is distributed on an "AS IS" BASIS, 1233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * See the License for the specific language governing permissions and 1433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * limitations under the License. 1533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 1733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpackage android.app; 1833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 19d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport android.annotation.IntDef; 20d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport android.annotation.NonNull; 21d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport android.annotation.Nullable; 229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.Context; 23e43340c80dc66c45edc793ecd0343774aa34d108Adam Powellimport android.content.res.Configuration; 249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.res.TypedArray; 2533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.graphics.drawable.Drawable; 269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.util.AttributeSet; 27e43340c80dc66c45edc793ecd0343774aa34d108Adam Powellimport android.view.ActionMode; 289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.Gravity; 2933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.view.View; 309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewDebug; 319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup; 329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup.MarginLayoutParams; 336b336f835d637853800b94689375a03f337139a4Adam Powellimport android.view.Window; 34a408291e22def5755559f42cde913706a6d628c0Adam Powellimport android.widget.SpinnerAdapter; 35e43340c80dc66c45edc793ecd0343774aa34d108Adam Powellimport android.widget.Toolbar; 3633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 37d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.Retention; 38d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.RetentionPolicy; 39e43340c80dc66c45edc793ecd0343774aa34d108Adam Powellimport java.util.Map; 40d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 4133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/** 42e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * A primary toolbar within the activity that may display the activity title, application-level 43e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * navigation affordances, and other interactive items. 44e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 45e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an 46e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * activity's window when the activity uses the system's {@link 47e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. 48e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * You may otherwise add the action bar by calling {@link 49e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a 50e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. 51e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * </p> 52e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 53e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>Beginning with Android L (API level 21), the action bar may be represented by any 54e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * Toolbar widget within the application layout. The application may signal to the Activity 55e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * which Toolbar should be treated as the Activity's action bar. Activities that use this 56e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * feature should use one of the supplied <code>.NoActionBar</code> themes, set the 57e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code> 58e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * or otherwise not request the window feature.</p> 59e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 60e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>By adjusting the window features requested by the theme and the layouts used for 61e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * an Activity's content view, an app can use the standard system action bar on older platform 62e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * releases and the newer inline toolbars on newer platform releases. The <code>ActionBar</code> 63e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * object obtained from the Activity can be used to control either configuration transparently.</p> 64e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 65e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>When using the Holo themes the action bar shows the application icon on 66e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * the left, followed by the activity title. If your activity has an options menu, you can make 67e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * select items accessible directly from the action bar as "action items". You can also 68e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * modify various characteristics of the action bar or remove it completely.</p> 69e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 70e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>When using the Quantum themes (default in API 21 or newer) the navigation button 71e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * (formerly "Home") takes over the space previously occupied by the application icon. 72e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * Apps wishing to express a stronger branding should use their brand colors heavily 73e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * in the action bar and other application chrome or use a {@link #setLogo(int) logo} 74e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * in place of their standard title text.</p> 75e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 7636193d09a87035395d036a730038b765ac0b0913Scott Main * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 7736193d09a87035395d036a730038b765ac0b0913Scott Main * android.app.Activity#getActionBar getActionBar()}.</p> 78e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 79e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 80e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in 81e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * your activity, you can enable an action mode that offers actions specific to the selected 82e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 83e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for 84e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * {@link ActionBar}.</p> 85e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 86b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <div class="special reference"> 87b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <h3>Developer Guides</h3> 88b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <p>For information about how to use the action bar, including how to add action items, navigation 89b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 90b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * Bar</a> developer guide.</p> 91b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * </div> 9233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 9333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar { 94d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 95d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 96d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 97d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface NavigationMode {} 98d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 99a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 100a408291e22def5755559f42cde913706a6d628c0Adam Powell * Standard navigation mode. Consists of either a logo or icon 101a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * and title text with an optional subtitle. Clicking any of these elements 102cf0357639e952a87f0d535c82691919af81f058bAdam Powell * will dispatch onOptionsItemSelected to the host Activity with 103a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a MenuItem with item ID android.R.id.home. 104fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 105fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 106fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 107fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 108fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 109a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 110a408291e22def5755559f42cde913706a6d628c0Adam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 11133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 11233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * List navigation mode. Instead of static title text this mode 1149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * presents a list menu for navigation within the activity. 1159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. this might be presented to the user as a dropdown list. 116fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 117fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 118fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 119fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 120fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 12133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int NAVIGATION_MODE_LIST = 1; 12333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 12433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 12533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Tab navigation mode. Instead of static title text this mode 12633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * presents a series of tabs for navigation within the activity. 127fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 128fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 129fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 130fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 131fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 13233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 13333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 13433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 135d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 136d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 137d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef(flag = true, 138d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye value = { 139d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_USE_LOGO, 140d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_HOME, 141d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_HOME_AS_UP, 142d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_TITLE, 143d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_CUSTOM, 144d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_TITLE_MULTIPLE_LINES 145d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye }) 146d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface DisplayOptions {} 147d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 14833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 14933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Use logo instead of icon if available. This flag will cause appropriate 15033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation modes to use a wider logo in place of the standard icon. 1519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 15433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 15533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 15633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 15733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show 'home' elements in this action bar, leaving more space for other 15933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation elements. This includes logo and icon. 1609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 1659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Display the 'home' element such that it appears as an 'up' affordance. 1689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. show an arrow to the left indicating the action that will be taken. 1699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set this flag if selecting the 'home' button in the action bar to return 1719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * up by a single level in your UI rather than back to the top level or front page. 1729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 173c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting this option will implicitly enable interaction with the home/up 174c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button. See {@link #setHomeButtonEnabled(boolean)}. 175c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 1769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 1809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the activity title and subtitle, if present. 1839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(CharSequence) 1859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(int) 1869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(CharSequence) 1879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(int) 1889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 1929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the custom view if one has been set. 1959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setCustomView(View) 1969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 2009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 20227cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Allow the title to wrap onto multiple lines if space is available 20327cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 20427cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 20527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public static final int DISPLAY_TITLE_MULTIPLE_LINES = 0x20; 20627cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 20727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 2089ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the action bar into custom navigation mode, supplying a view 2099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * for custom navigation. 2109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Custom navigation views appear between the application icon and 2129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * any action buttons and may use any space available there. Common 2139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * use cases for custom navigation views might include an auto-suggesting 2149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * address bar for a browser or other navigation mechanisms that do not 2159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * translate well to provided navigation modes. 2169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param view Custom navigation view to place in the ActionBar. 21833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view); 22089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell 22133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 222a408291e22def5755559f42cde913706a6d628c0Adam Powell * Set the action bar into custom navigation mode, supplying a view 223a408291e22def5755559f42cde913706a6d628c0Adam Powell * for custom navigation. 22433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 225ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>Custom navigation views appear between the application icon and 22633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * any action buttons and may use any space available there. Common 227a408291e22def5755559f42cde913706a6d628c0Adam Powell * use cases for custom navigation views might include an auto-suggesting 228a408291e22def5755559f42cde913706a6d628c0Adam Powell * address bar for a browser or other navigation mechanisms that do not 229ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * translate well to provided navigation modes.</p> 230ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 231ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 232ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * the custom view to be displayed.</p> 23333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 23433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param view Custom navigation view to place in the ActionBar. 2359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param layoutParams How this custom view should layout in the bar. 236ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 237ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 23833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 2409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2423f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set the action bar into custom navigation mode, supplying a view 2433f476b34049d062942eafcf48396f593e00bd324Adam Powell * for custom navigation. 2443f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2453f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>Custom navigation views appear between the application icon and 2463f476b34049d062942eafcf48396f593e00bd324Adam Powell * any action buttons and may use any space available there. Common 2473f476b34049d062942eafcf48396f593e00bd324Adam Powell * use cases for custom navigation views might include an auto-suggesting 2483f476b34049d062942eafcf48396f593e00bd324Adam Powell * address bar for a browser or other navigation mechanisms that do not 2493f476b34049d062942eafcf48396f593e00bd324Adam Powell * translate well to provided navigation modes.</p> 2503f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2513f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 2523f476b34049d062942eafcf48396f593e00bd324Adam Powell * the custom view to be displayed.</p> 2533f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2543f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 2553f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2563f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 2573f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 2583f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setCustomView(int resId); 2593f476b34049d062942eafcf48396f593e00bd324Adam Powell 2603f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 2611969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2621969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2631969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2641969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2651969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2661969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2671969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2681969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as an icon. 2691969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2701969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2711969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2721969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2731969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(int resId); 2741969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2751969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2761969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2771969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2781969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2791969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2801969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2811969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2821969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2831969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param icon Drawable to show as an icon. 2841969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2851969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2861969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2871969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2881969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(Drawable icon); 2891969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2901969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2911969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 2921969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 2931969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 2941969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2951969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2961969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2971969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2981969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as a logo. 2991969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3001969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 3011969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 3021969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 3031969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(int resId); 3041969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 3051969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 3061969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 3071969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 3081969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 3091969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3101969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 3111969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 3121969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3131969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param logo Drawable to show as a logo. 3141969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3151969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 3161969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 3171969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 3181969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(Drawable logo); 3191969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 3201969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 3219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the adapter and navigation callback for list navigation mode. 3229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * The supplied adapter will provide views for the expanded list as well as 3249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the currently selected item. (These may be displayed differently.) 3259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3268515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * The supplied OnNavigationListener will alert the application when the user 3279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * changes the current list selection. 3289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param adapter An adapter that will provide views both to display 3309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the current navigation selection and populate views 3319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * within the dropdown navigation menu. 3328515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param callback An OnNavigationListener that will receive events when the user 3339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * selects a navigation item. 334fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 335fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 336fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 337fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 338fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 3418515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell OnNavigationListener callback); 3429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the selected navigation item in list or tabbed navigation modes. 345178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 346178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param position Position of the item to select. 347fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 348fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 349fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 350fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 351fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 352178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 353178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract void setSelectedNavigationItem(int position); 354178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 355178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 3569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 357178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 358178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @return Position of the selected item. 359fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 360fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 361fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 362fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 363fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getSelectedNavigationIndex(); 3669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the number of navigation items present in the current navigation mode. 3699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return Number of navigation items. 371fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 372fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 373fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 374fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 375fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getNavigationItemCount(); 3789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 380ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 381ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 3820e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 3830e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param title Title to set 384a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 385a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(int) 386ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 3870e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 3880e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setTitle(CharSequence title); 3890e94b5151d817e600a888448a662208b29b5ef46Adam Powell 3900e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 391ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 392ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 393a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 394a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of title string to set 395a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 396a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(CharSequence) 397ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 398a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 399a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell public abstract void setTitle(int resId); 400a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 401a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 402ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 403ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 404ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * subtitle entirely. 4050e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 4060e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param subtitle Subtitle to set 407a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 408a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(int) 409ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 4100e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 4110e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setSubtitle(CharSequence subtitle); 4120e94b5151d817e600a888448a662208b29b5ef46Adam Powell 4130e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 414ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 415ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 416a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 417a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of subtitle string to set 418a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 419a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(CharSequence) 420ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 421a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 422a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell public abstract void setSubtitle(int resId); 423a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 424a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 425a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set display options. This changes all display option bits at once. To change 426a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 42733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 42833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 42933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * defined in ActionBar. 43033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 431d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 43233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 43333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 434a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set selected display options. Only the options specified by mask will be changed. 435a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 436a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 4379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 4389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * {@link #DISPLAY_SHOW_HOME} option. 4395ad7af6fc764f71765b134b8cd51787a7e78753aBen Komalo * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 4409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 441a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 442a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 443a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * defined in ActionBar. 444a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param mask A bit mask declaring which display options should be changed. 445a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 446d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 4473f476b34049d062942eafcf48396f593e00bd324Adam Powell 4483f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4493f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to display the activity logo rather than the activity icon. 4503f476b34049d062942eafcf48396f593e00bd324Adam Powell * A logo is often a wider, more detailed image. 4513f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4523f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4533f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4543f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 4553f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4563f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4573f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4583f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4593f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 4603f476b34049d062942eafcf48396f593e00bd324Adam Powell 4613f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4623f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to include the application home affordance in the action bar. 4633f476b34049d062942eafcf48396f593e00bd324Adam Powell * Home is presented as either an activity icon or logo. 4643f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4653f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4663f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4673f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHome true to show home, false otherwise. 4683f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4693f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4703f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4713f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4723f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 4733f476b34049d062942eafcf48396f593e00bd324Adam Powell 4743f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4753f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether home should be displayed as an "up" affordance. 4763f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set this to true if selecting "home" returns up by a single level in your UI 4773f476b34049d062942eafcf48396f593e00bd324Adam Powell * rather than back to the top level or front page. 4783f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4793f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4803f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4813f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHomeAsUp true to show the user that selecting home will return one 4823f476b34049d062942eafcf48396f593e00bd324Adam Powell * level up rather than to the top level of the app. 4833f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4843f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4853f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4863f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4873f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 4883f476b34049d062942eafcf48396f593e00bd324Adam Powell 4893f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4903f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether an activity title/subtitle should be displayed. 4913f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4923f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4933f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4943f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showTitle true to display a title/subtitle if present. 4953f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4963f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4973f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4983f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4993f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 5003f476b34049d062942eafcf48396f593e00bd324Adam Powell 5013f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 5023f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether a custom view should be displayed, if set. 5033f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5043f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 5053f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5063f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showCustom true if the currently set custom view should be displayed, false otherwise. 5073f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5083f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 5093f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 5103f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 5113f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 5123f476b34049d062942eafcf48396f593e00bd324Adam Powell 513a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 514f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's background. This will be used for the primary 515f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * action bar. 51633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 51733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param d Background drawable 518f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 519f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 52033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 521d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setBackgroundDrawable(@Nullable Drawable d); 522ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 523ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell /** 524f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's stacked background. This will appear 525f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * in the second row/stacked bar on some devices and configurations. 526f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 527f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the stacked row 528f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5290145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setStackedBackgroundDrawable(Drawable d) { } 530f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 531f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 532f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's split background. This will appear in 533f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * the split action bar containing menu-provided action buttons 534f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * on some devices and configurations. 535e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 536f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 537f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the split bar 538f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5390145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setSplitBackgroundDrawable(Drawable d) { } 540f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 541f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 542ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @return The current custom view. 543ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell */ 544ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell public abstract View getCustomView(); 545ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 54633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 547a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar title in standard mode. 548a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 549a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 550a408291e22def5755559f42cde913706a6d628c0Adam Powell * 551a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar title or null. 55233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 55333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getTitle(); 55433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 55533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 556a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar subtitle in standard mode. 557a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 558a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 559a408291e22def5755559f42cde913706a6d628c0Adam Powell * 560a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar subtitle or null. 56133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 56233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getSubtitle(); 56333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 56433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 565a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current navigation mode. The result will be one of: 566a408291e22def5755559f42cde913706a6d628c0Adam Powell * <ul> 567a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 5689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 569a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_TABS}</li> 570a408291e22def5755559f42cde913706a6d628c0Adam Powell * </ul> 571a408291e22def5755559f42cde913706a6d628c0Adam Powell * 57233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current navigation mode. 573fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 574fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 575fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 576fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 577fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 57833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 579d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @NavigationMode 58033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getNavigationMode(); 5819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 5829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 5839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the current navigation mode. 5849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 5859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param mode The new mode to set. 5869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_STANDARD 5879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_LIST 5889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_TABS 589fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 590fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 591fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 592fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 593fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 5949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 595d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 5969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 59733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 59833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current set of display options. 59933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 60033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getDisplayOptions(); 601661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 602661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 603661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Create and return a new {@link Tab}. 604661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * This tab will not be included in the action bar until it is added. 605661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 6062f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * <p>Very often tabs will be used to switch between {@link Fragment} 6072f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * objects. Here is a typical implementation of such tabs:</p> 6082f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 6092f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 6102f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * complete} 6112f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 612661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return A new Tab 613661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 614661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #addTab(Tab) 615fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 616fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 617fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 618fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 619fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 620661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 621661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Tab newTab(); 622661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 623661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 624661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 62581b8944131946e451b31665652de8cc71d81ea07Adam Powell * If this is the first tab to be added it will become the selected tab. 626661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 627661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to add 628fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 629fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 630fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 631fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 632fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 633661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 634661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void addTab(Tab tab); 635661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 636661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 63781b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 63881b8944131946e451b31665652de8cc71d81ea07Adam Powell * 63981b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab Tab to add 64081b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 641fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 642fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 643fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 644fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 645fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 64681b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 64781b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, boolean setSelected); 64881b8944131946e451b31665652de8cc71d81ea07Adam Powell 64981b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6502b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 65181b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. If this is the first tab to be added it will become 65281b8944131946e451b31665652de8cc71d81ea07Adam Powell * the selected tab. 653661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 654661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to add 655661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position The new position of the tab 656fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 657fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 658fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 659fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 660fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 661661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 6622b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract void addTab(Tab tab, int position); 663661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 664661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 66581b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 66681b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. 66781b8944131946e451b31665652de8cc71d81ea07Adam Powell * 66881b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab The tab to add 66981b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param position The new position of the tab 67081b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 671fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 672fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 673fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 674fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 675fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 67681b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 67781b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 67881b8944131946e451b31665652de8cc71d81ea07Adam Powell 67981b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 6819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 682661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 683661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to remove 684fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 685fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 686fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 687fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 688fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 689661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 690661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTab(Tab tab); 691661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 692661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 6939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 6949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 695661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 696661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position Position of the tab to remove 697fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 698fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 699fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 700fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 701fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 702661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 703661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTabAt(int position); 704661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 705661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove all tabs from the action bar and deselect the current tab. 707fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 708fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 709fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 710fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 711fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 7139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void removeAllTabs(); 7149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 716661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 717661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 7189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 7199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 720661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to select 721fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 722fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 723fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 724fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 725fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 726661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 727661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void selectTab(Tab tab); 728661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 729661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7302b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Returns the currently selected tab if in tabbed navigation mode and there is at least 7312b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * one tab present. 7322b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 7332b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The currently selected tab or null 734fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 735fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 736fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 737fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 738fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7392b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 7402b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Tab getSelectedTab(); 7412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 7422b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 7439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Returns the tab at the specified index. 7449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 7459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param index Index value in the range 0-get 7469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return 747fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 748fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 749fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 750fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 751fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 7539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab getTabAt(int index); 7549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 7560c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * Returns the number of tabs currently registered with the action bar. 7570c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * @return Tab count 758fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 759fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 760fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 761fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 762fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7630c24a5514c1ff143a223720a090b19a86a75945fAdam Powell */ 7640c24a5514c1ff143a223720a090b19a86a75945fAdam Powell public abstract int getTabCount(); 7650c24a5514c1ff143a223720a090b19a86a75945fAdam Powell 7660c24a5514c1ff143a223720a090b19a86a75945fAdam Powell /** 7676b336f835d637853800b94689375a03f337139a4Adam Powell * Retrieve the current height of the ActionBar. 7686b336f835d637853800b94689375a03f337139a4Adam Powell * 7696b336f835d637853800b94689375a03f337139a4Adam Powell * @return The ActionBar's height 7706b336f835d637853800b94689375a03f337139a4Adam Powell */ 7716b336f835d637853800b94689375a03f337139a4Adam Powell public abstract int getHeight(); 7726b336f835d637853800b94689375a03f337139a4Adam Powell 7736b336f835d637853800b94689375a03f337139a4Adam Powell /** 7746b336f835d637853800b94689375a03f337139a4Adam Powell * Show the ActionBar if it is not currently showing. 7756b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7766b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 7776b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 7783a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 7793a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>If you are hiding the ActionBar through 7803a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 7813a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * you should not call this function directly. 7826b336f835d637853800b94689375a03f337139a4Adam Powell */ 7836b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void show(); 7846b336f835d637853800b94689375a03f337139a4Adam Powell 7856b336f835d637853800b94689375a03f337139a4Adam Powell /** 786e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * Hide the ActionBar if it is currently showing. 7876b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7886b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 7896b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 7903a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 7913a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>Instead of calling this function directly, you can also cause an 7923a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * ActionBar using the overlay feature to hide through 7933a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 7943a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * Hiding the ActionBar through this system UI flag allows you to more 7953a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * seamlessly hide it in conjunction with other screen decorations. 7966b336f835d637853800b94689375a03f337139a4Adam Powell */ 7976b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void hide(); 7986b336f835d637853800b94689375a03f337139a4Adam Powell 7996b336f835d637853800b94689375a03f337139a4Adam Powell /** 8006b336f835d637853800b94689375a03f337139a4Adam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 8016b336f835d637853800b94689375a03f337139a4Adam Powell */ 8026b336f835d637853800b94689375a03f337139a4Adam Powell public abstract boolean isShowing(); 8036b336f835d637853800b94689375a03f337139a4Adam Powell 8046b336f835d637853800b94689375a03f337139a4Adam Powell /** 8058515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Add a listener that will respond to menu visibility change events. 8068515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 8078515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener The new listener to add 8088515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 8098515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 8108515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 8118515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 8128515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Remove a menu visibility listener. This listener will no longer receive menu 8138515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * visibility change events. 8148515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 8158515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener A listener to remove that was previously added 8168515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 8178515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 8188515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 8198515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 820c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * Enable or disable the "home" button in the corner of the action bar. (Note that this 821c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * is the application home/up affordance on the action bar, not the systemwide home 822c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button.) 823c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 824c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>This defaults to true for packages targeting < API 14. For packages targeting 825c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * API 14 or greater, the application should call this method to enable interaction 826c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * with the home/up affordance. 827c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 828c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 829c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * the home button. 830c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 831c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * @param enabled true to enable the home button, false to disable the home button. 832c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell */ 83388ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public void setHomeButtonEnabled(boolean enabled) { } 83488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell 83588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell /** 83688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * Returns a {@link Context} with an appropriate theme for creating views that 83788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * will appear in the action bar. If you are inflating or instantiating custom views 83888ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * that will appear in an action bar, you should use the Context returned by this method. 83988ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * (This includes adapters used for list navigation mode.) 84088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * This will ensure that views contrast properly against the action bar. 84188ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * 84288ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * @return A themed Context for creating views 84388ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell */ 84488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public Context getThemedContext() { return null; } 845c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell 846c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell /** 84727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Returns true if the Title field has been truncated during layout for lack 84827cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * of available space. 84927cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * 85027cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @return true if the Title field has been truncated 85127cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 85227cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 85327cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public boolean isTitleTruncated() { return false; } 85427cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 85527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 856e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 857e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 858e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 859e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 860e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>null</code> to this method, the default drawable from the theme 861e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 862e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 863e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 864e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 865e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 866e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 867e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param indicator A drawable to use for the up indicator, or null to use the theme's default 868e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 869e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 870e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 871e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 872e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 873e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeAsUpIndicator(Drawable indicator) { } 874e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 875e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 876e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 877e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 878e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 879e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 880e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>0</code> to this method, the default drawable from the theme 881e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 882e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 883e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 884e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 885e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 886e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 887e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a drawable to use for the up indicator, or null 888e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to use the theme's default 889e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 890e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 891e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 892e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 893e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 894e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeAsUpIndicator(int resId) { } 895e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 896e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 897e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 898e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 899e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 900e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 901e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 902e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 903e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 904e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 905e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 906e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 907e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>null</code> will use the system default description.</p> 908e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 909e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param description New description for the Home action when enabled 910e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 911e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 912e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 913e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeActionContentDescription(CharSequence description) { } 914e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 915e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 916e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 917e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 918e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 919e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 920e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 921e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 922e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 923e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 924e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 925e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 926e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>0</code> will use the system default description.</p> 927e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 928e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a string to use as the new description 929e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * for the Home action when enabled 930e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 931e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 932e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 933e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeActionContentDescription(int resId) { } 934e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 935e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 936e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { 937e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 938e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 939e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 940e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void setShowHideAnimationEnabled(boolean enabled) { 941e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 942e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 943e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 944e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void onConfigurationChanged(Configuration config) { 945e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 946e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 947e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 948e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void dispatchMenuVisibilityChanged(boolean visible) { 949e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 950e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 951e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 952e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void captureSharedElements(Map<String, View> sharedElements) { 953e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 954e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 955e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 956e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public ActionMode startActionMode(ActionMode.Callback callback) { 957e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell return null; 958e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 959e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 960e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 9618515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener interface for ActionBar navigation events. 962fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 963fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 964fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 965fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 966fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 96789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 9688515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnNavigationListener { 96989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell /** 97089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * This method is called whenever a navigation item in your action bar 97189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * is selected. 97289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * 97389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemPosition Position of the item clicked. 97489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemId ID of the item clicked. 97589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @return True if the event was handled, false otherwise. 97689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 97789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 97833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell } 979661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 980661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 9818515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener for receiving events when action bar menus are shown or hidden. 9828515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 9838515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnMenuVisibilityListener { 9848515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 9858515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Called when an action bar menu is shown or hidden. Applications may want to use 9868515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 9878515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * gameplay, or other activity within the main content area. 9888515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 9898515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param isVisible True if an action bar menu is now visible, false if no action bar 9908515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * menus are visible. 9918515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 9928515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 9938515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell } 9948515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 9958515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 996661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * A tab in the action bar. 997661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 998661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * <p>Tabs manage the hiding and showing of {@link Fragment}s. 999fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1000fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1001fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1002fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1003fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 1004661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1005661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static abstract class Tab { 1006661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1007661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * An invalid position for a tab. 1008661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1009661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #getPosition() 1010661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1011661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static final int INVALID_POSITION = -1; 1012661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1013661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1014661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the current position of this tab in the action bar. 1015661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1016661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 1017661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * the action bar. 1018661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1019661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract int getPosition(); 1020661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1021661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1022661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the icon associated with this tab. 1023661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1024661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's icon 1025661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1026661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Drawable getIcon(); 1027661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1028661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1029661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the text of this tab. 1030661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1031661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's text 1032661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1033661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract CharSequence getText(); 1034661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1035661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1036661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the icon displayed on this tab. 1037661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1038661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param icon The drawable to use as an icon 10399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1040661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 10419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setIcon(Drawable icon); 1042661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1043661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 104432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the icon displayed on this tab. 104532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 104632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId Resource ID referring to the drawable to use as an icon 104732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 104832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 104932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setIcon(int resId); 105032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 105132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 1052661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the text displayed on this tab. Text may be truncated if there is not 1053661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * room to display the entire string. 1054661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1055661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param text The text to display 10569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1057661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 10589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setText(CharSequence text); 1059661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1060661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 106132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the text displayed on this tab. Text may be truncated if there is not 106232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * room to display the entire string. 106332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 106432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId A resource ID referring to the text that should be displayed 106532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 106632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 106732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setText(int resId); 106832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 106932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 10702b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set a custom view to be used for this tab. This overrides values set by 10712b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1072661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 10732b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param view Custom view to be used as a tab. 10749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1075661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 10769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setCustomView(View view); 1077661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1078661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 107932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set a custom view to be used for this tab. This overrides values set by 108032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 108132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 108232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 108332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 108432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 108532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setCustomView(int layoutResId); 108632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 108732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 10882b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Retrieve a previously set custom view for this tab. 1089661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 10902b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The custom view set by {@link #setCustomView(View)}. 1091661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 10922b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract View getCustomView(); 10932b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 10942b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 10952b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Give this Tab an arbitrary object to hold for later use. 10962b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 10972b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param obj Object to store 10989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 10992b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTag(Object obj); 11012b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 11022b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 11032b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return This Tab's tag object. 11042b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11052b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Object getTag(); 11062b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 11072b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 11082b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set the {@link TabListener} that will handle switching to and from this tab. 11092b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * All tabs must have a TabListener set before being added to the ActionBar. 11102b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 11112b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param listener Listener to handle tab selection events 11129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 11132b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTabListener(TabListener listener); 1115661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1116661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1117661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1118661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1119661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void select(); 112094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 112194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 112294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 112394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 112494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 112594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param resId A resource ID referring to the description text 112694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 112794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 112894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 112994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 113094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(int resId); 113194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 113294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 113394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 113494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 113594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 113694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param contentDesc Description of this tab's content 113794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 113894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 113994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 114094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 114194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 114294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 114394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 114494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 114594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 114694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return Description of this tab's content 114794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 114894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 114994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 115094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract CharSequence getContentDescription(); 1151661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell } 11522b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 11532b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 11542b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Callback interface invoked when a tab is focused, unfocused, added, or removed. 1155fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1156fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1157fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1158fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1159fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 11602b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11612b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public interface TabListener { 11622b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 11632b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab enters the selected state. 11642b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 11652b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was selected 11662b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 11672b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. The previous tab's unselect and this tab's select will be 11680c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * executed in a single transaction. This FragmentTransaction does not support 11690c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 11702b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11712b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 11722b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 11732b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 11742b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab exits the selected state. 11752b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 11762b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was unselected 11772b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 11782b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. This tab's unselect and the newly selected tab's select 11790c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * will be executed in a single transaction. This FragmentTransaction does not 11800c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * support being added to the back stack. 11812b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11822b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 11837f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell 11847f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell /** 11857f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Called when a tab that is already selected is chosen again by the user. 11867f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Some applications may use this action to return to the top level of a category. 11877f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * 11887f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param tab The tab that was reselected. 11897f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 11900c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * once this method returns. This FragmentTransaction does not support 11910c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 11927f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell */ 11937f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 11942b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell } 11959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 11969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 11979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Per-child layout information associated with action bar custom views. 11989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 11999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 12009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1201e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public static class LayoutParams extends ViewGroup.MarginLayoutParams { 12029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 12039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Gravity for the view associated with these LayoutParams. 12049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 12059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see android.view.Gravity 12069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 12079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.ExportedProperty(category = "layout", mapping = { 1208e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = -1, to = "NONE"), 1209e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.NO_GRAVITY, to = "NONE"), 1210e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.TOP, to = "TOP"), 1211e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), 1212e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), 1213e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), 1214e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.START, to = "START"), 1215e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.END, to = "END"), 1216e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), 1217e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), 1218e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), 1219e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_HORIZONTAL, to = "FILL_HORIZONTAL"), 1220e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"), 1221e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL, to = "FILL") 12229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell }) 1223cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio public int gravity = Gravity.NO_GRAVITY; 12249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1225d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public LayoutParams(@NonNull Context c, AttributeSet attrs) { 12269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(c, attrs); 12279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 12289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 12299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height) { 12309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 12319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 12329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 12339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height, int gravity) { 12349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 12359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 12369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 12379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int gravity) { 12389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this(WRAP_CONTENT, MATCH_PARENT, gravity); 12399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 12409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 12419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(LayoutParams source) { 12429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 12439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 12449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 12459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(ViewGroup.LayoutParams source) { 12469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 12479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 1248e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1249e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public LayoutParams(MarginLayoutParams source) { 1250e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell super(source); 1251e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 12529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 125333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell} 1254