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; 349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewDebug; 359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup; 3694a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamyimport android.view.ViewHierarchyEncoder; 376b336f835d637853800b94689375a03f337139a4Adam Powellimport android.view.Window; 38a408291e22def5755559f42cde913706a6d628c0Adam Powellimport android.widget.SpinnerAdapter; 391abe85c867f552a5cdf50fba3f60d796284c2102Vadim Tryshev 40d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.Retention; 41d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.RetentionPolicy; 42d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 4333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/** 44e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * A primary toolbar within the activity that may display the activity title, application-level 45e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * navigation affordances, and other interactive items. 46e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 47e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an 48e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * activity's window when the activity uses the system's {@link 49e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. 50e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * You may otherwise add the action bar by calling {@link 51e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a 52e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. 53e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * </p> 54e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 55e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>Beginning with Android L (API level 21), the action bar may be represented by any 56e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * Toolbar widget within the application layout. The application may signal to the Activity 57e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * which Toolbar should be treated as the Activity's action bar. Activities that use this 58e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * feature should use one of the supplied <code>.NoActionBar</code> themes, set the 59e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code> 60e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * or otherwise not request the window feature.</p> 61e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 62e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>By adjusting the window features requested by the theme and the layouts used for 63e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * an Activity's content view, an app can use the standard system action bar on older platform 64e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * releases and the newer inline toolbars on newer platform releases. The <code>ActionBar</code> 65e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * object obtained from the Activity can be used to control either configuration transparently.</p> 66e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 67e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>When using the Holo themes the action bar shows the application icon on 68e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * the left, followed by the activity title. If your activity has an options menu, you can make 69e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * select items accessible directly from the action bar as "action items". You can also 70e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * modify various characteristics of the action bar or remove it completely.</p> 71e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 72830960cce032a1b0dc0cf54bcc44ffa339388c21Alan Viverette * <p>When using the Material themes (default in API 21 or newer) the navigation button 73e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * (formerly "Home") takes over the space previously occupied by the application icon. 74e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * Apps wishing to express a stronger branding should use their brand colors heavily 75e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * in the action bar and other application chrome or use a {@link #setLogo(int) logo} 76e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * in place of their standard title text.</p> 77e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 7836193d09a87035395d036a730038b765ac0b0913Scott Main * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 7936193d09a87035395d036a730038b765ac0b0913Scott Main * android.app.Activity#getActionBar getActionBar()}.</p> 80e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 81e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 82e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in 83e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * your activity, you can enable an action mode that offers actions specific to the selected 84e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 85e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for 86e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * {@link ActionBar}.</p> 87e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 88b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <div class="special reference"> 89b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <h3>Developer Guides</h3> 90b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <p>For information about how to use the action bar, including how to add action items, navigation 91b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 92b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * Bar</a> developer guide.</p> 93b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * </div> 9433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 9533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar { 96d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 97d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 98d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 99d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface NavigationMode {} 100d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 101a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 102a408291e22def5755559f42cde913706a6d628c0Adam Powell * Standard navigation mode. Consists of either a logo or icon 103a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * and title text with an optional subtitle. Clicking any of these elements 104cf0357639e952a87f0d535c82691919af81f058bAdam Powell * will dispatch onOptionsItemSelected to the host Activity with 105a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a MenuItem with item ID android.R.id.home. 106fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 107fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 108fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 109fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 110fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 111a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 112514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 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 */ 125514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 1269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int NAVIGATION_MODE_LIST = 1; 12733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 12833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 12933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Tab navigation mode. Instead of static title text this mode 13033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * presents a series of tabs for navigation within the activity. 131fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 132fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 133fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 134fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 135fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 13633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 137514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 13833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 13933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 140d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 141d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 142d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef(flag = true, 143d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye value = { 144d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_USE_LOGO, 145d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_HOME, 146d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_HOME_AS_UP, 147d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_TITLE, 148d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_CUSTOM, 149d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_TITLE_MULTIPLE_LINES 150d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye }) 151d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface DisplayOptions {} 152d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 15333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 15433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Use logo instead of icon if available. This flag will cause appropriate 15533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation modes to use a wider logo in place of the standard icon. 1569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 15933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 16033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 16133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 16233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show 'home' elements in this action bar, leaving more space for other 16433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation elements. This includes logo and icon. 1659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 1709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Display the 'home' element such that it appears as an 'up' affordance. 1739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. show an arrow to the left indicating the action that will be taken. 1749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set this flag if selecting the 'home' button in the action bar to return 1769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * up by a single level in your UI rather than back to the top level or front page. 1779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 178c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting this option will implicitly enable interaction with the home/up 179c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button. See {@link #setHomeButtonEnabled(boolean)}. 180c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 1819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 1859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the activity title and subtitle, if present. 1889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(CharSequence) 1909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(int) 1919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(CharSequence) 1929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(int) 1939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 1979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the custom view if one has been set. 2009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setCustomView(View) 2019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 2029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 2039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 2049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 2059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 20727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Allow the title to wrap onto multiple lines if space is available 20827cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 20927cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 21027cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public static final int DISPLAY_TITLE_MULTIPLE_LINES = 0x20; 21127cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 21227cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 2139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the action bar into custom navigation mode, supplying a view 2149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * for custom navigation. 2159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Custom navigation views appear between the application icon and 2179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * any action buttons and may use any space available there. Common 2189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * use cases for custom navigation views might include an auto-suggesting 2199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * address bar for a browser or other navigation mechanisms that do not 2209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * translate well to provided navigation modes. 2219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param view Custom navigation view to place in the ActionBar. 22333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view); 22589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell 22633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 227a408291e22def5755559f42cde913706a6d628c0Adam Powell * Set the action bar into custom navigation mode, supplying a view 228a408291e22def5755559f42cde913706a6d628c0Adam Powell * for custom navigation. 22933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 230ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>Custom navigation views appear between the application icon and 23133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * any action buttons and may use any space available there. Common 232a408291e22def5755559f42cde913706a6d628c0Adam Powell * use cases for custom navigation views might include an auto-suggesting 233a408291e22def5755559f42cde913706a6d628c0Adam Powell * address bar for a browser or other navigation mechanisms that do not 234ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * translate well to provided navigation modes.</p> 235ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 236ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 237ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * the custom view to be displayed.</p> 23833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 23933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param view Custom navigation view to place in the ActionBar. 2409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param layoutParams How this custom view should layout in the bar. 241ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 242ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 24333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 2459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2473f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set the action bar into custom navigation mode, supplying a view 2483f476b34049d062942eafcf48396f593e00bd324Adam Powell * for custom navigation. 2493f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2503f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>Custom navigation views appear between the application icon and 2513f476b34049d062942eafcf48396f593e00bd324Adam Powell * any action buttons and may use any space available there. Common 2523f476b34049d062942eafcf48396f593e00bd324Adam Powell * use cases for custom navigation views might include an auto-suggesting 2533f476b34049d062942eafcf48396f593e00bd324Adam Powell * address bar for a browser or other navigation mechanisms that do not 2543f476b34049d062942eafcf48396f593e00bd324Adam Powell * translate well to provided navigation modes.</p> 2553f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2563f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 2573f476b34049d062942eafcf48396f593e00bd324Adam Powell * the custom view to be displayed.</p> 2583f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2593f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 2603f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2613f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 2623f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 2637b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setCustomView(@LayoutRes int resId); 2643f476b34049d062942eafcf48396f593e00bd324Adam Powell 2653f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 2661969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2671969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2681969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2691969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2701969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2711969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2721969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2731969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as an icon. 2741969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2751969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2761969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2771969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2787b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setIcon(@DrawableRes int resId); 2791969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2801969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2811969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2821969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2831969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2841969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2851969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2861969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2871969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2881969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param icon Drawable to show as an icon. 2891969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2901969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2911969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2921969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2931969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(Drawable icon); 2941969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2951969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2961969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 2971969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 2981969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 2991969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3001969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 3011969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 3021969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3031969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as a logo. 3041969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3051969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 3061969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 3071969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 3087b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setLogo(@DrawableRes int resId); 3091969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 3101969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 3111969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 3121969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 3131969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 3141969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3151969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 3161969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 3171969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3181969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param logo Drawable to show as a logo. 3191969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3201969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 3211969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 3221969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 3231969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(Drawable logo); 3241969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 3251969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 3269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the adapter and navigation callback for list navigation mode. 3279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * The supplied adapter will provide views for the expanded list as well as 3299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the currently selected item. (These may be displayed differently.) 3309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3318515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * The supplied OnNavigationListener will alert the application when the user 3329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * changes the current list selection. 3339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param adapter An adapter that will provide views both to display 3359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the current navigation selection and populate views 3369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * within the dropdown navigation menu. 3378515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param callback An OnNavigationListener that will receive events when the user 3389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * selects a navigation item. 339fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 340fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 341fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 342fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 343fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 345514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 3469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 3478515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell OnNavigationListener callback); 3489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the selected navigation item in list or tabbed navigation modes. 351178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 352178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param position Position of the item to select. 353fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 354fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 355fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 356fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 357fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 358178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 359514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 360178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract void setSelectedNavigationItem(int position); 361178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 362178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 3639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 364178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 365178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @return Position of the selected item. 366fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 367fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 368fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 369fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 370fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 372514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 3739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getSelectedNavigationIndex(); 3749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the number of navigation items present in the current navigation mode. 3779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return Number of navigation items. 379fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 380fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 381fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 382fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 383fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 385514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 3869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getNavigationItemCount(); 3879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 389ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 390ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 3910e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 3920e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param title Title to set 393a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 394a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(int) 395ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 3960e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 3970e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setTitle(CharSequence title); 3980e94b5151d817e600a888448a662208b29b5ef46Adam Powell 3990e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 400ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 401ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 402a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 403a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of title string to set 404a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 405a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(CharSequence) 406ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 407a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 4087b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setTitle(@StringRes int resId); 409a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 410a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 411ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 412ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 413ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * subtitle entirely. 4140e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 4150e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param subtitle Subtitle to set 416a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 417a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(int) 418ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 4190e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 4200e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setSubtitle(CharSequence subtitle); 4210e94b5151d817e600a888448a662208b29b5ef46Adam Powell 4220e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 423ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 424ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 425a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 426a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of subtitle string to set 427a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 428a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(CharSequence) 429ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 430a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 4317b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setSubtitle(@StringRes int resId); 432a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 433a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 434a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set display options. This changes all display option bits at once. To change 435a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 43633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 43733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 43833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * defined in ActionBar. 43933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 440d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 44133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 44233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 443a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set selected display options. Only the options specified by mask will be changed. 444a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 445a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 4469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 4479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * {@link #DISPLAY_SHOW_HOME} option. 4485ad7af6fc764f71765b134b8cd51787a7e78753aBen Komalo * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 4499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 450a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 451a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 452a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * defined in ActionBar. 453a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param mask A bit mask declaring which display options should be changed. 454a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 455d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 4563f476b34049d062942eafcf48396f593e00bd324Adam Powell 4573f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4583f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to display the activity logo rather than the activity icon. 4593f476b34049d062942eafcf48396f593e00bd324Adam Powell * A logo is often a wider, more detailed image. 4603f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4613f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4623f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4633f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 4643f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4653f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4663f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4673f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4683f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 4693f476b34049d062942eafcf48396f593e00bd324Adam Powell 4703f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4713f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to include the application home affordance in the action bar. 4723f476b34049d062942eafcf48396f593e00bd324Adam Powell * Home is presented as either an activity icon or logo. 4733f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4743f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4753f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4763f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHome true to show home, false otherwise. 4773f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4783f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4793f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4803f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4813f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 4823f476b34049d062942eafcf48396f593e00bd324Adam Powell 4833f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4843f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether home should be displayed as an "up" affordance. 4853f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set this to true if selecting "home" returns up by a single level in your UI 4863f476b34049d062942eafcf48396f593e00bd324Adam Powell * rather than back to the top level or front page. 4873f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4883f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4893f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4903f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHomeAsUp true to show the user that selecting home will return one 4913f476b34049d062942eafcf48396f593e00bd324Adam Powell * level up rather than to the top level of the app. 4923f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4933f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4943f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4953f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4963f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 4973f476b34049d062942eafcf48396f593e00bd324Adam Powell 4983f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4993f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether an activity title/subtitle should be displayed. 5003f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5013f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 5023f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5033f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showTitle true to display a title/subtitle if present. 5043f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5053f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 5063f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 5073f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 5083f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 5093f476b34049d062942eafcf48396f593e00bd324Adam Powell 5103f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 5113f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether a custom view should be displayed, if set. 5123f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5133f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 5143f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5153f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showCustom true if the currently set custom view should be displayed, false otherwise. 5163f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5173f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 5183f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 5193f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 5203f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 5213f476b34049d062942eafcf48396f593e00bd324Adam Powell 522a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 523f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's background. This will be used for the primary 524f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * action bar. 52533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 52633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param d Background drawable 527f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 528f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 52933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 530d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setBackgroundDrawable(@Nullable Drawable d); 531ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 532ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell /** 533f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's stacked background. This will appear 534f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * in the second row/stacked bar on some devices and configurations. 535f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 536f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the stacked row 537f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5380145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setStackedBackgroundDrawable(Drawable d) { } 539f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 540f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 541f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's split background. This will appear in 542f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * the split action bar containing menu-provided action buttons 543f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * on some devices and configurations. 544e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 545f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 546f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the split bar 547f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5480145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setSplitBackgroundDrawable(Drawable d) { } 549f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 550f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 551ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @return The current custom view. 552ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell */ 553ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell public abstract View getCustomView(); 554ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 55533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 556a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar title in standard mode. 557a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 558a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 559a408291e22def5755559f42cde913706a6d628c0Adam Powell * 560a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar title or null. 56133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 56233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getTitle(); 56333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 56433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 565a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar subtitle in standard mode. 566a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 567a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 568a408291e22def5755559f42cde913706a6d628c0Adam Powell * 569a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar subtitle or null. 57033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 57133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getSubtitle(); 57233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 57333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 574a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current navigation mode. The result will be one of: 575a408291e22def5755559f42cde913706a6d628c0Adam Powell * <ul> 576a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 5779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 578a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_TABS}</li> 579a408291e22def5755559f42cde913706a6d628c0Adam Powell * </ul> 580a408291e22def5755559f42cde913706a6d628c0Adam Powell * 58133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current navigation mode. 582fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 583fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 584fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 585fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 586fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 58733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 588514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 589d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @NavigationMode 59033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getNavigationMode(); 5919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 5929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 5939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the current navigation mode. 5949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 5959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param mode The new mode to set. 5969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_STANDARD 5979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_LIST 5989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_TABS 599fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 600fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 601fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 602fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 603fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 6049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 605514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 606d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 6079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 60833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 60933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current set of display options. 61033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 61133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getDisplayOptions(); 612661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 613661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 614661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Create and return a new {@link Tab}. 615661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * This tab will not be included in the action bar until it is added. 616661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 6172f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * <p>Very often tabs will be used to switch between {@link Fragment} 6182f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * objects. Here is a typical implementation of such tabs:</p> 6192f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 6202f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 6212f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * complete} 6222f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 623661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return A new Tab 624661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 625661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #addTab(Tab) 626fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 627fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 628fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 629fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 630fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 631661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 632514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 633661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Tab newTab(); 634661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 635661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 636661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 63781b8944131946e451b31665652de8cc71d81ea07Adam Powell * If this is the first tab to be added it will become the selected tab. 638661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 639661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to add 640fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 641fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 642fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 643fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 644fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 645661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 646514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 647661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void addTab(Tab tab); 648661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 649661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 65081b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 65181b8944131946e451b31665652de8cc71d81ea07Adam Powell * 65281b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab Tab to add 65381b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 654fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 655fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 656fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 657fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 658fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 65981b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 660514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 66181b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, boolean setSelected); 66281b8944131946e451b31665652de8cc71d81ea07Adam Powell 66381b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6642b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 66581b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. If this is the first tab to be added it will become 66681b8944131946e451b31665652de8cc71d81ea07Adam Powell * the selected tab. 667661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 668661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to add 669661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position The new position of the tab 670fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 671fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 672fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 673fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 674fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 675661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 676514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 6772b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract void addTab(Tab tab, int position); 678661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 679661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 68081b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 68181b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. 68281b8944131946e451b31665652de8cc71d81ea07Adam Powell * 68381b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab The tab to add 68481b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param position The new position of the tab 68581b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 686fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 687fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 688fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 689fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 690fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 69181b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 692514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 69381b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 69481b8944131946e451b31665652de8cc71d81ea07Adam Powell 69581b8944131946e451b31665652de8cc71d81ea07Adam 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 tab 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 */ 706514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 707661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTab(Tab tab); 708661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 709661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 7119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 712661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 713661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position Position of the tab to remove 714fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 715fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 716fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 717fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 718fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 719661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 720514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 721661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTabAt(int position); 722661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 723661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove all tabs from the action bar and deselect the current tab. 725fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 726fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 727fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 728fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 729fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 731514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 7329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void removeAllTabs(); 7339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 735661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 736661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 7379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 7389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 739661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to select 740fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 741fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 742fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 743fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 744fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 745661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 746514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 747661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void selectTab(Tab tab); 748661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 749661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7502b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Returns the currently selected tab if in tabbed navigation mode and there is at least 7512b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * one tab present. 7522b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 7532b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The currently selected tab or null 754fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 755fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 756fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 757fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 758fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7592b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 760514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 7612b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Tab getSelectedTab(); 7622b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 7632b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 7649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Returns the tab at the specified index. 7659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 7669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param index Index value in the range 0-get 7679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return 768fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 769fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 770fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 771fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 772fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 774514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 7759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab getTabAt(int index); 7769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 7780c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * Returns the number of tabs currently registered with the action bar. 7790c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * @return Tab count 780fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 781fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 782fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 783fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 784fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7850c24a5514c1ff143a223720a090b19a86a75945fAdam Powell */ 786514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 7870c24a5514c1ff143a223720a090b19a86a75945fAdam Powell public abstract int getTabCount(); 7880c24a5514c1ff143a223720a090b19a86a75945fAdam Powell 7890c24a5514c1ff143a223720a090b19a86a75945fAdam Powell /** 7906b336f835d637853800b94689375a03f337139a4Adam Powell * Retrieve the current height of the ActionBar. 7916b336f835d637853800b94689375a03f337139a4Adam Powell * 7926b336f835d637853800b94689375a03f337139a4Adam Powell * @return The ActionBar's height 7936b336f835d637853800b94689375a03f337139a4Adam Powell */ 7946b336f835d637853800b94689375a03f337139a4Adam Powell public abstract int getHeight(); 7956b336f835d637853800b94689375a03f337139a4Adam Powell 7966b336f835d637853800b94689375a03f337139a4Adam Powell /** 7976b336f835d637853800b94689375a03f337139a4Adam Powell * Show the ActionBar if it is not currently showing. 7986b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7996b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 8006b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 8013a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 8023a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>If you are hiding the ActionBar through 8033a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 8043a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * you should not call this function directly. 8056b336f835d637853800b94689375a03f337139a4Adam Powell */ 8066b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void show(); 8076b336f835d637853800b94689375a03f337139a4Adam Powell 8086b336f835d637853800b94689375a03f337139a4Adam Powell /** 809e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * Hide the ActionBar if it is currently showing. 8106b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 8116b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 8126b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 8133a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 8143a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>Instead of calling this function directly, you can also cause an 8153a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * ActionBar using the overlay feature to hide through 8163a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 8173a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * Hiding the ActionBar through this system UI flag allows you to more 8183a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * seamlessly hide it in conjunction with other screen decorations. 8196b336f835d637853800b94689375a03f337139a4Adam Powell */ 8206b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void hide(); 8216b336f835d637853800b94689375a03f337139a4Adam Powell 8226b336f835d637853800b94689375a03f337139a4Adam Powell /** 8236b336f835d637853800b94689375a03f337139a4Adam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 8246b336f835d637853800b94689375a03f337139a4Adam Powell */ 8256b336f835d637853800b94689375a03f337139a4Adam Powell public abstract boolean isShowing(); 8266b336f835d637853800b94689375a03f337139a4Adam Powell 8276b336f835d637853800b94689375a03f337139a4Adam Powell /** 8288515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Add a listener that will respond to menu visibility change events. 8298515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 8308515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener The new listener to add 8318515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 8328515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 8338515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 8348515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 8358515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Remove a menu visibility listener. This listener will no longer receive menu 8368515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * visibility change events. 8378515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 8388515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener A listener to remove that was previously added 8398515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 8408515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 8418515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 8428515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 843c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * Enable or disable the "home" button in the corner of the action bar. (Note that this 844c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * is the application home/up affordance on the action bar, not the systemwide home 845c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button.) 846c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 847c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>This defaults to true for packages targeting < API 14. For packages targeting 848c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * API 14 or greater, the application should call this method to enable interaction 849c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * with the home/up affordance. 850c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 851c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 852c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * the home button. 853c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 854c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * @param enabled true to enable the home button, false to disable the home button. 855c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell */ 85688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public void setHomeButtonEnabled(boolean enabled) { } 85788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell 85888ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell /** 85988ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * Returns a {@link Context} with an appropriate theme for creating views that 86088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * will appear in the action bar. If you are inflating or instantiating custom views 86188ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * that will appear in an action bar, you should use the Context returned by this method. 86288ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * (This includes adapters used for list navigation mode.) 86388ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * This will ensure that views contrast properly against the action bar. 86488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * 86588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * @return A themed Context for creating views 86688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell */ 86788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public Context getThemedContext() { return null; } 868c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell 869c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell /** 87027cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Returns true if the Title field has been truncated during layout for lack 87127cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * of available space. 87227cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * 87327cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @return true if the Title field has been truncated 87427cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 87527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 87627cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public boolean isTitleTruncated() { return false; } 87727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 87827cba3895282ac1da1f1d43d37d53f8113527569Adam 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>null</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 indicator A drawable to use for the up indicator, or null to use the theme's default 891e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 892e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 893e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 894e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 895e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 896e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeAsUpIndicator(Drawable indicator) { } 897e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 898e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 899e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 900e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 901e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 902e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 903e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>0</code> to this method, the default drawable from the theme 904e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 905e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 906e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 907e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 908e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 909e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 910e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a drawable to use for the up indicator, or null 911e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to use the theme's default 912e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 913e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 914e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 915e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 916e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 9177b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public void setHomeAsUpIndicator(@DrawableRes int resId) { } 918e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 919e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 920e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 921e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 922e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 923e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 924e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 925e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 926e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 927e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 928e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 929e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 930e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>null</code> will use the system default description.</p> 931e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 932e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param description New description for the Home action when enabled 933e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 934e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 935e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 936e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeActionContentDescription(CharSequence description) { } 937e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 938e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 939e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 940e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 941e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 942e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 943e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 944e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 945e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 946e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 947e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 948e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 949e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>0</code> will use the system default description.</p> 950e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 951e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a string to use as the new description 952e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * for the Home action when enabled 953e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 954e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 955e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 9567b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public void setHomeActionContentDescription(@StringRes int resId) { } 957e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 958b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 959b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Enable hiding the action bar on content scroll. 960b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 961b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>If enabled, the action bar will scroll out of sight along with a 962b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content. 963b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode} 964b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * to enable hiding on content scroll.</p> 965b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 966b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>When partially scrolled off screen the action bar is considered 967b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view. 968b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * </p> 969b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @param hideOnContentScroll true to enable hiding on content scroll. 970b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 971b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) { 972b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell if (hideOnContentScroll) { 973b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell throw new UnsupportedOperationException("Hide on content scroll is not supported in " + 974b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell "this action bar configuration."); 975b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 976b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 977b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 978b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 979b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Return whether the action bar is configured to scroll out of sight along with 980b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}. 981b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 982b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @return true if hide-on-content-scroll is enabled 983b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @see #setHideOnContentScrollEnabled(boolean) 984b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 985b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public boolean isHideOnContentScrollEnabled() { 986b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell return false; 987b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 988b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 989b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 990b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Return the current vertical offset of the action bar. 991b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 992b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>The action bar's current hide offset is the distance that the action bar is currently 993b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 994b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * current measured {@link #getHeight() height} (fully invisible).</p> 995b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 996b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @return The action bar's offset toward its fully hidden state in pixels 997b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 998b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public int getHideOffset() { 999b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell return 0; 1000b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 1001b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 1002b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 1003b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Set the current hide offset of the action bar. 1004b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 1005b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>The action bar's current hide offset is the distance that the action bar is currently 1006b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 1007b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * current measured {@link #getHeight() height} (fully invisible).</p> 1008b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 1009b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @param offset The action bar's offset toward its fully hidden state in pixels. 1010b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 1011b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public void setHideOffset(int offset) { 1012b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell if (offset != 0) { 1013b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell throw new UnsupportedOperationException("Setting an explicit action bar hide offset " + 1014b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell "is not supported in this action bar configuration."); 1015b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 1016b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 1017b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 101814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell /** 101914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * Set the Z-axis elevation of the action bar in pixels. 102014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 102114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 102214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * values are closer to the user.</p> 102314d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 102414d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * @param elevation Elevation value in pixels 102514d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell */ 102614d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell public void setElevation(float elevation) { 102714d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell if (elevation != 0) { 102814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell throw new UnsupportedOperationException("Setting a non-zero elevation is " + 102914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell "not supported in this action bar configuration."); 103014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 103114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 103214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell 103314d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell /** 103414d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * Get the Z-axis elevation of the action bar in pixels. 103514d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 103614d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 103714d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * values are closer to the user.</p> 103814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 103914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * @return Elevation value in pixels 104014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell */ 104114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell public float getElevation() { 104214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell return 0; 104314d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 104414d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell 1045e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1046e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { 1047e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1048e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1049e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1050e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void setShowHideAnimationEnabled(boolean enabled) { 1051e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1052e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1053e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1054e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void onConfigurationChanged(Configuration config) { 1055e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1056e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1057e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1058e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void dispatchMenuVisibilityChanged(boolean visible) { 1059e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1060e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1061e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1062e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public ActionMode startActionMode(ActionMode.Callback callback) { 1063e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell return null; 1064e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1065e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 106607a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 106707a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean openOptionsMenu() { 106807a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 106907a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 107007a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 107107a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 107241823d19b6d1749158fc1643cf0911a8e961c702Evan Rosky public boolean closeOptionsMenu() { 107341823d19b6d1749158fc1643cf0911a8e961c702Evan Rosky return false; 107441823d19b6d1749158fc1643cf0911a8e961c702Evan Rosky } 107541823d19b6d1749158fc1643cf0911a8e961c702Evan Rosky 107641823d19b6d1749158fc1643cf0911a8e961c702Evan Rosky /** @hide */ 107707a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean invalidateOptionsMenu() { 107807a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 107907a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 108007a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 108107a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 108207a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean onMenuKeyEvent(KeyEvent event) { 108307a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 108407a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 108507a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 108607a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 1087a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki public boolean onKeyShortcut(int keyCode, KeyEvent event) { 1088a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki return false; 1089a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki } 1090a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki 1091a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki /** @hide */ 109207a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean collapseActionView() { 109307a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 109407a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 109507a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 1096af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell /** @hide */ 1097af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell public void setWindowTitle(CharSequence title) { 1098af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell } 1099af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell 110021b257717fe0c60574fe1cfaa44ed894edd21200Chris Banes /** @hide */ 110121b257717fe0c60574fe1cfaa44ed894edd21200Chris Banes public void onDestroy() { 110221b257717fe0c60574fe1cfaa44ed894edd21200Chris Banes } 110321b257717fe0c60574fe1cfaa44ed894edd21200Chris Banes 11045beb2617f91e28c45917ea48109b8350f4e62140George Mount /** 11058515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener interface for ActionBar navigation events. 1106fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1107fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1108fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1109fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1110fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 111189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 1112514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 11138515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnNavigationListener { 111489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell /** 111589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * This method is called whenever a navigation item in your action bar 111689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * is selected. 111789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * 111889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemPosition Position of the item clicked. 111989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemId ID of the item clicked. 112089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @return True if the event was handled, false otherwise. 112189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 112289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 112333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell } 1124661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1125661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 11268515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener for receiving events when action bar menus are shown or hidden. 11278515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 11288515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnMenuVisibilityListener { 11298515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 11308515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Called when an action bar menu is shown or hidden. Applications may want to use 11318515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 11328515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * gameplay, or other activity within the main content area. 11338515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 11348515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param isVisible True if an action bar menu is now visible, false if no action bar 11358515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * menus are visible. 11368515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 11378515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 11388515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell } 11398515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 11408515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 1141661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * A tab in the action bar. 1142661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1143661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * <p>Tabs manage the hiding and showing of {@link Fragment}s. 1144fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1145fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1146fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1147fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1148fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 1149661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1150514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 1151661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static abstract class Tab { 1152661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1153661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * An invalid position for a tab. 1154661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1155661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #getPosition() 1156661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1157661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static final int INVALID_POSITION = -1; 1158661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1159661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1160661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the current position of this tab in the action bar. 1161661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1162661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 1163661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * the action bar. 1164661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1165661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract int getPosition(); 1166661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1167661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1168661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the icon associated with this tab. 1169661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1170661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's icon 1171661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1172661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Drawable getIcon(); 1173661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1174661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1175661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the text of this tab. 1176661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1177661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's text 1178661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1179661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract CharSequence getText(); 1180661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1181661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1182661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the icon displayed on this tab. 1183661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1184661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param icon The drawable to use as an icon 11859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1186661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 11879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setIcon(Drawable icon); 1188661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1189661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 119032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the icon displayed on this tab. 119132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 119232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId Resource ID referring to the drawable to use as an icon 119332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 119432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 11957b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setIcon(@DrawableRes int resId); 119632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 119732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 1198661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the text displayed on this tab. Text may be truncated if there is not 1199661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * room to display the entire string. 1200661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1201661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param text The text to display 12029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1203661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 12049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setText(CharSequence text); 1205661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1206661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 120732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the text displayed on this tab. Text may be truncated if there is not 120832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * room to display the entire string. 120932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 121032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId A resource ID referring to the text that should be displayed 121132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 121232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 12137b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setText(@StringRes int resId); 121432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 121532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 12162b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set a custom view to be used for this tab. This overrides values set by 12172b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1218661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 12192b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param view Custom view to be used as a tab. 12209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1221661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 12229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setCustomView(View view); 1223661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1224661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 122532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set a custom view to be used for this tab. This overrides values set by 122632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 122732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 122832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 122932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 123032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 12317b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setCustomView(@LayoutRes int layoutResId); 123232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 123332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 12342b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Retrieve a previously set custom view for this tab. 1235661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 12362b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The custom view set by {@link #setCustomView(View)}. 1237661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 12382b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract View getCustomView(); 12392b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12402b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Give this Tab an arbitrary object to hold for later use. 12422b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 12432b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param obj Object to store 12449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 12452b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTag(Object obj); 12472b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12482b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12492b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return This Tab's tag object. 12502b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12512b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Object getTag(); 12522b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12532b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12542b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set the {@link TabListener} that will handle switching to and from this tab. 12552b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * All tabs must have a TabListener set before being added to the ActionBar. 12562b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 12572b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param listener Listener to handle tab selection events 12589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 12592b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTabListener(TabListener listener); 1261661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1262661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1263661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1264661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1265661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void select(); 126694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 126794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 126894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 126994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 127094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 127194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param resId A resource ID referring to the description text 127294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 127394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 127494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 127594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 12767b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setContentDescription(@StringRes int resId); 127794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 127894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 127994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 128094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 128194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 128294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param contentDesc Description of this tab's content 128394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 128494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 128594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 128694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 128794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 128894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 128994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 129094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 129194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 129294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return Description of this tab's content 129394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 129494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 129594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 129694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract CharSequence getContentDescription(); 1297661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell } 12982b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12992b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 13002b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Callback interface invoked when a tab is focused, unfocused, added, or removed. 1301fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1302fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1303fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1304fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1305fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 13062b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 1307514c5ef8d5774d8820ed1bf90fe53af1606cf106Aurimas Liutikas @Deprecated 13082b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public interface TabListener { 13092b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 13102b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab enters the selected state. 13112b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 13122b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was selected 13132b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 13142b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. The previous tab's unselect and this tab's select will be 13150c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * executed in a single transaction. This FragmentTransaction does not support 13160c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 13172b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 13182b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 13192b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 13202b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 13212b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab exits the selected state. 13222b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 13232b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was unselected 13242b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 13252b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. This tab's unselect and the newly selected tab's select 13260c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * will be executed in a single transaction. This FragmentTransaction does not 13270c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * support being added to the back stack. 13282b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 13292b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 13307f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell 13317f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell /** 13327f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Called when a tab that is already selected is chosen again by the user. 13337f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Some applications may use this action to return to the top level of a category. 13347f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * 13357f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param tab The tab that was reselected. 13367f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 13370c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * once this method returns. This FragmentTransaction does not support 13380c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 13397f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell */ 13407f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 13412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell } 13429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 13449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Per-child layout information associated with action bar custom views. 13459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 13469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 13479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1348e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public static class LayoutParams extends ViewGroup.MarginLayoutParams { 13499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 13509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Gravity for the view associated with these LayoutParams. 13519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 13529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see android.view.Gravity 13539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 13549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.ExportedProperty(category = "layout", mapping = { 1355e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = -1, to = "NONE"), 1356e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.NO_GRAVITY, to = "NONE"), 1357e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.TOP, to = "TOP"), 1358e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), 1359e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), 1360e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), 1361e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.START, to = "START"), 1362e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.END, to = "END"), 1363e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), 1364e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), 1365e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), 1366e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_HORIZONTAL, to = "FILL_HORIZONTAL"), 1367e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"), 1368e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL, to = "FILL") 13699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell }) 1370cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio public int gravity = Gravity.NO_GRAVITY; 13719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1372d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public LayoutParams(@NonNull Context c, AttributeSet attrs) { 13739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(c, attrs); 1374b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell 1375b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell TypedArray a = c.obtainStyledAttributes(attrs, 1376b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams); 1377b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell gravity = a.getInt( 1378b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, 1379b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell Gravity.NO_GRAVITY); 1380b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell a.recycle(); 13819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height) { 13849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 1385e021e6ed8931a0a8296af182fc9b0c76b64fb0c4Adam Powell this.gravity = Gravity.CENTER_VERTICAL | Gravity.START; 13869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height, int gravity) { 13899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 1390da4bd6fd9609e4aafe8a6ff8a8896a82fd668963Alan Viverette 1391da4bd6fd9609e4aafe8a6ff8a8896a82fd668963Alan Viverette this.gravity = gravity; 13929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int gravity) { 13959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this(WRAP_CONTENT, MATCH_PARENT, gravity); 13969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(LayoutParams source) { 13999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 1400e021e6ed8931a0a8296af182fc9b0c76b64fb0c4Adam Powell this.gravity = source.gravity; 14019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 14029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 14039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(ViewGroup.LayoutParams source) { 14049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 14059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 1406e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1407d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell /* 1408d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * Note for framework developers: 1409d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * 1410d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * You might notice that ActionBar.LayoutParams is missing a constructor overload 1411d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * for MarginLayoutParams. While it may seem like a good idea to add one, at this 1412d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * point it's dangerous for source compatibility. Upon building against a new 1413d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * version of the SDK an app can end up statically linking to the new MarginLayoutParams 1414d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * overload, causing a crash when running on older platform versions with no other changes. 1415d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell */ 141694a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy 141794a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy /** @hide */ 141894a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy @Override 141994a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) { 142094a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy super.encodeProperties(encoder); 142194a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy 142294a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy encoder.addProperty("gravity", gravity); 142394a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy } 14249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 142533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell} 1426