Loading api/current.txt +53 −0 Original line number Diff line number Diff line Loading @@ -1075,6 +1075,7 @@ package android { field public static final int strokeOpacity = 16843812; // 0x1010424 field public static final int strokeWidth = 16843813; // 0x1010425 field public static final int subtitle = 16843473; // 0x10102d1 field public static final int subtitleTextAppearance = 16843834; // 0x101043a field public static final int subtitleTextStyle = 16843513; // 0x10102f9 field public static final int subtypeExtraValue = 16843674; // 0x101039a field public static final int subtypeId = 16843713; // 0x10103c1 Loading Loading @@ -1190,6 +1191,7 @@ package android { field public static final int tintMode = 16843798; // 0x1010416 field public static final int title = 16843233; // 0x10101e1 field public static final int titleCondensed = 16843234; // 0x10101e2 field public static final int titleTextAppearance = 16843833; // 0x1010439 field public static final int titleTextStyle = 16843512; // 0x10102f8 field public static final int toAlpha = 16843211; // 0x10101cb field public static final int toDegrees = 16843188; // 0x10101b4 Loading Loading @@ -3088,6 +3090,7 @@ package android.app { ctor public ActionBar.LayoutParams(int); ctor public ActionBar.LayoutParams(android.app.ActionBar.LayoutParams); ctor public ActionBar.LayoutParams(android.view.ViewGroup.LayoutParams); ctor public ActionBar.LayoutParams(android.view.ViewGroup.MarginLayoutParams); field public int gravity; } Loading Loading @@ -3263,6 +3266,7 @@ package android.app { method public void reportFullyDrawn(); method public final boolean requestWindowFeature(int); method public final void runOnUiThread(java.lang.Runnable); method public void setActionBar(android.widget.Toolbar); method public void setActivityLabelAndIcon(java.lang.CharSequence, android.graphics.Bitmap); method public void setContentTransitionManager(android.transition.TransitionManager); method public void setContentView(int); Loading Loading @@ -32514,6 +32518,7 @@ package android.widget { method public android.view.Menu getMenu(); method public void onConfigurationChanged(android.content.res.Configuration); method public void onDetachedFromWindow(); method public void setOnMenuItemClickListener(android.widget.ActionMenuView.OnMenuItemClickListener); } public static class ActionMenuView.LayoutParams extends android.widget.LinearLayout.LayoutParams { Loading @@ -32523,6 +32528,10 @@ package android.widget { ctor public ActionMenuView.LayoutParams(int, int); } public static abstract interface ActionMenuView.OnMenuItemClickListener { method public abstract boolean onMenuItemClick(android.view.MenuItem); } public abstract interface Adapter { method public abstract int getCount(); method public abstract java.lang.Object getItem(int); Loading Loading @@ -34676,6 +34685,50 @@ package android.widget { method public void setTextOn(java.lang.CharSequence); } public class Toolbar extends android.view.ViewGroup { ctor public Toolbar(android.content.Context); ctor public Toolbar(android.content.Context, android.util.AttributeSet); ctor public Toolbar(android.content.Context, android.util.AttributeSet, int); ctor public Toolbar(android.content.Context, android.util.AttributeSet, int, int); method public android.graphics.drawable.Drawable getLogo(); method public java.lang.CharSequence getLogoDescription(); method public android.view.Menu getMenu(); method public android.graphics.drawable.Drawable getNavigationIcon(); method public java.lang.CharSequence getSubtitle(); method public java.lang.CharSequence getTitle(); method public void inflateMenu(int); method protected void onLayout(boolean, int, int, int, int); method public void setLogo(int); method public void setLogo(android.graphics.drawable.Drawable); method public void setLogoDescription(int); method public void setLogoDescription(java.lang.CharSequence); method public void setNavigationDescription(int); method public void setNavigationDescription(java.lang.CharSequence); method public void setNavigationIcon(int); method public void setNavigationIcon(android.graphics.drawable.Drawable); method public void setNavigationOnClickListener(android.view.View.OnClickListener); method public void setOnMenuItemClickListener(android.widget.Toolbar.OnMenuItemClickListener); method public void setSubtitle(int); method public void setSubtitle(java.lang.CharSequence); method public void setTitle(int); method public void setTitle(java.lang.CharSequence); } public static class Toolbar.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { ctor public Toolbar.LayoutParams(android.content.Context, android.util.AttributeSet); ctor public Toolbar.LayoutParams(int, int); ctor public Toolbar.LayoutParams(int, int, int); ctor public Toolbar.LayoutParams(int); ctor public Toolbar.LayoutParams(android.widget.Toolbar.LayoutParams); ctor public Toolbar.LayoutParams(android.view.ViewGroup.MarginLayoutParams); ctor public Toolbar.LayoutParams(android.view.ViewGroup.LayoutParams); field public int gravity; } public static abstract interface Toolbar.OnMenuItemClickListener { method public abstract boolean onMenuItemClick(android.view.MenuItem); } public deprecated class TwoLineListItem extends android.widget.RelativeLayout { ctor public TwoLineListItem(android.content.Context); ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet); core/java/android/app/ActionBar.java +76 −30 Original line number Diff line number Diff line Loading @@ -20,9 +20,11 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.ActionMode; import android.view.Gravity; import android.view.View; import android.view.ViewDebug; Loading @@ -30,31 +32,57 @@ import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; import android.view.Window; import android.widget.SpinnerAdapter; import android.widget.Toolbar; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Map; /** * A window feature at the top of the activity that may display the activity title, navigation * modes, and other interactive items. * A primary toolbar within the activity that may display the activity title, application-level * navigation affordances, and other interactive items. * * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an * activity's window when the activity uses the system's {@link * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. * You may otherwise add the action bar by calling {@link * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. * <p>By default, the action bar shows the application icon on * </p> * * <p>Beginning with Android L (API level 21), the action bar may be represented by any * Toolbar widget within the application layout. The application may signal to the Activity * which Toolbar should be treated as the Activity's action bar. Activities that use this * feature should use one of the supplied <code>.NoActionBar</code> themes, set the * {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code> * or otherwise not request the window feature.</p> * * <p>By adjusting the window features requested by the theme and the layouts used for * an Activity's content view, an app can use the standard system action bar on older platform * releases and the newer inline toolbars on newer platform releases. The <code>ActionBar</code> * object obtained from the Activity can be used to control either configuration transparently.</p> * * <p>When using the Holo themes the action bar shows the application icon on * the left, followed by the activity title. If your activity has an options menu, you can make * select items accessible directly from the action bar as "action items". You can also * modify various characteristics of the action bar or remove it completely.</p> * * <p>When using the Quantum themes (default in API 21 or newer) the navigation button * (formerly "Home") takes over the space previously occupied by the application icon. * Apps wishing to express a stronger branding should use their brand colors heavily * in the action bar and other application chrome or use a {@link #setLogo(int) logo} * in place of their standard title text.</p> * * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link * android.app.Activity#getActionBar getActionBar()}.</p> * * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in * your activity, you can enable an action mode that offers actions specific to the selected * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for * {@link ActionBar}. * {@link ActionBar}.</p> * * <div class="special reference"> * <h3>Developer Guides</h3> * <p>For information about how to use the action bar, including how to add action items, navigation Loading Loading @@ -904,6 +932,31 @@ public abstract class ActionBar { */ public void setHomeActionContentDescription(int resId) { } /** @hide */ public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { } /** @hide */ public void setShowHideAnimationEnabled(boolean enabled) { } /** @hide */ public void onConfigurationChanged(Configuration config) { } /** @hide */ public void dispatchMenuVisibilityChanged(boolean visible) { } /** @hide */ public void captureSharedElements(Map<String, View> sharedElements) { } /** @hide */ public ActionMode startActionMode(ActionMode.Callback callback) { return null; } /** * Listener interface for ActionBar navigation events. * Loading Loading @@ -1145,7 +1198,7 @@ public abstract class ActionBar { * * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity */ public static class LayoutParams extends MarginLayoutParams { public static class LayoutParams extends ViewGroup.MarginLayoutParams { /** * Gravity for the view associated with these LayoutParams. * Loading @@ -1171,23 +1224,14 @@ public abstract class ActionBar { public LayoutParams(@NonNull Context c, AttributeSet attrs) { super(c, attrs); TypedArray a = c.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ActionBar_LayoutParams); gravity = a.getInt( com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, Gravity.NO_GRAVITY); a.recycle(); } public LayoutParams(int width, int height) { super(width, height); this.gravity = Gravity.CENTER_VERTICAL | Gravity.START; } public LayoutParams(int width, int height, int gravity) { super(width, height); this.gravity = gravity; } public LayoutParams(int gravity) { Loading @@ -1196,12 +1240,14 @@ public abstract class ActionBar { public LayoutParams(LayoutParams source) { super(source); this.gravity = source.gravity; } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } public LayoutParams(MarginLayoutParams source) { super(source); } } } core/java/android/app/Activity.java +39 −13 Original line number Diff line number Diff line Loading @@ -23,7 +23,9 @@ import android.transition.TransitionManager; import android.util.ArrayMap; import android.util.Pair; import android.util.SuperNotCalledException; import com.android.internal.app.ActionBarImpl; import android.widget.Toolbar; import com.android.internal.app.WindowDecorActionBar; import com.android.internal.app.ToolbarActionBar; import com.android.internal.policy.PolicyManager; import android.annotation.IntDef; Loading Loading @@ -723,7 +725,7 @@ public class Activity extends ContextThemeWrapper /*package*/ boolean mWindowAdded = false; /*package*/ boolean mVisibleFromServer = false; /*package*/ boolean mVisibleFromClient = true; /*package*/ ActionBarImpl mActionBar = null; /*package*/ ActionBar mActionBar = null; private boolean mEnableDefaultActionBarUp; private CharSequence mTitle; Loading Loading @@ -1906,15 +1908,39 @@ public class Activity extends ContextThemeWrapper */ @Nullable public ActionBar getActionBar() { initActionBar(); initWindowDecorActionBar(); return mActionBar; } /** * Set a {@link android.widget.Toolbar Toolbar} to act as the {@link ActionBar} for this * Activity window. * * <p>When set to a non-null value the {@link #getActionBar()} method will return * an {@link ActionBar} object that can be used to control the given toolbar as if it were * a traditional window decor action bar. The toolbar's menu will be populated with the * Activity's options menu and the navigation button will be wired through the standard * {@link android.R.id#home home} menu select action.</p> * * <p>In order to use a Toolbar within the Activity's window content the application * must not request the window feature {@link Window#FEATURE_ACTION_BAR FEATURE_ACTION_BAR}.</p> * * @param actionBar Toolbar to set as the Activity's action bar */ public void setActionBar(@Nullable Toolbar actionBar) { if (getActionBar() instanceof WindowDecorActionBar) { throw new IllegalStateException("This Activity already has an action bar supplied " + "by the window decor. Do not request Window.FEATURE_ACTION_BAR and set " + "android:windowActionBar to false in your theme to use a Toolbar instead."); } mActionBar = new ToolbarActionBar(actionBar); } /** * Creates a new ActionBar, locates the inflated ActionBarView, * initializes the ActionBar with the view, and sets mActionBar. */ private void initActionBar() { private void initWindowDecorActionBar() { Window window = getWindow(); // Initializing the window decor can change window feature flags. Loading @@ -1925,7 +1951,7 @@ public class Activity extends ContextThemeWrapper return; } mActionBar = new ActionBarImpl(this); mActionBar = new WindowDecorActionBar(this); mActionBar.setDefaultDisplayHomeAsUpEnabled(mEnableDefaultActionBarUp); mWindow.setDefaultIcon(mActivityInfo.getIconResource()); Loading @@ -1943,7 +1969,7 @@ public class Activity extends ContextThemeWrapper */ public void setContentView(int layoutResID) { getWindow().setContentView(layoutResID); initActionBar(); initWindowDecorActionBar(); } /** Loading @@ -1963,7 +1989,7 @@ public class Activity extends ContextThemeWrapper */ public void setContentView(View view) { getWindow().setContentView(view); initActionBar(); initWindowDecorActionBar(); } /** Loading @@ -1979,7 +2005,7 @@ public class Activity extends ContextThemeWrapper */ public void setContentView(View view, ViewGroup.LayoutParams params) { getWindow().setContentView(view, params); initActionBar(); initWindowDecorActionBar(); } /** Loading @@ -1991,7 +2017,7 @@ public class Activity extends ContextThemeWrapper */ public void addContentView(View view, ViewGroup.LayoutParams params) { getWindow().addContentView(view, params); initActionBar(); initWindowDecorActionBar(); } /** Loading Loading @@ -2636,7 +2662,7 @@ public class Activity extends ContextThemeWrapper */ public boolean onMenuOpened(int featureId, Menu menu) { if (featureId == Window.FEATURE_ACTION_BAR) { initActionBar(); initWindowDecorActionBar(); if (mActionBar != null) { mActionBar.dispatchMenuVisibilityChanged(true); } else { Loading Loading @@ -2717,7 +2743,7 @@ public class Activity extends ContextThemeWrapper break; case Window.FEATURE_ACTION_BAR: initActionBar(); initWindowDecorActionBar(); mActionBar.dispatchMenuVisibilityChanged(false); break; } Loading Loading @@ -3417,7 +3443,7 @@ public class Activity extends ContextThemeWrapper public MenuInflater getMenuInflater() { // Make sure that action views can get an appropriate theme. if (mMenuInflater == null) { initActionBar(); initWindowDecorActionBar(); if (mActionBar != null) { mMenuInflater = new MenuInflater(mActionBar.getThemedContext(), this); } else { Loading Loading @@ -5139,7 +5165,7 @@ public class Activity extends ContextThemeWrapper @Nullable @Override public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) { initActionBar(); initWindowDecorActionBar(); if (mActionBar != null) { return mActionBar.startActionMode(callback); } Loading core/java/android/app/Dialog.java +3 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package android.app; import android.content.pm.ApplicationInfo; import com.android.internal.app.ActionBarImpl; import com.android.internal.app.WindowDecorActionBar; import com.android.internal.policy.PolicyManager; import android.content.ComponentName; Loading Loading @@ -87,7 +87,7 @@ public class Dialog implements DialogInterface, Window.Callback, final WindowManager mWindowManager; Window mWindow; View mDecor; private ActionBarImpl mActionBar; private ActionBar mActionBar; /** * This field should be made private, so it is hidden from the SDK. * {@hide} Loading Loading @@ -280,7 +280,7 @@ public class Dialog implements DialogInterface, Window.Callback, final ApplicationInfo info = mContext.getApplicationInfo(); mWindow.setDefaultIcon(info.icon); mWindow.setDefaultLogo(info.logo); mActionBar = new ActionBarImpl(this); mActionBar = new WindowDecorActionBar(this); } WindowManager.LayoutParams l = mWindow.getAttributes(); Loading core/java/android/widget/ActionMenuPresenter.java +0 −10 Original line number Diff line number Diff line Loading @@ -639,16 +639,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter return false; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { // Fill available height heightMeasureSpec = MeasureSpec.makeMeasureSpec( MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); Loading Loading
api/current.txt +53 −0 Original line number Diff line number Diff line Loading @@ -1075,6 +1075,7 @@ package android { field public static final int strokeOpacity = 16843812; // 0x1010424 field public static final int strokeWidth = 16843813; // 0x1010425 field public static final int subtitle = 16843473; // 0x10102d1 field public static final int subtitleTextAppearance = 16843834; // 0x101043a field public static final int subtitleTextStyle = 16843513; // 0x10102f9 field public static final int subtypeExtraValue = 16843674; // 0x101039a field public static final int subtypeId = 16843713; // 0x10103c1 Loading Loading @@ -1190,6 +1191,7 @@ package android { field public static final int tintMode = 16843798; // 0x1010416 field public static final int title = 16843233; // 0x10101e1 field public static final int titleCondensed = 16843234; // 0x10101e2 field public static final int titleTextAppearance = 16843833; // 0x1010439 field public static final int titleTextStyle = 16843512; // 0x10102f8 field public static final int toAlpha = 16843211; // 0x10101cb field public static final int toDegrees = 16843188; // 0x10101b4 Loading Loading @@ -3088,6 +3090,7 @@ package android.app { ctor public ActionBar.LayoutParams(int); ctor public ActionBar.LayoutParams(android.app.ActionBar.LayoutParams); ctor public ActionBar.LayoutParams(android.view.ViewGroup.LayoutParams); ctor public ActionBar.LayoutParams(android.view.ViewGroup.MarginLayoutParams); field public int gravity; } Loading Loading @@ -3263,6 +3266,7 @@ package android.app { method public void reportFullyDrawn(); method public final boolean requestWindowFeature(int); method public final void runOnUiThread(java.lang.Runnable); method public void setActionBar(android.widget.Toolbar); method public void setActivityLabelAndIcon(java.lang.CharSequence, android.graphics.Bitmap); method public void setContentTransitionManager(android.transition.TransitionManager); method public void setContentView(int); Loading Loading @@ -32514,6 +32518,7 @@ package android.widget { method public android.view.Menu getMenu(); method public void onConfigurationChanged(android.content.res.Configuration); method public void onDetachedFromWindow(); method public void setOnMenuItemClickListener(android.widget.ActionMenuView.OnMenuItemClickListener); } public static class ActionMenuView.LayoutParams extends android.widget.LinearLayout.LayoutParams { Loading @@ -32523,6 +32528,10 @@ package android.widget { ctor public ActionMenuView.LayoutParams(int, int); } public static abstract interface ActionMenuView.OnMenuItemClickListener { method public abstract boolean onMenuItemClick(android.view.MenuItem); } public abstract interface Adapter { method public abstract int getCount(); method public abstract java.lang.Object getItem(int); Loading Loading @@ -34676,6 +34685,50 @@ package android.widget { method public void setTextOn(java.lang.CharSequence); } public class Toolbar extends android.view.ViewGroup { ctor public Toolbar(android.content.Context); ctor public Toolbar(android.content.Context, android.util.AttributeSet); ctor public Toolbar(android.content.Context, android.util.AttributeSet, int); ctor public Toolbar(android.content.Context, android.util.AttributeSet, int, int); method public android.graphics.drawable.Drawable getLogo(); method public java.lang.CharSequence getLogoDescription(); method public android.view.Menu getMenu(); method public android.graphics.drawable.Drawable getNavigationIcon(); method public java.lang.CharSequence getSubtitle(); method public java.lang.CharSequence getTitle(); method public void inflateMenu(int); method protected void onLayout(boolean, int, int, int, int); method public void setLogo(int); method public void setLogo(android.graphics.drawable.Drawable); method public void setLogoDescription(int); method public void setLogoDescription(java.lang.CharSequence); method public void setNavigationDescription(int); method public void setNavigationDescription(java.lang.CharSequence); method public void setNavigationIcon(int); method public void setNavigationIcon(android.graphics.drawable.Drawable); method public void setNavigationOnClickListener(android.view.View.OnClickListener); method public void setOnMenuItemClickListener(android.widget.Toolbar.OnMenuItemClickListener); method public void setSubtitle(int); method public void setSubtitle(java.lang.CharSequence); method public void setTitle(int); method public void setTitle(java.lang.CharSequence); } public static class Toolbar.LayoutParams extends android.view.ViewGroup.MarginLayoutParams { ctor public Toolbar.LayoutParams(android.content.Context, android.util.AttributeSet); ctor public Toolbar.LayoutParams(int, int); ctor public Toolbar.LayoutParams(int, int, int); ctor public Toolbar.LayoutParams(int); ctor public Toolbar.LayoutParams(android.widget.Toolbar.LayoutParams); ctor public Toolbar.LayoutParams(android.view.ViewGroup.MarginLayoutParams); ctor public Toolbar.LayoutParams(android.view.ViewGroup.LayoutParams); field public int gravity; } public static abstract interface Toolbar.OnMenuItemClickListener { method public abstract boolean onMenuItemClick(android.view.MenuItem); } public deprecated class TwoLineListItem extends android.widget.RelativeLayout { ctor public TwoLineListItem(android.content.Context); ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet);
core/java/android/app/ActionBar.java +76 −30 Original line number Diff line number Diff line Loading @@ -20,9 +20,11 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.ActionMode; import android.view.Gravity; import android.view.View; import android.view.ViewDebug; Loading @@ -30,31 +32,57 @@ import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; import android.view.Window; import android.widget.SpinnerAdapter; import android.widget.Toolbar; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Map; /** * A window feature at the top of the activity that may display the activity title, navigation * modes, and other interactive items. * A primary toolbar within the activity that may display the activity title, application-level * navigation affordances, and other interactive items. * * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an * activity's window when the activity uses the system's {@link * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. * You may otherwise add the action bar by calling {@link * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property. * <p>By default, the action bar shows the application icon on * </p> * * <p>Beginning with Android L (API level 21), the action bar may be represented by any * Toolbar widget within the application layout. The application may signal to the Activity * which Toolbar should be treated as the Activity's action bar. Activities that use this * feature should use one of the supplied <code>.NoActionBar</code> themes, set the * {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code> * or otherwise not request the window feature.</p> * * <p>By adjusting the window features requested by the theme and the layouts used for * an Activity's content view, an app can use the standard system action bar on older platform * releases and the newer inline toolbars on newer platform releases. The <code>ActionBar</code> * object obtained from the Activity can be used to control either configuration transparently.</p> * * <p>When using the Holo themes the action bar shows the application icon on * the left, followed by the activity title. If your activity has an options menu, you can make * select items accessible directly from the action bar as "action items". You can also * modify various characteristics of the action bar or remove it completely.</p> * * <p>When using the Quantum themes (default in API 21 or newer) the navigation button * (formerly "Home") takes over the space previously occupied by the application icon. * Apps wishing to express a stronger branding should use their brand colors heavily * in the action bar and other application chrome or use a {@link #setLogo(int) logo} * in place of their standard title text.</p> * * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link * android.app.Activity#getActionBar getActionBar()}.</p> * * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in * your activity, you can enable an action mode that offers actions specific to the selected * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for * {@link ActionBar}. * {@link ActionBar}.</p> * * <div class="special reference"> * <h3>Developer Guides</h3> * <p>For information about how to use the action bar, including how to add action items, navigation Loading Loading @@ -904,6 +932,31 @@ public abstract class ActionBar { */ public void setHomeActionContentDescription(int resId) { } /** @hide */ public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) { } /** @hide */ public void setShowHideAnimationEnabled(boolean enabled) { } /** @hide */ public void onConfigurationChanged(Configuration config) { } /** @hide */ public void dispatchMenuVisibilityChanged(boolean visible) { } /** @hide */ public void captureSharedElements(Map<String, View> sharedElements) { } /** @hide */ public ActionMode startActionMode(ActionMode.Callback callback) { return null; } /** * Listener interface for ActionBar navigation events. * Loading Loading @@ -1145,7 +1198,7 @@ public abstract class ActionBar { * * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity */ public static class LayoutParams extends MarginLayoutParams { public static class LayoutParams extends ViewGroup.MarginLayoutParams { /** * Gravity for the view associated with these LayoutParams. * Loading @@ -1171,23 +1224,14 @@ public abstract class ActionBar { public LayoutParams(@NonNull Context c, AttributeSet attrs) { super(c, attrs); TypedArray a = c.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ActionBar_LayoutParams); gravity = a.getInt( com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, Gravity.NO_GRAVITY); a.recycle(); } public LayoutParams(int width, int height) { super(width, height); this.gravity = Gravity.CENTER_VERTICAL | Gravity.START; } public LayoutParams(int width, int height, int gravity) { super(width, height); this.gravity = gravity; } public LayoutParams(int gravity) { Loading @@ -1196,12 +1240,14 @@ public abstract class ActionBar { public LayoutParams(LayoutParams source) { super(source); this.gravity = source.gravity; } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } public LayoutParams(MarginLayoutParams source) { super(source); } } }
core/java/android/app/Activity.java +39 −13 Original line number Diff line number Diff line Loading @@ -23,7 +23,9 @@ import android.transition.TransitionManager; import android.util.ArrayMap; import android.util.Pair; import android.util.SuperNotCalledException; import com.android.internal.app.ActionBarImpl; import android.widget.Toolbar; import com.android.internal.app.WindowDecorActionBar; import com.android.internal.app.ToolbarActionBar; import com.android.internal.policy.PolicyManager; import android.annotation.IntDef; Loading Loading @@ -723,7 +725,7 @@ public class Activity extends ContextThemeWrapper /*package*/ boolean mWindowAdded = false; /*package*/ boolean mVisibleFromServer = false; /*package*/ boolean mVisibleFromClient = true; /*package*/ ActionBarImpl mActionBar = null; /*package*/ ActionBar mActionBar = null; private boolean mEnableDefaultActionBarUp; private CharSequence mTitle; Loading Loading @@ -1906,15 +1908,39 @@ public class Activity extends ContextThemeWrapper */ @Nullable public ActionBar getActionBar() { initActionBar(); initWindowDecorActionBar(); return mActionBar; } /** * Set a {@link android.widget.Toolbar Toolbar} to act as the {@link ActionBar} for this * Activity window. * * <p>When set to a non-null value the {@link #getActionBar()} method will return * an {@link ActionBar} object that can be used to control the given toolbar as if it were * a traditional window decor action bar. The toolbar's menu will be populated with the * Activity's options menu and the navigation button will be wired through the standard * {@link android.R.id#home home} menu select action.</p> * * <p>In order to use a Toolbar within the Activity's window content the application * must not request the window feature {@link Window#FEATURE_ACTION_BAR FEATURE_ACTION_BAR}.</p> * * @param actionBar Toolbar to set as the Activity's action bar */ public void setActionBar(@Nullable Toolbar actionBar) { if (getActionBar() instanceof WindowDecorActionBar) { throw new IllegalStateException("This Activity already has an action bar supplied " + "by the window decor. Do not request Window.FEATURE_ACTION_BAR and set " + "android:windowActionBar to false in your theme to use a Toolbar instead."); } mActionBar = new ToolbarActionBar(actionBar); } /** * Creates a new ActionBar, locates the inflated ActionBarView, * initializes the ActionBar with the view, and sets mActionBar. */ private void initActionBar() { private void initWindowDecorActionBar() { Window window = getWindow(); // Initializing the window decor can change window feature flags. Loading @@ -1925,7 +1951,7 @@ public class Activity extends ContextThemeWrapper return; } mActionBar = new ActionBarImpl(this); mActionBar = new WindowDecorActionBar(this); mActionBar.setDefaultDisplayHomeAsUpEnabled(mEnableDefaultActionBarUp); mWindow.setDefaultIcon(mActivityInfo.getIconResource()); Loading @@ -1943,7 +1969,7 @@ public class Activity extends ContextThemeWrapper */ public void setContentView(int layoutResID) { getWindow().setContentView(layoutResID); initActionBar(); initWindowDecorActionBar(); } /** Loading @@ -1963,7 +1989,7 @@ public class Activity extends ContextThemeWrapper */ public void setContentView(View view) { getWindow().setContentView(view); initActionBar(); initWindowDecorActionBar(); } /** Loading @@ -1979,7 +2005,7 @@ public class Activity extends ContextThemeWrapper */ public void setContentView(View view, ViewGroup.LayoutParams params) { getWindow().setContentView(view, params); initActionBar(); initWindowDecorActionBar(); } /** Loading @@ -1991,7 +2017,7 @@ public class Activity extends ContextThemeWrapper */ public void addContentView(View view, ViewGroup.LayoutParams params) { getWindow().addContentView(view, params); initActionBar(); initWindowDecorActionBar(); } /** Loading Loading @@ -2636,7 +2662,7 @@ public class Activity extends ContextThemeWrapper */ public boolean onMenuOpened(int featureId, Menu menu) { if (featureId == Window.FEATURE_ACTION_BAR) { initActionBar(); initWindowDecorActionBar(); if (mActionBar != null) { mActionBar.dispatchMenuVisibilityChanged(true); } else { Loading Loading @@ -2717,7 +2743,7 @@ public class Activity extends ContextThemeWrapper break; case Window.FEATURE_ACTION_BAR: initActionBar(); initWindowDecorActionBar(); mActionBar.dispatchMenuVisibilityChanged(false); break; } Loading Loading @@ -3417,7 +3443,7 @@ public class Activity extends ContextThemeWrapper public MenuInflater getMenuInflater() { // Make sure that action views can get an appropriate theme. if (mMenuInflater == null) { initActionBar(); initWindowDecorActionBar(); if (mActionBar != null) { mMenuInflater = new MenuInflater(mActionBar.getThemedContext(), this); } else { Loading Loading @@ -5139,7 +5165,7 @@ public class Activity extends ContextThemeWrapper @Nullable @Override public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) { initActionBar(); initWindowDecorActionBar(); if (mActionBar != null) { return mActionBar.startActionMode(callback); } Loading
core/java/android/app/Dialog.java +3 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package android.app; import android.content.pm.ApplicationInfo; import com.android.internal.app.ActionBarImpl; import com.android.internal.app.WindowDecorActionBar; import com.android.internal.policy.PolicyManager; import android.content.ComponentName; Loading Loading @@ -87,7 +87,7 @@ public class Dialog implements DialogInterface, Window.Callback, final WindowManager mWindowManager; Window mWindow; View mDecor; private ActionBarImpl mActionBar; private ActionBar mActionBar; /** * This field should be made private, so it is hidden from the SDK. * {@hide} Loading Loading @@ -280,7 +280,7 @@ public class Dialog implements DialogInterface, Window.Callback, final ApplicationInfo info = mContext.getApplicationInfo(); mWindow.setDefaultIcon(info.icon); mWindow.setDefaultLogo(info.logo); mActionBar = new ActionBarImpl(this); mActionBar = new WindowDecorActionBar(this); } WindowManager.LayoutParams l = mWindow.getAttributes(); Loading
core/java/android/widget/ActionMenuPresenter.java +0 −10 Original line number Diff line number Diff line Loading @@ -639,16 +639,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter return false; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { // Fill available height heightMeasureSpec = MeasureSpec.makeMeasureSpec( MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); Loading