ActionBar.java revision 7f9b90542e05b350d14bd63c16446c8ce2baf407
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
1933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.graphics.drawable.Drawable;
2033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.view.View;
216b336f835d637853800b94689375a03f337139a4Adam Powellimport android.view.Window;
22a408291e22def5755559f42cde913706a6d628c0Adam Powellimport android.widget.SpinnerAdapter;
2333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
2433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/**
2533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * This is the public interface to the contextual ActionBar.
2633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * The ActionBar acts as a replacement for the title bar in Activities.
2733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * It provides facilities for creating toolbar actions as well as
2833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * methods of navigating around an application.
2933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */
3033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar {
31a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell    /**
32a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Standard navigation mode. Consists of either a logo or icon
33a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * and title text with an optional subtitle. Clicking any of these elements
34a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * will dispatch onActionItemSelected to the registered Callback with
35a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * a MenuItem with item ID android.R.id.home.
36a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     */
37a408291e22def5755559f42cde913706a6d628c0Adam Powell    public static final int NAVIGATION_MODE_STANDARD = 0;
3833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
3933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
4033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Dropdown list navigation mode. Instead of static title text this mode
4133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * presents a dropdown menu for navigation within the activity.
4233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
4333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public static final int NAVIGATION_MODE_DROPDOWN_LIST = 1;
4433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
4533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
4633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Tab navigation mode. Instead of static title text this mode
4733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * presents a series of tabs for navigation within the activity.
4833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
4933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public static final int NAVIGATION_MODE_TABS = 2;
5033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
5133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
5233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Custom navigation mode. This navigation mode is set implicitly whenever
534dc643eb6749afe5211198c920e739475590f92cWink Saville     * a custom navigation view is set. See {@link #setCustomNavigationMode(View)}.
5433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
5533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public static final int NAVIGATION_MODE_CUSTOM = 3;
5633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
5733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
5833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Use logo instead of icon if available. This flag will cause appropriate
5933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * navigation modes to use a wider logo in place of the standard icon.
6033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
6133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public static final int DISPLAY_USE_LOGO = 0x1;
6233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
6333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
6433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Hide 'home' elements in this action bar, leaving more space for other
6533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * navigation elements. This includes logo and icon.
6633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
6733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public static final int DISPLAY_HIDE_HOME = 0x2;
6889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell
6933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
70a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Set the action bar into custom navigation mode, supplying a view
71a408291e22def5755559f42cde913706a6d628c0Adam Powell     * for custom navigation.
7233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
7333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Custom navigation views appear between the application icon and
7433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * any action buttons and may use any space available there. Common
75a408291e22def5755559f42cde913706a6d628c0Adam Powell     * use cases for custom navigation views might include an auto-suggesting
76a408291e22def5755559f42cde913706a6d628c0Adam Powell     * address bar for a browser or other navigation mechanisms that do not
77a408291e22def5755559f42cde913706a6d628c0Adam Powell     * translate well to provided navigation modes.
7833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
7933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @param view Custom navigation view to place in the ActionBar.
8033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
81a408291e22def5755559f42cde913706a6d628c0Adam Powell    public abstract void setCustomNavigationMode(View view);
8233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
8333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
84a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Set the action bar into dropdown navigation mode and supply an adapter
85a408291e22def5755559f42cde913706a6d628c0Adam Powell     * that will provide views for navigation choices.
8633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
87a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @param adapter An adapter that will provide views both to display
88a408291e22def5755559f42cde913706a6d628c0Adam Powell     *                the current navigation selection and populate views
89a408291e22def5755559f42cde913706a6d628c0Adam Powell     *                within the dropdown navigation menu.
9089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell     * @param callback A NavigationCallback that will receive events when the user
9189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell     *                 selects a navigation item.
9233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
9389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public abstract void setDropdownNavigationMode(SpinnerAdapter adapter,
9489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell            NavigationCallback callback);
95a408291e22def5755559f42cde913706a6d628c0Adam Powell
9633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
97178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * Set the action bar into dropdown navigation mode and supply an adapter that will
98178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * provide views for navigation choices.
99178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *
100178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * @param adapter An adapter that will provide views both to display the current
101178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *                navigation selection and populate views within the dropdown
102178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *                navigation menu.
103178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * @param callback A NavigationCallback that will receive events when the user
104178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *                 selects a navigation item.
105178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * @param defaultSelectedPosition Position within the provided adapter that should be
106178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *                                selected from the outset.
107178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     */
108178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell    public abstract void setDropdownNavigationMode(SpinnerAdapter adapter,
109178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell            NavigationCallback callback, int defaultSelectedPosition);
110178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell
111178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell    /**
112178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * Set the selected navigation item in dropdown or tabbed navigation modes.
113178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *
114178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * @param position Position of the item to select.
115178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     */
116178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell    public abstract void setSelectedNavigationItem(int position);
117178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell
118178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell    /**
119178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * Get the position of the selected navigation item in dropdown or tabbed navigation modes.
120178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     *
121178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     * @return Position of the selected item.
122178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell     */
123178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell    public abstract int getSelectedNavigationItem();
124178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell
125178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell    /**
1260e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * Set the action bar into standard navigation mode, using the currently set title
1270e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * and/or subtitle.
1280e94b5151d817e600a888448a662208b29b5ef46Adam Powell     *
1290e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * Standard navigation mode is default. The title is automatically set to the name of
1300e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * your Activity on startup if an action bar is present.
1310e94b5151d817e600a888448a662208b29b5ef46Adam Powell     */
1320e94b5151d817e600a888448a662208b29b5ef46Adam Powell    public abstract void setStandardNavigationMode();
1330e94b5151d817e600a888448a662208b29b5ef46Adam Powell
1340e94b5151d817e600a888448a662208b29b5ef46Adam Powell    /**
1350e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * Set the action bar's title. This will only be displayed in standard navigation mode.
1360e94b5151d817e600a888448a662208b29b5ef46Adam Powell     *
1370e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * @param title Title to set
138a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
139a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @see #setTitle(int)
1400e94b5151d817e600a888448a662208b29b5ef46Adam Powell     */
1410e94b5151d817e600a888448a662208b29b5ef46Adam Powell    public abstract void setTitle(CharSequence title);
1420e94b5151d817e600a888448a662208b29b5ef46Adam Powell
1430e94b5151d817e600a888448a662208b29b5ef46Adam Powell    /**
144a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * Set the action bar's title. This will only be displayed in standard navigation mode.
145a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
146a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @param resId Resource ID of title string to set
147a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
148a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @see #setTitle(CharSequence)
149a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     */
150a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell    public abstract void setTitle(int resId);
151a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell
152a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell    /**
1530e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * Set the action bar's subtitle. This will only be displayed in standard navigation mode.
1540e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * Set to null to disable the subtitle entirely.
1550e94b5151d817e600a888448a662208b29b5ef46Adam Powell     *
1560e94b5151d817e600a888448a662208b29b5ef46Adam Powell     * @param subtitle Subtitle to set
157a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
158a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @see #setSubtitle(int)
1590e94b5151d817e600a888448a662208b29b5ef46Adam Powell     */
1600e94b5151d817e600a888448a662208b29b5ef46Adam Powell    public abstract void setSubtitle(CharSequence subtitle);
1610e94b5151d817e600a888448a662208b29b5ef46Adam Powell
1620e94b5151d817e600a888448a662208b29b5ef46Adam Powell    /**
163a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * Set the action bar's subtitle. This will only be displayed in standard navigation mode.
164a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
165a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @param resId Resource ID of subtitle string to set
166a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     *
167a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     * @see #setSubtitle(CharSequence)
168a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell     */
169a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell    public abstract void setSubtitle(int resId);
170a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell
171a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell    /**
172a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * Set display options. This changes all display option bits at once. To change
173a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * a limited subset of display options, see {@link #setDisplayOptions(int, int)}.
17433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
17533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @param options A combination of the bits defined by the DISPLAY_ constants
17633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *                defined in ActionBar.
17733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
17833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract void setDisplayOptions(int options);
17933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
18033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
181a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * Set selected display options. Only the options specified by mask will be changed.
182a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * To change all display option bits at once, see {@link #setDisplayOptions(int)}.
183a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     *
184a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * <p>Example: setDisplayOptions(0, DISPLAY_HIDE_HOME) will disable the
185a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * {@link #DISPLAY_HIDE_HOME} option.
186a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * setDisplayOptions(DISPLAY_HIDE_HOME, DISPLAY_HIDE_HOME | DISPLAY_USE_LOGO)
187a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * will enable {@link #DISPLAY_HIDE_HOME} and disable {@link #DISPLAY_USE_LOGO}.
188a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     *
189a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * @param options A combination of the bits defined by the DISPLAY_ constants
190a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     *                defined in ActionBar.
191a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     * @param mask A bit mask declaring which display options should be changed.
192a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell     */
193a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell    public abstract void setDisplayOptions(int options, int mask);
194a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell
195a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell    /**
19633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * Set the ActionBar's background.
19733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     *
19833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @param d Background drawable
19933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
20033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract void setBackgroundDrawable(Drawable d);
20133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
20233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
20333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @return The current custom navigation view.
20433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
20533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract View getCustomNavigationView();
20633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
20733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
208a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns the current ActionBar title in standard mode.
209a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns null if {@link #getNavigationMode()} would not return
210a408291e22def5755559f42cde913706a6d628c0Adam Powell     * {@link #NAVIGATION_MODE_STANDARD}.
211a408291e22def5755559f42cde913706a6d628c0Adam Powell     *
212a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @return The current ActionBar title or null.
21333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
21433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract CharSequence getTitle();
21533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
21633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
217a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns the current ActionBar subtitle in standard mode.
218a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns null if {@link #getNavigationMode()} would not return
219a408291e22def5755559f42cde913706a6d628c0Adam Powell     * {@link #NAVIGATION_MODE_STANDARD}.
220a408291e22def5755559f42cde913706a6d628c0Adam Powell     *
221a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @return The current ActionBar subtitle or null.
22233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
22333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract CharSequence getSubtitle();
22433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
22533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
226a408291e22def5755559f42cde913706a6d628c0Adam Powell     * Returns the current navigation mode. The result will be one of:
227a408291e22def5755559f42cde913706a6d628c0Adam Powell     * <ul>
228a408291e22def5755559f42cde913706a6d628c0Adam Powell     * <li>{@link #NAVIGATION_MODE_STANDARD}</li>
229a408291e22def5755559f42cde913706a6d628c0Adam Powell     * <li>{@link #NAVIGATION_MODE_DROPDOWN_LIST}</li>
230a408291e22def5755559f42cde913706a6d628c0Adam Powell     * <li>{@link #NAVIGATION_MODE_TABS}</li>
231a408291e22def5755559f42cde913706a6d628c0Adam Powell     * <li>{@link #NAVIGATION_MODE_CUSTOM}</li>
232a408291e22def5755559f42cde913706a6d628c0Adam Powell     * </ul>
233a408291e22def5755559f42cde913706a6d628c0Adam Powell     *
23433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @return The current navigation mode.
235a408291e22def5755559f42cde913706a6d628c0Adam Powell     *
236661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #setStandardNavigationMode()
237a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @see #setStandardNavigationMode(CharSequence)
238a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @see #setStandardNavigationMode(CharSequence, CharSequence)
239a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @see #setDropdownNavigationMode(SpinnerAdapter)
240661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #setTabNavigationMode()
241a408291e22def5755559f42cde913706a6d628c0Adam Powell     * @see #setCustomNavigationMode(View)
24233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
24333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract int getNavigationMode();
24433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell
24533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    /**
24633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     * @return The current set of display options.
24733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell     */
24833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    public abstract int getDisplayOptions();
249661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
250661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
251661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Set the action bar into tabbed navigation mode.
252661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
253661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #addTab(Tab)
254661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #insertTab(Tab, int)
255661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #removeTab(Tab)
256661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #removeTabAt(int)
257661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
258661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void setTabNavigationMode();
259661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
260661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
261661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Create and return a new {@link Tab}.
262661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * This tab will not be included in the action bar until it is added.
263661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
264661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @return A new Tab
265661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
266661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #addTab(Tab)
267661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @see #insertTab(Tab, int)
268661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
269661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract Tab newTab();
270661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
271661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
272661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list.
273661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
274661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param tab Tab to add
275661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
276661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void addTab(Tab tab);
277661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
278661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
2792b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * Add a tab for use in tabbed navigation mode. The tab will be inserted at
280661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * <code>position</code>.
281661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
282661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param tab The tab to add
283661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param position The new position of the tab
284661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
2852b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    public abstract void addTab(Tab tab, int position);
286661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
287661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
288661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Remove a tab from the action bar.
289661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
290661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param tab The tab to remove
291661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
292661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void removeTab(Tab tab);
293661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
294661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
295661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Remove a tab from the action bar.
296661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
297661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param position Position of the tab to remove
298661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
299661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void removeTabAt(int position);
300661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
301661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
302661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * Select the specified tab. If it is not a child of this action bar it will be added.
303661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
304661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * @param tab Tab to select
305661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
306661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public abstract void selectTab(Tab tab);
307661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
308661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
3092b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * Returns the currently selected tab if in tabbed navigation mode and there is at least
3102b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * one tab present.
3112b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     *
3122b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * @return The currently selected tab or null
3132b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     */
3142b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    public abstract Tab getSelectedTab();
3152b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
3162b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    /**
3176b336f835d637853800b94689375a03f337139a4Adam Powell     * Retrieve the current height of the ActionBar.
3186b336f835d637853800b94689375a03f337139a4Adam Powell     *
3196b336f835d637853800b94689375a03f337139a4Adam Powell     * @return The ActionBar's height
3206b336f835d637853800b94689375a03f337139a4Adam Powell     */
3216b336f835d637853800b94689375a03f337139a4Adam Powell    public abstract int getHeight();
3226b336f835d637853800b94689375a03f337139a4Adam Powell
3236b336f835d637853800b94689375a03f337139a4Adam Powell    /**
3246b336f835d637853800b94689375a03f337139a4Adam Powell     * Show the ActionBar if it is not currently showing.
3256b336f835d637853800b94689375a03f337139a4Adam Powell     * If the window hosting the ActionBar does not have the feature
3266b336f835d637853800b94689375a03f337139a4Adam Powell     * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application
3276b336f835d637853800b94689375a03f337139a4Adam Powell     * content to fit the new space available.
3286b336f835d637853800b94689375a03f337139a4Adam Powell     */
3296b336f835d637853800b94689375a03f337139a4Adam Powell    public abstract void show();
3306b336f835d637853800b94689375a03f337139a4Adam Powell
3316b336f835d637853800b94689375a03f337139a4Adam Powell    /**
3326b336f835d637853800b94689375a03f337139a4Adam Powell     * Hide the ActionBar if it is not currently showing.
3336b336f835d637853800b94689375a03f337139a4Adam Powell     * If the window hosting the ActionBar does not have the feature
3346b336f835d637853800b94689375a03f337139a4Adam Powell     * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application
3356b336f835d637853800b94689375a03f337139a4Adam Powell     * content to fit the new space available.
3366b336f835d637853800b94689375a03f337139a4Adam Powell     */
3376b336f835d637853800b94689375a03f337139a4Adam Powell    public abstract void hide();
3386b336f835d637853800b94689375a03f337139a4Adam Powell
3396b336f835d637853800b94689375a03f337139a4Adam Powell    /**
3406b336f835d637853800b94689375a03f337139a4Adam Powell     * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise.
3416b336f835d637853800b94689375a03f337139a4Adam Powell     */
3426b336f835d637853800b94689375a03f337139a4Adam Powell    public abstract boolean isShowing();
3436b336f835d637853800b94689375a03f337139a4Adam Powell
3446b336f835d637853800b94689375a03f337139a4Adam Powell    /**
34589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell     * Callback interface for ActionBar navigation events.
34689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell     */
34789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell    public interface NavigationCallback {
34889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        /**
34989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * This method is called whenever a navigation item in your action bar
35089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * is selected.
35189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         *
35289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * @param itemPosition Position of the item clicked.
35389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * @param itemId ID of the item clicked.
35489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         * @return True if the event was handled, false otherwise.
35589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell         */
35689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell        public boolean onNavigationItemSelected(int itemPosition, long itemId);
35733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell    }
358661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
359661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    /**
360661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * A tab in the action bar.
361661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     *
362661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     * <p>Tabs manage the hiding and showing of {@link Fragment}s.
363661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell     */
364661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    public static abstract class Tab {
365661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
366661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * An invalid position for a tab.
367661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
368661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @see #getPosition()
369661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
370661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public static final int INVALID_POSITION = -1;
371661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
372661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
373661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Return the current position of this tab in the action bar.
374661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
375661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in
376661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *         the action bar.
377661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
378661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract int getPosition();
379661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
380661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
381661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Return the icon associated with this tab.
382661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
383661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @return The tab's icon
384661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
385661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract Drawable getIcon();
386661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
387661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
388661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Return the text of this tab.
389661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
390661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @return The tab's text
391661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
392661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract CharSequence getText();
393661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
394661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
395661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Set the icon displayed on this tab.
396661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
397661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @param icon The drawable to use as an icon
398661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
399661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract void setIcon(Drawable icon);
400661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
401661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
402661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Set the text displayed on this tab. Text may be truncated if there is not
403661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * room to display the entire string.
404661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
405661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * @param text The text to display
406661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
407661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract void setText(CharSequence text);
408661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
409661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
4102b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Set a custom view to be used for this tab. This overrides values set by
4112b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.
412661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
4132b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param view Custom view to be used as a tab.
414661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
4152b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public abstract void setCustomView(View view);
416661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
417661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
4182b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Retrieve a previously set custom view for this tab.
419661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         *
4202b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @return The custom view set by {@link #setCustomView(View)}.
421661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
4222b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public abstract View getCustomView();
4232b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
4242b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
4252b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Give this Tab an arbitrary object to hold for later use.
4262b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *
4272b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param obj Object to store
4282b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
4292b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public abstract void setTag(Object obj);
4302b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
4312b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
4322b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @return This Tab's tag object.
4332b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
4342b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public abstract Object getTag();
4352b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
4362b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
4372b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Set the {@link TabListener} that will handle switching to and from this tab.
4382b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * All tabs must have a TabListener set before being added to the ActionBar.
4392b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *
4402b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param listener Listener to handle tab selection events
4412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
4422b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public abstract void setTabListener(TabListener listener);
443661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell
444661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        /**
445661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         * Select this tab. Only valid if the tab has been added to the action bar.
446661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell         */
447661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell        public abstract void select();
448661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell    }
4492b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
4502b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    /**
4512b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     * Callback interface invoked when a tab is focused, unfocused, added, or removed.
4522b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell     */
4532b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    public interface TabListener {
4542b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
4552b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Called when a tab enters the selected state.
4562b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *
4572b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param tab The tab that was selected
4582b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
4592b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *        during a tab switch. The previous tab's unselect and this tab's select will be
4602b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *        executed in a single transaction.
4612b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
4622b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public void onTabSelected(Tab tab, FragmentTransaction ft);
4632b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell
4642b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        /**
4652b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * Called when a tab exits the selected state.
4662b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *
4672b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param tab The tab that was unselected
4682b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
4692b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *        during a tab switch. This tab's unselect and the newly selected tab's select
4702b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         *        will be executed in a single transaction.
4712b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell         */
4722b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell        public void onTabUnselected(Tab tab, FragmentTransaction ft);
4737f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell
4747f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell        /**
4757f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         * Called when a tab that is already selected is chosen again by the user.
4767f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         * Some applications may use this action to return to the top level of a category.
4777f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         *
4787f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         * @param tab The tab that was reselected.
4797f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
4807f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         *        once this method returns.
4817f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell         */
4827f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell        public void onTabReselected(Tab tab, FragmentTransaction ft);
4832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell    }
48433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell}
485