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 199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.Context; 209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.res.TypedArray; 2133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.graphics.drawable.Drawable; 229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.util.AttributeSet; 239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.Gravity; 2433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.view.View; 259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewDebug; 269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup; 279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup.MarginLayoutParams; 286b336f835d637853800b94689375a03f337139a4Adam Powellimport android.view.Window; 29a408291e22def5755559f42cde913706a6d628c0Adam Powellimport android.widget.SpinnerAdapter; 3033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 3133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/** 32e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * A window feature at the top of the activity that may display the activity title, navigation 33e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * modes, and other interactive items. 34e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an 35e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * activity's window when the activity uses the system's {@link 36e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. 37e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * You may otherwise add the action bar by calling {@link 38e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a 39e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. 40e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>By default, the action bar shows the application icon on 41e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * the left, followed by the activity title. If your activity has an options menu, you can make 42e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * select items accessible directly from the action bar as "action items". You can also 43e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * modify various characteristics of the action bar or remove it completely.</p> 4436193d09a87035395d036a730038b765ac0b0913Scott Main * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 4536193d09a87035395d036a730038b765ac0b0913Scott Main * android.app.Activity#getActionBar getActionBar()}.</p> 46e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 47e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in 48e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * your activity, you can enable an action mode that offers actions specific to the selected 49e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 50e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for 51e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * {@link ActionBar}. 52b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <div class="special reference"> 53b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <h3>Developer Guides</h3> 54b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <p>For information about how to use the action bar, including how to add action items, navigation 55b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 56b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * Bar</a> developer guide.</p> 57b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * </div> 5833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 5933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar { 60a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 61a408291e22def5755559f42cde913706a6d628c0Adam Powell * Standard navigation mode. Consists of either a logo or icon 62a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * and title text with an optional subtitle. Clicking any of these elements 63cf0357639e952a87f0d535c82691919af81f058bAdam Powell * will dispatch onOptionsItemSelected to the host Activity with 64a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a MenuItem with item ID android.R.id.home. 65a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 66a408291e22def5755559f42cde913706a6d628c0Adam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 6733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 6833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * List navigation mode. Instead of static title text this mode 709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * presents a list menu for navigation within the activity. 719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. this might be presented to the user as a dropdown list. 7233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int NAVIGATION_MODE_LIST = 1; 7433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 7533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 7633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Tab navigation mode. Instead of static title text this mode 7733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * presents a series of tabs for navigation within the activity. 7833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 7933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 8033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 8133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 8233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Use logo instead of icon if available. This flag will cause appropriate 8333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation modes to use a wider logo in place of the standard icon. 849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 8733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 8833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 8933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 9033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show 'home' elements in this action bar, leaving more space for other 9233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation elements. This includes logo and icon. 939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Display the 'home' element such that it appears as an 'up' affordance. 1019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. show an arrow to the left indicating the action that will be taken. 1029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set this flag if selecting the 'home' button in the action bar to return 1049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * up by a single level in your UI rather than back to the top level or front page. 1059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 106c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting this option will implicitly enable interaction with the home/up 107c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button. See {@link #setHomeButtonEnabled(boolean)}. 108c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 1099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 1139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the activity title and subtitle, if present. 1169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(CharSequence) 1189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(int) 1199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(CharSequence) 1209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(int) 1219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 1259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the custom view if one has been set. 1289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setCustomView(View) 1299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 1339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the action bar into custom navigation mode, supplying a view 1369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * for custom navigation. 1379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Custom navigation views appear between the application icon and 1399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * any action buttons and may use any space available there. Common 1409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * use cases for custom navigation views might include an auto-suggesting 1419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * address bar for a browser or other navigation mechanisms that do not 1429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * translate well to provided navigation modes. 1439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param view Custom navigation view to place in the ActionBar. 14533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view); 14789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell 14833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 149a408291e22def5755559f42cde913706a6d628c0Adam Powell * Set the action bar into custom navigation mode, supplying a view 150a408291e22def5755559f42cde913706a6d628c0Adam Powell * for custom navigation. 15133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 152ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>Custom navigation views appear between the application icon and 15333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * any action buttons and may use any space available there. Common 154a408291e22def5755559f42cde913706a6d628c0Adam Powell * use cases for custom navigation views might include an auto-suggesting 155a408291e22def5755559f42cde913706a6d628c0Adam Powell * address bar for a browser or other navigation mechanisms that do not 156ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * translate well to provided navigation modes.</p> 157ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 158ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 159ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * the custom view to be displayed.</p> 16033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 16133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param view Custom navigation view to place in the ActionBar. 1629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param layoutParams How this custom view should layout in the bar. 163ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 164ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 16533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 1679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1693f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set the action bar into custom navigation mode, supplying a view 1703f476b34049d062942eafcf48396f593e00bd324Adam Powell * for custom navigation. 1713f476b34049d062942eafcf48396f593e00bd324Adam Powell * 1723f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>Custom navigation views appear between the application icon and 1733f476b34049d062942eafcf48396f593e00bd324Adam Powell * any action buttons and may use any space available there. Common 1743f476b34049d062942eafcf48396f593e00bd324Adam Powell * use cases for custom navigation views might include an auto-suggesting 1753f476b34049d062942eafcf48396f593e00bd324Adam Powell * address bar for a browser or other navigation mechanisms that do not 1763f476b34049d062942eafcf48396f593e00bd324Adam Powell * translate well to provided navigation modes.</p> 1773f476b34049d062942eafcf48396f593e00bd324Adam Powell * 1783f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 1793f476b34049d062942eafcf48396f593e00bd324Adam Powell * the custom view to be displayed.</p> 1803f476b34049d062942eafcf48396f593e00bd324Adam Powell * 1813f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 1823f476b34049d062942eafcf48396f593e00bd324Adam Powell * 1833f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 1843f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 1853f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setCustomView(int resId); 1863f476b34049d062942eafcf48396f593e00bd324Adam Powell 1873f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 1881969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 1891969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 1901969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 1911969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 1921969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 1931969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 1941969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 1951969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as an icon. 1961969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 1971969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 1981969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 1991969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2001969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(int resId); 2011969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2021969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2031969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2041969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2051969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2061969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2071969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2081969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2091969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2101969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param icon Drawable to show as an icon. 2111969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2121969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2131969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2141969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2151969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(Drawable icon); 2161969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2171969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2181969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 2191969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 2201969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 2211969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2221969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2231969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2241969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2251969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as a logo. 2261969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2271969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2281969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2291969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2301969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(int resId); 2311969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2321969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2331969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 2341969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 2351969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo 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 logo Drawable to show as a logo. 2411969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2421969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2431969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2441969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2451969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(Drawable logo); 2461969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2471969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the adapter and navigation callback for list navigation mode. 2499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * The supplied adapter will provide views for the expanded list as well as 2519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the currently selected item. (These may be displayed differently.) 2529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2538515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * The supplied OnNavigationListener will alert the application when the user 2549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * changes the current list selection. 2559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param adapter An adapter that will provide views both to display 2579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the current navigation selection and populate views 2589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * within the dropdown navigation menu. 2598515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param callback An OnNavigationListener that will receive events when the user 2609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * selects a navigation item. 2619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 2629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 2638515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell OnNavigationListener callback); 2649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the selected navigation item in list or tabbed navigation modes. 267178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 268178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param position Position of the item to select. 269178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 270178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract void setSelectedNavigationItem(int position); 271178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 272178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 2739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 274178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 275178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @return Position of the selected item. 2769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 2779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getSelectedNavigationIndex(); 2789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the number of navigation items present in the current navigation mode. 2819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return Number of navigation items. 2839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 2849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getNavigationItemCount(); 2859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 287ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 288ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 2890e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 2900e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param title Title to set 291a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 292a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(int) 293ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 2940e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 2950e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setTitle(CharSequence title); 2960e94b5151d817e600a888448a662208b29b5ef46Adam Powell 2970e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 298ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 299ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 300a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 301a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of title string to set 302a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 303a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(CharSequence) 304ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 305a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 306a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell public abstract void setTitle(int resId); 307a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 308a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 309ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 310ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 311ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * subtitle entirely. 3120e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 3130e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param subtitle Subtitle to set 314a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 315a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(int) 316ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 3170e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 3180e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setSubtitle(CharSequence subtitle); 3190e94b5151d817e600a888448a662208b29b5ef46Adam Powell 3200e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 321ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 322ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 323a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 324a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of subtitle string to set 325a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 326a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(CharSequence) 327ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 328a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 329a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell public abstract void setSubtitle(int resId); 330a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 331a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 332a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set display options. This changes all display option bits at once. To change 333a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 33433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 33533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 33633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * defined in ActionBar. 33733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 33833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract void setDisplayOptions(int options); 33933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 34033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 341a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set selected display options. Only the options specified by mask will be changed. 342a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 343a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 3449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 3459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * {@link #DISPLAY_SHOW_HOME} option. 3465ad7af6fc764f71765b134b8cd51787a7e78753aBen Komalo * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 3479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 348a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 349a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 350a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * defined in ActionBar. 351a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param mask A bit mask declaring which display options should be changed. 352a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 353a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell public abstract void setDisplayOptions(int options, int mask); 3543f476b34049d062942eafcf48396f593e00bd324Adam Powell 3553f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 3563f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to display the activity logo rather than the activity icon. 3573f476b34049d062942eafcf48396f593e00bd324Adam Powell * A logo is often a wider, more detailed image. 3583f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3593f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 3603f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3613f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 3623f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3633f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 3643f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 3653f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 3663f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 3673f476b34049d062942eafcf48396f593e00bd324Adam Powell 3683f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 3693f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to include the application home affordance in the action bar. 3703f476b34049d062942eafcf48396f593e00bd324Adam Powell * Home is presented as either an activity icon or logo. 3713f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3723f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 3733f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3743f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHome true to show home, false otherwise. 3753f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3763f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 3773f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 3783f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 3793f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 3803f476b34049d062942eafcf48396f593e00bd324Adam Powell 3813f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 3823f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether home should be displayed as an "up" affordance. 3833f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set this to true if selecting "home" returns up by a single level in your UI 3843f476b34049d062942eafcf48396f593e00bd324Adam Powell * rather than back to the top level or front page. 3853f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3863f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 3873f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3883f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHomeAsUp true to show the user that selecting home will return one 3893f476b34049d062942eafcf48396f593e00bd324Adam Powell * level up rather than to the top level of the app. 3903f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3913f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 3923f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 3933f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 3943f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 3953f476b34049d062942eafcf48396f593e00bd324Adam Powell 3963f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 3973f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether an activity title/subtitle should be displayed. 3983f476b34049d062942eafcf48396f593e00bd324Adam Powell * 3993f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4003f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4013f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showTitle true to display a title/subtitle if present. 4023f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4033f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4043f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4053f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4063f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 4073f476b34049d062942eafcf48396f593e00bd324Adam Powell 4083f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4093f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether a custom view should be displayed, if set. 4103f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4113f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4123f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4133f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showCustom true if the currently set custom view should be displayed, false otherwise. 4143f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4153f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4163f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4173f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4183f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 4193f476b34049d062942eafcf48396f593e00bd324Adam Powell 420a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 421f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's background. This will be used for the primary 422f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * action bar. 42333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 42433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param d Background drawable 425f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 426f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 42733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 42833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract void setBackgroundDrawable(Drawable d); 429ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 430ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell /** 431f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's stacked background. This will appear 432f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * in the second row/stacked bar on some devices and configurations. 433f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 434f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the stacked row 435f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 4360145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setStackedBackgroundDrawable(Drawable d) { } 437f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 438f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 439f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's split background. This will appear in 440f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * the split action bar containing menu-provided action buttons 441f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * on some devices and configurations. 442e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 443f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 444f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the split bar 445f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 4460145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setSplitBackgroundDrawable(Drawable d) { } 447f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 448f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 449ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @return The current custom view. 450ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell */ 451ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell public abstract View getCustomView(); 452ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 45333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 454a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar title in standard mode. 455a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 456a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 457a408291e22def5755559f42cde913706a6d628c0Adam Powell * 458a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar title or null. 45933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 46033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getTitle(); 46133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 46233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 463a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar subtitle in standard mode. 464a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 465a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 466a408291e22def5755559f42cde913706a6d628c0Adam Powell * 467a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar subtitle or null. 46833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 46933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getSubtitle(); 47033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 47133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 472a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current navigation mode. The result will be one of: 473a408291e22def5755559f42cde913706a6d628c0Adam Powell * <ul> 474a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 4759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 476a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_TABS}</li> 477a408291e22def5755559f42cde913706a6d628c0Adam Powell * </ul> 478a408291e22def5755559f42cde913706a6d628c0Adam Powell * 47933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current navigation mode. 48033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 48133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getNavigationMode(); 4829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 4839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 4849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the current navigation mode. 4859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 4869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param mode The new mode to set. 4879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_STANDARD 4889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_LIST 4899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_TABS 4909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 4919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setNavigationMode(int mode); 4929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 49333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 49433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current set of display options. 49533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 49633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getDisplayOptions(); 497661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 498661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 499661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Create and return a new {@link Tab}. 500661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * This tab will not be included in the action bar until it is added. 501661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 5022f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * <p>Very often tabs will be used to switch between {@link Fragment} 5032f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * objects. Here is a typical implementation of such tabs:</p> 5042f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 5052f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 5062f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * complete} 5072f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 508661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return A new Tab 509661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 510661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #addTab(Tab) 511661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 512661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Tab newTab(); 513661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 514661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 515661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 51681b8944131946e451b31665652de8cc71d81ea07Adam Powell * If this is the first tab to be added it will become the selected tab. 517661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 518661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to add 519661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 520661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void addTab(Tab tab); 521661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 522661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 52381b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 52481b8944131946e451b31665652de8cc71d81ea07Adam Powell * 52581b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab Tab to add 52681b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 52781b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 52881b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, boolean setSelected); 52981b8944131946e451b31665652de8cc71d81ea07Adam Powell 53081b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 5312b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 53281b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. If this is the first tab to be added it will become 53381b8944131946e451b31665652de8cc71d81ea07Adam Powell * the selected tab. 534661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 535661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to add 536661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position The new position of the tab 537661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 5382b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract void addTab(Tab tab, int position); 539661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 540661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 54181b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 54281b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. 54381b8944131946e451b31665652de8cc71d81ea07Adam Powell * 54481b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab The tab to add 54581b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param position The new position of the tab 54681b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 54781b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 54881b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 54981b8944131946e451b31665652de8cc71d81ea07Adam Powell 55081b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 5519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 5529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 553661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 554661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to remove 555661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 556661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTab(Tab tab); 557661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 558661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 5599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 5609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 561661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 562661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position Position of the tab to remove 563661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 564661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTabAt(int position); 565661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 566661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 5679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove all tabs from the action bar and deselect the current tab. 5689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 5699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void removeAllTabs(); 5709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 5719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 572661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 573661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 5749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 5759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 576661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to select 577661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 578661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void selectTab(Tab tab); 579661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 580661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 5812b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Returns the currently selected tab if in tabbed navigation mode and there is at least 5822b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * one tab present. 5832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 5842b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The currently selected tab or null 5852b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 5862b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Tab getSelectedTab(); 5872b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 5882b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 5899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Returns the tab at the specified index. 5909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 5919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param index Index value in the range 0-get 5929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return 5939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 5949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab getTabAt(int index); 5959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 5969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 5970c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * Returns the number of tabs currently registered with the action bar. 5980c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * @return Tab count 5990c24a5514c1ff143a223720a090b19a86a75945fAdam Powell */ 6000c24a5514c1ff143a223720a090b19a86a75945fAdam Powell public abstract int getTabCount(); 6010c24a5514c1ff143a223720a090b19a86a75945fAdam Powell 6020c24a5514c1ff143a223720a090b19a86a75945fAdam Powell /** 6036b336f835d637853800b94689375a03f337139a4Adam Powell * Retrieve the current height of the ActionBar. 6046b336f835d637853800b94689375a03f337139a4Adam Powell * 6056b336f835d637853800b94689375a03f337139a4Adam Powell * @return The ActionBar's height 6066b336f835d637853800b94689375a03f337139a4Adam Powell */ 6076b336f835d637853800b94689375a03f337139a4Adam Powell public abstract int getHeight(); 6086b336f835d637853800b94689375a03f337139a4Adam Powell 6096b336f835d637853800b94689375a03f337139a4Adam Powell /** 6106b336f835d637853800b94689375a03f337139a4Adam Powell * Show the ActionBar if it is not currently showing. 6116b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 6126b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 6136b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 6143a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 6153a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>If you are hiding the ActionBar through 6163a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 6173a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * you should not call this function directly. 6186b336f835d637853800b94689375a03f337139a4Adam Powell */ 6196b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void show(); 6206b336f835d637853800b94689375a03f337139a4Adam Powell 6216b336f835d637853800b94689375a03f337139a4Adam Powell /** 622e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * Hide the ActionBar if it is currently showing. 6236b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 6246b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 6256b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 6263a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 6273a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>Instead of calling this function directly, you can also cause an 6283a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * ActionBar using the overlay feature to hide through 6293a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 6303a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * Hiding the ActionBar through this system UI flag allows you to more 6313a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * seamlessly hide it in conjunction with other screen decorations. 6326b336f835d637853800b94689375a03f337139a4Adam Powell */ 6336b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void hide(); 6346b336f835d637853800b94689375a03f337139a4Adam Powell 6356b336f835d637853800b94689375a03f337139a4Adam Powell /** 6366b336f835d637853800b94689375a03f337139a4Adam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 6376b336f835d637853800b94689375a03f337139a4Adam Powell */ 6386b336f835d637853800b94689375a03f337139a4Adam Powell public abstract boolean isShowing(); 6396b336f835d637853800b94689375a03f337139a4Adam Powell 6406b336f835d637853800b94689375a03f337139a4Adam Powell /** 6418515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Add a listener that will respond to menu visibility change events. 6428515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 6438515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener The new listener to add 6448515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 6458515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 6468515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 6478515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 6488515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Remove a menu visibility listener. This listener will no longer receive menu 6498515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * visibility change events. 6508515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 6518515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener A listener to remove that was previously added 6528515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 6538515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 6548515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 6558515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 656c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * Enable or disable the "home" button in the corner of the action bar. (Note that this 657c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * is the application home/up affordance on the action bar, not the systemwide home 658c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button.) 659c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 660c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>This defaults to true for packages targeting < API 14. For packages targeting 661c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * API 14 or greater, the application should call this method to enable interaction 662c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * with the home/up affordance. 663c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 664c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 665c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * the home button. 666c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 667c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * @param enabled true to enable the home button, false to disable the home button. 668c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell */ 66988ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public void setHomeButtonEnabled(boolean enabled) { } 67088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell 67188ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell /** 67288ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * Returns a {@link Context} with an appropriate theme for creating views that 67388ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * will appear in the action bar. If you are inflating or instantiating custom views 67488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * that will appear in an action bar, you should use the Context returned by this method. 67588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * (This includes adapters used for list navigation mode.) 67688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * This will ensure that views contrast properly against the action bar. 67788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * 67888ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * @return A themed Context for creating views 67988ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell */ 68088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public Context getThemedContext() { return null; } 681c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell 682c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell /** 6838515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener interface for ActionBar navigation events. 68489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 6858515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnNavigationListener { 68689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell /** 68789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * This method is called whenever a navigation item in your action bar 68889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * is selected. 68989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * 69089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemPosition Position of the item clicked. 69189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemId ID of the item clicked. 69289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @return True if the event was handled, false otherwise. 69389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 69489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 69533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell } 696661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 697661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 6988515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener for receiving events when action bar menus are shown or hidden. 6998515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 7008515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnMenuVisibilityListener { 7018515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 7028515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Called when an action bar menu is shown or hidden. Applications may want to use 7038515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 7048515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * gameplay, or other activity within the main content area. 7058515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 7068515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param isVisible True if an action bar menu is now visible, false if no action bar 7078515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * menus are visible. 7088515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 7098515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 7108515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell } 7118515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 7128515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 713661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * A tab in the action bar. 714661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 715661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * <p>Tabs manage the hiding and showing of {@link Fragment}s. 716661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 717661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static abstract class Tab { 718661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 719661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * An invalid position for a tab. 720661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 721661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #getPosition() 722661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 723661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static final int INVALID_POSITION = -1; 724661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 725661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 726661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the current position of this tab in the action bar. 727661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 728661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 729661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * the action bar. 730661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 731661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract int getPosition(); 732661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 733661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 734661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the icon associated with this tab. 735661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 736661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's icon 737661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 738661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Drawable getIcon(); 739661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 740661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 741661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the text of this tab. 742661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 743661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's text 744661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 745661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract CharSequence getText(); 746661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 747661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 748661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the icon displayed on this tab. 749661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 750661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param icon The drawable to use as an icon 7519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 752661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 7539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setIcon(Drawable icon); 754661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 755661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 75632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the icon displayed on this tab. 75732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 75832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId Resource ID referring to the drawable to use as an icon 75932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 76032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 76132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setIcon(int resId); 76232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 76332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 764661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the text displayed on this tab. Text may be truncated if there is not 765661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * room to display the entire string. 766661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 767661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param text The text to display 7689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 769661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 7709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setText(CharSequence text); 771661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 772661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 77332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the text displayed on this tab. Text may be truncated if there is not 77432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * room to display the entire string. 77532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 77632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId A resource ID referring to the text that should be displayed 77732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 77832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 77932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setText(int resId); 78032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 78132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 7822b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set a custom view to be used for this tab. This overrides values set by 7832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 784661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 7852b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param view Custom view to be used as a tab. 7869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 787661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 7889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setCustomView(View view); 789661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 790661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 79132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set a custom view to be used for this tab. This overrides values set by 79232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 79332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 79432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 79532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 79632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 79732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell public abstract Tab setCustomView(int layoutResId); 79832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 79932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 8002b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Retrieve a previously set custom view for this tab. 801661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 8022b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The custom view set by {@link #setCustomView(View)}. 803661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 8042b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract View getCustomView(); 8052b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 8062b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 8072b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Give this Tab an arbitrary object to hold for later use. 8082b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 8092b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param obj Object to store 8109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 8112b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 8129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTag(Object obj); 8132b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 8142b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 8152b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return This Tab's tag object. 8162b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 8172b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Object getTag(); 8182b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 8192b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 8202b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set the {@link TabListener} that will handle switching to and from this tab. 8212b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * All tabs must have a TabListener set before being added to the ActionBar. 8222b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 8232b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param listener Listener to handle tab selection events 8249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 8252b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 8269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTabListener(TabListener listener); 827661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 828661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 829661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 830661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 831661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void select(); 83294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 83394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 83494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 83594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 83694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 83794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param resId A resource ID referring to the description text 83894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 83994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 84094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 84194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 84294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(int resId); 84394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 84494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 84594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 84694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 84794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 84894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param contentDesc Description of this tab's content 84994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 85094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 85194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 85294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 85394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 85494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 85594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 85694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 85794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 85894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return Description of this tab's content 85994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 86094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 86194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 86294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract CharSequence getContentDescription(); 863661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell } 8642b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 8652b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 8662b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Callback interface invoked when a tab is focused, unfocused, added, or removed. 8672b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 8682b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public interface TabListener { 8692b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 8702b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab enters the selected state. 8712b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 8722b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was selected 8732b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 8742b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. The previous tab's unselect and this tab's select will be 8750c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * executed in a single transaction. This FragmentTransaction does not support 8760c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 8772b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 8782b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 8792b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 8802b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 8812b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab exits the selected state. 8822b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 8832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was unselected 8842b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 8852b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. This tab's unselect and the newly selected tab's select 8860c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * will be executed in a single transaction. This FragmentTransaction does not 8870c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * support being added to the back stack. 8882b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 8892b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 8907f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell 8917f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell /** 8927f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Called when a tab that is already selected is chosen again by the user. 8937f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Some applications may use this action to return to the top level of a category. 8947f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * 8957f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param tab The tab that was reselected. 8967f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 8970c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * once this method returns. This FragmentTransaction does not support 8980c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 8997f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell */ 9007f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 9012b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell } 9029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 9049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Per-child layout information associated with action bar custom views. 9059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 9069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 9079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 9089ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static class LayoutParams extends MarginLayoutParams { 9099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 9109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Gravity for the view associated with these LayoutParams. 9119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 9129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see android.view.Gravity 9139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 9149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.ExportedProperty(category = "layout", mapping = { 9159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = -1, to = "NONE"), 9169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.NO_GRAVITY, to = "NONE"), 9179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.TOP, to = "TOP"), 9189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), 9199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), 9209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), 921cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio @ViewDebug.IntToString(from = Gravity.START, to = "START"), 922cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio @ViewDebug.IntToString(from = Gravity.END, to = "END"), 9239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), 9249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), 9259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), 9269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_HORIZONTAL, to = "FILL_HORIZONTAL"), 9279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"), 9289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL, to = "FILL") 9299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell }) 930cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio public int gravity = Gravity.NO_GRAVITY; 9319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(Context c, AttributeSet attrs) { 9339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(c, attrs); 9349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell TypedArray a = c.obtainStyledAttributes(attrs, 9369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams); 9379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell gravity = a.getInt( 938cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, 939cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio Gravity.NO_GRAVITY); 940ab0f485e64418eb22f0a1d89d7064902b381e9c2Dianne Hackborn a.recycle(); 9419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 9429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height) { 9449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 945cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio this.gravity = Gravity.CENTER_VERTICAL | Gravity.START; 9469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 9479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height, int gravity) { 9499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 9509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this.gravity = gravity; 9519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 9529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int gravity) { 9549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this(WRAP_CONTENT, MATCH_PARENT, gravity); 9559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 9569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(LayoutParams source) { 9589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 9599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this.gravity = source.gravity; 9619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 9629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 9639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(ViewGroup.LayoutParams source) { 9649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 9659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 9669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 96733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell} 968