ActionBar.java revision ab0f485e64418eb22f0a1d89d7064902b381e9c2
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/**
3236193d09a87035395d036a730038b765ac0b0913Scott Main * Acts as a replacement for the title bar in Activities.
3336193d09a87035395d036a730038b765ac0b0913Scott Main * The action bar provides facilities for creating toolbar actions as well as
3436193d09a87035395d036a730038b765ac0b0913Scott Main * methods of navigating the application.
3536193d09a87035395d036a730038b765ac0b0913Scott Main * <p>By default, the action bar appears at the top of every activity, with the application icon on
3636193d09a87035395d036a730038b765ac0b0913Scott Main * the left, followed by the activity title. Items from the activity's options menu are also
3736193d09a87035395d036a730038b765ac0b0913Scott Main * accessible from the action bar.</p>
3836193d09a87035395d036a730038b765ac0b0913Scott Main * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link
3936193d09a87035395d036a730038b765ac0b0913Scott Main * android.app.Activity#getActionBar getActionBar()}.</p>
4036193d09a87035395d036a730038b765ac0b0913Scott Main * <p>For more information, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action
4136193d09a87035395d036a730038b765ac0b0913Scott Main * Bar</a> developer guide.</p>
4233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */
4333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar {
44a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell    /**
45a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Standard navigation mode. Consists of either a logo or icon
46a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * and title text with an optional subtitle. Clicking any of these elements
47cf0357639e952a87f0d535c82691919af81f058bAdam Powell     * will dispatch onOptionsItemSelected to the host Activity with
48a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * a MenuItem with item ID android.R.id.home.
49a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     */
50a408291e22def5755559f42cde913706a6d628c0Adam Powell    public static final int NAVIGATION_MODE_STANDARD = 0;
5133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
5233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * List navigation mode. Instead of static title text this mode
549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * presents a list menu for navigation within the activity.
559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * e.g. this might be presented to the user as a dropdown list.
5633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public static final int NAVIGATION_MODE_LIST = 1;
5833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
5933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
6033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Tab navigation mode. Instead of static title text this mode
6133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * presents a series of tabs for navigation within the activity.
6233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
6333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public static final int NAVIGATION_MODE_TABS = 2;
6433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
6533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
6633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Use logo instead of icon if available. This flag will cause appropriate
6733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * navigation modes to use a wider logo in place of the standard icon.
689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int)
709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int, int)
7133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
7233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public static final int DISPLAY_USE_LOGO = 0x1;
7333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
7433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Show 'home' elements in this action bar, leaving more space for other
7633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * navigation elements. This includes logo and icon.
779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int)
799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int, int)
809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public static final int DISPLAY_SHOW_HOME = 0x2;
829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Display the 'home' element such that it appears as an 'up' affordance.
859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * e.g. show an arrow to the left indicating the action that will be taken.
869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Set this flag if selecting the 'home' button in the action bar to return
889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * up by a single level in your UI rather than back to the top level or front page.
899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
90c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * <p>Setting this option will implicitly enable interaction with the home/up
91c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * button. See {@link #setHomeButtonEnabled(boolean)}.
92c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     *
939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int)
949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int, int)
959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public static final int DISPLAY_HOME_AS_UP = 0x4;
979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Show the activity title and subtitle, if present.
1009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
1019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setTitle(CharSequence)
1029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setTitle(int)
1039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setSubtitle(CharSequence)
1049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setSubtitle(int)
1059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int)
1069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int, int)
1079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
1089ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public static final int DISPLAY_SHOW_TITLE = 0x8;
1099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
1109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
1119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Show the custom view if one has been set.
1129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setCustomView(View)
1139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int)
1149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #setDisplayOptions(int, int)
1159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
1169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public static final int DISPLAY_SHOW_CUSTOM = 0x10;
1179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
1189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
1199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Set the action bar into custom navigation mode, supplying a view
1209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * for custom navigation.
1219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
1229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Custom navigation views appear between the application icon and
1239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * any action buttons and may use any space available there. Common
1249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * use cases for custom navigation views might include an auto-suggesting
1259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * address bar for a browser or other navigation mechanisms that do not
1269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * translate well to provided navigation modes.
1279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
1289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @param view Custom navigation view to place in the ActionBar.
12933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
1309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public abstract void setCustomView(View view);
13189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
13233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
133a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Set the action bar into custom navigation mode, supplying a view
134a408291e22def5755559f42cde913706a6d628c0Adam Powell     * for custom navigation.
13533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
136ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * <p>Custom navigation views appear between the application icon and
13733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * any action buttons and may use any space available there. Common
138a408291e22def5755559f42cde913706a6d628c0Adam Powell     * use cases for custom navigation views might include an auto-suggesting
139a408291e22def5755559f42cde913706a6d628c0Adam Powell     * address bar for a browser or other navigation mechanisms that do not
140ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * translate well to provided navigation modes.</p>
141ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     *
142ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for
143ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * the custom view to be displayed.</p>
14433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
14533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @param view Custom navigation view to place in the ActionBar.
1469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @param layoutParams How this custom view should layout in the bar.
147ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     *
148ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * @see #setDisplayOptions(int, int)
14933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
1509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public abstract void setCustomView(View view, LayoutParams layoutParams);
1519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
1529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
1533f476b34049d062942eafcf48396f593e00bd324Adam Powell     * Set the action bar into custom navigation mode, supplying a view
1543f476b34049d062942eafcf48396f593e00bd324Adam Powell     * for custom navigation.
1553f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
1563f476b34049d062942eafcf48396f593e00bd324Adam Powell     * <p>Custom navigation views appear between the application icon and
1573f476b34049d062942eafcf48396f593e00bd324Adam Powell     * any action buttons and may use any space available there. Common
1583f476b34049d062942eafcf48396f593e00bd324Adam Powell     * use cases for custom navigation views might include an auto-suggesting
1593f476b34049d062942eafcf48396f593e00bd324Adam Powell     * address bar for a browser or other navigation mechanisms that do not
1603f476b34049d062942eafcf48396f593e00bd324Adam Powell     * translate well to provided navigation modes.</p>
1613f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
1623f476b34049d062942eafcf48396f593e00bd324Adam Powell     * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for
1633f476b34049d062942eafcf48396f593e00bd324Adam Powell     * the custom view to be displayed.</p>
1643f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
1653f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @param resId Resource ID of a layout to inflate into the ActionBar.
1663f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
1673f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int, int)
1683f476b34049d062942eafcf48396f593e00bd324Adam Powell     */
1693f476b34049d062942eafcf48396f593e00bd324Adam Powell    public abstract void setCustomView(int resId);
1703f476b34049d062942eafcf48396f593e00bd324Adam Powell
1713f476b34049d062942eafcf48396f593e00bd324Adam Powell    /**
1721969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * Set the icon to display in the 'home' section of the action bar.
1731969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * The action bar will use an icon specified by its style or the
1741969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * activity icon by default.
1751969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
1761969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * Whether the home section shows an icon or logo is controlled
1771969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * by the display option {@link #DISPLAY_USE_LOGO}.
1781969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
1791969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @param resId Resource ID of a drawable to show as an icon.
1801969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
1811969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @see #setDisplayUseLogoEnabled(boolean)
1821969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @see #setDisplayShowHomeEnabled(boolean)
1831969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     */
1841969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell    public abstract void setIcon(int resId);
1851969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell
1861969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell    /**
1871969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * Set the icon to display in the 'home' section of the action bar.
1881969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * The action bar will use an icon specified by its style or the
1891969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * activity icon by default.
1901969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
1911969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * Whether the home section shows an icon or logo is controlled
1921969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * by the display option {@link #DISPLAY_USE_LOGO}.
1931969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
1941969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @param icon Drawable to show as an icon.
1951969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
1961969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @see #setDisplayUseLogoEnabled(boolean)
1971969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @see #setDisplayShowHomeEnabled(boolean)
1981969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     */
1991969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell    public abstract void setIcon(Drawable icon);
2001969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell
2011969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell    /**
2021969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * Set the logo to display in the 'home' section of the action bar.
2031969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * The action bar will use a logo specified by its style or the
2041969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * activity logo by default.
2051969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
2061969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * Whether the home section shows an icon or logo is controlled
2071969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * by the display option {@link #DISPLAY_USE_LOGO}.
2081969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
2091969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @param resId Resource ID of a drawable to show as a logo.
2101969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
2111969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @see #setDisplayUseLogoEnabled(boolean)
2121969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @see #setDisplayShowHomeEnabled(boolean)
2131969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     */
2141969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell    public abstract void setLogo(int resId);
2151969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell
2161969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell    /**
2171969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * Set the logo to display in the 'home' section of the action bar.
2181969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * The action bar will use a logo specified by its style or the
2191969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * activity logo by default.
2201969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
2211969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * Whether the home section shows an icon or logo is controlled
2221969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * by the display option {@link #DISPLAY_USE_LOGO}.
2231969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
2241969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @param logo Drawable to show as a logo.
2251969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     *
2261969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @see #setDisplayUseLogoEnabled(boolean)
2271969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     * @see #setDisplayShowHomeEnabled(boolean)
2281969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell     */
2291969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell    public abstract void setLogo(Drawable logo);
2301969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell
2311969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell    /**
2329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Set the adapter and navigation callback for list navigation mode.
2339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
2349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * The supplied adapter will provide views for the expanded list as well as
2359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * the currently selected item. (These may be displayed differently.)
2369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
2378515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * The supplied OnNavigationListener will alert the application when the user
2389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * changes the current list selection.
2399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
2409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @param adapter An adapter that will provide views both to display
2419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *                the current navigation selection and populate views
2429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *                within the dropdown navigation menu.
2438515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * @param callback An OnNavigationListener that will receive events when the user
2449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *                 selects a navigation item.
2459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
2469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public abstract void setListNavigationCallbacks(SpinnerAdapter adapter,
2478515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell            OnNavigationListener callback);
2489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
2499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
2509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Set the selected navigation item in list or tabbed navigation modes.
251178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *
252178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * @param position Position of the item to select.
253178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     */
254178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell    public abstract void setSelectedNavigationItem(int position);
255178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell
256178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell    /**
2579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Get the position of the selected navigation item in list or tabbed navigation modes.
258178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *
259178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * @return Position of the selected item.
2609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
2619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public abstract int getSelectedNavigationIndex();
2629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
2639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
2649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Get the number of navigation items present in the current navigation mode.
2659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
2669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @return Number of navigation items.
2679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
2689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public abstract int getNavigationItemCount();
2699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
2709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
271ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * Set the action bar's title. This will only be displayed if
272ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * {@link #DISPLAY_SHOW_TITLE} is set.
2730e94b5151d817e600a888448a662208b29b5ef46Adam Powell     *
2740e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * @param title Title to set
275a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
276a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @see #setTitle(int)
277ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * @see #setDisplayOptions(int, int)
2780e94b5151d817e600a888448a662208b29b5ef46Adam Powell     */
2790e94b5151d817e600a888448a662208b29b5ef46Adam Powell    public abstract void setTitle(CharSequence title);
2800e94b5151d817e600a888448a662208b29b5ef46Adam Powell
2810e94b5151d817e600a888448a662208b29b5ef46Adam Powell    /**
282ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * Set the action bar's title. This will only be displayed if
283ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * {@link #DISPLAY_SHOW_TITLE} is set.
284a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
285a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @param resId Resource ID of title string to set
286a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
287a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @see #setTitle(CharSequence)
288ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * @see #setDisplayOptions(int, int)
289a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     */
290a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell    public abstract void setTitle(int resId);
291a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell
292a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell    /**
293ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * Set the action bar's subtitle. This will only be displayed if
294ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the
295ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * subtitle entirely.
2960e94b5151d817e600a888448a662208b29b5ef46Adam Powell     *
2970e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * @param subtitle Subtitle to set
298a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
299a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @see #setSubtitle(int)
300ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * @see #setDisplayOptions(int, int)
3010e94b5151d817e600a888448a662208b29b5ef46Adam Powell     */
3020e94b5151d817e600a888448a662208b29b5ef46Adam Powell    public abstract void setSubtitle(CharSequence subtitle);
3030e94b5151d817e600a888448a662208b29b5ef46Adam Powell
3040e94b5151d817e600a888448a662208b29b5ef46Adam Powell    /**
305ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * Set the action bar's subtitle. This will only be displayed if
306ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * {@link #DISPLAY_SHOW_TITLE} is set.
307a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
308a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @param resId Resource ID of subtitle string to set
309a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
310a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @see #setSubtitle(CharSequence)
311ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * @see #setDisplayOptions(int, int)
312a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     */
313a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell    public abstract void setSubtitle(int resId);
314a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell
315a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell    /**
316a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * Set display options. This changes all display option bits at once. To change
317a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * a limited subset of display options, see {@link #setDisplayOptions(int, int)}.
31833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
31933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @param options A combination of the bits defined by the DISPLAY_ constants
32033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *                defined in ActionBar.
32133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
32233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract void setDisplayOptions(int options);
32333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
32433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
325a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * Set selected display options. Only the options specified by mask will be changed.
326a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * To change all display option bits at once, see {@link #setDisplayOptions(int)}.
327a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     *
3289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the
3299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * {@link #DISPLAY_SHOW_HOME} option.
3305ad7af6fc764f71765b134b8cd51787a7e78753aBen Komalo     * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO)
3319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}.
332a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     *
333a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * @param options A combination of the bits defined by the DISPLAY_ constants
334a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     *                defined in ActionBar.
335a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * @param mask A bit mask declaring which display options should be changed.
336a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     */
337a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell    public abstract void setDisplayOptions(int options, int mask);
3383f476b34049d062942eafcf48396f593e00bd324Adam Powell
3393f476b34049d062942eafcf48396f593e00bd324Adam Powell    /**
3403f476b34049d062942eafcf48396f593e00bd324Adam Powell     * Set whether to display the activity logo rather than the activity icon.
3413f476b34049d062942eafcf48396f593e00bd324Adam Powell     * A logo is often a wider, more detailed image.
3423f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3433f476b34049d062942eafcf48396f593e00bd324Adam Powell     * <p>To set several display options at once, see the setDisplayOptions methods.
3443f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3453f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @param useLogo true to use the activity logo, false to use the activity icon.
3463f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3473f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int)
3483f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int, int)
3493f476b34049d062942eafcf48396f593e00bd324Adam Powell     */
3503f476b34049d062942eafcf48396f593e00bd324Adam Powell    public abstract void setDisplayUseLogoEnabled(boolean useLogo);
3513f476b34049d062942eafcf48396f593e00bd324Adam Powell
3523f476b34049d062942eafcf48396f593e00bd324Adam Powell    /**
3533f476b34049d062942eafcf48396f593e00bd324Adam Powell     * Set whether to include the application home affordance in the action bar.
3543f476b34049d062942eafcf48396f593e00bd324Adam Powell     * Home is presented as either an activity icon or logo.
3553f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3563f476b34049d062942eafcf48396f593e00bd324Adam Powell     * <p>To set several display options at once, see the setDisplayOptions methods.
3573f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3583f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @param showHome true to show home, false otherwise.
3593f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3603f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int)
3613f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int, int)
3623f476b34049d062942eafcf48396f593e00bd324Adam Powell     */
3633f476b34049d062942eafcf48396f593e00bd324Adam Powell    public abstract void setDisplayShowHomeEnabled(boolean showHome);
3643f476b34049d062942eafcf48396f593e00bd324Adam Powell
3653f476b34049d062942eafcf48396f593e00bd324Adam Powell    /**
3663f476b34049d062942eafcf48396f593e00bd324Adam Powell     * Set whether home should be displayed as an "up" affordance.
3673f476b34049d062942eafcf48396f593e00bd324Adam Powell     * Set this to true if selecting "home" returns up by a single level in your UI
3683f476b34049d062942eafcf48396f593e00bd324Adam Powell     * rather than back to the top level or front page.
3693f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3703f476b34049d062942eafcf48396f593e00bd324Adam Powell     * <p>To set several display options at once, see the setDisplayOptions methods.
3713f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3723f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @param showHomeAsUp true to show the user that selecting home will return one
3733f476b34049d062942eafcf48396f593e00bd324Adam Powell     *                     level up rather than to the top level of the app.
3743f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3753f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int)
3763f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int, int)
3773f476b34049d062942eafcf48396f593e00bd324Adam Powell     */
3783f476b34049d062942eafcf48396f593e00bd324Adam Powell    public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);
3793f476b34049d062942eafcf48396f593e00bd324Adam Powell
3803f476b34049d062942eafcf48396f593e00bd324Adam Powell    /**
3813f476b34049d062942eafcf48396f593e00bd324Adam Powell     * Set whether an activity title/subtitle should be displayed.
3823f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3833f476b34049d062942eafcf48396f593e00bd324Adam Powell     * <p>To set several display options at once, see the setDisplayOptions methods.
3843f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3853f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @param showTitle true to display a title/subtitle if present.
3863f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3873f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int)
3883f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int, int)
3893f476b34049d062942eafcf48396f593e00bd324Adam Powell     */
3903f476b34049d062942eafcf48396f593e00bd324Adam Powell    public abstract void setDisplayShowTitleEnabled(boolean showTitle);
3913f476b34049d062942eafcf48396f593e00bd324Adam Powell
3923f476b34049d062942eafcf48396f593e00bd324Adam Powell    /**
3933f476b34049d062942eafcf48396f593e00bd324Adam Powell     * Set whether a custom view should be displayed, if set.
3943f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3953f476b34049d062942eafcf48396f593e00bd324Adam Powell     * <p>To set several display options at once, see the setDisplayOptions methods.
3963f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3973f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @param showCustom true if the currently set custom view should be displayed, false otherwise.
3983f476b34049d062942eafcf48396f593e00bd324Adam Powell     *
3993f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int)
4003f476b34049d062942eafcf48396f593e00bd324Adam Powell     * @see #setDisplayOptions(int, int)
4013f476b34049d062942eafcf48396f593e00bd324Adam Powell     */
4023f476b34049d062942eafcf48396f593e00bd324Adam Powell    public abstract void setDisplayShowCustomEnabled(boolean showCustom);
4033f476b34049d062942eafcf48396f593e00bd324Adam Powell
404a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell    /**
405f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * Set the ActionBar's background. This will be used for the primary
406f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * action bar.
40733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
40833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @param d Background drawable
409f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * @see #setStackedBackgroundDrawable(Drawable)
410f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * @see #setSplitBackgroundDrawable(Drawable)
41133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
41233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract void setBackgroundDrawable(Drawable d);
413ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell
414ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell    /**
415f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * Set the ActionBar's stacked background. This will appear
416f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * in the second row/stacked bar on some devices and configurations.
417f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     *
418f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * @param d Background drawable for the stacked row
419f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     */
4200145322e82f640f33befa7cb517a793d12abfb57Adam Powell    public void setStackedBackgroundDrawable(Drawable d) { }
421f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell
422f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell    /**
423f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * Set the ActionBar's split background. This will appear in
424f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * the split action bar containing menu-provided action buttons
425f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * on some devices and configurations.
426f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     *
427f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     * @param d Background drawable for the split bar
428f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell     */
4290145322e82f640f33befa7cb517a793d12abfb57Adam Powell    public void setSplitBackgroundDrawable(Drawable d) { }
430f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell
431f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell    /**
432ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     * @return The current custom view.
433ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell     */
434ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell    public abstract View getCustomView();
435ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell
43633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
437a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns the current ActionBar title in standard mode.
438a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns null if {@link #getNavigationMode()} would not return
439a408291e22def5755559f42cde913706a6d628c0Adam Powell     * {@link #NAVIGATION_MODE_STANDARD}.
440a408291e22def5755559f42cde913706a6d628c0Adam Powell     *
441a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @return The current ActionBar title or null.
44233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
44333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract CharSequence getTitle();
44433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
44533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
446a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns the current ActionBar subtitle in standard mode.
447a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns null if {@link #getNavigationMode()} would not return
448a408291e22def5755559f42cde913706a6d628c0Adam Powell     * {@link #NAVIGATION_MODE_STANDARD}.
449a408291e22def5755559f42cde913706a6d628c0Adam Powell     *
450a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @return The current ActionBar subtitle or null.
45133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
45233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract CharSequence getSubtitle();
45333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
45433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
455a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns the current navigation mode. The result will be one of:
456a408291e22def5755559f42cde913706a6d628c0Adam Powell     * <ul>
457a408291e22def5755559f42cde913706a6d628c0Adam Powell     * <li>{@link #NAVIGATION_MODE_STANDARD}</li>
4589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * <li>{@link #NAVIGATION_MODE_LIST}</li>
459a408291e22def5755559f42cde913706a6d628c0Adam Powell     * <li>{@link #NAVIGATION_MODE_TABS}</li>
460a408291e22def5755559f42cde913706a6d628c0Adam Powell     * </ul>
461a408291e22def5755559f42cde913706a6d628c0Adam Powell     *
46233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @return The current navigation mode.
463a408291e22def5755559f42cde913706a6d628c0Adam Powell     *
464661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #setStandardNavigationMode()
465a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @see #setStandardNavigationMode(CharSequence)
466a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @see #setStandardNavigationMode(CharSequence, CharSequence)
467a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @see #setDropdownNavigationMode(SpinnerAdapter)
468661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #setTabNavigationMode()
469a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @see #setCustomNavigationMode(View)
47033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
47133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract int getNavigationMode();
4729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
4739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
4749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Set the current navigation mode.
4759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
4769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @param mode The new mode to set.
4779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #NAVIGATION_MODE_STANDARD
4789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #NAVIGATION_MODE_LIST
4799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @see #NAVIGATION_MODE_TABS
4809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
4819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public abstract void setNavigationMode(int mode);
4829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
48333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
48433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @return The current set of display options.
48533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
48633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract int getDisplayOptions();
487661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
488661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
489661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Create and return a new {@link Tab}.
490661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * This tab will not be included in the action bar until it is added.
491661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
4922f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn     * <p>Very often tabs will be used to switch between {@link Fragment}
4932f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn     * objects.  Here is a typical implementation of such tabs:</p>
4942f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn     *
4952f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn     * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java
4962f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn     *      complete}
4972f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn     *
498661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @return A new Tab
499661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
500661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #addTab(Tab)
501661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #insertTab(Tab, int)
502661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
503661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract Tab newTab();
504661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
505661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
506661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list.
50781b8944131946e451b31665652de8cc71d81ea07Adam Powell     * If this is the first tab to be added it will become the selected tab.
508661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
509661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param tab Tab to add
510661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
511661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void addTab(Tab tab);
512661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
513661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
51481b8944131946e451b31665652de8cc71d81ea07Adam Powell     * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list.
51581b8944131946e451b31665652de8cc71d81ea07Adam Powell     *
51681b8944131946e451b31665652de8cc71d81ea07Adam Powell     * @param tab Tab to add
51781b8944131946e451b31665652de8cc71d81ea07Adam Powell     * @param setSelected True if the added tab should become the selected tab.
51881b8944131946e451b31665652de8cc71d81ea07Adam Powell     */
51981b8944131946e451b31665652de8cc71d81ea07Adam Powell    public abstract void addTab(Tab tab, boolean setSelected);
52081b8944131946e451b31665652de8cc71d81ea07Adam Powell
52181b8944131946e451b31665652de8cc71d81ea07Adam Powell    /**
5222b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * Add a tab for use in tabbed navigation mode. The tab will be inserted at
52381b8944131946e451b31665652de8cc71d81ea07Adam Powell     * <code>position</code>. If this is the first tab to be added it will become
52481b8944131946e451b31665652de8cc71d81ea07Adam Powell     * the selected tab.
525661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
526661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param tab The tab to add
527661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param position The new position of the tab
528661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
5292b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    public abstract void addTab(Tab tab, int position);
530661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
531661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
53281b8944131946e451b31665652de8cc71d81ea07Adam Powell     * Add a tab for use in tabbed navigation mode. The tab will be insterted at
53381b8944131946e451b31665652de8cc71d81ea07Adam Powell     * <code>position</code>.
53481b8944131946e451b31665652de8cc71d81ea07Adam Powell     *
53581b8944131946e451b31665652de8cc71d81ea07Adam Powell     * @param tab The tab to add
53681b8944131946e451b31665652de8cc71d81ea07Adam Powell     * @param position The new position of the tab
53781b8944131946e451b31665652de8cc71d81ea07Adam Powell     * @param setSelected True if the added tab should become the selected tab.
53881b8944131946e451b31665652de8cc71d81ea07Adam Powell     */
53981b8944131946e451b31665652de8cc71d81ea07Adam Powell    public abstract void addTab(Tab tab, int position, boolean setSelected);
54081b8944131946e451b31665652de8cc71d81ea07Adam Powell
54181b8944131946e451b31665652de8cc71d81ea07Adam Powell    /**
5429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Remove a tab from the action bar. If the removed tab was selected it will be deselected
5439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * and another tab will be selected if present.
544661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
545661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param tab The tab to remove
546661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
547661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void removeTab(Tab tab);
548661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
549661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
5509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Remove a tab from the action bar. If the removed tab was selected it will be deselected
5519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * and another tab will be selected if present.
552661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
553661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param position Position of the tab to remove
554661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
555661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void removeTabAt(int position);
556661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
557661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
5589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Remove all tabs from the action bar and deselect the current tab.
5599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
5609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public abstract void removeAllTabs();
5619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
5629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
563661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Select the specified tab. If it is not a child of this action bar it will be added.
564661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
5659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p>
5669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
567661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param tab Tab to select
568661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
569661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void selectTab(Tab tab);
570661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
571661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
5722b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * Returns the currently selected tab if in tabbed navigation mode and there is at least
5732b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * one tab present.
5742b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     *
5752b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * @return The currently selected tab or null
5762b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     */
5772b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    public abstract Tab getSelectedTab();
5782b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
5792b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    /**
5809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Returns the tab at the specified index.
5819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
5829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @param index Index value in the range 0-get
5839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @return
5849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
5859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public abstract Tab getTabAt(int index);
5869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
5879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
5880c24a5514c1ff143a223720a090b19a86a75945fAdam Powell     * Returns the number of tabs currently registered with the action bar.
5890c24a5514c1ff143a223720a090b19a86a75945fAdam Powell     * @return Tab count
5900c24a5514c1ff143a223720a090b19a86a75945fAdam Powell     */
5910c24a5514c1ff143a223720a090b19a86a75945fAdam Powell    public abstract int getTabCount();
5920c24a5514c1ff143a223720a090b19a86a75945fAdam Powell
5930c24a5514c1ff143a223720a090b19a86a75945fAdam Powell    /**
5946b336f835d637853800b94689375a03f337139a4Adam Powell     * Retrieve the current height of the ActionBar.
5956b336f835d637853800b94689375a03f337139a4Adam Powell     *
5966b336f835d637853800b94689375a03f337139a4Adam Powell     * @return The ActionBar's height
5976b336f835d637853800b94689375a03f337139a4Adam Powell     */
5986b336f835d637853800b94689375a03f337139a4Adam Powell    public abstract int getHeight();
5996b336f835d637853800b94689375a03f337139a4Adam Powell
6006b336f835d637853800b94689375a03f337139a4Adam Powell    /**
6016b336f835d637853800b94689375a03f337139a4Adam Powell     * Show the ActionBar if it is not currently showing.
6026b336f835d637853800b94689375a03f337139a4Adam Powell     * If the window hosting the ActionBar does not have the feature
6036b336f835d637853800b94689375a03f337139a4Adam Powell     * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application
6046b336f835d637853800b94689375a03f337139a4Adam Powell     * content to fit the new space available.
6056b336f835d637853800b94689375a03f337139a4Adam Powell     */
6066b336f835d637853800b94689375a03f337139a4Adam Powell    public abstract void show();
6076b336f835d637853800b94689375a03f337139a4Adam Powell
6086b336f835d637853800b94689375a03f337139a4Adam Powell    /**
6096b336f835d637853800b94689375a03f337139a4Adam Powell     * Hide the ActionBar if it is not currently showing.
6106b336f835d637853800b94689375a03f337139a4Adam Powell     * If the window hosting the ActionBar does not have the feature
6116b336f835d637853800b94689375a03f337139a4Adam Powell     * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application
6126b336f835d637853800b94689375a03f337139a4Adam Powell     * content to fit the new space available.
6136b336f835d637853800b94689375a03f337139a4Adam Powell     */
6146b336f835d637853800b94689375a03f337139a4Adam Powell    public abstract void hide();
6156b336f835d637853800b94689375a03f337139a4Adam Powell
6166b336f835d637853800b94689375a03f337139a4Adam Powell    /**
6176b336f835d637853800b94689375a03f337139a4Adam Powell     * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise.
6186b336f835d637853800b94689375a03f337139a4Adam Powell     */
6196b336f835d637853800b94689375a03f337139a4Adam Powell    public abstract boolean isShowing();
6206b336f835d637853800b94689375a03f337139a4Adam Powell
6216b336f835d637853800b94689375a03f337139a4Adam Powell    /**
6228515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * Add a listener that will respond to menu visibility change events.
6238515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     *
6248515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * @param listener The new listener to add
6258515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     */
6268515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener);
6278515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell
6288515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    /**
6298515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * Remove a menu visibility listener. This listener will no longer receive menu
6308515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * visibility change events.
6318515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     *
6328515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * @param listener A listener to remove that was previously added
6338515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     */
6348515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener);
6358515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell
6368515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    /**
637c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * Enable or disable the "home" button in the corner of the action bar. (Note that this
638c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * is the application home/up affordance on the action bar, not the systemwide home
639c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * button.)
640c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     *
641c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * <p>This defaults to true for packages targeting &lt; API 14. For packages targeting
642c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * API 14 or greater, the application should call this method to enable interaction
643c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * with the home/up affordance.
644c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     *
645c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable
646c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * the home button.
647c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     *
648c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     * @param enabled true to enable the home button, false to disable the home button.
649c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell     */
65088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell    public void setHomeButtonEnabled(boolean enabled) { }
65188ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell
65288ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell    /**
65388ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell     * Returns a {@link Context} with an appropriate theme for creating views that
65488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell     * will appear in the action bar. If you are inflating or instantiating custom views
65588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell     * that will appear in an action bar, you should use the Context returned by this method.
65688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell     * (This includes adapters used for list navigation mode.)
65788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell     * This will ensure that views contrast properly against the action bar.
65888ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell     *
65988ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell     * @return A themed Context for creating views
66088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell     */
66188ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell    public Context getThemedContext() { return null; }
662c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell
663c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell    /**
6648515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * Listener interface for ActionBar navigation events.
66589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell     */
6668515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    public interface OnNavigationListener {
66789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        /**
66889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * This method is called whenever a navigation item in your action bar
66989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * is selected.
67089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         *
67189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * @param itemPosition Position of the item clicked.
67289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * @param itemId ID of the item clicked.
67389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * @return True if the event was handled, false otherwise.
67489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         */
67589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        public boolean onNavigationItemSelected(int itemPosition, long itemId);
67633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    }
677661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
678661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
6798515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     * Listener for receiving events when action bar menus are shown or hidden.
6808515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell     */
6818515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    public interface OnMenuVisibilityListener {
6828515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell        /**
6838515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell         * Called when an action bar menu is shown or hidden. Applications may want to use
6848515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell         * this to tune auto-hiding behavior for the action bar or pause/resume video playback,
6858515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell         * gameplay, or other activity within the main content area.
6868515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell         *
6878515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell         * @param isVisible True if an action bar menu is now visible, false if no action bar
6888515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell         *                  menus are visible.
6898515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell         */
6908515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell        public void onMenuVisibilityChanged(boolean isVisible);
6918515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    }
6928515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell
6938515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell    /**
694661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * A tab in the action bar.
695661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
696661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * <p>Tabs manage the hiding and showing of {@link Fragment}s.
697661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
698661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public static abstract class Tab {
699661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
700661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * An invalid position for a tab.
701661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
702661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @see #getPosition()
703661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
704661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public static final int INVALID_POSITION = -1;
705661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
706661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
707661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Return the current position of this tab in the action bar.
708661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
709661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in
710661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *         the action bar.
711661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
712661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract int getPosition();
713661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
714661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
715661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Return the icon associated with this tab.
716661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
717661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @return The tab's icon
718661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
719661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract Drawable getIcon();
720661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
721661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
722661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Return the text of this tab.
723661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
724661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @return The tab's text
725661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
726661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract CharSequence getText();
727661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
728661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
729661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Set the icon displayed on this tab.
730661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
731661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @param icon The drawable to use as an icon
7329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         * @return The current instance for call chaining
733661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
7349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public abstract Tab setIcon(Drawable icon);
735661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
736661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
73732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * Set the icon displayed on this tab.
73832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         *
73932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * @param resId Resource ID referring to the drawable to use as an icon
74032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * @return The current instance for call chaining
74132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         */
74232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell        public abstract Tab setIcon(int resId);
74332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell
74432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell        /**
745661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Set the text displayed on this tab. Text may be truncated if there is not
746661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * room to display the entire string.
747661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
748661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @param text The text to display
7499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         * @return The current instance for call chaining
750661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
7519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public abstract Tab setText(CharSequence text);
752661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
753661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
75432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * Set the text displayed on this tab. Text may be truncated if there is not
75532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * room to display the entire string.
75632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         *
75732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * @param resId A resource ID referring to the text that should be displayed
75832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * @return The current instance for call chaining
75932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         */
76032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell        public abstract Tab setText(int resId);
76132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell
76232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell        /**
7632b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Set a custom view to be used for this tab. This overrides values set by
7642b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.
765661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
7662b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param view Custom view to be used as a tab.
7679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         * @return The current instance for call chaining
768661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
7699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public abstract Tab setCustomView(View view);
770661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
771661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
77232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * Set a custom view to be used for this tab. This overrides values set by
77332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.
77432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         *
77532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * @param layoutResId A layout resource to inflate and use as a custom tab view
77632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         * @return The current instance for call chaining
77732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell         */
77832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell        public abstract Tab setCustomView(int layoutResId);
77932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell
78032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell        /**
7812b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Retrieve a previously set custom view for this tab.
782661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
7832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @return The custom view set by {@link #setCustomView(View)}.
784661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
7852b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public abstract View getCustomView();
7862b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
7872b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
7882b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Give this Tab an arbitrary object to hold for later use.
7892b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *
7902b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param obj Object to store
7919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         * @return The current instance for call chaining
7922b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
7939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public abstract Tab setTag(Object obj);
7942b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
7952b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
7962b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @return This Tab's tag object.
7972b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
7982b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public abstract Object getTag();
7992b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
8002b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
8012b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Set the {@link TabListener} that will handle switching to and from this tab.
8022b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * All tabs must have a TabListener set before being added to the ActionBar.
8032b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *
8042b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param listener Listener to handle tab selection events
8059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         * @return The current instance for call chaining
8062b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
8079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public abstract Tab setTabListener(TabListener listener);
808661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
809661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
810661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Select this tab. Only valid if the tab has been added to the action bar.
811661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
812661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract void select();
81394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell
81494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell        /**
81594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * Set a description of this tab's content for use in accessibility support.
81694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * If no content description is provided the title will be used.
81794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         *
81894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @param resId A resource ID referring to the description text
81994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @return The current instance for call chaining
82094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @see #setContentDescription(CharSequence)
82194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @see #getContentDescription()
82294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         */
82394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell        public abstract Tab setContentDescription(int resId);
82494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell
82594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell        /**
82694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * Set a description of this tab's content for use in accessibility support.
82794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * If no content description is provided the title will be used.
82894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         *
82994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @param contentDesc Description of this tab's content
83094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @return The current instance for call chaining
83194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @see #setContentDescription(int)
83294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @see #getContentDescription()
83394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         */
83494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell        public abstract Tab setContentDescription(CharSequence contentDesc);
83594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell
83694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell        /**
83794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * Gets a brief description of this tab's content for use in accessibility support.
83894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         *
83994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @return Description of this tab's content
84094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @see #setContentDescription(CharSequence)
84194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         * @see #setContentDescription(int)
84294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell         */
84394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell        public abstract CharSequence getContentDescription();
844661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    }
8452b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
8462b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    /**
8472b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * Callback interface invoked when a tab is focused, unfocused, added, or removed.
8482b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     */
8492b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    public interface TabListener {
8502b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
8512b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Called when a tab enters the selected state.
8522b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *
8532b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param tab The tab that was selected
8542b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
8552b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *        during a tab switch. The previous tab's unselect and this tab's select will be
8560c24a5514c1ff143a223720a090b19a86a75945fAdam Powell         *        executed in a single transaction. This FragmentTransaction does not support
8570c24a5514c1ff143a223720a090b19a86a75945fAdam Powell         *        being added to the back stack.
8582b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
8592b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public void onTabSelected(Tab tab, FragmentTransaction ft);
8602b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
8612b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
8622b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Called when a tab exits the selected state.
8632b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *
8642b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param tab The tab that was unselected
8652b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
8662b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *        during a tab switch. This tab's unselect and the newly selected tab's select
8670c24a5514c1ff143a223720a090b19a86a75945fAdam Powell         *        will be executed in a single transaction. This FragmentTransaction does not
8680c24a5514c1ff143a223720a090b19a86a75945fAdam Powell         *        support being added to the back stack.
8692b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
8702b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public void onTabUnselected(Tab tab, FragmentTransaction ft);
8717f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell
8727f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell        /**
8737f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         * Called when a tab that is already selected is chosen again by the user.
8747f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         * Some applications may use this action to return to the top level of a category.
8757f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         *
8767f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         * @param tab The tab that was reselected.
8777f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
8780c24a5514c1ff143a223720a090b19a86a75945fAdam Powell         *        once this method returns. This FragmentTransaction does not support
8790c24a5514c1ff143a223720a090b19a86a75945fAdam Powell         *        being added to the back stack.
8807f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         */
8817f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell        public void onTabReselected(Tab tab, FragmentTransaction ft);
8822b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    }
8839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
8849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    /**
8859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * Per-child layout information associated with action bar custom views.
8869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     *
8879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity
8889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell     */
8899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    public static class LayoutParams extends MarginLayoutParams {
8909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        /**
8919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         * Gravity for the view associated with these LayoutParams.
8929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         *
8939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         * @see android.view.Gravity
8949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell         */
8959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        @ViewDebug.ExportedProperty(category = "layout", mapping = {
8969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from =  -1,                       to = "NONE"),
8979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.NO_GRAVITY,        to = "NONE"),
8989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.TOP,               to = "TOP"),
8999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.BOTTOM,            to = "BOTTOM"),
9009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.LEFT,              to = "LEFT"),
9019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.RIGHT,             to = "RIGHT"),
9029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL,   to = "CENTER_VERTICAL"),
9039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL,     to = "FILL_VERTICAL"),
9049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"),
9059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.FILL_HORIZONTAL,   to = "FILL_HORIZONTAL"),
9069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.CENTER,            to = "CENTER"),
9079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            @ViewDebug.IntToString(from = Gravity.FILL,              to = "FILL")
9089ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        })
9099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public int gravity = -1;
9109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
9119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public LayoutParams(Context c, AttributeSet attrs) {
9129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            super(c, attrs);
9139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
9149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            TypedArray a = c.obtainStyledAttributes(attrs,
9159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell                    com.android.internal.R.styleable.ActionBar_LayoutParams);
9169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            gravity = a.getInt(
9179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell                    com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, -1);
918ab0f485e64418eb22f0a1d89d7064902b381e9c2Dianne Hackborn            a.recycle();
9199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        }
9209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
9219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public LayoutParams(int width, int height) {
9229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            super(width, height);
9239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            this.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
9249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        }
9259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
9269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public LayoutParams(int width, int height, int gravity) {
9279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            super(width, height);
9289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            this.gravity = gravity;
9299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        }
9309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
9319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public LayoutParams(int gravity) {
9329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            this(WRAP_CONTENT, MATCH_PARENT, gravity);
9339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        }
9349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
9359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public LayoutParams(LayoutParams source) {
9369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            super(source);
9379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
9389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            this.gravity = source.gravity;
9399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        }
9409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell
9419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        public LayoutParams(ViewGroup.LayoutParams source) {
9429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell            super(source);
9439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell        }
9449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell    }
94533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell}
946