Loading api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -2595,6 +2595,10 @@ package android.app { method public abstract void setDisplayShowHomeEnabled(boolean); method public abstract void setDisplayShowTitleEnabled(boolean); method public abstract void setDisplayUseLogoEnabled(boolean); method public void setHomeActionContentDescription(java.lang.CharSequence); method public void setHomeActionContentDescription(int); method public void setHomeAsUpIndicator(android.graphics.drawable.Drawable); method public void setHomeAsUpIndicator(int); method public void setHomeButtonEnabled(boolean); method public abstract void setIcon(int); method public abstract void setIcon(android.graphics.drawable.Drawable); core/java/android/app/ActionBar.java +80 −0 Original line number Diff line number Diff line Loading @@ -694,6 +694,86 @@ public abstract class ActionBar { */ public boolean isTitleTruncated() { return false; } /** * Set an alternate drawable to display next to the icon/logo/title * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using * this mode to display an alternate selection for up navigation, such as a sliding drawer. * * <p>If you pass <code>null</code> to this method, the default drawable from the theme * will be used.</p> * * <p>If you implement alternate or intermediate behavior around Up, you should also * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} * to provide a correct description of the action for accessibility support.</p> * * @param indicator A drawable to use for the up indicator, or null to use the theme's default * * @see #setDisplayOptions(int, int) * @see #setDisplayHomeAsUpEnabled(boolean) * @see #setHomeActionContentDescription(int) */ public void setHomeAsUpIndicator(Drawable indicator) { } /** * Set an alternate drawable to display next to the icon/logo/title * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using * this mode to display an alternate selection for up navigation, such as a sliding drawer. * * <p>If you pass <code>0</code> to this method, the default drawable from the theme * will be used.</p> * * <p>If you implement alternate or intermediate behavior around Up, you should also * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} * to provide a correct description of the action for accessibility support.</p> * * @param resId Resource ID of a drawable to use for the up indicator, or null * to use the theme's default * * @see #setDisplayOptions(int, int) * @see #setDisplayHomeAsUpEnabled(boolean) * @see #setHomeActionContentDescription(int) */ public void setHomeAsUpIndicator(int resId) { } /** * Set an alternate description for the Home/Up action, when enabled. * * <p>This description is commonly used for accessibility/screen readers when * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) * Examples of this are, "Navigate Home" or "Navigate Up" depending on the * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific * functionality such as a sliding drawer, you should also set this to accurately * describe the action.</p> * * <p>Setting this to <code>null</code> will use the system default description.</p> * * @param description New description for the Home action when enabled * @see #setHomeAsUpIndicator(int) * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) */ public void setHomeActionContentDescription(CharSequence description) { } /** * Set an alternate description for the Home/Up action, when enabled. * * <p>This description is commonly used for accessibility/screen readers when * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) * Examples of this are, "Navigate Home" or "Navigate Up" depending on the * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific * functionality such as a sliding drawer, you should also set this to accurately * describe the action.</p> * * <p>Setting this to <code>0</code> will use the system default description.</p> * * @param resId Resource ID of a string to use as the new description * for the Home action when enabled * @see #setHomeAsUpIndicator(int) * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) */ public void setHomeActionContentDescription(int resId) { } /** * Listener interface for ActionBar navigation events. */ Loading core/java/com/android/internal/app/ActionBarImpl.java +20 −0 Original line number Diff line number Diff line Loading @@ -812,6 +812,26 @@ public class ActionBarImpl extends ActionBar { return mActionView != null && mActionView.isTitleTruncated(); } @Override public void setHomeAsUpIndicator(Drawable indicator) { mActionView.setHomeAsUpIndicator(indicator); } @Override public void setHomeAsUpIndicator(int resId) { mActionView.setHomeAsUpIndicator(resId); } @Override public void setHomeActionContentDescription(CharSequence description) { mActionView.setHomeActionContentDescription(description); } @Override public void setHomeActionContentDescription(int resId) { mActionView.setHomeActionContentDescription(resId); } /** * @hide */ Loading core/java/com/android/internal/view/menu/ActionMenuItem.java +1 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ public class ActionMenuItem implements MenuItem { } public CharSequence getTitleCondensed() { return mTitleCondensed; return mTitleCondensed != null ? mTitleCondensed : mTitle; } public boolean hasSubMenu() { Loading core/java/com/android/internal/widget/ActionBarView.java +80 −6 Original line number Diff line number Diff line Loading @@ -93,6 +93,8 @@ public class ActionBarView extends AbsActionBarView { private CharSequence mSubtitle; private Drawable mIcon; private Drawable mLogo; private CharSequence mHomeDescription; private int mHomeDescriptionRes; private HomeView mHomeLayout; private HomeView mExpandedHomeLayout; Loading Loading @@ -288,6 +290,10 @@ public class ActionBarView extends AbsActionBarView { initTitle(); } if (mHomeDescriptionRes != 0) { setHomeActionContentDescription(mHomeDescriptionRes); } if (mTabScrollView != null && mIncludeTabs) { ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams(); if (lp != null) { Loading Loading @@ -589,14 +595,43 @@ public class ActionBarView extends AbsActionBarView { mUpGoerFive.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); } else { mUpGoerFive.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO); mUpGoerFive.setContentDescription(buildHomeContentDescription()); } } /** * Compose a content description for the Home/Up affordance. * * <p>As this encompasses the icon/logo, title and subtitle all in one, we need * a description for the whole wad of stuff that can be localized properly.</p> */ private CharSequence buildHomeContentDescription() { final CharSequence homeDesc; if (mHomeDescription != null) { homeDesc = mHomeDescription; } else { if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) { mUpGoerFive.setContentDescription(mContext.getResources().getText( R.string.action_bar_up_description)); homeDesc = mContext.getResources().getText(R.string.action_bar_up_description); } else { mUpGoerFive.setContentDescription(mContext.getResources().getText( R.string.action_bar_home_description)); homeDesc = mContext.getResources().getText(R.string.action_bar_home_description); } } final CharSequence title = getTitle(); final CharSequence subtitle = getSubtitle(); if (!TextUtils.isEmpty(title)) { final String result; if (!TextUtils.isEmpty(subtitle)) { result = getResources().getString( R.string.action_bar_home_subtitle_description_format, title, subtitle, homeDesc); } else { result = getResources().getString(R.string.action_bar_home_description_format, title, homeDesc); } return result; } return homeDesc; } public void setDisplayOptions(int options) { Loading Loading @@ -1305,6 +1340,23 @@ public class ActionBarView extends AbsActionBarView { } } public void setHomeAsUpIndicator(Drawable indicator) { mHomeLayout.setUpIndicator(indicator); } public void setHomeAsUpIndicator(int resId) { mHomeLayout.setUpIndicator(resId); } public void setHomeActionContentDescription(CharSequence description) { mHomeDescription = description; } public void setHomeActionContentDescription(int resId) { mHomeDescriptionRes = resId; mHomeDescription = getResources().getText(resId); } static class SavedState extends BaseSavedState { int expandedMenuItemId; boolean isOverflowOpen; Loading Loading @@ -1339,9 +1391,11 @@ public class ActionBarView extends AbsActionBarView { } private static class HomeView extends FrameLayout { private View mUpView; private ImageView mUpView; private ImageView mIconView; private int mUpWidth; private int mUpIndicatorRes; private Drawable mDefaultUpIndicator; private static final long DEFAULT_TRANSITION_DURATION = 150; Loading @@ -1366,6 +1420,25 @@ public class ActionBarView extends AbsActionBarView { mIconView.setImageDrawable(icon); } public void setUpIndicator(Drawable d) { mUpView.setImageDrawable(d != null ? d : mDefaultUpIndicator); mUpIndicatorRes = 0; } public void setUpIndicator(int resId) { mUpIndicatorRes = resId; mUpView.setImageDrawable(resId != 0 ? getResources().getDrawable(resId) : null); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (mUpIndicatorRes != 0) { // Reload for config change setUpIndicator(mUpIndicatorRes); } } @Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { onPopulateAccessibilityEvent(event); Loading @@ -1389,8 +1462,9 @@ public class ActionBarView extends AbsActionBarView { @Override protected void onFinishInflate() { mUpView = findViewById(com.android.internal.R.id.up); mUpView = (ImageView) findViewById(com.android.internal.R.id.up); mIconView = (ImageView) findViewById(com.android.internal.R.id.home); mDefaultUpIndicator = mUpView.getDrawable(); } public int getStartOffset() { Loading Loading
api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -2595,6 +2595,10 @@ package android.app { method public abstract void setDisplayShowHomeEnabled(boolean); method public abstract void setDisplayShowTitleEnabled(boolean); method public abstract void setDisplayUseLogoEnabled(boolean); method public void setHomeActionContentDescription(java.lang.CharSequence); method public void setHomeActionContentDescription(int); method public void setHomeAsUpIndicator(android.graphics.drawable.Drawable); method public void setHomeAsUpIndicator(int); method public void setHomeButtonEnabled(boolean); method public abstract void setIcon(int); method public abstract void setIcon(android.graphics.drawable.Drawable);
core/java/android/app/ActionBar.java +80 −0 Original line number Diff line number Diff line Loading @@ -694,6 +694,86 @@ public abstract class ActionBar { */ public boolean isTitleTruncated() { return false; } /** * Set an alternate drawable to display next to the icon/logo/title * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using * this mode to display an alternate selection for up navigation, such as a sliding drawer. * * <p>If you pass <code>null</code> to this method, the default drawable from the theme * will be used.</p> * * <p>If you implement alternate or intermediate behavior around Up, you should also * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} * to provide a correct description of the action for accessibility support.</p> * * @param indicator A drawable to use for the up indicator, or null to use the theme's default * * @see #setDisplayOptions(int, int) * @see #setDisplayHomeAsUpEnabled(boolean) * @see #setHomeActionContentDescription(int) */ public void setHomeAsUpIndicator(Drawable indicator) { } /** * Set an alternate drawable to display next to the icon/logo/title * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using * this mode to display an alternate selection for up navigation, such as a sliding drawer. * * <p>If you pass <code>0</code> to this method, the default drawable from the theme * will be used.</p> * * <p>If you implement alternate or intermediate behavior around Up, you should also * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} * to provide a correct description of the action for accessibility support.</p> * * @param resId Resource ID of a drawable to use for the up indicator, or null * to use the theme's default * * @see #setDisplayOptions(int, int) * @see #setDisplayHomeAsUpEnabled(boolean) * @see #setHomeActionContentDescription(int) */ public void setHomeAsUpIndicator(int resId) { } /** * Set an alternate description for the Home/Up action, when enabled. * * <p>This description is commonly used for accessibility/screen readers when * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) * Examples of this are, "Navigate Home" or "Navigate Up" depending on the * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific * functionality such as a sliding drawer, you should also set this to accurately * describe the action.</p> * * <p>Setting this to <code>null</code> will use the system default description.</p> * * @param description New description for the Home action when enabled * @see #setHomeAsUpIndicator(int) * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) */ public void setHomeActionContentDescription(CharSequence description) { } /** * Set an alternate description for the Home/Up action, when enabled. * * <p>This description is commonly used for accessibility/screen readers when * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) * Examples of this are, "Navigate Home" or "Navigate Up" depending on the * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific * functionality such as a sliding drawer, you should also set this to accurately * describe the action.</p> * * <p>Setting this to <code>0</code> will use the system default description.</p> * * @param resId Resource ID of a string to use as the new description * for the Home action when enabled * @see #setHomeAsUpIndicator(int) * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) */ public void setHomeActionContentDescription(int resId) { } /** * Listener interface for ActionBar navigation events. */ Loading
core/java/com/android/internal/app/ActionBarImpl.java +20 −0 Original line number Diff line number Diff line Loading @@ -812,6 +812,26 @@ public class ActionBarImpl extends ActionBar { return mActionView != null && mActionView.isTitleTruncated(); } @Override public void setHomeAsUpIndicator(Drawable indicator) { mActionView.setHomeAsUpIndicator(indicator); } @Override public void setHomeAsUpIndicator(int resId) { mActionView.setHomeAsUpIndicator(resId); } @Override public void setHomeActionContentDescription(CharSequence description) { mActionView.setHomeActionContentDescription(description); } @Override public void setHomeActionContentDescription(int resId) { mActionView.setHomeActionContentDescription(resId); } /** * @hide */ Loading
core/java/com/android/internal/view/menu/ActionMenuItem.java +1 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ public class ActionMenuItem implements MenuItem { } public CharSequence getTitleCondensed() { return mTitleCondensed; return mTitleCondensed != null ? mTitleCondensed : mTitle; } public boolean hasSubMenu() { Loading
core/java/com/android/internal/widget/ActionBarView.java +80 −6 Original line number Diff line number Diff line Loading @@ -93,6 +93,8 @@ public class ActionBarView extends AbsActionBarView { private CharSequence mSubtitle; private Drawable mIcon; private Drawable mLogo; private CharSequence mHomeDescription; private int mHomeDescriptionRes; private HomeView mHomeLayout; private HomeView mExpandedHomeLayout; Loading Loading @@ -288,6 +290,10 @@ public class ActionBarView extends AbsActionBarView { initTitle(); } if (mHomeDescriptionRes != 0) { setHomeActionContentDescription(mHomeDescriptionRes); } if (mTabScrollView != null && mIncludeTabs) { ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams(); if (lp != null) { Loading Loading @@ -589,14 +595,43 @@ public class ActionBarView extends AbsActionBarView { mUpGoerFive.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); } else { mUpGoerFive.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO); mUpGoerFive.setContentDescription(buildHomeContentDescription()); } } /** * Compose a content description for the Home/Up affordance. * * <p>As this encompasses the icon/logo, title and subtitle all in one, we need * a description for the whole wad of stuff that can be localized properly.</p> */ private CharSequence buildHomeContentDescription() { final CharSequence homeDesc; if (mHomeDescription != null) { homeDesc = mHomeDescription; } else { if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) { mUpGoerFive.setContentDescription(mContext.getResources().getText( R.string.action_bar_up_description)); homeDesc = mContext.getResources().getText(R.string.action_bar_up_description); } else { mUpGoerFive.setContentDescription(mContext.getResources().getText( R.string.action_bar_home_description)); homeDesc = mContext.getResources().getText(R.string.action_bar_home_description); } } final CharSequence title = getTitle(); final CharSequence subtitle = getSubtitle(); if (!TextUtils.isEmpty(title)) { final String result; if (!TextUtils.isEmpty(subtitle)) { result = getResources().getString( R.string.action_bar_home_subtitle_description_format, title, subtitle, homeDesc); } else { result = getResources().getString(R.string.action_bar_home_description_format, title, homeDesc); } return result; } return homeDesc; } public void setDisplayOptions(int options) { Loading Loading @@ -1305,6 +1340,23 @@ public class ActionBarView extends AbsActionBarView { } } public void setHomeAsUpIndicator(Drawable indicator) { mHomeLayout.setUpIndicator(indicator); } public void setHomeAsUpIndicator(int resId) { mHomeLayout.setUpIndicator(resId); } public void setHomeActionContentDescription(CharSequence description) { mHomeDescription = description; } public void setHomeActionContentDescription(int resId) { mHomeDescriptionRes = resId; mHomeDescription = getResources().getText(resId); } static class SavedState extends BaseSavedState { int expandedMenuItemId; boolean isOverflowOpen; Loading Loading @@ -1339,9 +1391,11 @@ public class ActionBarView extends AbsActionBarView { } private static class HomeView extends FrameLayout { private View mUpView; private ImageView mUpView; private ImageView mIconView; private int mUpWidth; private int mUpIndicatorRes; private Drawable mDefaultUpIndicator; private static final long DEFAULT_TRANSITION_DURATION = 150; Loading @@ -1366,6 +1420,25 @@ public class ActionBarView extends AbsActionBarView { mIconView.setImageDrawable(icon); } public void setUpIndicator(Drawable d) { mUpView.setImageDrawable(d != null ? d : mDefaultUpIndicator); mUpIndicatorRes = 0; } public void setUpIndicator(int resId) { mUpIndicatorRes = resId; mUpView.setImageDrawable(resId != 0 ? getResources().getDrawable(resId) : null); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (mUpIndicatorRes != 0) { // Reload for config change setUpIndicator(mUpIndicatorRes); } } @Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { onPopulateAccessibilityEvent(event); Loading @@ -1389,8 +1462,9 @@ public class ActionBarView extends AbsActionBarView { @Override protected void onFinishInflate() { mUpView = findViewById(com.android.internal.R.id.up); mUpView = (ImageView) findViewById(com.android.internal.R.id.up); mIconView = (ImageView) findViewById(com.android.internal.R.id.home); mDefaultUpIndicator = mUpView.getDrawable(); } public int getStartOffset() { Loading