Skip to content

Commit 785c447

Browse files
committed
JB API cleanup; ActionMode and View docs
Bugs 6435315, 6434937 Add ActionMode#getTitleOptionalHint() and extend documentation for View#hasTransientState/setHasTransientState Change-Id: I2049fb79864c33b34e3bbd13df32861e308c99ad
1 parent fbbdbc2 commit 785c447

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

api/current.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22532,6 +22532,7 @@ package android.view {
2253222532
method public abstract java.lang.CharSequence getSubtitle();
2253322533
method public java.lang.Object getTag();
2253422534
method public abstract java.lang.CharSequence getTitle();
22535+
method public boolean getTitleOptionalHint();
2253522536
method public abstract void invalidate();
2253622537
method public boolean isTitleOptional();
2253722538
method public abstract void setCustomView(android.view.View);

core/java/android/view/ActionMode.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
*/
3131
public abstract class ActionMode {
3232
private Object mTag;
33+
private boolean mTitleOptionalHint;
3334

3435
/**
3536
* Set a tag object associated with this ActionMode.
@@ -119,6 +120,18 @@ public Object getTag() {
119120
* @param titleOptional true if the title only presents optional information.
120121
*/
121122
public void setTitleOptionalHint(boolean titleOptional) {
123+
mTitleOptionalHint = titleOptional;
124+
}
125+
126+
/**
127+
* @return true if this action mode has been given a hint to consider the
128+
* title/subtitle display to be optional.
129+
*
130+
* @see #setTitleOptionalHint(boolean)
131+
* @see #isTitleOptional()
132+
*/
133+
public boolean getTitleOptionalHint() {
134+
return mTitleOptionalHint;
122135
}
123136

124137
/**

core/java/android/view/View.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5423,6 +5423,11 @@ public boolean isLayoutRtl() {
54235423
* app should not need to concern itself with saving and restoring, but that
54245424
* the framework should take special note to preserve when possible.
54255425
*
5426+
* <p>A view with transient state cannot be trivially rebound from an external
5427+
* data source, such as an adapter binding item views in a list. This may be
5428+
* because the view is performing an animation, tracking user selection
5429+
* of content, or similar.</p>
5430+
*
54265431
* @return true if the view has transient state
54275432
*/
54285433
@ViewDebug.ExportedProperty(category = "layout")
@@ -5436,6 +5441,11 @@ public boolean hasTransientState() {
54365441
* so every call to setHasTransientState(true) should be paired with a later call
54375442
* to setHasTransientState(false).
54385443
*
5444+
* <p>A view with transient state cannot be trivially rebound from an external
5445+
* data source, such as an adapter binding item views in a list. This may be
5446+
* because the view is performing an animation, tracking user selection
5447+
* of content, or similar.</p>
5448+
*
54395449
* @param hasTransientState true if this view has transient state
54405450
*/
54415451
public void setHasTransientState(boolean hasTransientState) {

core/java/com/android/internal/app/ActionBarImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ public CharSequence getSubtitle() {
817817

818818
@Override
819819
public void setTitleOptionalHint(boolean titleOptional) {
820+
super.setTitleOptionalHint(titleOptional);
820821
mContextView.setTitleOptional(titleOptional);
821822
}
822823

core/java/com/android/internal/view/StandaloneActionMode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public void setSubtitle(int resId) {
7373

7474
@Override
7575
public void setTitleOptionalHint(boolean titleOptional) {
76+
super.setTitleOptionalHint(titleOptional);
7677
mContextView.setTitleOptional(titleOptional);
7778
}
7879

0 commit comments

Comments
 (0)