From 785c447b2bc625209706fd128ce61781c3a4183b Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Wed, 2 May 2012 21:25:39 -0700 Subject: [PATCH] JB API cleanup; ActionMode and View docs Bugs 6435315, 6434937 Add ActionMode#getTitleOptionalHint() and extend documentation for View#hasTransientState/setHasTransientState Change-Id: I2049fb79864c33b34e3bbd13df32861e308c99ad --- api/current.txt | 1 + core/java/android/view/ActionMode.java | 13 +++++++++++++ core/java/android/view/View.java | 10 ++++++++++ .../com/android/internal/app/ActionBarImpl.java | 1 + .../android/internal/view/StandaloneActionMode.java | 1 + 5 files changed, 26 insertions(+) diff --git a/api/current.txt b/api/current.txt index 43647ba05310b..bd71d806d2527 100644 --- a/api/current.txt +++ b/api/current.txt @@ -22532,6 +22532,7 @@ package android.view { method public abstract java.lang.CharSequence getSubtitle(); method public java.lang.Object getTag(); method public abstract java.lang.CharSequence getTitle(); + method public boolean getTitleOptionalHint(); method public abstract void invalidate(); method public boolean isTitleOptional(); method public abstract void setCustomView(android.view.View); diff --git a/core/java/android/view/ActionMode.java b/core/java/android/view/ActionMode.java index 0ba5fdbc4f1af..a359952ddcf2d 100644 --- a/core/java/android/view/ActionMode.java +++ b/core/java/android/view/ActionMode.java @@ -30,6 +30,7 @@ package android.view; */ public abstract class ActionMode { private Object mTag; + private boolean mTitleOptionalHint; /** * Set a tag object associated with this ActionMode. @@ -119,6 +120,18 @@ public abstract class ActionMode { * @param titleOptional true if the title only presents optional information. */ public void setTitleOptionalHint(boolean titleOptional) { + mTitleOptionalHint = titleOptional; + } + + /** + * @return true if this action mode has been given a hint to consider the + * title/subtitle display to be optional. + * + * @see #setTitleOptionalHint(boolean) + * @see #isTitleOptional() + */ + public boolean getTitleOptionalHint() { + return mTitleOptionalHint; } /** diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 092bcbd4b4ef2..2f67481aba221 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5423,6 +5423,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * app should not need to concern itself with saving and restoring, but that * the framework should take special note to preserve when possible. * + *

A view with transient state cannot be trivially rebound from an external + * data source, such as an adapter binding item views in a list. This may be + * because the view is performing an animation, tracking user selection + * of content, or similar.

+ * * @return true if the view has transient state */ @ViewDebug.ExportedProperty(category = "layout") @@ -5436,6 +5441,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * so every call to setHasTransientState(true) should be paired with a later call * to setHasTransientState(false). * + *

A view with transient state cannot be trivially rebound from an external + * data source, such as an adapter binding item views in a list. This may be + * because the view is performing an animation, tracking user selection + * of content, or similar.

+ * * @param hasTransientState true if this view has transient state */ public void setHasTransientState(boolean hasTransientState) { diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java index ed711f3ecc274..805c0a93ee498 100644 --- a/core/java/com/android/internal/app/ActionBarImpl.java +++ b/core/java/com/android/internal/app/ActionBarImpl.java @@ -817,6 +817,7 @@ public class ActionBarImpl extends ActionBar { @Override public void setTitleOptionalHint(boolean titleOptional) { + super.setTitleOptionalHint(titleOptional); mContextView.setTitleOptional(titleOptional); } diff --git a/core/java/com/android/internal/view/StandaloneActionMode.java b/core/java/com/android/internal/view/StandaloneActionMode.java index 4b681ec3a44c6..fae7ea12fd832 100644 --- a/core/java/com/android/internal/view/StandaloneActionMode.java +++ b/core/java/com/android/internal/view/StandaloneActionMode.java @@ -73,6 +73,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call @Override public void setTitleOptionalHint(boolean titleOptional) { + super.setTitleOptionalHint(titleOptional); mContextView.setTitleOptional(titleOptional); }