ActionBar.java revision a04b7add4bbcb68da89427b4f82725f11d98bdc5
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; 39d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.Retention; 40d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbyeimport java.lang.annotation.RetentionPolicy; 41d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 4233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/** 43e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * A primary toolbar within the activity that may display the activity title, application-level 44e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * navigation affordances, and other interactive items. 45e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 46e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an 47e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * activity's window when the activity uses the system's {@link 48e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. 49e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * You may otherwise add the action bar by calling {@link 50e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a 51e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. 52e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * </p> 53e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 54e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>Beginning with Android L (API level 21), the action bar may be represented by any 55e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * Toolbar widget within the application layout. The application may signal to the Activity 56e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * which Toolbar should be treated as the Activity's action bar. Activities that use this 57e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * feature should use one of the supplied <code>.NoActionBar</code> themes, set the 58e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code> 59e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * or otherwise not request the window feature.</p> 60e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 61e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>By adjusting the window features requested by the theme and the layouts used for 62e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * an Activity's content view, an app can use the standard system action bar on older platform 63e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * releases and the newer inline toolbars on newer platform releases. The <code>ActionBar</code> 64e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * object obtained from the Activity can be used to control either configuration transparently.</p> 65e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 66e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * <p>When using the Holo themes the action bar shows the application icon on 67e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * the left, followed by the activity title. If your activity has an options menu, you can make 68e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * select items accessible directly from the action bar as "action items". You can also 69e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * modify various characteristics of the action bar or remove it completely.</p> 70e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 71830960cce032a1b0dc0cf54bcc44ffa339388c21Alan Viverette * <p>When using the Material themes (default in API 21 or newer) the navigation button 72e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * (formerly "Home") takes over the space previously occupied by the application icon. 73e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * Apps wishing to express a stronger branding should use their brand colors heavily 74e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * in the action bar and other application chrome or use a {@link #setLogo(int) logo} 75e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * in place of their standard title text.</p> 76e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 7736193d09a87035395d036a730038b765ac0b0913Scott Main * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 7836193d09a87035395d036a730038b765ac0b0913Scott Main * android.app.Activity#getActionBar getActionBar()}.</p> 79e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 80e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 81e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in 82e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * your activity, you can enable an action mode that offers actions specific to the selected 83e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the 84e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for 85e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * {@link ActionBar}.</p> 86e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell * 87b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <div class="special reference"> 88b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <h3>Developer Guides</h3> 89b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * <p>For information about how to use the action bar, including how to add action items, navigation 90b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 91b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * Bar</a> developer guide.</p> 92b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23Joe Fernandez * </div> 9333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 9433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar { 95d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 96d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 97d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) 98d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface NavigationMode {} 99d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 100a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 101a408291e22def5755559f42cde913706a6d628c0Adam Powell * Standard navigation mode. Consists of either a logo or icon 102a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * and title text with an optional subtitle. Clicking any of these elements 103cf0357639e952a87f0d535c82691919af81f058bAdam Powell * will dispatch onOptionsItemSelected to the host Activity with 104a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a MenuItem with item ID android.R.id.home. 105fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 106fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 107fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 108fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 109fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 110a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 111a408291e22def5755559f42cde913706a6d628c0Adam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 11233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 11333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * List navigation mode. Instead of static title text this mode 1159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * presents a list menu for navigation within the activity. 1169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. this might be presented to the user as a dropdown list. 117fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 118fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 119fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 120fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 121fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 12233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int NAVIGATION_MODE_LIST = 1; 12433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 12533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 12633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Tab navigation mode. Instead of static title text this mode 12733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * presents a series of tabs for navigation within the activity. 128fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 129fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 130fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 131fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 132fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 13333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 13433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 13533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 136d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye /** @hide */ 137d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @Retention(RetentionPolicy.SOURCE) 138d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @IntDef(flag = true, 139d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye value = { 140d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_USE_LOGO, 141d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_HOME, 142d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_HOME_AS_UP, 143d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_TITLE, 144d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_SHOW_CUSTOM, 145d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye DISPLAY_TITLE_MULTIPLE_LINES 146d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye }) 147d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public @interface DisplayOptions {} 148d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye 14933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 15033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Use logo instead of icon if available. This flag will cause appropriate 15133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation modes to use a wider logo in place of the standard icon. 1529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 15533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 15633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 15733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 15833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show 'home' elements in this action bar, leaving more space for other 16033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation elements. This includes logo and icon. 1619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 1669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Display the 'home' element such that it appears as an 'up' affordance. 1699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. show an arrow to the left indicating the action that will be taken. 1709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set this flag if selecting the 'home' button in the action bar to return 1729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * up by a single level in your UI rather than back to the top level or front page. 1739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 174c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting this option will implicitly enable interaction with the home/up 175c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button. See {@link #setHomeButtonEnabled(boolean)}. 176c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 1779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 1819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the activity title and subtitle, if present. 1849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(CharSequence) 1869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(int) 1879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(CharSequence) 1889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(int) 1899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 1939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the custom view if one has been set. 1969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setCustomView(View) 1979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 2009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 2019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 20327cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Allow the title to wrap onto multiple lines if space is available 20427cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 20527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 20627cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public static final int DISPLAY_TITLE_MULTIPLE_LINES = 0x20; 20727cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 20827cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 2099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the action bar into custom navigation mode, supplying a view 2109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * for custom navigation. 2119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Custom navigation views appear between the application icon and 2139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * any action buttons and may use any space available there. Common 2149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * use cases for custom navigation views might include an auto-suggesting 2159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * address bar for a browser or other navigation mechanisms that do not 2169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * translate well to provided navigation modes. 2179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param view Custom navigation view to place in the ActionBar. 21933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view); 22189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell 22233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 223a408291e22def5755559f42cde913706a6d628c0Adam Powell * Set the action bar into custom navigation mode, supplying a view 224a408291e22def5755559f42cde913706a6d628c0Adam Powell * for custom navigation. 22533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 226ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>Custom navigation views appear between the application icon and 22733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * any action buttons and may use any space available there. Common 228a408291e22def5755559f42cde913706a6d628c0Adam Powell * use cases for custom navigation views might include an auto-suggesting 229a408291e22def5755559f42cde913706a6d628c0Adam Powell * address bar for a browser or other navigation mechanisms that do not 230ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * translate well to provided navigation modes.</p> 231ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 232ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 233ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * the custom view to be displayed.</p> 23433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 23533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param view Custom navigation view to place in the ActionBar. 2369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param layoutParams How this custom view should layout in the bar. 237ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * 238ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 23933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 2409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 2419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2429ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2433f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set the action bar into custom navigation mode, supplying a view 2443f476b34049d062942eafcf48396f593e00bd324Adam Powell * for custom navigation. 2453f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2463f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>Custom navigation views appear between the application icon and 2473f476b34049d062942eafcf48396f593e00bd324Adam Powell * any action buttons and may use any space available there. Common 2483f476b34049d062942eafcf48396f593e00bd324Adam Powell * use cases for custom navigation views might include an auto-suggesting 2493f476b34049d062942eafcf48396f593e00bd324Adam Powell * address bar for a browser or other navigation mechanisms that do not 2503f476b34049d062942eafcf48396f593e00bd324Adam Powell * translate well to provided navigation modes.</p> 2513f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2523f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for 2533f476b34049d062942eafcf48396f593e00bd324Adam Powell * the custom view to be displayed.</p> 2543f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2553f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 2563f476b34049d062942eafcf48396f593e00bd324Adam Powell * 2573f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 2583f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 2597b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setCustomView(@LayoutRes int resId); 2603f476b34049d062942eafcf48396f593e00bd324Adam Powell 2613f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 2621969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2631969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2641969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2651969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2661969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2671969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2681969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2691969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as an icon. 2701969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2711969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2721969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2731969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2747b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setIcon(@DrawableRes int resId); 2751969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2761969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2771969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the icon to display in the 'home' section of the action bar. 2781969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use an icon specified by its style or the 2791969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity icon by default. 2801969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2811969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2821969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2831969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2841969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param icon Drawable to show as an icon. 2851969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2861969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 2871969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 2881969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 2891969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setIcon(Drawable icon); 2901969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 2911969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 2921969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 2931969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 2941969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 2951969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2961969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 2971969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 2981969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 2991969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param resId Resource ID of a drawable to show as a logo. 3001969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3011969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 3021969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 3031969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 3047b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setLogo(@DrawableRes int resId); 3051969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 3061969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 3071969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Set the logo to display in the 'home' section of the action bar. 3081969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * The action bar will use a logo specified by its style or the 3091969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * activity logo by default. 3101969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3111969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * Whether the home section shows an icon or logo is controlled 3121969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * by the display option {@link #DISPLAY_USE_LOGO}. 3131969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3141969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @param logo Drawable to show as a logo. 3151969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * 3161969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayUseLogoEnabled(boolean) 3171969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell * @see #setDisplayShowHomeEnabled(boolean) 3181969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell */ 3191969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell public abstract void setLogo(Drawable logo); 3201969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell 3211969b8799085322f9ef6e75b78c2c9a5d5944801Adam Powell /** 3229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the adapter and navigation callback for list navigation mode. 3239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * The supplied adapter will provide views for the expanded list as well as 3259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the currently selected item. (These may be displayed differently.) 3269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3278515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * The supplied OnNavigationListener will alert the application when the user 3289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * changes the current list selection. 3299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param adapter An adapter that will provide views both to display 3319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the current navigation selection and populate views 3329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * within the dropdown navigation menu. 3338515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param callback An OnNavigationListener that will receive events when the user 3349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * selects a navigation item. 335fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 336fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 337fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 338fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 339fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3409ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 3428515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell OnNavigationListener callback); 3439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the selected navigation item in list or tabbed navigation modes. 346178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 347178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param position Position of the item to select. 348fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 349fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 350fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 351fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 352fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 353178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 354178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract void setSelectedNavigationItem(int position); 355178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 356178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 3579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 358178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 359178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @return Position of the selected item. 360fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 361fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 362fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 363fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 364fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getSelectedNavigationIndex(); 3679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the number of navigation items present in the current navigation mode. 3709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return Number of navigation items. 372fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 373fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 374fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 375fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 376fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 3779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getNavigationItemCount(); 3799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 381ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 382ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 3830e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 3840e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param title Title to set 385a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 386a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(int) 387ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 3880e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 3890e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setTitle(CharSequence title); 3900e94b5151d817e600a888448a662208b29b5ef46Adam Powell 3910e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 392ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's title. This will only be displayed if 393ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 394a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 395a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of title string to set 396a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 397a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(CharSequence) 398ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 399a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 4007b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setTitle(@StringRes int resId); 401a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 402a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 403ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 404ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the 405ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * subtitle entirely. 4060e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 4070e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param subtitle Subtitle to set 408a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 409a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(int) 410ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 4110e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 4120e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setSubtitle(CharSequence subtitle); 4130e94b5151d817e600a888448a662208b29b5ef46Adam Powell 4140e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 415ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * Set the action bar's subtitle. This will only be displayed if 416ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * {@link #DISPLAY_SHOW_TITLE} is set. 417a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 418a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of subtitle string to set 419a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 420a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(CharSequence) 421ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @see #setDisplayOptions(int, int) 422a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 4237b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract void setSubtitle(@StringRes int resId); 424a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 425a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 426a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set display options. This changes all display option bits at once. To change 427a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 42833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 42933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 43033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * defined in ActionBar. 43133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 432d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options); 43333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 43433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 435a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set selected display options. Only the options specified by mask will be changed. 436a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 437a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 4389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 4399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * {@link #DISPLAY_SHOW_HOME} option. 4405ad7af6fc764f71765b134b8cd51787a7e78753aBen Komalo * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 4419ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 442a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 443a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 444a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * defined in ActionBar. 445a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param mask A bit mask declaring which display options should be changed. 446a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 447d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask); 4483f476b34049d062942eafcf48396f593e00bd324Adam Powell 4493f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4503f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to display the activity logo rather than the activity icon. 4513f476b34049d062942eafcf48396f593e00bd324Adam Powell * A logo is often a wider, more detailed image. 4523f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4533f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4543f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4553f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 4563f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4573f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4583f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4593f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4603f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 4613f476b34049d062942eafcf48396f593e00bd324Adam Powell 4623f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4633f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether to include the application home affordance in the action bar. 4643f476b34049d062942eafcf48396f593e00bd324Adam Powell * Home is presented as either an activity icon or logo. 4653f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4663f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4673f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4683f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHome true to show home, false otherwise. 4693f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4703f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4713f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4723f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4733f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 4743f476b34049d062942eafcf48396f593e00bd324Adam Powell 4753f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4763f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether home should be displayed as an "up" affordance. 4773f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set this to true if selecting "home" returns up by a single level in your UI 4783f476b34049d062942eafcf48396f593e00bd324Adam Powell * rather than back to the top level or front page. 4793f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4803f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4813f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4823f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showHomeAsUp true to show the user that selecting home will return one 4833f476b34049d062942eafcf48396f593e00bd324Adam Powell * level up rather than to the top level of the app. 4843f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4853f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4863f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4873f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 4883f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 4893f476b34049d062942eafcf48396f593e00bd324Adam Powell 4903f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 4913f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether an activity title/subtitle should be displayed. 4923f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4933f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 4943f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4953f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showTitle true to display a title/subtitle if present. 4963f476b34049d062942eafcf48396f593e00bd324Adam Powell * 4973f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 4983f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 4993f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 5003f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 5013f476b34049d062942eafcf48396f593e00bd324Adam Powell 5023f476b34049d062942eafcf48396f593e00bd324Adam Powell /** 5033f476b34049d062942eafcf48396f593e00bd324Adam Powell * Set whether a custom view should be displayed, if set. 5043f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5053f476b34049d062942eafcf48396f593e00bd324Adam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 5063f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5073f476b34049d062942eafcf48396f593e00bd324Adam Powell * @param showCustom true if the currently set custom view should be displayed, false otherwise. 5083f476b34049d062942eafcf48396f593e00bd324Adam Powell * 5093f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int) 5103f476b34049d062942eafcf48396f593e00bd324Adam Powell * @see #setDisplayOptions(int, int) 5113f476b34049d062942eafcf48396f593e00bd324Adam Powell */ 5123f476b34049d062942eafcf48396f593e00bd324Adam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 5133f476b34049d062942eafcf48396f593e00bd324Adam Powell 514a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 515f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's background. This will be used for the primary 516f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * action bar. 51733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 51833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param d Background drawable 519f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 520f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 52133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 522d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setBackgroundDrawable(@Nullable Drawable d); 523ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 524ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell /** 525f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's stacked background. This will appear 526f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * in the second row/stacked bar on some devices and configurations. 527f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 528f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the stacked row 529f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5300145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setStackedBackgroundDrawable(Drawable d) { } 531f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 532f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 533f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * Set the ActionBar's split background. This will appear in 534f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * the split action bar containing menu-provided action buttons 535f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * on some devices and configurations. 536e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 537f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * 538f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell * @param d Background drawable for the split bar 539f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell */ 5400145322e82f640f33befa7cb517a793d12abfb57Adam Powell public void setSplitBackgroundDrawable(Drawable d) { } 541f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell 542f88b915567a37c481c4c50a6cc57e1ec0e7cf50dAdam Powell /** 543ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell * @return The current custom view. 544ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell */ 545ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell public abstract View getCustomView(); 546ef704447689cb991049d31e67be41e66e8a44b6dAdam Powell 54733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 548a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar title in standard mode. 549a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 550a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 551a408291e22def5755559f42cde913706a6d628c0Adam Powell * 552a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar title or null. 55333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 55433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getTitle(); 55533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 55633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 557a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar subtitle in standard mode. 558a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 559a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 560a408291e22def5755559f42cde913706a6d628c0Adam Powell * 561a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar subtitle or null. 56233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 56333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getSubtitle(); 56433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 56533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 566a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current navigation mode. The result will be one of: 567a408291e22def5755559f42cde913706a6d628c0Adam Powell * <ul> 568a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 5699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 570a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_TABS}</li> 571a408291e22def5755559f42cde913706a6d628c0Adam Powell * </ul> 572a408291e22def5755559f42cde913706a6d628c0Adam Powell * 57333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current navigation mode. 574fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 575fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 576fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 577fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 578fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 57933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 580d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye @NavigationMode 58133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getNavigationMode(); 5829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 5839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 5849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the current navigation mode. 5859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 5869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param mode The new mode to set. 5879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_STANDARD 5889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_LIST 5899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_TABS 590fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 591fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 592fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 593fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 594fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 5959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 596d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public abstract void setNavigationMode(@NavigationMode int mode); 5979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 59833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 59933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current set of display options. 60033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 60133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getDisplayOptions(); 602661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 603661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 604661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Create and return a new {@link Tab}. 605661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * This tab will not be included in the action bar until it is added. 606661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 6072f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * <p>Very often tabs will be used to switch between {@link Fragment} 6082f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * objects. Here is a typical implementation of such tabs:</p> 6092f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 6102f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 6112f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * complete} 6122f04883ff880966d63d1aa4a1c7b05e497cfcc58Dianne Hackborn * 613661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return A new Tab 614661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 615661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #addTab(Tab) 616fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 617fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 618fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 619fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 620fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 621661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 622661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Tab newTab(); 623661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 624661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 625661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 62681b8944131946e451b31665652de8cc71d81ea07Adam Powell * If this is the first tab to be added it will become the selected tab. 627661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 628661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to add 629fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 630fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 631fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 632fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 633fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 634661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 635661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void addTab(Tab tab); 636661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 637661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 63881b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 63981b8944131946e451b31665652de8cc71d81ea07Adam Powell * 64081b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab Tab to add 64181b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 642fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 643fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 644fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 645fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 646fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 64781b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 64881b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, boolean setSelected); 64981b8944131946e451b31665652de8cc71d81ea07Adam Powell 65081b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6512b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 65281b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. If this is the first tab to be added it will become 65381b8944131946e451b31665652de8cc71d81ea07Adam Powell * the selected tab. 654661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 655661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to add 656661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position The new position of the tab 657fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 658fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 659fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 660fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 661fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 662661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 6632b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract void addTab(Tab tab, int position); 664661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 665661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 66681b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 66781b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. 66881b8944131946e451b31665652de8cc71d81ea07Adam Powell * 66981b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab The tab to add 67081b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param position The new position of the tab 67181b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 672fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 673fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 674fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 675fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 676fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 67781b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 67881b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 67981b8944131946e451b31665652de8cc71d81ea07Adam Powell 68081b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 6819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 6829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 683661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 684661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to remove 685fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 686fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 687fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 688fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 689fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 690661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 691661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTab(Tab tab); 692661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 693661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 6949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 6959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 696661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 697661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position Position of the tab to remove 698fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 699fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 700fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 701fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 702fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 703661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 704661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTabAt(int position); 705661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 706661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove all tabs from the action bar and deselect the current tab. 708fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 709fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 710fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 711fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 712fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 7149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void removeAllTabs(); 7159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 717661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 718661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 7199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 7209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 721661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to select 722fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 723fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 724fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 725fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 726fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 727661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 728661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void selectTab(Tab tab); 729661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 730661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 7312b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Returns the currently selected tab if in tabbed navigation mode and there is at least 7322b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * one tab present. 7332b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 7342b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The currently selected tab or null 735fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 736fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 737fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 738fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 739fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7402b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 7412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Tab getSelectedTab(); 7422b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 7432b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 7449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Returns the tab at the specified index. 7459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 7469ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param index Index value in the range 0-get 7479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return 748fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 749fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 750fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 751fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 752fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 7549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab getTabAt(int index); 7559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 7570c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * Returns the number of tabs currently registered with the action bar. 7580c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * @return Tab count 759fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 760fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 761fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 762fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 763fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 7640c24a5514c1ff143a223720a090b19a86a75945fAdam Powell */ 7650c24a5514c1ff143a223720a090b19a86a75945fAdam Powell public abstract int getTabCount(); 7660c24a5514c1ff143a223720a090b19a86a75945fAdam Powell 7670c24a5514c1ff143a223720a090b19a86a75945fAdam Powell /** 7686b336f835d637853800b94689375a03f337139a4Adam Powell * Retrieve the current height of the ActionBar. 7696b336f835d637853800b94689375a03f337139a4Adam Powell * 7706b336f835d637853800b94689375a03f337139a4Adam Powell * @return The ActionBar's height 7716b336f835d637853800b94689375a03f337139a4Adam Powell */ 7726b336f835d637853800b94689375a03f337139a4Adam Powell public abstract int getHeight(); 7736b336f835d637853800b94689375a03f337139a4Adam Powell 7746b336f835d637853800b94689375a03f337139a4Adam Powell /** 7756b336f835d637853800b94689375a03f337139a4Adam Powell * Show the ActionBar if it is not currently showing. 7766b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7776b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 7786b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 7793a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 7803a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>If you are hiding the ActionBar through 7813a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, 7823a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * you should not call this function directly. 7836b336f835d637853800b94689375a03f337139a4Adam Powell */ 7846b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void show(); 7856b336f835d637853800b94689375a03f337139a4Adam Powell 7866b336f835d637853800b94689375a03f337139a4Adam Powell /** 787e797ed6a74593630219faf7f0ba5dc8235586bceScott Main * Hide the ActionBar if it is currently showing. 7886b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 7896b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 7906b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 7913a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * 7923a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * <p>Instead of calling this function directly, you can also cause an 7933a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * ActionBar using the overlay feature to hide through 7943a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. 7953a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * Hiding the ActionBar through this system UI flag allows you to more 7963a3a6cfd8ec12208ca75c0d0d871d19d76c34194Dianne Hackborn * seamlessly hide it in conjunction with other screen decorations. 7976b336f835d637853800b94689375a03f337139a4Adam Powell */ 7986b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void hide(); 7996b336f835d637853800b94689375a03f337139a4Adam Powell 8006b336f835d637853800b94689375a03f337139a4Adam Powell /** 8016b336f835d637853800b94689375a03f337139a4Adam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 8026b336f835d637853800b94689375a03f337139a4Adam Powell */ 8036b336f835d637853800b94689375a03f337139a4Adam Powell public abstract boolean isShowing(); 8046b336f835d637853800b94689375a03f337139a4Adam Powell 8056b336f835d637853800b94689375a03f337139a4Adam Powell /** 8068515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Add a listener that will respond to menu visibility change events. 8078515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 8088515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener The new listener to add 8098515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 8108515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 8118515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 8128515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 8138515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Remove a menu visibility listener. This listener will no longer receive menu 8148515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * visibility change events. 8158515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 8168515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param listener A listener to remove that was previously added 8178515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 8188515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 8198515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 8208515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 821c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * Enable or disable the "home" button in the corner of the action bar. (Note that this 822c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * is the application home/up affordance on the action bar, not the systemwide home 823c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * button.) 824c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 825c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>This defaults to true for packages targeting < API 14. For packages targeting 826c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * API 14 or greater, the application should call this method to enable interaction 827c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * with the home/up affordance. 828c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 829c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable 830c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * the home button. 831c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * 832c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell * @param enabled true to enable the home button, false to disable the home button. 833c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell */ 83488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public void setHomeButtonEnabled(boolean enabled) { } 83588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell 83688ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell /** 83788ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * Returns a {@link Context} with an appropriate theme for creating views that 83888ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * will appear in the action bar. If you are inflating or instantiating custom views 83988ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * that will appear in an action bar, you should use the Context returned by this method. 84088ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * (This includes adapters used for list navigation mode.) 84188ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * This will ensure that views contrast properly against the action bar. 84288ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * 84388ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell * @return A themed Context for creating views 84488ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell */ 84588ab69780f58e4b32d497266b2ad646a4d74827bAdam Powell public Context getThemedContext() { return null; } 846c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell 847c29f4e52c3377924df26910cce3ff26278d1f484Adam Powell /** 84827cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * Returns true if the Title field has been truncated during layout for lack 84927cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * of available space. 85027cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * 85127cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @return true if the Title field has been truncated 85227cba3895282ac1da1f1d43d37d53f8113527569Adam Powell * @hide pending API approval 85327cba3895282ac1da1f1d43d37d53f8113527569Adam Powell */ 85427cba3895282ac1da1f1d43d37d53f8113527569Adam Powell public boolean isTitleTruncated() { return false; } 85527cba3895282ac1da1f1d43d37d53f8113527569Adam Powell 85627cba3895282ac1da1f1d43d37d53f8113527569Adam Powell /** 857e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 858e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 859e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 860e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 861e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>null</code> to this method, the default drawable from the theme 862e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 863e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 864e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 865e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 866e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 867e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 868e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param indicator A drawable to use for the up indicator, or null to use the theme's default 869e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 870e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 871e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 872e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 873e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 874e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeAsUpIndicator(Drawable indicator) { } 875e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 876e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 877e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate drawable to display next to the icon/logo/title 878e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 879e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * this mode to display an alternate selection for up navigation, such as a sliding drawer. 880e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 881e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you pass <code>0</code> to this method, the default drawable from the theme 882e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * will be used.</p> 883e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 884e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>If you implement alternate or intermediate behavior around Up, you should also 885e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 886e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to provide a correct description of the action for accessibility support.</p> 887e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 888e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a drawable to use for the up indicator, or null 889e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * to use the theme's default 890e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 891e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayOptions(int, int) 892e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setDisplayHomeAsUpEnabled(boolean) 893e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeActionContentDescription(int) 894e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 8957b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public void setHomeAsUpIndicator(@DrawableRes int resId) { } 896e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 897e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 898e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 899e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 900e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 901e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 902e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 903e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 904e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 905e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 906e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 907e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 908e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>null</code> will use the system default description.</p> 909e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 910e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param description New description for the Home action when enabled 911e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 912e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 913e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 914e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell public void setHomeActionContentDescription(CharSequence description) { } 915e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 916e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 917e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Set an alternate description for the Home/Up action, when enabled. 918e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 919e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>This description is commonly used for accessibility/screen readers when 920e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 921e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 922e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 923e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 924e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * functionality such as a sliding drawer, you should also set this to accurately 925e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * describe the action.</p> 926e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 927e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * <p>Setting this to <code>0</code> will use the system default description.</p> 928e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * 929e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @param resId Resource ID of a string to use as the new description 930e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * for the Home action when enabled 931e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(int) 932e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 933e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell */ 9347b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public void setHomeActionContentDescription(@StringRes int resId) { } 935e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell 936b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 937b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Enable hiding the action bar on content scroll. 938b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 939b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>If enabled, the action bar will scroll out of sight along with a 940b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content. 941b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode} 942b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * to enable hiding on content scroll.</p> 943b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 944b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>When partially scrolled off screen the action bar is considered 945b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view. 946b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * </p> 947b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @param hideOnContentScroll true to enable hiding on content scroll. 948b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 949b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) { 950b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell if (hideOnContentScroll) { 951b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell throw new UnsupportedOperationException("Hide on content scroll is not supported in " + 952b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell "this action bar configuration."); 953b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 954b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 955b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 956b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 957b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Return whether the action bar is configured to scroll out of sight along with 958b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}. 959b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 960b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @return true if hide-on-content-scroll is enabled 961b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @see #setHideOnContentScrollEnabled(boolean) 962b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 963b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public boolean isHideOnContentScrollEnabled() { 964b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell return false; 965b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 966b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 967b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 968b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Return the current vertical offset of the action bar. 969b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 970b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>The action bar's current hide offset is the distance that the action bar is currently 971b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 972b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * current measured {@link #getHeight() height} (fully invisible).</p> 973b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 974b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @return The action bar's offset toward its fully hidden state in pixels 975b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 976b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public int getHideOffset() { 977b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell return 0; 978b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 979b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 980b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell /** 981b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * Set the current hide offset of the action bar. 982b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 983b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * <p>The action bar's current hide offset is the distance that the action bar is currently 984b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's 985b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * current measured {@link #getHeight() height} (fully invisible).</p> 986b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * 987b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell * @param offset The action bar's offset toward its fully hidden state in pixels. 988b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell */ 989b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell public void setHideOffset(int offset) { 990b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell if (offset != 0) { 991b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell throw new UnsupportedOperationException("Setting an explicit action bar hide offset " + 992b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell "is not supported in this action bar configuration."); 993b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 994b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell } 995b36e4f944fe28ce68182f9ec91e5341866b49084Adam Powell 99614d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell /** 99714d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * Set the Z-axis elevation of the action bar in pixels. 99814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 99914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 100014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * values are closer to the user.</p> 100114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 100214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * @param elevation Elevation value in pixels 100314d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell */ 100414d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell public void setElevation(float elevation) { 100514d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell if (elevation != 0) { 100614d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell throw new UnsupportedOperationException("Setting a non-zero elevation is " + 100714d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell "not supported in this action bar configuration."); 100814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 100914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 101014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell 101114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell /** 101214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * Get the Z-axis elevation of the action bar in pixels. 101314d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 101414d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher 101514d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * values are closer to the user.</p> 101614d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * 101714d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell * @return Elevation value in pixels 101814d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell */ 101914d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell public float getElevation() { 102014d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell return 0; 102114d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell } 102214d1fa4ba753d3480abf031525da0aa23d8e5abeAdam Powell 1023e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1024e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { 1025e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1026e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1027e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1028e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void setShowHideAnimationEnabled(boolean enabled) { 1029e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1030e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1031e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1032e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void onConfigurationChanged(Configuration config) { 1033e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1034e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1035e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1036e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public void dispatchMenuVisibilityChanged(boolean visible) { 1037e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1038e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1039e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell /** @hide */ 1040e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public ActionMode startActionMode(ActionMode.Callback callback) { 1041e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell return null; 1042e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell } 1043e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 104407a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 104507a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean openOptionsMenu() { 104607a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 104707a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 104807a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 104907a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 105007a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean invalidateOptionsMenu() { 105107a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 105207a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 105307a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 105407a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 105507a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean onMenuKeyEvent(KeyEvent event) { 105607a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 105707a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 105807a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 105907a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell /** @hide */ 1060a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki public boolean onKeyShortcut(int keyCode, KeyEvent event) { 1061a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki return false; 1062a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki } 1063a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki 1064a04b7add4bbcb68da89427b4f82725f11d98bdc5Abodunrinwa Toki /** @hide */ 106507a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell public boolean collapseActionView() { 106607a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell return false; 106707a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell } 106807a74548ae5c1e064508cb1c79ac34de1142b240Adam Powell 1069af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell /** @hide */ 1070af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell public void setWindowTitle(CharSequence title) { 1071af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell } 1072af2d85973ed768e390bc2f40f255ea39cc6f6fe5Adam Powell 1073e0e2f4fd3ac8e70e341ae52d6376d8d67bd9edceAdam Powell /** 10748515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener interface for ActionBar navigation events. 1075fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1076fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1077fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1078fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1079fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 108089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 10818515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnNavigationListener { 108289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell /** 108389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * This method is called whenever a navigation item in your action bar 108489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * is selected. 108589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * 108689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemPosition Position of the item clicked. 108789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemId ID of the item clicked. 108889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @return True if the event was handled, false otherwise. 108989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 109089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 109133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell } 1092661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1093661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 10948515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Listener for receiving events when action bar menus are shown or hidden. 10958515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 10968515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public interface OnMenuVisibilityListener { 10978515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 10988515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * Called when an action bar menu is shown or hidden. Applications may want to use 10998515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * this to tune auto-hiding behavior for the action bar or pause/resume video playback, 11008515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * gameplay, or other activity within the main content area. 11018515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * 11028515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * @param isVisible True if an action bar menu is now visible, false if no action bar 11038515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell * menus are visible. 11048515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell */ 11058515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 11068515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell } 11078515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell 11088515ee846bd76aee86ec5ddfcc4dd1e626dd999cAdam Powell /** 1109661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * A tab in the action bar. 1110661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1111661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * <p>Tabs manage the hiding and showing of {@link Fragment}s. 1112fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1113fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1114fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1115fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1116fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 1117661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1118661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static abstract class Tab { 1119661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1120661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * An invalid position for a tab. 1121661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1122661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #getPosition() 1123661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1124661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static final int INVALID_POSITION = -1; 1125661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1126661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1127661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the current position of this tab in the action bar. 1128661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1129661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 1130661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * the action bar. 1131661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1132661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract int getPosition(); 1133661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1134661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1135661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the icon associated with this tab. 1136661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1137661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's icon 1138661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1139661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Drawable getIcon(); 1140661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1141661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1142661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the text of this tab. 1143661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1144661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's text 1145661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1146661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract CharSequence getText(); 1147661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1148661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1149661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the icon displayed on this tab. 1150661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1151661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param icon The drawable to use as an icon 11529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1153661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 11549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setIcon(Drawable icon); 1155661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1156661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 115732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the icon displayed on this tab. 115832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 115932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId Resource ID referring to the drawable to use as an icon 116032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 116132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 11627b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setIcon(@DrawableRes int resId); 116332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 116432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 1165661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the text displayed on this tab. Text may be truncated if there is not 1166661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * room to display the entire string. 1167661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 1168661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param text The text to display 11699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1170661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 11719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setText(CharSequence text); 1172661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1173661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 117432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set the text displayed on this tab. Text may be truncated if there is not 117532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * room to display the entire string. 117632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 117732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param resId A resource ID referring to the text that should be displayed 117832555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 117932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 11807b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setText(@StringRes int resId); 118132555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 118232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 11832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set a custom view to be used for this tab. This overrides values set by 11842b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 1185661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 11862b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param view Custom view to be used as a tab. 11879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 1188661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 11899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setCustomView(View view); 1190661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1191661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 119232555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * Set a custom view to be used for this tab. This overrides values set by 119332555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 119432555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * 119532555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 119632555f347974711aac1f0c9acc0f06e8676d9362Adam Powell * @return The current instance for call chaining 119732555f347974711aac1f0c9acc0f06e8676d9362Adam Powell */ 11987b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setCustomView(@LayoutRes int layoutResId); 119932555f347974711aac1f0c9acc0f06e8676d9362Adam Powell 120032555f347974711aac1f0c9acc0f06e8676d9362Adam Powell /** 12012b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Retrieve a previously set custom view for this tab. 1202661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 12032b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The custom view set by {@link #setCustomView(View)}. 1204661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 12052b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract View getCustomView(); 12062b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12072b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12082b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Give this Tab an arbitrary object to hold for later use. 12092b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 12102b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param obj Object to store 12119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 12122b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTag(Object obj); 12142b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12152b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12162b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return This Tab's tag object. 12172b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12182b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Object getTag(); 12192b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12202b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12212b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set the {@link TabListener} that will handle switching to and from this tab. 12222b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * All tabs must have a TabListener set before being added to the ActionBar. 12232b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 12242b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param listener Listener to handle tab selection events 12259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 12262b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTabListener(TabListener listener); 1228661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 1229661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 1230661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 1231661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 1232661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void select(); 123394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 123494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 123594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 123694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 123794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 123894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param resId A resource ID referring to the description text 123994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 124094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 124194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 124294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 12437b9c912f536925ac6ec43935d6e97506851b33d6Tor Norbye public abstract Tab setContentDescription(@StringRes int resId); 124494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 124594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 124694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Set a description of this tab's content for use in accessibility support. 124794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * If no content description is provided the title will be used. 124894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 124994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @param contentDesc Description of this tab's content 125094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return The current instance for call chaining 125194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 125294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #getContentDescription() 125394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 125494e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 125594e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell 125694e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell /** 125794e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 125894e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * 125994e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @return Description of this tab's content 126094e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(CharSequence) 126194e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell * @see #setContentDescription(int) 126294e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell */ 126394e56ef3b8de6ed485546b462559ac862c10eabfAdam Powell public abstract CharSequence getContentDescription(); 1264661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell } 12652b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12662b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12672b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Callback interface invoked when a tab is focused, unfocused, added, or removed. 1268fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * 1269fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * @deprecated Action bar navigation modes are deprecated and not supported by inline 1270fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * toolbar action bars. Consider using other 1271fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * <a href="http://developer.android.com/design/patterns/navigation.html">common 1272fc35dfd513677ca01e8d4950ff9faa4ed19e65feAdam Powell * navigation patterns</a> instead. 12732b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12742b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public interface TabListener { 12752b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12762b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab enters the selected state. 12772b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 12782b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was selected 12792b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 12802b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. The previous tab's unselect and this tab's select will be 12810c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * executed in a single transaction. This FragmentTransaction does not support 12820c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 12832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12842b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 12852b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 12862b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 12872b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab exits the selected state. 12882b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 12892b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was unselected 12902b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 12912b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. This tab's unselect and the newly selected tab's select 12920c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * will be executed in a single transaction. This FragmentTransaction does not 12930c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * support being added to the back stack. 12942b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 12952b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 12967f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell 12977f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell /** 12987f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Called when a tab that is already selected is chosen again by the user. 12997f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Some applications may use this action to return to the top level of a category. 13007f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * 13017f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param tab The tab that was reselected. 13027f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 13030c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * once this method returns. This FragmentTransaction does not support 13040c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 13057f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell */ 13067f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 13072b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell } 13089ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 13109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Per-child layout information associated with action bar custom views. 13119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 13129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 13139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1314e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell public static class LayoutParams extends ViewGroup.MarginLayoutParams { 13159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 13169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Gravity for the view associated with these LayoutParams. 13179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 13189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see android.view.Gravity 13199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 13209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.ExportedProperty(category = "layout", mapping = { 1321e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = -1, to = "NONE"), 1322e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.NO_GRAVITY, to = "NONE"), 1323e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.TOP, to = "TOP"), 1324e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), 1325e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), 1326e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), 1327e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.START, to = "START"), 1328e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.END, to = "END"), 1329e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), 1330e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), 1331e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), 1332e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_HORIZONTAL, to = "FILL_HORIZONTAL"), 1333e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"), 1334e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell @ViewDebug.IntToString(from = Gravity.FILL, to = "FILL") 13359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell }) 1336cf1ba0298c48ae56608ed556dc715eb69c54f9b9Fabrice Di Meglio public int gravity = Gravity.NO_GRAVITY; 13379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1338d9273d6f289d9b55da3fd0db2f659fdfb48106a8Tor Norbye public LayoutParams(@NonNull Context c, AttributeSet attrs) { 13399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(c, attrs); 1340b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell 1341b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell TypedArray a = c.obtainStyledAttributes(attrs, 1342b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams); 1343b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell gravity = a.getInt( 1344b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, 1345b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell Gravity.NO_GRAVITY); 1346b226bea10880b3e8e3916b8ca96c51c1a59f5a03Adam Powell a.recycle(); 13479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height) { 13509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 1351e021e6ed8931a0a8296af182fc9b0c76b64fb0c4Adam Powell this.gravity = Gravity.CENTER_VERTICAL | Gravity.START; 13529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height, int gravity) { 13559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 1356da4bd6fd9609e4aafe8a6ff8a8896a82fd668963Alan Viverette 1357da4bd6fd9609e4aafe8a6ff8a8896a82fd668963Alan Viverette this.gravity = gravity; 13589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int gravity) { 13619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this(WRAP_CONTENT, MATCH_PARENT, gravity); 13629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(LayoutParams source) { 13659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 1366e021e6ed8931a0a8296af182fc9b0c76b64fb0c4Adam Powell this.gravity = source.gravity; 13679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 13689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 13699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(ViewGroup.LayoutParams source) { 13709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 13719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 1372e43340c80dc66c45edc793ecd0343774aa34d108Adam Powell 1373d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell /* 1374d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * Note for framework developers: 1375d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * 1376d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * You might notice that ActionBar.LayoutParams is missing a constructor overload 1377d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * for MarginLayoutParams. While it may seem like a good idea to add one, at this 1378d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * point it's dangerous for source compatibility. Upon building against a new 1379d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * version of the SDK an app can end up statically linking to the new MarginLayoutParams 1380d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell * overload, causing a crash when running on older platform versions with no other changes. 1381d76008352eeb246af76ba4a81eaeb4901ca4ef7fAdam Powell */ 138294a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy 138394a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy /** @hide */ 138494a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy @Override 138594a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) { 138694a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy super.encodeProperties(encoder); 138794a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy 138894a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy encoder.addProperty("gravity", gravity); 138994a6d15ede149189bba9e5f474ed853c98230e75Siva Velusamy } 13909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 139133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell} 1392