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 197b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbyeimport android.annotation.DrawableRes; 20d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport android.annotation.IntDef; 217b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbyeimport android.annotation.LayoutRes; 22d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport android.annotation.NonNull; 23d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport android.annotation.Nullable; 247b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbyeimport android.annotation.StringRes; 259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.Context; 26e43340c80dc66c45edc793ecd0343774aa34d108Adam Powellimport android.content.res.Configuration; 279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.res.TypedArray; 2833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.graphics.drawable.Drawable; 299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.util.AttributeSet; 30e43340c80dc66c45edc793ecd0343774aa34d108Adam Powellimport android.view.ActionMode; 319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.Gravity; 3207a74548ae5c1e064508cb1c79ac34de1142b240Adam Powellimport android.view.KeyEvent; 3333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.view.View; 345beb2617f91e28c45917ea48109b8350f4e62140George Mountimport android.view.View.OnFocusChangeListener; 359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewDebug; 369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup; 3794a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamyimport android.view.ViewHierarchyEncoder; 385beb2617f91e28c45917ea48109b8350f4e62140George Mountimport android.view.ViewParent; 396b336f835d637853800b94689375a03f337139a4Adam Powellimport android.view.Window; 40a408291e22def5755559f42cde913706a6d628c0Adam Powellimport android.widget.SpinnerAdapter; 41d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.Retention; 42d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.RetentionPolicy; 43d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 4433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/** 45e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * A primary toolbar within the activity that may display the activity title, application-level 46e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * navigation affordances, and other interactive items. 47e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 48e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an 49e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * activity's window when the activity uses the system's {@link 50e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. 51e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * You may otherwise add the action bar by calling {@link 52e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a 53e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. 54e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * </p> 55e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 56e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>Beginning with Android L (API level 21), the action bar may be represented by any 57e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * Toolbar widget within the application layout. The application may signal to the Activity 58e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * which Toolbar should be treated as the Activity's action bar. Activities that use this 59e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * feature should use one of the supplied <code>.NoActionBar</code> themes, set the 60e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code> 61e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * or otherwise not request the window feature.</p> 62e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 63e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>By adjusting the window features requested by the theme and the layouts used for 64e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * an Activity's content view, an app can use the standard system action bar on older platform 65e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * releases and the newer inline toolbars on newer platform releases. The <code>ActionBar</code> 66e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * object obtained from the Activity can be used to control either configuration transparently.</p> 67e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 68e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>When using the Holo themes the action bar shows the application icon on 69e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * the left, followed by the activity title. If your activity has an options menu, you can make 70e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * select items accessible directly from the action bar as "action items". You can also 71e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * modify various characteristics of the action bar or remove it completely.</p> 72e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 73830960cce032a1b0dc0cf54bcc44ffa339388c21Alan Viverette * <p>When using the Material themes (default in API 21 or newer) the navigation button 74e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * (formerly "Home") takes over the space previously occupied by the application icon. 75e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * Apps wishing to express a stronger branding should use their brand colors heavily 76e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * in the action bar and other application chrome or use a {@link #setLogo(int) logo} 77e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * in place of their standard title text.</p> 78e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 7936193d09a87035395d036a730038b765ac0b0913Scott Main * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 8036193d09a87035395d036a730038b765ac0b0913Scott Main * android.app.Activity#getActionBar getActionBar()}.</p> 81e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 82e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 83e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in 84e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * your activity, you can enable an action mode that offers actions specific to the selected 85e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 86e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for 87e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * {@link ActionBar}.</p> 88e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 89b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <div class="special reference"> 90b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <h3>Developer Guides</h3> 91b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <p>For information about how to use the action bar, including how to add action items, navigation 92b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 93b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * Bar</a> developer guide.</p> 94b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * </div> 9533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 9633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar { 97d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 98d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 99d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 100d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface NavigationMode {} 101d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 102a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 103a408291e22def5755559f42cde913706a6d628c0Adam Powell * Standard navigation mode. Consists of either a logo or icon 104a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * and title text with an optional subtitle. Clicking any of these elements 105cf0357639e952a87f0d535c82691919af81f058bAdam Powell * will dispatch onOptionsItemSelected to the host Activity with 106a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a MenuItem with item ID android.R.id.home. 107fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 108fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 109fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 110fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 111fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 112a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 113a408291e22def5755559f42cde913706a6d628c0Adam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 11433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 11533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * List navigation mode. Instead of static title text this mode 1179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * presents a list menu for navigation within the activity. 1189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. this might be presented to the user as a dropdown list. 119fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 120fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 121fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 122fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 123fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 12433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int NAVIGATION_MODE_LIST = 1; 12633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 12733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 12833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Tab navigation mode. Instead of static title text this mode 12933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * presents a series of tabs for navigation within the activity. 130fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 131fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 132fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 133fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 134fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 13533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 13633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 13733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 138d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 139d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 140d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef(flag = true, 141d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye value = { 142d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_USE_LOGO, 143d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_HOME, 144d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_HOME_AS_UP, 145d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_TITLE, 146d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_CUSTOM, 147d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_TITLE_MULTIPLE_LINES 148d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye }) 149d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface DisplayOptions {} 150d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 15133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 15233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Use logo instead of icon if available. This flag will cause appropriate 15333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation modes to use a wider logo in place of the standard icon. 1549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 15733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 15833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 15933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 16033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show 'home' elements in this action bar, leaving more space for other 16233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation elements. This includes logo and icon. 1639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 1689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Display the 'home' element such that it appears as an 'up' affordance. 1719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. show an arrow to the left indicating the action that will be taken. 1729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set this flag if selecting the 'home' button in the action bar to return 1749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * up by a single level in your UI rather than back to the top level or front page. 1759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 176c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting this option will implicitly enable interaction with the home/up 177c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button. See {@link #setHomeButtonEnabled(boolean)}. 178c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 1799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 1839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the activity title and subtitle, if present. 1869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(CharSequence) 1889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(int) 1899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(CharSequence) 1909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(int) 1919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 1959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the custom view if one has been set. 1989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setCustomView(View) 1999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 2009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 2019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 2029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 2039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 20527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Allow the title to wrap onto multiple lines if space is available 20627cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 20727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 20827cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public static final int DISPLAY_TITLE_MULTIPLE_LINES = 0x20; 20927cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 21027cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 2119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the action bar into custom navigation mode, supplying a view 2129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * for custom navigation. 2139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Custom navigation views appear between the application icon and 2159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * any action buttons and may use any space available there. Common 2169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * use cases for custom navigation views might include an auto-suggesting 2179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * address bar for a browser or other navigation mechanisms that do not 2189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * translate well to provided navigation modes. 2199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param view Custom navigation view to place in the ActionBar. 22133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view); 22389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell 22433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 225a408291e22def5755559f42cde913706a6d628c0Adam Powell * Set the action bar into custom navigation mode, supplying a view 226a408291e22def5755559f42cde913706a6d628c0Adam Powell * for custom navigation. 22733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 228ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>Custom navigation views appear between the application icon and 22933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * any action buttons and may use any space available there. Common 230a408291e22def5755559f42cde913706a6d628c0Adam Powell * use cases for custom navigation views might include an auto-suggesting 231a408291e22def5755559f42cde913706a6d628c0Adam Powell * address bar for a browser or other navigation mechanisms that do not 232ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * translate well to provided navigation modes.</p> 233ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 234ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 235ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * the custom view to be displayed.</p> 23633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 23733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param view Custom navigation view to place in the ActionBar. 2389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param layoutParams How this custom view should layout in the bar. 239ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 240ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 24133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 2439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2453f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set the action bar into custom navigation mode, supplying a view 2463f476b34049d062942eafcf48396f593e00bd324Adam Powell * for custom navigation. 2473f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2483f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>Custom navigation views appear between the application icon and 2493f476b34049d062942eafcf48396f593e00bd324Adam Powell * any action buttons and may use any space available there. Common 2503f476b34049d062942eafcf48396f593e00bd324Adam Powell * use cases for custom navigation views might include an auto-suggesting 2513f476b34049d062942eafcf48396f593e00bd324Adam Powell * address bar for a browser or other navigation mechanisms that do not 2523f476b34049d062942eafcf48396f593e00bd324Adam Powell * translate well to provided navigation modes.</p> 2533f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2543f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 2553f476b34049d062942eafcf48396f593e00bd324Adam Powell * the custom view to be displayed.</p> 2563f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2573f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 2583f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2593f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 2603f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 2617b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setCustomView(@LayoutRes int resId); 2623f476b34049d062942eafcf48396f593e00bd324Adam Powell 2633f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 2641969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2651969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2661969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2671969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2681969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2691969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2701969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2711969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as an icon. 2721969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2731969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2741969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2751969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2767b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setIcon(@DrawableRes int resId); 2771969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2781969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2791969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2801969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2811969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2821969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2831969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2841969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2851969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2861969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param icon Drawable to show as an icon. 2871969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2881969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2891969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2901969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2911969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(Drawable icon); 2921969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2931969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2941969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 2951969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 2961969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 2971969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2981969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2991969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 3001969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3011969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as a logo. 3021969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3031969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 3041969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 3051969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 3067b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setLogo(@DrawableRes int resId); 3071969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 3081969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 3091969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 3101969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 3111969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 3121969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3131969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 3141969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 3151969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3161969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param logo Drawable to show as a logo. 3171969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3181969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 3191969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 3201969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 3211969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(Drawable logo); 3221969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 3231969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 3249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the adapter and navigation callback for list navigation mode. 3259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * The supplied adapter will provide views for the expanded list as well as 3279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the currently selected item. (These may be displayed differently.) 3289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3298515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * The supplied OnNavigationListener will alert the application when the user 3309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * changes the current list selection. 3319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param adapter An adapter that will provide views both to display 3339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the current navigation selection and populate views 3349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * within the dropdown navigation menu. 3358515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param callback An OnNavigationListener that will receive events when the user 3369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * selects a navigation item. 337fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 338fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 339fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 340fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 341fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 3448515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell OnNavigationListener callback); 3459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the selected navigation item in list or tabbed navigation modes. 348178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 349178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param position Position of the item to select. 350fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 351fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 352fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 353fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 354fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 355178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 356178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract void setSelectedNavigationItem(int position); 357178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 358178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 3599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 360178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 361178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @return Position of the selected item. 362fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 363fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 364fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 365fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 366fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getSelectedNavigationIndex(); 3699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the number of navigation items present in the current navigation mode. 3729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return Number of navigation items. 374fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 375fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 376fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 377fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 378fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getNavigationItemCount(); 3819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 383ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 384ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 3850e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 3860e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param title Title to set 387a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 388a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(int) 389ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 3900e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 3910e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setTitle(CharSequence title); 3920e94b5151d817e600a888448a662208b29b5ef46Adam Powell 3930e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 394ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 395ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 396a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 397a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of title string to set 398a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 399a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(CharSequence) 400ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 401a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 4027b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setTitle(@StringRes int resId); 403a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 404a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 405ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 406ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 407ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * subtitle entirely. 4080e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 4090e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param subtitle Subtitle to set 410a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 411a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(int) 412ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 4130e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 4140e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setSubtitle(CharSequence subtitle); 4150e94b5151d817e600a888448a662208b29b5ef46Adam Powell 4160e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 417ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 418ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 419a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 420a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of subtitle string to set 421a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 422a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(CharSequence) 423ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 424a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 4257b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setSubtitle(@StringRes int resId); 426a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 427a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 428a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set display options. This changes all display option bits at once. To change 429a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 43033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 43133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 43233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * defined in ActionBar. 43333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 434d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 43533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 43633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 437a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set selected display options. Only the options specified by mask will be changed. 438a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 439a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 4409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 4419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * {@link #DISPLAY_SHOW_HOME} option. 4425ad7af6fc764f71765b134b8cd51787a7e78753aBen Komalo * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 4439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 444a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 445a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 446a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * defined in ActionBar. 447a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param mask A bit mask declaring which display options should be changed. 448a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 449d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 4503f476b34049d062942eafcf48396f593e00bd324Adam Powell 4513f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4523f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to display the activity logo rather than the activity icon. 4533f476b34049d062942eafcf48396f593e00bd324Adam Powell * A logo is often a wider, more detailed image. 4543f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4553f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4563f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4573f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 4583f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4593f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4603f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4613f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4623f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 4633f476b34049d062942eafcf48396f593e00bd324Adam Powell 4643f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4653f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to include the application home affordance in the action bar. 4663f476b34049d062942eafcf48396f593e00bd324Adam Powell * Home is presented as either an activity icon or logo. 4673f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4683f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4693f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4703f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHome true to show home, false otherwise. 4713f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4723f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4733f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4743f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4753f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 4763f476b34049d062942eafcf48396f593e00bd324Adam Powell 4773f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4783f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether home should be displayed as an "up" affordance. 4793f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set this to true if selecting "home" returns up by a single level in your UI 4803f476b34049d062942eafcf48396f593e00bd324Adam Powell * rather than back to the top level or front page. 4813f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4823f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4833f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4843f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHomeAsUp true to show the user that selecting home will return one 4853f476b34049d062942eafcf48396f593e00bd324Adam Powell * level up rather than to the top level of the app. 4863f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4873f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4883f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4893f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4903f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 4913f476b34049d062942eafcf48396f593e00bd324Adam Powell 4923f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4933f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether an activity title/subtitle should be displayed. 4943f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4953f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4963f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4973f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showTitle true to display a title/subtitle if present. 4983f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4993f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 5003f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 5013f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 5023f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 5033f476b34049d062942eafcf48396f593e00bd324Adam Powell 5043f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 5053f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether a custom view should be displayed, if set. 5063f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5073f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 5083f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5093f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showCustom true if the currently set custom view should be displayed, false otherwise. 5103f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5113f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 5123f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 5133f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 5143f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 5153f476b34049d062942eafcf48396f593e00bd324Adam Powell 516a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 517f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's background. This will be used for the primary 518f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * action bar. 51933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 52033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param d Background drawable 521f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 522f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 52333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 524d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setBackgroundDrawable(@Nullable Drawable d); 525ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 526ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell /** 527f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's stacked background. This will appear 528f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * in the second row/stacked bar on some devices and configurations. 529f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 530f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the stacked row 531f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5320145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setStackedBackgroundDrawable(Drawable d) { } 533f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 534f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 535f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's split background. This will appear in 536f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * the split action bar containing menu-provided action buttons 537f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * on some devices and configurations. 538e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 539f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 540f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the split bar 541f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5420145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setSplitBackgroundDrawable(Drawable d) { } 543f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 544f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 545ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @return The current custom view. 546ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell */ 547ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell public abstract View getCustomView(); 548ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 54933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 550a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar title in standard mode. 551a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 552a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 553a408291e22def5755559f42cde913706a6d628c0Adam Powell * 554a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar title or null. 55533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 55633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getTitle(); 55733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 55833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 559a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar subtitle in standard mode. 560a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 561a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 562a408291e22def5755559f42cde913706a6d628c0Adam Powell * 563a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar subtitle or null. 56433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 56533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getSubtitle(); 56633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 56733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 568a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current navigation mode. The result will be one of: 569a408291e22def5755559f42cde913706a6d628c0Adam Powell * <ul> 570a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 5719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 572a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_TABS}</li> 573a408291e22def5755559f42cde913706a6d628c0Adam Powell * </ul> 574a408291e22def5755559f42cde913706a6d628c0Adam Powell * 57533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current navigation mode. 576fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 577fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 578fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 579fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 580fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 58133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 582d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @NavigationMode 58333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getNavigationMode(); 5849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 5859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 5869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the current navigation mode. 5879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 5889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param mode The new mode to set. 5899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_STANDARD 5909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_LIST 5919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_TABS 592fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 593fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 594fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 595fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 596fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 5979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 598d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 5999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 60033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 60133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current set of display options. 60233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 60333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getDisplayOptions(); 604661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 605661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 606661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Create and return a new {@link Tab}. 607661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * This tab will not be included in the action bar until it is added. 608661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 6092f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * <p>Very often tabs will be used to switch between {@link Fragment} 6102f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * objects. Here is a typical implementation of such tabs:</p> 6112f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 6122f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 6132f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * complete} 6142f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 615661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return A new Tab 616661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 617661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #addTab(Tab) 618fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 619fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 620fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 621fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 622fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 623661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 624661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Tab newTab(); 625661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 626661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 627661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 62881b8944131946e451b31665652de8cc71d81ea07Adam Powell * If this is the first tab to be added it will become the selected tab. 629661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 630661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to add 631fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 632fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 633fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 634fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 635fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 636661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 637661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void addTab(Tab tab); 638661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 639661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 64081b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 64181b8944131946e451b31665652de8cc71d81ea07Adam Powell * 64281b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab Tab to add 64381b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 644fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 645fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 646fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 647fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 648fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 64981b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 65081b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, boolean setSelected); 65181b8944131946e451b31665652de8cc71d81ea07Adam Powell 65281b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6532b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 65481b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. If this is the first tab to be added it will become 65581b8944131946e451b31665652de8cc71d81ea07Adam Powell * the selected tab. 656661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 657661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to add 658661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position The new position of the tab 659fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 660fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 661fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 662fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 663fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 664661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 6652b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract void addTab(Tab tab, int position); 666661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 667661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 66881b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 66981b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. 67081b8944131946e451b31665652de8cc71d81ea07Adam Powell * 67181b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab The tab to add 67281b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param position The new position of the tab 67381b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 674fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 675fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 676fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 677fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 678fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 67981b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 68081b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 68181b8944131946e451b31665652de8cc71d81ea07Adam Powell 68281b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 6849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 685661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 686661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to remove 687fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 688fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 689fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 690fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 691fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 692661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 693661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTab(Tab tab); 694661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 695661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 6969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 6979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 698661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 699661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position Position of the tab to remove 700fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 701fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 702fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 703fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 704fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 705661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 706661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTabAt(int position); 707661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 708661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove all tabs from the action bar and deselect the current tab. 710fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 711fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 712fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 713fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 714fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 7169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void removeAllTabs(); 7179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 719661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 720661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 7219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 7229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 723661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to select 724fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 725fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 726fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 727fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 728fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 729661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 730661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void selectTab(Tab tab); 731661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 732661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7332b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Returns the currently selected tab if in tabbed navigation mode and there is at least 7342b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * one tab present. 7352b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 7362b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The currently selected tab or null 737fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 738fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 739fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 740fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 741fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7422b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 7432b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Tab getSelectedTab(); 7442b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 7452b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 7469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Returns the tab at the specified index. 7479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 7489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param index Index value in the range 0-get 7499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return 750fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 751fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 752fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 753fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 754fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 7569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab getTabAt(int index); 7579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 7590c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * Returns the number of tabs currently registered with the action bar. 7600c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * @return Tab count 761fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 762fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 763fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 764fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 765fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7660c24a5514c1ff143a223720a090b19a86a75945fAdam Powell */ 7670c24a5514c1ff143a223720a090b19a86a75945fAdam Powell public abstract int getTabCount(); 7680c24a5514c1ff143a223720a090b19a86a75945fAdam Powell 7690c24a5514c1ff143a223720a090b19a86a75945fAdam Powell /** 7706b336f835d637853800b94689375a03f337139a4Adam Powell * Retrieve the current height of the ActionBar. 7716b336f835d637853800b94689375a03f337139a4Adam Powell * 7726b336f835d637853800b94689375a03f337139a4Adam Powell * @return The ActionBar's height 7736b336f835d637853800b94689375a03f337139a4Adam Powell */ 7746b336f835d637853800b94689375a03f337139a4Adam Powell public abstract int getHeight(); 7756b336f835d637853800b94689375a03f337139a4Adam Powell 7766b336f835d637853800b94689375a03f337139a4Adam Powell /** 7776b336f835d637853800b94689375a03f337139a4Adam Powell * Show the ActionBar if it is not currently showing. 7786b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7796b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 7806b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 7813a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 7823a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>If you are hiding the ActionBar through 7833a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 7843a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * you should not call this function directly. 7856b336f835d637853800b94689375a03f337139a4Adam Powell */ 7866b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void show(); 7876b336f835d637853800b94689375a03f337139a4Adam Powell 7886b336f835d637853800b94689375a03f337139a4Adam Powell /** 789e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * Hide the ActionBar if it is currently showing. 7906b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7916b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 7926b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 7933a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 7943a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>Instead of calling this function directly, you can also cause an 7953a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * ActionBar using the overlay feature to hide through 7963a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 7973a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * Hiding the ActionBar through this system UI flag allows you to more 7983a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * seamlessly hide it in conjunction with other screen decorations. 7996b336f835d637853800b94689375a03f337139a4Adam Powell */ 8006b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void hide(); 8016b336f835d637853800b94689375a03f337139a4Adam Powell 8026b336f835d637853800b94689375a03f337139a4Adam Powell /** 8036b336f835d637853800b94689375a03f337139a4Adam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 8046b336f835d637853800b94689375a03f337139a4Adam Powell */ 8056b336f835d637853800b94689375a03f337139a4Adam Powell public abstract boolean isShowing(); 8066b336f835d637853800b94689375a03f337139a4Adam Powell 8076b336f835d637853800b94689375a03f337139a4Adam Powell /** 8088515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Add a listener that will respond to menu visibility change events. 8098515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 8108515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener The new listener to add 8118515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 8128515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 8138515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 8148515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 8158515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Remove a menu visibility listener. This listener will no longer receive menu 8168515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * visibility change events. 8178515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 8188515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener A listener to remove that was previously added 8198515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 8208515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 8218515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 8228515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 823c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * Enable or disable the "home" button in the corner of the action bar. (Note that this 824c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * is the application home/up affordance on the action bar, not the systemwide home 825c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button.) 826c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 827c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>This defaults to true for packages targeting < API 14. For packages targeting 828c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * API 14 or greater, the application should call this method to enable interaction 829c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * with the home/up affordance. 830c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 831c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 832c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * the home button. 833c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 834c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * @param enabled true to enable the home button, false to disable the home button. 835c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell */ 83688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public void setHomeButtonEnabled(boolean enabled) { } 83788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell 83888ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell /** 83988ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * Returns a {@link Context} with an appropriate theme for creating views that 84088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * will appear in the action bar. If you are inflating or instantiating custom views 84188ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * that will appear in an action bar, you should use the Context returned by this method. 84288ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * (This includes adapters used for list navigation mode.) 84388ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * This will ensure that views contrast properly against the action bar. 84488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * 84588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * @return A themed Context for creating views 84688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell */ 84788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public Context getThemedContext() { return null; } 848c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell 849c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell /** 85027cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Returns true if the Title field has been truncated during layout for lack 85127cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * of available space. 85227cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * 85327cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @return true if the Title field has been truncated 85427cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 85527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 85627cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public boolean isTitleTruncated() { return false; } 85727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 85827cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 859e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 860e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 861e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 862e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 863e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>null</code> to this method, the default drawable from the theme 864e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 865e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 866e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 867e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 868e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 869e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 870e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param indicator A drawable to use for the up indicator, or null to use the theme's default 871e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 872e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 873e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 874e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 875e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 876e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeAsUpIndicator(Drawable indicator) { } 877e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 878e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 879e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 880e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 881e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 882e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 883e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>0</code> to this method, the default drawable from the theme 884e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 885e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 886e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 887e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 888e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 889e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 890e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a drawable to use for the up indicator, or null 891e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to use the theme's default 892e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 893e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 894e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 895e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 896e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 8977b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public void setHomeAsUpIndicator(@DrawableRes int resId) { } 898e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 899e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 900e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 901e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 902e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 903e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 904e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 905e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 906e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 907e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 908e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 909e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 910e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>null</code> will use the system default description.</p> 911e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 912e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param description New description for the Home action when enabled 913e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 914e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 915e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 916e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeActionContentDescription(CharSequence description) { } 917e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 918e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 919e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 920e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 921e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 922e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 923e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 924e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 925e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 926e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 927e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 928e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 929e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>0</code> will use the system default description.</p> 930e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 931e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a string to use as the new description 932e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * for the Home action when enabled 933e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 934e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 935e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 9367b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public void setHomeActionContentDescription(@StringRes int resId) { } 937e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 938b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 939b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Enable hiding the action bar on content scroll. 940b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 941b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>If enabled, the action bar will scroll out of sight along with a 942b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content. 943b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode} 944b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * to enable hiding on content scroll.</p> 945b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 946b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>When partially scrolled off screen the action bar is considered 947b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view. 948b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * </p> 949b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @param hideOnContentScroll true to enable hiding on content scroll. 950b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 951b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) { 952b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell if (hideOnContentScroll) { 953b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell throw new UnsupportedOperationException("Hide on content scroll is not supported in " + 954b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell "this action bar configuration."); 955b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 956b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 957b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 958b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 959b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Return whether the action bar is configured to scroll out of sight along with 960b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}. 961b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 962b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @return true if hide-on-content-scroll is enabled 963b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @see #setHideOnContentScrollEnabled(boolean) 964b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 965b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public boolean isHideOnContentScrollEnabled() { 966b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell return false; 967b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 968b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 969b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 970b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Return the current vertical offset of the action bar. 971b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 972b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>The action bar's current hide offset is the distance that the action bar is currently 973b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 974b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * current measured {@link #getHeight() height} (fully invisible).</p> 975b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 976b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @return The action bar's offset toward its fully hidden state in pixels 977b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 978b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public int getHideOffset() { 979b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell return 0; 980b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 981b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 982b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 983b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Set the current hide offset of the action bar. 984b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 985b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>The action bar's current hide offset is the distance that the action bar is currently 986b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 987b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * current measured {@link #getHeight() height} (fully invisible).</p> 988b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 989b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @param offset The action bar's offset toward its fully hidden state in pixels. 990b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 991b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public void setHideOffset(int offset) { 992b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell if (offset != 0) { 993b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell throw new UnsupportedOperationException("Setting an explicit action bar hide offset " + 994b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell "is not supported in this action bar configuration."); 995b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 996b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 997b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 99814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell /** 99914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * Set the Z-axis elevation of the action bar in pixels. 100014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 100114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 100214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * values are closer to the user.</p> 100314d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 100414d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * @param elevation Elevation value in pixels 100514d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell */ 100614d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell public void setElevation(float elevation) { 100714d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell if (elevation != 0) { 100814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell throw new UnsupportedOperationException("Setting a non-zero elevation is " + 100914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell "not supported in this action bar configuration."); 101014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 101114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 101214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell 101314d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell /** 101414d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * Get the Z-axis elevation of the action bar in pixels. 101514d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 101614d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 101714d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * values are closer to the user.</p> 101814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 101914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * @return Elevation value in pixels 102014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell */ 102114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell public float getElevation() { 102214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell return 0; 102314d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 102414d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell 1025e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1026e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { 1027e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1028e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1029e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1030e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void setShowHideAnimationEnabled(boolean enabled) { 1031e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1032e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1033e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1034e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void onConfigurationChanged(Configuration config) { 1035e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1036e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1037e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1038e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void dispatchMenuVisibilityChanged(boolean visible) { 1039e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1040e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1041e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1042e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public ActionMode startActionMode(ActionMode.Callback callback) { 1043e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell return null; 1044e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1045e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 104607a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 104707a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean openOptionsMenu() { 104807a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 104907a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 105007a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 105107a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 105207a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean invalidateOptionsMenu() { 105307a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 105407a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 105507a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 105607a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 105707a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean onMenuKeyEvent(KeyEvent event) { 105807a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 105907a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 106007a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 106107a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 1062a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki public boolean onKeyShortcut(int keyCode, KeyEvent event) { 1063a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki return false; 1064a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki } 1065a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki 1066a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki /** @hide */ 106707a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean collapseActionView() { 106807a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 106907a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 107007a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 1071af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell /** @hide */ 1072af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell public void setWindowTitle(CharSequence title) { 1073af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell } 1074af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell 1075e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 10765beb2617f91e28c45917ea48109b8350f4e62140George Mount * Attempts to move focus to the ActionBar if it does not already contain the focus. 10775beb2617f91e28c45917ea48109b8350f4e62140George Mount * 10785beb2617f91e28c45917ea48109b8350f4e62140George Mount * @return {@code true} if focus changes or {@code false} if focus doesn't change. 10795beb2617f91e28c45917ea48109b8350f4e62140George Mount * @hide 10805beb2617f91e28c45917ea48109b8350f4e62140George Mount */ 10815beb2617f91e28c45917ea48109b8350f4e62140George Mount public boolean requestFocus() { 10825beb2617f91e28c45917ea48109b8350f4e62140George Mount return false; 10835beb2617f91e28c45917ea48109b8350f4e62140George Mount } 10845beb2617f91e28c45917ea48109b8350f4e62140George Mount 108521b257717fe0c60574fe1cfaa44ed894edd21200Chris Banes /** @hide */ 108621b257717fe0c60574fe1cfaa44ed894edd21200Chris Banes public void onDestroy() { 108721b257717fe0c60574fe1cfaa44ed894edd21200Chris Banes } 108821b257717fe0c60574fe1cfaa44ed894edd21200Chris Banes 10895beb2617f91e28c45917ea48109b8350f4e62140George Mount /** 10905beb2617f91e28c45917ea48109b8350f4e62140George Mount * Common implementation for requestFocus that takes in the Toolbar and moves focus 10915beb2617f91e28c45917ea48109b8350f4e62140George Mount * to the contents. This makes the ViewGroups containing the toolbar allow focus while it stays 10925beb2617f91e28c45917ea48109b8350f4e62140George Mount * in the ActionBar and then prevents it again once it leaves. 10935beb2617f91e28c45917ea48109b8350f4e62140George Mount * 10945beb2617f91e28c45917ea48109b8350f4e62140George Mount * @param viewGroup The toolbar ViewGroup 10955beb2617f91e28c45917ea48109b8350f4e62140George Mount * @return {@code true} if focus changes or {@code false} if focus doesn't change. 10965beb2617f91e28c45917ea48109b8350f4e62140George Mount * @hide 10975beb2617f91e28c45917ea48109b8350f4e62140George Mount */ 10985beb2617f91e28c45917ea48109b8350f4e62140George Mount protected boolean requestFocus(ViewGroup viewGroup) { 10995beb2617f91e28c45917ea48109b8350f4e62140George Mount if (viewGroup != null && !viewGroup.hasFocus()) { 11005beb2617f91e28c45917ea48109b8350f4e62140George Mount final ViewGroup toolbar = viewGroup.getTouchscreenBlocksFocus() ? viewGroup : null; 11015beb2617f91e28c45917ea48109b8350f4e62140George Mount ViewParent parent = viewGroup.getParent(); 11025beb2617f91e28c45917ea48109b8350f4e62140George Mount ViewGroup container = null; 11035beb2617f91e28c45917ea48109b8350f4e62140George Mount while (parent != null && parent instanceof ViewGroup) { 11045beb2617f91e28c45917ea48109b8350f4e62140George Mount final ViewGroup vgParent = (ViewGroup) parent; 11055beb2617f91e28c45917ea48109b8350f4e62140George Mount if (vgParent.getTouchscreenBlocksFocus()) { 11065beb2617f91e28c45917ea48109b8350f4e62140George Mount container = vgParent; 11075beb2617f91e28c45917ea48109b8350f4e62140George Mount break; 11085beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11095beb2617f91e28c45917ea48109b8350f4e62140George Mount parent = vgParent.getParent(); 11105beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11115beb2617f91e28c45917ea48109b8350f4e62140George Mount if (container != null) { 11125beb2617f91e28c45917ea48109b8350f4e62140George Mount container.setTouchscreenBlocksFocus(false); 11135beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11145beb2617f91e28c45917ea48109b8350f4e62140George Mount if (toolbar != null) { 11155beb2617f91e28c45917ea48109b8350f4e62140George Mount toolbar.setTouchscreenBlocksFocus(false); 11165beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11175beb2617f91e28c45917ea48109b8350f4e62140George Mount viewGroup.requestFocus(); 11185beb2617f91e28c45917ea48109b8350f4e62140George Mount final View focused = viewGroup.findFocus(); 11195beb2617f91e28c45917ea48109b8350f4e62140George Mount if (focused != null) { 11205beb2617f91e28c45917ea48109b8350f4e62140George Mount focused.setOnFocusChangeListener(new FollowOutOfActionBar(viewGroup, 11215beb2617f91e28c45917ea48109b8350f4e62140George Mount container, toolbar)); 11225beb2617f91e28c45917ea48109b8350f4e62140George Mount } else { 11235beb2617f91e28c45917ea48109b8350f4e62140George Mount if (container != null) { 11245beb2617f91e28c45917ea48109b8350f4e62140George Mount container.setTouchscreenBlocksFocus(true); 11255beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11265beb2617f91e28c45917ea48109b8350f4e62140George Mount if (toolbar != null) { 11275beb2617f91e28c45917ea48109b8350f4e62140George Mount toolbar.setTouchscreenBlocksFocus(true); 11285beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11295beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11305beb2617f91e28c45917ea48109b8350f4e62140George Mount return true; 11315beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11325beb2617f91e28c45917ea48109b8350f4e62140George Mount return false; 11335beb2617f91e28c45917ea48109b8350f4e62140George Mount } 11345beb2617f91e28c45917ea48109b8350f4e62140George Mount 11355beb2617f91e28c45917ea48109b8350f4e62140George Mount /** 11368515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener interface for ActionBar navigation events. 1137fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1138fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1139fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1140fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1141fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 114289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 11438515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnNavigationListener { 114489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell /** 114589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * This method is called whenever a navigation item in your action bar 114689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * is selected. 114789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * 114889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemPosition Position of the item clicked. 114989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemId ID of the item clicked. 115089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @return True if the event was handled, false otherwise. 115189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 115289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 115333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell } 1154661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1155661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 11568515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener for receiving events when action bar menus are shown or hidden. 11578515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 11588515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnMenuVisibilityListener { 11598515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 11608515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Called when an action bar menu is shown or hidden. Applications may want to use 11618515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 11628515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * gameplay, or other activity within the main content area. 11638515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 11648515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param isVisible True if an action bar menu is now visible, false if no action bar 11658515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * menus are visible. 11668515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 11678515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 11688515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell } 11698515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 11708515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 1171661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * A tab in the action bar. 1172661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1173661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * <p>Tabs manage the hiding and showing of {@link Fragment}s. 1174fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1175fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1176fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1177fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1178fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 1179661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1180661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static abstract class Tab { 1181661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1182661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * An invalid position for a tab. 1183661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1184661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #getPosition() 1185661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1186661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static final int INVALID_POSITION = -1; 1187661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1188661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1189661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the current position of this tab in the action bar. 1190661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1191661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 1192661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * the action bar. 1193661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1194661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract int getPosition(); 1195661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1196661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1197661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the icon associated with this tab. 1198661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1199661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's icon 1200661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1201661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Drawable getIcon(); 1202661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1203661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1204661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the text of this tab. 1205661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1206661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's text 1207661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1208661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract CharSequence getText(); 1209661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1210661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1211661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the icon displayed on this tab. 1212661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1213661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param icon The drawable to use as an icon 12149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1215661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 12169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setIcon(Drawable icon); 1217661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1218661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 121932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the icon displayed on this tab. 122032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 122132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId Resource ID referring to the drawable to use as an icon 122232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 122332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 12247b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setIcon(@DrawableRes int resId); 122532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 122632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 1227661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the text displayed on this tab. Text may be truncated if there is not 1228661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * room to display the entire string. 1229661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1230661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param text The text to display 12319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1232661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 12339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setText(CharSequence text); 1234661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1235661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 123632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the text displayed on this tab. Text may be truncated if there is not 123732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * room to display the entire string. 123832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 123932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId A resource ID referring to the text that should be displayed 124032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 124132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 12427b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setText(@StringRes int resId); 124332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 124432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 12452b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set a custom view to be used for this tab. This overrides values set by 12462b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1247661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 12482b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param view Custom view to be used as a tab. 12499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1250661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 12519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setCustomView(View view); 1252661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1253661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 125432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set a custom view to be used for this tab. This overrides values set by 125532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 125632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 125732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 125832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 125932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 12607b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setCustomView(@LayoutRes int layoutResId); 126132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 126232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 12632b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Retrieve a previously set custom view for this tab. 1264661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 12652b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The custom view set by {@link #setCustomView(View)}. 1266661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 12672b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract View getCustomView(); 12682b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12692b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12702b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Give this Tab an arbitrary object to hold for later use. 12712b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 12722b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param obj Object to store 12739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 12742b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTag(Object obj); 12762b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12772b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12782b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return This Tab's tag object. 12792b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12802b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Object getTag(); 12812b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12822b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set the {@link TabListener} that will handle switching to and from this tab. 12842b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * All tabs must have a TabListener set before being added to the ActionBar. 12852b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 12862b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param listener Listener to handle tab selection events 12879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 12882b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTabListener(TabListener listener); 1290661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1291661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1292661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1293661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1294661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void select(); 129594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 129694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 129794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 129894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 129994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 130094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param resId A resource ID referring to the description text 130194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 130294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 130394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 130494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 13057b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setContentDescription(@StringRes int resId); 130694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 130794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 130894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 130994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 131094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 131194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param contentDesc Description of this tab's content 131294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 131394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 131494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 131594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 131694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 131794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 131894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 131994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 132094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 132194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return Description of this tab's content 132294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 132394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 132494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 132594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract CharSequence getContentDescription(); 1326661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell } 13272b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 13282b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 13292b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Callback interface invoked when a tab is focused, unfocused, added, or removed. 1330fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1331fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1332fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1333fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1334fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 13352b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 13362b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public interface TabListener { 13372b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 13382b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab enters the selected state. 13392b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 13402b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was selected 13412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 13422b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. The previous tab's unselect and this tab's select will be 13430c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * executed in a single transaction. This FragmentTransaction does not support 13440c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 13452b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 13462b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 13472b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 13482b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 13492b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab exits the selected state. 13502b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 13512b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was unselected 13522b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 13532b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. This tab's unselect and the newly selected tab's select 13540c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * will be executed in a single transaction. This FragmentTransaction does not 13550c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * support being added to the back stack. 13562b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 13572b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 13587f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell 13597f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell /** 13607f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Called when a tab that is already selected is chosen again by the user. 13617f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Some applications may use this action to return to the top level of a category. 13627f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * 13637f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param tab The tab that was reselected. 13647f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 13650c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * once this method returns. This FragmentTransaction does not support 13660c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 13677f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell */ 13687f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 13692b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell } 13709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 13729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Per-child layout information associated with action bar custom views. 13739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 13749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 13759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1376e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public static class LayoutParams extends ViewGroup.MarginLayoutParams { 13779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 13789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Gravity for the view associated with these LayoutParams. 13799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 13809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see android.view.Gravity 13819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 13829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.ExportedProperty(category = "layout", mapping = { 1383e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = -1, to = "NONE"), 1384e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.NO_GRAVITY, to = "NONE"), 1385e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.TOP, to = "TOP"), 1386e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), 1387e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), 1388e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), 1389e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.START, to = "START"), 1390e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.END, to = "END"), 1391e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), 1392e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), 1393e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), 1394e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_HORIZONTAL, to = "FILL_HORIZONTAL"), 1395e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"), 1396e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL, to = "FILL") 13979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell }) 1398cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio public int gravity = Gravity.NO_GRAVITY; 13999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1400d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public LayoutParams(@NonNull Context c, AttributeSet attrs) { 14019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(c, attrs); 1402b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell 1403b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell TypedArray a = c.obtainStyledAttributes(attrs, 1404b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams); 1405b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell gravity = a.getInt( 1406b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, 1407b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell Gravity.NO_GRAVITY); 1408b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell a.recycle(); 14099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 14109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 14119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height) { 14129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 1413e021e6ed8931a0a8296af182fc9b0c76b64fb0c4Adam Powell this.gravity = Gravity.CENTER_VERTICAL | Gravity.START; 14149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 14159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 14169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height, int gravity) { 14179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 1418da4bd6fd9609e4aafe8a6ff8a8896a82fd668963Alan Viverette 1419da4bd6fd9609e4aafe8a6ff8a8896a82fd668963Alan Viverette this.gravity = gravity; 14209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 14219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 14229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int gravity) { 14239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this(WRAP_CONTENT, MATCH_PARENT, gravity); 14249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 14259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 14269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(LayoutParams source) { 14279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 1428e021e6ed8931a0a8296af182fc9b0c76b64fb0c4Adam Powell this.gravity = source.gravity; 14299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 14309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 14319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(ViewGroup.LayoutParams source) { 14329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 14339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 1434e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1435d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell /* 1436d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * Note for framework developers: 1437d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * 1438d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * You might notice that ActionBar.LayoutParams is missing a constructor overload 1439d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * for MarginLayoutParams. While it may seem like a good idea to add one, at this 1440d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * point it's dangerous for source compatibility. Upon building against a new 1441d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * version of the SDK an app can end up statically linking to the new MarginLayoutParams 1442d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * overload, causing a crash when running on older platform versions with no other changes. 1443d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell */ 144494a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy 144594a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy /** @hide */ 144694a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy @Override 144794a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) { 144894a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy super.encodeProperties(encoder); 144994a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy 145094a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy encoder.addProperty("gravity", gravity); 145194a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy } 14529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 14535beb2617f91e28c45917ea48109b8350f4e62140George Mount 14545beb2617f91e28c45917ea48109b8350f4e62140George Mount /** 14555beb2617f91e28c45917ea48109b8350f4e62140George Mount * Tracks the focused View until it leaves the ActionBar, then it resets the 14565beb2617f91e28c45917ea48109b8350f4e62140George Mount * touchscreenBlocksFocus value. 14575beb2617f91e28c45917ea48109b8350f4e62140George Mount */ 14585beb2617f91e28c45917ea48109b8350f4e62140George Mount private static class FollowOutOfActionBar implements OnFocusChangeListener, Runnable { 14595beb2617f91e28c45917ea48109b8350f4e62140George Mount private final ViewGroup mFocusRoot; 14605beb2617f91e28c45917ea48109b8350f4e62140George Mount private final ViewGroup mContainer; 14615beb2617f91e28c45917ea48109b8350f4e62140George Mount private final ViewGroup mToolbar; 14625beb2617f91e28c45917ea48109b8350f4e62140George Mount 14635beb2617f91e28c45917ea48109b8350f4e62140George Mount public FollowOutOfActionBar(ViewGroup focusRoot, ViewGroup container, ViewGroup toolbar) { 14645beb2617f91e28c45917ea48109b8350f4e62140George Mount mContainer = container; 14655beb2617f91e28c45917ea48109b8350f4e62140George Mount mToolbar = toolbar; 14665beb2617f91e28c45917ea48109b8350f4e62140George Mount mFocusRoot = focusRoot; 14675beb2617f91e28c45917ea48109b8350f4e62140George Mount } 14685beb2617f91e28c45917ea48109b8350f4e62140George Mount 14695beb2617f91e28c45917ea48109b8350f4e62140George Mount @Override 14705beb2617f91e28c45917ea48109b8350f4e62140George Mount public void onFocusChange(View v, boolean hasFocus) { 14715beb2617f91e28c45917ea48109b8350f4e62140George Mount if (!hasFocus) { 14725beb2617f91e28c45917ea48109b8350f4e62140George Mount v.setOnFocusChangeListener(null); 14735beb2617f91e28c45917ea48109b8350f4e62140George Mount final View focused = mFocusRoot.findFocus(); 14745beb2617f91e28c45917ea48109b8350f4e62140George Mount if (focused != null) { 14755beb2617f91e28c45917ea48109b8350f4e62140George Mount focused.setOnFocusChangeListener(this); 14765beb2617f91e28c45917ea48109b8350f4e62140George Mount } else { 14775beb2617f91e28c45917ea48109b8350f4e62140George Mount mFocusRoot.post(this); 14785beb2617f91e28c45917ea48109b8350f4e62140George Mount } 14795beb2617f91e28c45917ea48109b8350f4e62140George Mount } 14805beb2617f91e28c45917ea48109b8350f4e62140George Mount } 14815beb2617f91e28c45917ea48109b8350f4e62140George Mount 14825beb2617f91e28c45917ea48109b8350f4e62140George Mount @Override 14835beb2617f91e28c45917ea48109b8350f4e62140George Mount public void run() { 14845beb2617f91e28c45917ea48109b8350f4e62140George Mount if (mContainer != null) { 14855beb2617f91e28c45917ea48109b8350f4e62140George Mount mContainer.setTouchscreenBlocksFocus(true); 14865beb2617f91e28c45917ea48109b8350f4e62140George Mount } 14875beb2617f91e28c45917ea48109b8350f4e62140George Mount if (mToolbar != null) { 14885beb2617f91e28c45917ea48109b8350f4e62140George Mount mToolbar.setTouchscreenBlocksFocus(true); 14895beb2617f91e28c45917ea48109b8350f4e62140George Mount } 14905beb2617f91e28c45917ea48109b8350f4e62140George Mount } 14915beb2617f91e28c45917ea48109b8350f4e62140George Mount } 149233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell} 1493