ActionBar.java revision fc35dfd513677ca01e8d4950ff9faa4ed19e65fe
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; 239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.res.TypedArray; 2433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.graphics.drawable.Drawable; 259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.util.AttributeSet; 269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.Gravity; 2733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.view.View; 289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewDebug; 299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup; 309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup.MarginLayoutParams; 316b336f835d637853800b94689375a03f337139a4Adam Powellimport android.view.Window; 32a408291e22def5755559f42cde913706a6d628c0Adam Powellimport android.widget.SpinnerAdapter; 3333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 34d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.Retention; 35d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.RetentionPolicy; 36d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 3733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/** 38e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * A window feature at the top of the activity that may display the activity title, navigation 39e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * modes, and other interactive items. 40e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an 41e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * activity's window when the activity uses the system's {@link 42e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. 43e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * You may otherwise add the action bar by calling {@link 44e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a 45e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. 46e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>By default, the action bar shows the application icon on 47e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * the left, followed by the activity title. If your activity has an options menu, you can make 48e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * select items accessible directly from the action bar as "action items". You can also 49e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * modify various characteristics of the action bar or remove it completely.</p> 5036193d09a87035395d036a730038b765ac0b0913Scott Main * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 5136193d09a87035395d036a730038b765ac0b0913Scott Main * android.app.Activity#getActionBar getActionBar()}.</p> 52e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 53e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in 54e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * your activity, you can enable an action mode that offers actions specific to the selected 55e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 56e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for 57e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * {@link ActionBar}. 58b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <div class="special reference"> 59b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <h3>Developer Guides</h3> 60b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <p>For information about how to use the action bar, including how to add action items, navigation 61b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 62b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * Bar</a> developer guide.</p> 63b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * </div> 6433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 6533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar { 66d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 67d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 68d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 69d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface NavigationMode {} 70d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 71a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 72a408291e22def5755559f42cde913706a6d628c0Adam Powell * Standard navigation mode. Consists of either a logo or icon 73a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * and title text with an optional subtitle. Clicking any of these elements 74cf0357639e952a87f0d535c82691919af81f058bAdam Powell * will dispatch onOptionsItemSelected to the host Activity with 75a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a MenuItem with item ID android.R.id.home. 76fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 77fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 78fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 79fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 80fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 81a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 82a408291e22def5755559f42cde913706a6d628c0Adam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 8333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 8433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * List navigation mode. Instead of static title text this mode 869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * presents a list menu for navigation within the activity. 879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. this might be presented to the user as a dropdown list. 88fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 89fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 90fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 91fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 92fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 9333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int NAVIGATION_MODE_LIST = 1; 9533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 9633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 9733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Tab navigation mode. Instead of static title text this mode 9833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * presents a series of tabs for navigation within the activity. 99fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 100fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 101fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 102fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 103fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 10433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 10533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 10633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 107d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 108d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 109d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef(flag = true, 110d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye value = { 111d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_USE_LOGO, 112d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_HOME, 113d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_HOME_AS_UP, 114d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_TITLE, 115d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_CUSTOM, 116d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_TITLE_MULTIPLE_LINES 117d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye }) 118d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface DisplayOptions {} 119d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 12033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 12133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Use logo instead of icon if available. This flag will cause appropriate 12233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation modes to use a wider logo in place of the standard icon. 1239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 12633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 12733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 12833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 12933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show 'home' elements in this action bar, leaving more space for other 13133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation elements. This includes logo and icon. 1329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 1379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Display the 'home' element such that it appears as an 'up' affordance. 1409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. show an arrow to the left indicating the action that will be taken. 1419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set this flag if selecting the 'home' button in the action bar to return 1439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * up by a single level in your UI rather than back to the top level or front page. 1449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 145c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting this option will implicitly enable interaction with the home/up 146c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button. See {@link #setHomeButtonEnabled(boolean)}. 147c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 1489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 1529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the activity title and subtitle, if present. 1559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(CharSequence) 1579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(int) 1589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(CharSequence) 1599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(int) 1609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 1649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the custom view if one has been set. 1679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setCustomView(View) 1689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 1729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 17427cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Allow the title to wrap onto multiple lines if space is available 17527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 17627cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 17727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public static final int DISPLAY_TITLE_MULTIPLE_LINES = 0x20; 17827cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 17927cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 1809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the action bar into custom navigation mode, supplying a view 1819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * for custom navigation. 1829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Custom navigation views appear between the application icon and 1849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * any action buttons and may use any space available there. Common 1859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * use cases for custom navigation views might include an auto-suggesting 1869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * address bar for a browser or other navigation mechanisms that do not 1879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * translate well to provided navigation modes. 1889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param view Custom navigation view to place in the ActionBar. 19033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view); 19289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell 19333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 194a408291e22def5755559f42cde913706a6d628c0Adam Powell * Set the action bar into custom navigation mode, supplying a view 195a408291e22def5755559f42cde913706a6d628c0Adam Powell * for custom navigation. 19633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 197ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>Custom navigation views appear between the application icon and 19833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * any action buttons and may use any space available there. Common 199a408291e22def5755559f42cde913706a6d628c0Adam Powell * use cases for custom navigation views might include an auto-suggesting 200a408291e22def5755559f42cde913706a6d628c0Adam Powell * address bar for a browser or other navigation mechanisms that do not 201ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * translate well to provided navigation modes.</p> 202ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 203ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 204ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * the custom view to be displayed.</p> 20533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 20633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param view Custom navigation view to place in the ActionBar. 2079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param layoutParams How this custom view should layout in the bar. 208ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 209ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 21033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 2129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2143f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set the action bar into custom navigation mode, supplying a view 2153f476b34049d062942eafcf48396f593e00bd324Adam Powell * for custom navigation. 2163f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2173f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>Custom navigation views appear between the application icon and 2183f476b34049d062942eafcf48396f593e00bd324Adam Powell * any action buttons and may use any space available there. Common 2193f476b34049d062942eafcf48396f593e00bd324Adam Powell * use cases for custom navigation views might include an auto-suggesting 2203f476b34049d062942eafcf48396f593e00bd324Adam Powell * address bar for a browser or other navigation mechanisms that do not 2213f476b34049d062942eafcf48396f593e00bd324Adam Powell * translate well to provided navigation modes.</p> 2223f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2233f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 2243f476b34049d062942eafcf48396f593e00bd324Adam Powell * the custom view to be displayed.</p> 2253f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2263f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 2273f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2283f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 2293f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 2303f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setCustomView(int resId); 2313f476b34049d062942eafcf48396f593e00bd324Adam Powell 2323f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 2331969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2341969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2351969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2361969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2371969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2381969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2391969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2401969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as an icon. 2411969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2421969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2431969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2441969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2451969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(int resId); 2461969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2471969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2481969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2491969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2501969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2511969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2521969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2531969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2541969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2551969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param icon Drawable to show as an icon. 2561969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2571969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2581969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2591969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2601969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(Drawable icon); 2611969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2621969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2631969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 2641969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 2651969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 2661969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2671969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2681969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2691969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2701969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as a logo. 2711969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2721969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2731969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2741969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2751969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(int resId); 2761969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2771969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2781969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 2791969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 2801969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 2811969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2821969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2831969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2841969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2851969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param logo Drawable to show as a logo. 2861969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2871969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2881969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2891969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2901969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(Drawable logo); 2911969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2921969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the adapter and navigation callback for list navigation mode. 2949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * The supplied adapter will provide views for the expanded list as well as 2969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the currently selected item. (These may be displayed differently.) 2979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2988515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * The supplied OnNavigationListener will alert the application when the user 2999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * changes the current list selection. 3009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param adapter An adapter that will provide views both to display 3029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the current navigation selection and populate views 3039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * within the dropdown navigation menu. 3048515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param callback An OnNavigationListener that will receive events when the user 3059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * selects a navigation item. 306fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 307fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 308fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 309fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 310fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 3138515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell OnNavigationListener callback); 3149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the selected navigation item in list or tabbed navigation modes. 317178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 318178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param position Position of the item to select. 319fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 320fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 321fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 322fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 323fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 324178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 325178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract void setSelectedNavigationItem(int position); 326178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 327178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 3289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 329178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 330178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @return Position of the selected item. 331fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 332fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 333fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 334fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 335fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getSelectedNavigationIndex(); 3389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the number of navigation items present in the current navigation mode. 3419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return Number of navigation items. 343fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 344fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 345fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 346fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 347fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getNavigationItemCount(); 3509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 352ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 353ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 3540e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 3550e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param title Title to set 356a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 357a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(int) 358ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 3590e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 3600e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setTitle(CharSequence title); 3610e94b5151d817e600a888448a662208b29b5ef46Adam Powell 3620e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 363ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 364ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 365a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 366a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of title string to set 367a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 368a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(CharSequence) 369ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 370a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 371a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell public abstract void setTitle(int resId); 372a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 373a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 374ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 375ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 376ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * subtitle entirely. 3770e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 3780e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param subtitle Subtitle to set 379a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 380a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(int) 381ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 3820e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 3830e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setSubtitle(CharSequence subtitle); 3840e94b5151d817e600a888448a662208b29b5ef46Adam Powell 3850e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 386ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 387ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 388a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 389a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of subtitle string to set 390a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 391a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(CharSequence) 392ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 393a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 394a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell public abstract void setSubtitle(int resId); 395a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 396a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 397a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set display options. This changes all display option bits at once. To change 398a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 39933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 40033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 40133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * defined in ActionBar. 40233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 403d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 40433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 40533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 406a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set selected display options. Only the options specified by mask will be changed. 407a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 408a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 4099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 4109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * {@link #DISPLAY_SHOW_HOME} option. 4115ad7af6fc764f71765b134b8cd51787a7e78753aBen Komalo * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 4129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 413a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 414a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 415a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * defined in ActionBar. 416a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param mask A bit mask declaring which display options should be changed. 417a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 418d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 4193f476b34049d062942eafcf48396f593e00bd324Adam Powell 4203f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4213f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to display the activity logo rather than the activity icon. 4223f476b34049d062942eafcf48396f593e00bd324Adam Powell * A logo is often a wider, more detailed image. 4233f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4243f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4253f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4263f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 4273f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4283f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4293f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4303f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4313f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 4323f476b34049d062942eafcf48396f593e00bd324Adam Powell 4333f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4343f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to include the application home affordance in the action bar. 4353f476b34049d062942eafcf48396f593e00bd324Adam Powell * Home is presented as either an activity icon or logo. 4363f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4373f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4383f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4393f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHome true to show home, false otherwise. 4403f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4413f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4423f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4433f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4443f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 4453f476b34049d062942eafcf48396f593e00bd324Adam Powell 4463f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4473f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether home should be displayed as an "up" affordance. 4483f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set this to true if selecting "home" returns up by a single level in your UI 4493f476b34049d062942eafcf48396f593e00bd324Adam Powell * rather than back to the top level or front page. 4503f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4513f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4523f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4533f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHomeAsUp true to show the user that selecting home will return one 4543f476b34049d062942eafcf48396f593e00bd324Adam Powell * level up rather than to the top level of the app. 4553f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4563f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4573f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4583f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4593f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 4603f476b34049d062942eafcf48396f593e00bd324Adam Powell 4613f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4623f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether an activity title/subtitle should be displayed. 4633f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4643f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4653f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4663f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showTitle true to display a title/subtitle if present. 4673f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4683f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4693f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4703f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4713f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 4723f476b34049d062942eafcf48396f593e00bd324Adam Powell 4733f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4743f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether a custom view should be displayed, if set. 4753f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4763f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4773f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4783f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showCustom true if the currently set custom view should be displayed, false otherwise. 4793f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4803f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4813f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4823f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4833f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 4843f476b34049d062942eafcf48396f593e00bd324Adam Powell 485a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 486f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's background. This will be used for the primary 487f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * action bar. 48833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 48933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param d Background drawable 490f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 491f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 49233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 493d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setBackgroundDrawable(@Nullable Drawable d); 494ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 495ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell /** 496f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's stacked background. This will appear 497f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * in the second row/stacked bar on some devices and configurations. 498f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 499f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the stacked row 500f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5010145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setStackedBackgroundDrawable(Drawable d) { } 502f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 503f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 504f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's split background. This will appear in 505f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * the split action bar containing menu-provided action buttons 506f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * on some devices and configurations. 507e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 508f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 509f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the split bar 510f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5110145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setSplitBackgroundDrawable(Drawable d) { } 512f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 513f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 514ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @return The current custom view. 515ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell */ 516ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell public abstract View getCustomView(); 517ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 51833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 519a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar title in standard mode. 520a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 521a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 522a408291e22def5755559f42cde913706a6d628c0Adam Powell * 523a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar title or null. 52433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 52533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getTitle(); 52633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 52733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 528a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar subtitle in standard mode. 529a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 530a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 531a408291e22def5755559f42cde913706a6d628c0Adam Powell * 532a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar subtitle or null. 53333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 53433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getSubtitle(); 53533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 53633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 537a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current navigation mode. The result will be one of: 538a408291e22def5755559f42cde913706a6d628c0Adam Powell * <ul> 539a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 5409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 541a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_TABS}</li> 542a408291e22def5755559f42cde913706a6d628c0Adam Powell * </ul> 543a408291e22def5755559f42cde913706a6d628c0Adam Powell * 54433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current navigation mode. 545fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 546fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 547fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 548fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 549fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 55033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 551d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @NavigationMode 55233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getNavigationMode(); 5539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 5549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 5559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the current navigation mode. 5569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 5579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param mode The new mode to set. 5589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_STANDARD 5599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_LIST 5609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_TABS 561fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 562fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 563fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 564fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 565fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 5669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 567d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 5689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 56933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 57033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current set of display options. 57133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 57233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getDisplayOptions(); 573661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 574661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 575661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Create and return a new {@link Tab}. 576661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * This tab will not be included in the action bar until it is added. 577661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 5782f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * <p>Very often tabs will be used to switch between {@link Fragment} 5792f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * objects. Here is a typical implementation of such tabs:</p> 5802f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 5812f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 5822f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * complete} 5832f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 584661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return A new Tab 585661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 586661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #addTab(Tab) 587fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 588fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 589fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 590fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 591fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 592661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 593661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Tab newTab(); 594661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 595661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 596661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 59781b8944131946e451b31665652de8cc71d81ea07Adam Powell * If this is the first tab to be added it will become the selected tab. 598661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 599661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to add 600fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 601fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 602fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 603fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 604fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 605661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 606661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void addTab(Tab tab); 607661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 608661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 60981b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 61081b8944131946e451b31665652de8cc71d81ea07Adam Powell * 61181b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab Tab to add 61281b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 613fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 614fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 615fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 616fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 617fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 61881b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 61981b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, boolean setSelected); 62081b8944131946e451b31665652de8cc71d81ea07Adam Powell 62181b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6222b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 62381b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. If this is the first tab to be added it will become 62481b8944131946e451b31665652de8cc71d81ea07Adam Powell * the selected tab. 625661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 626661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to add 627661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position The new position of the tab 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 */ 6342b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract void addTab(Tab tab, int position); 635661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 636661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 63781b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 63881b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. 63981b8944131946e451b31665652de8cc71d81ea07Adam Powell * 64081b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab The tab to add 64181b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param position The new position of the tab 64281b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 643fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 644fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 645fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 646fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 647fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 64881b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 64981b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 65081b8944131946e451b31665652de8cc71d81ea07Adam Powell 65181b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 6539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 654661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 655661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to remove 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 */ 662661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTab(Tab tab); 663661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 664661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 6659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 6669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 667661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 668661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position Position of the tab to remove 669fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 670fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 671fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 672fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 673fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 674661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 675661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTabAt(int position); 676661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 677661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 6789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove all tabs from the action bar and deselect the current tab. 679fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 680fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 681fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 682fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 683fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 6849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 6859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void removeAllTabs(); 6869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 6879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 688661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 689661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 6909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 6919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 692661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to select 693fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 694fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 695fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 696fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 697fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 698661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 699661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void selectTab(Tab tab); 700661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 701661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7022b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Returns the currently selected tab if in tabbed navigation mode and there is at least 7032b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * one tab present. 7042b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 7052b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The currently selected tab or null 706fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 707fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 708fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 709fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 710fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7112b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 7122b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Tab getSelectedTab(); 7132b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 7142b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 7159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Returns the tab at the specified index. 7169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 7179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param index Index value in the range 0-get 7189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return 719fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 720fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 721fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 722fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 723fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 7259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab getTabAt(int index); 7269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 7280c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * Returns the number of tabs currently registered with the action bar. 7290c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * @return Tab count 730fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 731fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 732fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 733fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 734fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7350c24a5514c1ff143a223720a090b19a86a75945fAdam Powell */ 7360c24a5514c1ff143a223720a090b19a86a75945fAdam Powell public abstract int getTabCount(); 7370c24a5514c1ff143a223720a090b19a86a75945fAdam Powell 7380c24a5514c1ff143a223720a090b19a86a75945fAdam Powell /** 7396b336f835d637853800b94689375a03f337139a4Adam Powell * Retrieve the current height of the ActionBar. 7406b336f835d637853800b94689375a03f337139a4Adam Powell * 7416b336f835d637853800b94689375a03f337139a4Adam Powell * @return The ActionBar's height 7426b336f835d637853800b94689375a03f337139a4Adam Powell */ 7436b336f835d637853800b94689375a03f337139a4Adam Powell public abstract int getHeight(); 7446b336f835d637853800b94689375a03f337139a4Adam Powell 7456b336f835d637853800b94689375a03f337139a4Adam Powell /** 7466b336f835d637853800b94689375a03f337139a4Adam Powell * Show the ActionBar if it is not currently showing. 7476b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7486b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 7496b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 7503a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 7513a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>If you are hiding the ActionBar through 7523a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 7533a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * you should not call this function directly. 7546b336f835d637853800b94689375a03f337139a4Adam Powell */ 7556b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void show(); 7566b336f835d637853800b94689375a03f337139a4Adam Powell 7576b336f835d637853800b94689375a03f337139a4Adam Powell /** 758e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * Hide the ActionBar if it is currently showing. 7596b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7606b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 7616b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 7623a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 7633a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>Instead of calling this function directly, you can also cause an 7643a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * ActionBar using the overlay feature to hide through 7653a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 7663a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * Hiding the ActionBar through this system UI flag allows you to more 7673a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * seamlessly hide it in conjunction with other screen decorations. 7686b336f835d637853800b94689375a03f337139a4Adam Powell */ 7696b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void hide(); 7706b336f835d637853800b94689375a03f337139a4Adam Powell 7716b336f835d637853800b94689375a03f337139a4Adam Powell /** 7726b336f835d637853800b94689375a03f337139a4Adam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 7736b336f835d637853800b94689375a03f337139a4Adam Powell */ 7746b336f835d637853800b94689375a03f337139a4Adam Powell public abstract boolean isShowing(); 7756b336f835d637853800b94689375a03f337139a4Adam Powell 7766b336f835d637853800b94689375a03f337139a4Adam Powell /** 7778515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Add a listener that will respond to menu visibility change events. 7788515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 7798515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener The new listener to add 7808515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 7818515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 7828515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 7838515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 7848515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Remove a menu visibility listener. This listener will no longer receive menu 7858515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * visibility change events. 7868515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 7878515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener A listener to remove that was previously added 7888515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 7898515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 7908515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 7918515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 792c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * Enable or disable the "home" button in the corner of the action bar. (Note that this 793c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * is the application home/up affordance on the action bar, not the systemwide home 794c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button.) 795c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 796c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>This defaults to true for packages targeting < API 14. For packages targeting 797c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * API 14 or greater, the application should call this method to enable interaction 798c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * with the home/up affordance. 799c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 800c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 801c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * the home button. 802c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 803c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * @param enabled true to enable the home button, false to disable the home button. 804c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell */ 80588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public void setHomeButtonEnabled(boolean enabled) { } 80688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell 80788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell /** 80888ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * Returns a {@link Context} with an appropriate theme for creating views that 80988ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * will appear in the action bar. If you are inflating or instantiating custom views 81088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * that will appear in an action bar, you should use the Context returned by this method. 81188ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * (This includes adapters used for list navigation mode.) 81288ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * This will ensure that views contrast properly against the action bar. 81388ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * 81488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * @return A themed Context for creating views 81588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell */ 81688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public Context getThemedContext() { return null; } 817c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell 818c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell /** 81927cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Returns true if the Title field has been truncated during layout for lack 82027cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * of available space. 82127cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * 82227cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @return true if the Title field has been truncated 82327cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 82427cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 82527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public boolean isTitleTruncated() { return false; } 82627cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 82727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 828e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 829e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 830e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 831e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 832e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>null</code> to this method, the default drawable from the theme 833e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 834e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 835e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 836e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 837e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 838e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 839e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param indicator A drawable to use for the up indicator, or null to use the theme's default 840e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 841e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 842e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 843e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 844e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 845e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeAsUpIndicator(Drawable indicator) { } 846e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 847e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 848e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 849e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 850e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 851e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 852e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>0</code> to this method, the default drawable from the theme 853e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 854e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 855e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 856e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 857e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 858e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 859e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a drawable to use for the up indicator, or null 860e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to use the theme's default 861e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 862e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 863e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 864e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 865e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 866e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeAsUpIndicator(int resId) { } 867e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 868e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 869e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 870e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 871e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 872e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 873e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 874e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 875e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 876e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 877e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 878e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 879e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>null</code> will use the system default description.</p> 880e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 881e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param description New description for the Home action when enabled 882e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 883e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 884e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 885e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeActionContentDescription(CharSequence description) { } 886e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 887e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 888e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 889e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 890e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 891e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 892e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 893e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 894e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 895e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 896e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 897e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 898e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>0</code> will use the system default description.</p> 899e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 900e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a string to use as the new description 901e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * for the Home action when enabled 902e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 903e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 904e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 905e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeActionContentDescription(int resId) { } 906e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 907e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 9088515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener interface for ActionBar navigation events. 909fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 910fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 911fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 912fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 913fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 91489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 9158515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnNavigationListener { 91689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell /** 91789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * This method is called whenever a navigation item in your action bar 91889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * is selected. 91989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * 92089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemPosition Position of the item clicked. 92189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemId ID of the item clicked. 92289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @return True if the event was handled, false otherwise. 92389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 92489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 92533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell } 926661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 927661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 9288515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener for receiving events when action bar menus are shown or hidden. 9298515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 9308515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnMenuVisibilityListener { 9318515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 9328515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Called when an action bar menu is shown or hidden. Applications may want to use 9338515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 9348515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * gameplay, or other activity within the main content area. 9358515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 9368515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param isVisible True if an action bar menu is now visible, false if no action bar 9378515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * menus are visible. 9388515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 9398515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 9408515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell } 9418515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 9428515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 943661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * A tab in the action bar. 944661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 945661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * <p>Tabs manage the hiding and showing of {@link Fragment}s. 946fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 947fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 948fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 949fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 950fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 951661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 952661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static abstract class Tab { 953661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 954661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * An invalid position for a tab. 955661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 956661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #getPosition() 957661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 958661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static final int INVALID_POSITION = -1; 959661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 960661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 961661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the current position of this tab in the action bar. 962661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 963661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 964661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * the action bar. 965661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 966661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract int getPosition(); 967661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 968661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 969661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the icon associated with this tab. 970661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 971661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's icon 972661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 973661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Drawable getIcon(); 974661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 975661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 976661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the text of this tab. 977661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 978661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's text 979661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 980661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract CharSequence getText(); 981661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 982661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 983661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the icon displayed on this tab. 984661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 985661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param icon The drawable to use as an icon 9869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 987661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 9889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setIcon(Drawable icon); 989661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 990661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 99132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the icon displayed on this tab. 99232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 99332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId Resource ID referring to the drawable to use as an icon 99432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 99532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 99632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setIcon(int resId); 99732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 99832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 999661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the text displayed on this tab. Text may be truncated if there is not 1000661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * room to display the entire string. 1001661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1002661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param text The text to display 10039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1004661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 10059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setText(CharSequence text); 1006661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1007661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 100832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the text displayed on this tab. Text may be truncated if there is not 100932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * room to display the entire string. 101032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 101132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId A resource ID referring to the text that should be displayed 101232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 101332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 101432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setText(int resId); 101532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 101632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 10172b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set a custom view to be used for this tab. This overrides values set by 10182b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1019661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 10202b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param view Custom view to be used as a tab. 10219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1022661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 10239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setCustomView(View view); 1024661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1025661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 102632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set a custom view to be used for this tab. This overrides values set by 102732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 102832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 102932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 103032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 103132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 103232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setCustomView(int layoutResId); 103332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 103432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 10352b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Retrieve a previously set custom view for this tab. 1036661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 10372b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The custom view set by {@link #setCustomView(View)}. 1038661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 10392b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract View getCustomView(); 10402b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 10412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 10422b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Give this Tab an arbitrary object to hold for later use. 10432b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 10442b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param obj Object to store 10459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 10462b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 10479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTag(Object obj); 10482b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 10492b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 10502b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return This Tab's tag object. 10512b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 10522b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Object getTag(); 10532b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 10542b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 10552b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set the {@link TabListener} that will handle switching to and from this tab. 10562b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * All tabs must have a TabListener set before being added to the ActionBar. 10572b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 10582b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param listener Listener to handle tab selection events 10599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 10602b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 10619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTabListener(TabListener listener); 1062661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1063661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1064661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1065661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1066661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void select(); 106794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 106894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 106994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 107094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 107194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 107294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param resId A resource ID referring to the description text 107394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 107494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 107594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 107694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 107794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(int resId); 107894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 107994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 108094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 108194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 108294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 108394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param contentDesc Description of this tab's content 108494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 108594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 108694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 108794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 108894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 108994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 109094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 109194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 109294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 109394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return Description of this tab's content 109494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 109594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 109694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 109794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract CharSequence getContentDescription(); 1098661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell } 10992b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 11002b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 11012b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Callback interface invoked when a tab is focused, unfocused, added, or removed. 1102fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1103fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1104fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1105fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1106fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 11072b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11082b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public interface TabListener { 11092b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 11102b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab enters the selected state. 11112b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 11122b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was selected 11132b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 11142b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. The previous tab's unselect and this tab's select will be 11150c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * executed in a single transaction. This FragmentTransaction does not support 11160c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 11172b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11182b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 11192b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 11202b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 11212b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab exits the selected state. 11222b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 11232b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was unselected 11242b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 11252b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. This tab's unselect and the newly selected tab's select 11260c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * will be executed in a single transaction. This FragmentTransaction does not 11270c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * support being added to the back stack. 11282b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 11292b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 11307f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell 11317f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell /** 11327f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Called when a tab that is already selected is chosen again by the user. 11337f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Some applications may use this action to return to the top level of a category. 11347f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * 11357f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param tab The tab that was reselected. 11367f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 11370c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * once this method returns. This FragmentTransaction does not support 11380c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 11397f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell */ 11407f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 11412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell } 11429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 11439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 11449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Per-child layout information associated with action bar custom views. 11459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 11469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 11479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 11489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static class LayoutParams extends MarginLayoutParams { 11499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 11509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Gravity for the view associated with these LayoutParams. 11519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 11529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see android.view.Gravity 11539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 11549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.ExportedProperty(category = "layout", mapping = { 11559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = -1, to = "NONE"), 11569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.NO_GRAVITY, to = "NONE"), 11579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.TOP, to = "TOP"), 11589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), 11599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), 11609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), 1161cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio @ViewDebug.IntToString(from = Gravity.START, to = "START"), 1162cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio @ViewDebug.IntToString(from = Gravity.END, to = "END"), 11639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), 11649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), 11659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), 11669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_HORIZONTAL, to = "FILL_HORIZONTAL"), 11679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"), 11689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL, to = "FILL") 11699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell }) 1170cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio public int gravity = Gravity.NO_GRAVITY; 11719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1172d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public LayoutParams(@NonNull Context c, AttributeSet attrs) { 11739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(c, attrs); 11749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 11759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell TypedArray a = c.obtainStyledAttributes(attrs, 11769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams); 11779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell gravity = a.getInt( 1178cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, 1179cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio Gravity.NO_GRAVITY); 1180ab0f485e64418eb22f0a1d89d7064902b381e9c2Dianne Hackborn a.recycle(); 11819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 11829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 11839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height) { 11849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 1185cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio this.gravity = Gravity.CENTER_VERTICAL | Gravity.START; 11869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 11879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 11889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height, int gravity) { 11899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 11909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this.gravity = gravity; 11919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 11929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 11939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int gravity) { 11949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this(WRAP_CONTENT, MATCH_PARENT, gravity); 11959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 11969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 11979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(LayoutParams source) { 11989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 11999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 12009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this.gravity = source.gravity; 12019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 12029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 12039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(ViewGroup.LayoutParams source) { 12049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 12059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 12069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 120733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell} 1208