ActionBar.java revision 20ac724a3a836bfd362c911f7dc55a61c02b4d44
1bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/* 2bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Copyright (C) 2012 The Android Open Source Project 3bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 4bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * you may not use this file except in compliance with the License. 6bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * You may obtain a copy of the License at 7bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 8bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * http://www.apache.org/licenses/LICENSE-2.0 9bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 10bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Unless required by applicable law or agreed to in writing, software 11bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * See the License for the specific language governing permissions and 14bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * limitations under the License. 15bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 16bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 17bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellpackage android.support.appcompat.app; 18bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 19bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.content.Context; 20bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.content.res.TypedArray; 21bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.graphics.drawable.Drawable; 22bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.support.appcompat.R; 23bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.support.v4.app.Fragment; 24bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.support.v4.app.FragmentManager; 25bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.support.v4.app.FragmentTransaction; 26bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.util.AttributeSet; 27bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.Gravity; 28bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.View; 29bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.ViewGroup; 30bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.ViewGroup.MarginLayoutParams; 31bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.Window; 32bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.widget.SpinnerAdapter; 33bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 34bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/** 35bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * A window feature at the top of the activity that may display the activity title, navigation 36bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modes, and other interactive items. 3720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 38bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an 39bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * activity's window when the activity uses the system's {@link 40bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. 41bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * You may otherwise add the action bar by calling {@link 42bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a 43bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. 4420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 45bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>By default, the action bar shows the application icon on 46bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the left, followed by the activity title. If your activity has an options menu, you can make 47bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * select items accessible directly from the action bar as "action items". You can also 48bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modify various characteristics of the action bar or remove it completely.</p> 4920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 50bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 51bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * android.app.Activity#getActionBar getActionBar()}.</p> 5220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 53bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 54bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in 55bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * your activity, you can enable an action mode that offers actions specific to the selected 56bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 57bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for 58bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * {@link ActionBar}. 5920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 60bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <div class="special reference"> 61bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <h3>Developer Guides</h3> 6220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 63bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>For information about how to use the action bar, including how to add action items, navigation 64bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 65bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Bar</a> developer guide.</p> 66bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * </div> 67bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 68bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellpublic abstract class ActionBar { 6920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 70bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 7120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Standard navigation mode. Consists of either a logo or icon and title text with an optional 7220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * subtitle. Clicking any of these elements will dispatch onOptionsItemSelected to the host 7320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Activity with a MenuItem with item ID android.R.id.home. 74bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 75bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 76bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 77bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 7820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * List navigation mode. Instead of static title text this mode presents a list menu for 7920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * navigation within the activity. e.g. this might be presented to the user as a dropdown list. 80bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 81bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_LIST = 1; 82bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 83bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 8420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Tab navigation mode. Instead of static title text this mode presents a series of tabs for 8520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * navigation within the activity. 86bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 87bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 88bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 89bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 9020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Use logo instead of icon if available. This flag will cause appropriate navigation modes to 9120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * use a wider logo in place of the standard icon. 92bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 93bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 94bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 95bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 96bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 97bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 98bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 9920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Show 'home' elements in this action bar, leaving more space for other navigation elements. 10020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * This includes logo and icon. 101bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 102bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 103bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 104bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 105bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 106bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 107bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 10820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Display the 'home' element such that it appears as an 'up' affordance. e.g. show an arrow to 10920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the left indicating the action that will be taken. 110bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 11120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set this flag if selecting the 'home' button in the action bar to return up by a single level 11220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * in your UI rather than back to the top level or front page. 113bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 11420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Setting this option will implicitly enable interaction with the home/up button. See {@link 11520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #setHomeButtonEnabled(boolean)}. 116bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 117bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 118bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 119bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 120bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 121bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 122bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 123bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the activity title and subtitle, if present. 124bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 125bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 126bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 127bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 128bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 129bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 130bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 131bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 132bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 133bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 134bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 135bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the custom view if one has been set. 13620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 137bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setCustomView(View) 138bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 139bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 140bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 141bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 142bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 143bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 14420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar into custom navigation mode, supplying a view for custom navigation. 145bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 14620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Custom navigation views appear between the application icon and any action buttons and may 14720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * use any space available there. Common use cases for custom navigation views might include an 14820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * auto-suggesting address bar for a browser or other navigation mechanisms that do not 149bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes. 150bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 151bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom navigation view to place in the ActionBar. 152bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 153bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view); 154bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 15620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar into custom navigation mode, supplying a view for custom navigation. 157bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 15820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Custom navigation views appear between the application icon and any action buttons and may 15920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * use any space available there. Common use cases for custom navigation views might include an 16020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * auto-suggesting address bar for a browser or other navigation mechanisms that do not 161bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 162bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 16320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for the custom view to be 16420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * displayed.</p> 165bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 16620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param view Custom navigation view to place in the ActionBar. 167bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutParams How this custom view should layout in the bar. 168bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 169bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 170bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 171bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 172bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 17320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar into custom navigation mode, supplying a view for custom navigation. 174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 17520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Custom navigation views appear between the application icon and any action buttons and may 17620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * use any space available there. Common use cases for custom navigation views might include an 17720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * auto-suggesting address bar for a browser or other navigation mechanisms that do not 178bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 179bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 18020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for the custom view to be 18120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * displayed.</p> 182bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 183bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(int resId); 187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 188bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 18920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the icon to display in the 'home' section of the action bar. The action bar will use an 19020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * icon specified by its style or the activity icon by default. 191bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 19220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether the home section shows an icon or logo is controlled by the display option {@link 19320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 194bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 195bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as an icon. 196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 197bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 198bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setIcon(int resId); 200bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 201bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 20220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the icon to display in the 'home' section of the action bar. The action bar will use an 20320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * icon specified by its style or the activity icon by default. 204bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 20520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether the home section shows an icon or logo is controlled by the display option {@link 20620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 207bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 208bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon Drawable to show as an icon. 209bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 210bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 211bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 212bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setIcon(Drawable icon); 213bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 21520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the logo to display in the 'home' section of the action bar. The action bar will use a 21620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * logo specified by its style or the activity logo by default. 217bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 21820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether the home section shows an icon or logo is controlled by the display option {@link 21920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 220bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 221bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as a logo. 222bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 223bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 224bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 225bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setLogo(int resId); 226bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 227bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 22820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the logo to display in the 'home' section of the action bar. The action bar will use a 22920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * logo specified by its style or the activity logo by default. 230bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 23120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether the home section shows an icon or logo is controlled by the display option {@link 23220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 233bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 234bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param logo Drawable to show as a logo. 235bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 236bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 238bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setLogo(Drawable logo); 239bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 240bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 241bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the adapter and navigation callback for list navigation mode. 242bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * The supplied adapter will provide views for the expanded list as well as the currently 24420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * selected item. (These may be displayed differently.) 245bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * The supplied OnNavigationListener will alert the application when the user changes the 24720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * current list selection. 248bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param adapter An adapter that will provide views both to display the current navigation 25020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * selection and populate views within the dropdown navigation menu. 25120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param callback An OnNavigationListener that will receive events when the user selects a 25220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * navigation item. 253bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 254bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 255bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell OnNavigationListener callback); 256bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 257bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 258bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the selected navigation item in list or tabbed navigation modes. 259bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 260bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the item to select. 261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 262bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSelectedNavigationItem(int position); 263bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 264bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 266bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 267bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Position of the selected item. 268bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 269bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getSelectedNavigationIndex(); 270bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 271bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 272bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the number of navigation items present in the current navigation mode. 273bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 274bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Number of navigation items. 275bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 276bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationItemCount(); 277bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 278bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 27920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar's title. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is 28020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * set. 281bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 282bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param title Title to set 283bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 284bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 285bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 286bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setTitle(CharSequence title); 287bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 288bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 28920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar's title. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is 29020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * set. 291bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 292bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of title string to set 293bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 294bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 296bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setTitle(int resId); 297bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 298bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 29920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar's subtitle. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is 30020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * set. Set to null to disable the subtitle entirely. 301bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 302bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param subtitle Subtitle to set 303bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 304bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 305bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 306bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSubtitle(CharSequence subtitle); 307bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 308bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 30920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar's subtitle. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is 31020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * set. 311bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 312bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of subtitle string to set 313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 314bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 315bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 316bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSubtitle(int resId); 317bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 318bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 31920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set display options. This changes all display option bits at once. To change a limited subset 32020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * of display options, see {@link #setDisplayOptions(int, int)}. 321bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param options A combination of the bits defined by the DISPLAY_ constants defined in 32320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * ActionBar. 324bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 325bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayOptions(int options); 326bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 327bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 32820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set selected display options. Only the options specified by mask will be changed. To change 32920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * all display option bits at once, see {@link #setDisplayOptions(int)}. 330bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 33120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the {@link 33220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_SHOW_HOME} option. setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | 33320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * DISPLAY_USE_LOGO) will enable {@link #DISPLAY_SHOW_HOME} and disable {@link 33420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 335bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 33620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param options A combination of the bits defined by the DISPLAY_ constants defined in 33720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * ActionBar. 33820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param mask A bit mask declaring which display options should be changed. 339bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 340bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayOptions(int options, int mask); 341bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 342bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 34320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set whether to display the activity logo rather than the activity icon. A logo is often a 34420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * wider, more detailed image. 345bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 346bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 347bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 348bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 349bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 351bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 352bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 353bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 354bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 35520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set whether to include the application home affordance in the action bar. Home is presented 35620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * as either an activity icon or logo. 357bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 358bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 359bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 360bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showHome true to show home, false otherwise. 361bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 362bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 363bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 364bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 36720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set whether home should be displayed as an "up" affordance. Set this to true if selecting 36820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * "home" returns up by a single level in your UI rather than back to the top level or front 36920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * page. 370bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 371bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 372bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 37320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param showHomeAsUp true to show the user that selecting home will return one level up rather 37420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * than to the top level of the app. 375bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 376bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 377bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 378bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 379bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 380bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 381bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether an activity title/subtitle should be displayed. 382bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 383bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 384bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 385bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showTitle true to display a title/subtitle if present. 386bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 387bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 388bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 389bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 390bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 391bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 392bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether a custom view should be displayed, if set. 393bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 394bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 395bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 39620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param showCustom true if the currently set custom view should be displayed, false 39720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * otherwise. 398bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 399bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 400bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 401bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 402bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 403bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 40420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the ActionBar's background. This will be used for the primary action bar. 405bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 406bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable 407bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 408bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 409bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 410bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setBackgroundDrawable(Drawable d); 411bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 412bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 41320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the ActionBar's stacked background. This will appear in the second row/stacked bar on 41420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * some devices and configurations. 415bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 416bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the stacked row 417bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 41820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setStackedBackgroundDrawable(Drawable d) { 41920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 420bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 421bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 42220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the ActionBar's split background. This will appear in the split action bar containing 42320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * menu-provided action buttons on some devices and configurations 42420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 425bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 426bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 427bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the split bar 428bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 42920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setSplitBackgroundDrawable(Drawable d) { 43020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 431bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 432bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 433bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current custom view. 434bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 435bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 436bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 437bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 43820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns the current ActionBar title in standard mode. Returns null if {@link 43920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #getNavigationMode()} would not return {@link #NAVIGATION_MODE_STANDARD}. 440bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 441bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar title or null. 442bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 443bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getTitle(); 444bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 445bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 44620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns the current ActionBar subtitle in standard mode. Returns null if {@link 44720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #getNavigationMode()} would not return {@link #NAVIGATION_MODE_STANDARD}. 448bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 449bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar subtitle or null. 450bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 451bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getSubtitle(); 452bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 453bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 454bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the current navigation mode. The result will be one of: 45520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 45620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <ul><li>{@link 45720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #NAVIGATION_MODE_STANDARD}</li> 45820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 459bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 46020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 46120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <li>{@link #NAVIGATION_MODE_TABS}</li></ul> 462bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 463bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current navigation mode. 464bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 465bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationMode(); 466bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 467bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 468bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the current navigation mode. 469bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 470bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param mode The new mode to set. 471bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_STANDARD 472bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_LIST 473bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_TABS 474bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 475bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setNavigationMode(int mode); 476bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 477bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 478bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current set of display options. 479bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 480bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getDisplayOptions(); 481bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 482bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 48320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Create and return a new {@link Tab}. This tab will not be included in the action bar until it 48420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * is added. 485bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 48620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Very often tabs will be used to switch between {@link Fragment} objects. Here is a 48720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * typical implementation of such tabs:</p> 488bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 489bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 49020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * complete} 491bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 492bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A new Tab 493bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #addTab(Tab) 494bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 495bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab newTab(); 496bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 497bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 49820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. If 49920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * this is the first tab to be added it will become the selected tab. 500bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 501bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to add 502bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 503bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab); 504bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 505bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 506bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 507bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 50820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param tab Tab to add 509bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 510bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 511bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, boolean setSelected); 512bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 513bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 514bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 51520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <code>position</code>. If this is the first tab to be added it will become the selected tab. 516bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 51720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param tab The tab to add 518bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position The new position of the tab 519bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 520bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position); 521bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 522bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 523bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 524bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <code>position</code>. 525bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 52620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param tab The tab to add 52720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param position The new position of the tab 528bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 529bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 530bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 531bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 532bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 53320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Remove a tab from the action bar. If the removed tab was selected it will be deselected and 53420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * another tab will be selected if present. 535bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 536bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab to remove 537bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 538bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTab(Tab tab); 539bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 540bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 54120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Remove a tab from the action bar. If the removed tab was selected it will be deselected and 54220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * another tab will be selected if present. 543bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 544bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the tab to remove 545bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 546bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTabAt(int position); 547bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 548bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 549bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Remove all tabs from the action bar and deselect the current tab. 550bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 551bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeAllTabs(); 552bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 553bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 554bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 555bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 556bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 557bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 558bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to select 559bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 560bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void selectTab(Tab tab); 561bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 562bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 56320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns the currently selected tab if in tabbed navigation mode and there is at least one tab 56420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * present. 565bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 566bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The currently selected tab or null 567bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 568bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getSelectedTab(); 569bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 570bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 571bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the tab at the specified index. 572bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 573bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param index Index value in the range 0-get 574bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 575bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getTabAt(int index); 576bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 577bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 578bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the number of tabs currently registered with the action bar. 57920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 580bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Tab count 581bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 582bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getTabCount(); 583bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 584bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 585bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve the current height of the ActionBar. 586bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 587bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The ActionBar's height 588bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 589bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getHeight(); 590bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 591bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 59220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Show the ActionBar if it is not currently showing. If the window hosting the ActionBar does 59320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * not have the feature {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 594bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * content to fit the new space available. 595bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 59620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>If you are hiding the ActionBar through {@link View#SYSTEM_UI_FLAG_FULLSCREEN 59720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * View.SYSTEM_UI_FLAG_FULLSCREEN}, you should not call this function directly. 598bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 599bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void show(); 600bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 601bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 60220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Hide the ActionBar if it is currently showing. If the window hosting the ActionBar does not 60320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * have the feature {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application content 60420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * to fit the new space available. 605bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 60620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Instead of calling this function directly, you can also cause an ActionBar using the 60720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * overlay feature to hide through {@link View#SYSTEM_UI_FLAG_FULLSCREEN 60820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * View.SYSTEM_UI_FLAG_FULLSCREEN}. Hiding the ActionBar through this system UI flag allows you 60920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * to more seamlessly hide it in conjunction with other screen decorations. 610bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 611bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void hide(); 612bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 613bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 614bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 615bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 616bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract boolean isShowing(); 617bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 618bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 619bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a listener that will respond to menu visibility change events. 620bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 621bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener The new listener to add 622bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 623bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 624bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 625bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 62620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Remove a menu visibility listener. This listener will no longer receive menu visibility 62720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * change events. 628bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 629bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener A listener to remove that was previously added 630bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 631bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 632bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 633bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 63420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Enable or disable the "home" button in the corner of the action bar. (Note that this is the 63520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * application home/up affordance on the action bar, not the systemwide home button.) 636bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 63720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>This defaults to true for packages targeting < API 14. For packages targeting API 14 or 63820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * greater, the application should call this method to enable interaction with the home/up 63920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * affordance. 640bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 64120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable the home 64220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * button. 643bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 644bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param enabled true to enable the home button, false to disable the home button. 645bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 64620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setHomeButtonEnabled(boolean enabled) { 64720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 648bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 649bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 65020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns a {@link Context} with an appropriate theme for creating views that will appear in 65120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the action bar. If you are inflating or instantiating custom views that will appear in an 65220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * action bar, you should use the Context returned by this method. (This includes adapters used 65320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * for list navigation mode.) This will ensure that views contrast properly against the action 65420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * bar. 655bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 656bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A themed Context for creating views 657bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 65820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public Context getThemedContext() { 65920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns return null; 66020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 661bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 662bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 663bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Listener interface for ActionBar navigation events. 664bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 665bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface OnNavigationListener { 66620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 667bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 66820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * This method is called whenever a navigation item in your action bar is selected. 669bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 670bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param itemPosition Position of the item clicked. 67120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param itemId ID of the item clicked. 672bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return True if the event was handled, false otherwise. 673bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 674bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 675bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 676bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 677bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 678bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Listener for receiving events when action bar menus are shown or hidden. 679bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 680bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface OnMenuVisibilityListener { 68120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 682bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 68320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Called when an action bar menu is shown or hidden. Applications may want to use this to 68420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * tune auto-hiding behavior for the action bar or pause/resume video playback, gameplay, or 68520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * other activity within the main content area. 686bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 68720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param isVisible True if an action bar menu is now visible, false if no action bar menus 68820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * are visible. 689bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 690bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 691bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 692bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 693bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 694bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * A tab in the action bar. 695bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 696bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>Tabs manage the hiding and showing of {@link Fragment}s. 697bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 698bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static abstract class Tab { 69920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 700bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 701bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * An invalid position for a tab. 702bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 703bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getPosition() 704bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 705bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int INVALID_POSITION = -1; 706bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 707bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 708bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the current position of this tab in the action bar. 709bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 710bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 711bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the action bar. 712bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 713bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getPosition(); 714bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 715bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 716bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the icon associated with this tab. 717bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 718bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's icon 719bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 720bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Drawable getIcon(); 721bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 722bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 723bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the text of this tab. 724bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 725bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's text 726bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 727bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getText(); 728bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 729bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 730bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 731bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 732bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon The drawable to use as an icon 733bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 734bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 735bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setIcon(Drawable icon); 736bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 737bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 738bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 739bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 740bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID referring to the drawable to use as an icon 741bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 742bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 743bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setIcon(int resId); 744bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 745bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 74620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the text displayed on this tab. Text may be truncated if there is not room to display 74720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the entire string. 748bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 749bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param text The text to display 750bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 751bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 752bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setText(CharSequence text); 753bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 754bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 75520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the text displayed on this tab. Text may be truncated if there is not room to display 75620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the entire string. 757bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 758bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the text that should be displayed 759bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 760bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 761bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setText(int resId); 762bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 763bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 76420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set a custom view to be used for this tab. This overrides values set by {@link 76520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #setText(CharSequence)} and {@link #setIcon(Drawable)}. 766bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 767bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom view to be used as a tab. 768bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 769bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 770bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setCustomView(View view); 771bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 772bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 77320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set a custom view to be used for this tab. This overrides values set by {@link 77420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #setText(CharSequence)} and {@link #setIcon(Drawable)}. 775bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 776bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 777bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 778bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 779bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setCustomView(int layoutResId); 780bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 781bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 782bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve a previously set custom view for this tab. 783bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 784bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The custom view set by {@link #setCustomView(View)}. 785bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 786bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 787bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 788bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 789bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Give this Tab an arbitrary object to hold for later use. 790bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 791bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param obj Object to store 792bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 793bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 794bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTag(Object obj); 795bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 796bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 797bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return This Tab's tag object. 798bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 799bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Object getTag(); 800bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 801bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 80220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the {@link TabListener} that will handle switching to and from this tab. All tabs 80320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * must have a TabListener set before being added to the ActionBar. 804bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 805bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener Listener to handle tab selection events 806bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 807bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 808bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTabListener(TabListener listener); 809bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 810bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 811bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 812bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 813bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void select(); 814bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 815bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 81620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set a description of this tab's content for use in accessibility support. If no content 81720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * description is provided the title will be used. 818bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 819bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the description text 820bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 821bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 822bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 823bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 824bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setContentDescription(int resId); 825bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 826bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 82720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set a description of this tab's content for use in accessibility support. If no content 82820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * description is provided the title will be used. 829bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 830bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param contentDesc Description of this tab's content 831bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 832bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 833bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 834bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 835bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 836bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 837bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 838bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 839bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 840bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Description of this tab's content 841bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 842bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 843bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 844bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getContentDescription(); 845bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 846bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 847bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 848bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Callback interface invoked when a tab is focused, unfocused, added, or removed. 849bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 850bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface TabListener { 85120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 852bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 853bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab enters the selected state. 854bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 855bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was selected 85620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 85720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * during a tab switch. The previous tab's unselect and this tab's select will be 85820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * executed in a single transaction. This FragmentTransaction does not support 85920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * being added to the back stack. 860bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 861bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 862bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 863bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 864bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab exits the selected state. 865bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 866bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was unselected 86720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 86820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * during a tab switch. This tab's unselect and the newly selected tab's select 86920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * will be executed in a single transaction. This FragmentTransaction does not 87020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * support being added to the back stack. 871bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 872bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 873bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 874bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 87520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Called when a tab that is already selected is chosen again by the user. Some applications 87620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * may use this action to return to the top level of a category. 877bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 878bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was reselected. 87920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute once 88020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * this method returns. This FragmentTransaction does not support being added to 88120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the back stack. 882bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 883bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 884bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 885bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 886bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 887bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Per-child layout information associated with action bar custom views. 888bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 889bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 890bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 891bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static class LayoutParams extends MarginLayoutParams { 89220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 893bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 894bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gravity for the view associated with these LayoutParams. 895bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 896bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see android.view.Gravity 897bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 898bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public int gravity = -1; 899bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 900bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(Context c, AttributeSet attrs) { 901bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(c, attrs); 902bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 903bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell TypedArray a = c.obtainStyledAttributes(attrs, 904bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell R.styleable.ActionBarLayout); 905bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, -1); 906bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell a.recycle(); 907bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 908bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 909bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height) { 910bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 911bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT; 912bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 913bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 914bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height, int gravity) { 915bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 916bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = gravity; 917bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 918bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 919bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int gravity) { 920bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this(WRAP_CONTENT, FILL_PARENT, gravity); 921bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 922bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 923bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(LayoutParams source) { 924bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 925bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 926bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = source.gravity; 927bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 928bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 929bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(ViewGroup.LayoutParams source) { 930bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 931bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 932bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 933bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 934bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 935bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Interface implemented by entities such as Activities that host action bars. 936bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 937bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell interface Callback { 93820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 939bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell FragmentManager getSupportFragmentManager(); 940bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 941bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell} 942