Merge "Change sharedElementName to viewName."
diff --git a/api/current.txt b/api/current.txt
index 17f5e53..f02e74a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1021,7 +1021,6 @@
field public static final int shadowRadius = 16843108; // 0x1010164
field public static final int shape = 16843162; // 0x101019a
field public static final int shareInterpolator = 16843195; // 0x10101bb
- field public static final int sharedElementName = 16843803; // 0x101041b
field public static final int sharedUserId = 16842763; // 0x101000b
field public static final int sharedUserLabel = 16843361; // 0x1010261
field public static final int shouldDisableView = 16843246; // 0x10101ee
@@ -1266,6 +1265,7 @@
field public static final int verticalGap = 16843328; // 0x1010240
field public static final int verticalScrollbarPosition = 16843572; // 0x1010334
field public static final int verticalSpacing = 16843029; // 0x1010115
+ field public static final int viewName = 16843803; // 0x101041b
field public static final int viewportHeight = 16843806; // 0x101041e
field public static final int viewportWidth = 16843805; // 0x101041d
field public static final int visibility = 16842972; // 0x10100dc
@@ -1627,7 +1627,7 @@
field public static final int l_resource_pad8 = 16908345; // 0x1020039
field public static final int l_resource_pad9 = 16908344; // 0x1020038
field public static final int list = 16908298; // 0x102000a
- field public static final int mask = 16908354; // 0x1020042
+ field public static final int mask = 16908353; // 0x1020041
field public static final int message = 16908299; // 0x102000b
field public static final int paste = 16908322; // 0x1020022
field public static final int primary = 16908300; // 0x102000c
@@ -1636,8 +1636,7 @@
field public static final int selectAll = 16908319; // 0x102001f
field public static final int selectTextMode = 16908333; // 0x102002d
field public static final int selectedIcon = 16908302; // 0x102000e
- field public static final int shared_element = 16908355; // 0x1020043
- field public static final int shared_element_name = 16908353; // 0x1020041
+ field public static final int shared_element = 16908354; // 0x1020042
field public static final int startSelectingText = 16908328; // 0x1020028
field public static final int stopSelectingText = 16908329; // 0x1020029
field public static final int summary = 16908304; // 0x1020010
@@ -31311,7 +31310,6 @@
method public int getScrollBarStyle();
method public final int getScrollX();
method public final int getScrollY();
- method public java.lang.String getSharedElementName();
method public int getSolidColor();
method public android.animation.StateListAnimator getStateListAnimator();
method protected int getSuggestedMinimumHeight();
@@ -31332,6 +31330,7 @@
method public int getVerticalFadingEdgeLength();
method public int getVerticalScrollbarPosition();
method public int getVerticalScrollbarWidth();
+ method public java.lang.String getViewName();
method public android.view.ViewTreeObserver getViewTreeObserver();
method public int getVisibility();
method public final int getWidth();
@@ -31576,7 +31575,6 @@
method public void setScrollY(int);
method public void setScrollbarFadingEnabled(boolean);
method public void setSelected(boolean);
- method public void setSharedElementName(java.lang.String);
method public void setSoundEffectsEnabled(boolean);
method public void setStateListAnimator(android.animation.StateListAnimator);
method public void setSystemUiVisibility(int);
@@ -31592,6 +31590,7 @@
method public void setVerticalFadingEdgeEnabled(boolean);
method public void setVerticalScrollBarEnabled(boolean);
method public void setVerticalScrollbarPosition(int);
+ method public final void setViewName(java.lang.String);
method public void setVisibility(int);
method public void setWillNotCacheDrawing(boolean);
method public void setWillNotDraw(boolean);
diff --git a/core/java/android/app/ActivityTransitionCoordinator.java b/core/java/android/app/ActivityTransitionCoordinator.java
index 3eb2fea..ca64788 100644
--- a/core/java/android/app/ActivityTransitionCoordinator.java
+++ b/core/java/android/app/ActivityTransitionCoordinator.java
@@ -472,7 +472,7 @@
if (getViewsTransition() != null) {
setViewVisibility(mEnteringViews, View.VISIBLE);
}
- getDecor().findSharedElements(map);
+ getDecor().findNamedViews(map);
if (getViewsTransition() != null) {
setViewVisibility(mEnteringViews, View.INVISIBLE);
}
@@ -712,7 +712,7 @@
sharedElementBundle.putFloat(KEY_TRANSLATION_Z, view.getTranslationZ());
- sharedElementBundle.putString(KEY_NAME, view.getSharedElementName());
+ sharedElementBundle.putString(KEY_NAME, view.getViewName());
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
@@ -882,7 +882,7 @@
imageView.setId(com.android.internal.R.id.shared_element);
imageView.setScaleType(ImageView.ScaleType.CENTER);
imageView.setImageBitmap(bitmap);
- imageView.setSharedElementName(name);
+ imageView.setViewName(name);
setSharedElementState(imageView, name, state, parentLoc);
if (mTargetSharedNames.contains(name)) {
accepted.add(imageView);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index bef96b1..e829141 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -670,7 +670,7 @@
* @attr ref android.R.styleable#View_scrollbarAlwaysDrawHorizontalTrack
* @attr ref android.R.styleable#View_scrollbarAlwaysDrawVerticalTrack
* @attr ref android.R.styleable#View_stateListAnimator
- * @attr ref android.R.styleable#View_sharedElementName
+ * @attr ref android.R.styleable#View_viewName
* @attr ref android.R.styleable#View_soundEffectsEnabled
* @attr ref android.R.styleable#View_tag
* @attr ref android.R.styleable#View_textAlignment
@@ -3185,6 +3185,8 @@
private int mBackgroundResource;
private boolean mBackgroundSizeChanged;
+ private String mViewName;
+
static class ListenerInfo {
/**
* Listener used to dispatch focus change events.
@@ -3997,8 +3999,8 @@
case R.styleable.View_accessibilityLiveRegion:
setAccessibilityLiveRegion(a.getInt(attr, ACCESSIBILITY_LIVE_REGION_DEFAULT));
break;
- case R.styleable.View_sharedElementName:
- setSharedElementName(a.getString(attr));
+ case R.styleable.View_viewName:
+ setViewName(a.getString(attr));
break;
case R.styleable.View_nestedScrollingEnabled:
setNestedScrollingEnabled(a.getBoolean(attr, false));
@@ -18839,15 +18841,15 @@
}
/**
- * Adds all Views that have {@link #getSharedElementName()} non-null to sharedElements.
- * @param sharedElements Will contain all Views in the hierarchy having a shared element name.
+ * Adds all Views that have {@link #getViewName()} non-null to namedElements.
+ * @param namedElements Will contain all Views in the hierarchy having a view name.
* @hide
*/
- public void findSharedElements(Map<String, View> sharedElements) {
+ public void findNamedViews(Map<String, View> namedElements) {
if (getVisibility() == VISIBLE) {
- String sharedElementName = getSharedElementName();
- if (sharedElementName != null) {
- sharedElements.put(sharedElementName, this);
+ String viewName = getViewName();
+ if (viewName != null) {
+ namedElements.put(viewName, this);
}
}
}
@@ -19247,32 +19249,26 @@
}
/**
- * Specifies that the shared name of the View to be shared with another Activity.
- * When transitioning between Activities, the name links a UI element in the starting
- * Activity to UI element in the called Activity. Names should be unique in the
- * View hierarchy.
+ * Sets the name of the View to be used to identify Views in Transitions.
+ * Names should be unique in the View hierarchy.
*
- * @param sharedElementName The cross-Activity View identifier. The called Activity will use
- * the name to match the location with a View in its layout.
- * @see android.app.ActivityOptions#makeSceneTransitionAnimation(android.os.Bundle)
+ * @param viewName The name of the View to uniquely identify it for Transitions.
*/
- public void setSharedElementName(String sharedElementName) {
- setTagInternal(com.android.internal.R.id.shared_element_name, sharedElementName);
+ public final void setViewName(String viewName) {
+ mViewName = viewName;
}
/**
- * Returns the shared name of the View to be shared with another Activity.
- * When transitioning between Activities, the name links a UI element in the starting
- * Activity to UI element in the called Activity. Names should be unique in the
- * View hierarchy.
+ * Returns the name of the View to be used to identify Views in Transitions.
+ * Names should be unique in the View hierarchy.
*
- * <p>This returns null if the View is not a shared element or the name if it is.</p>
+ * <p>This returns null if the View has not been given a name.</p>
*
- * @return The name used for this View for cross-Activity transitions or null if
- * this View has not been identified as shared.
+ * @return The name used of the View to be used to identify Views in Transitions or null
+ * if no name has been given.
*/
- public String getSharedElementName() {
- return (String) getTag(com.android.internal.R.id.shared_element_name);
+ public String getViewName() {
+ return mViewName;
}
/**
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 4309366..92a42b7 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2301,13 +2301,13 @@
* individually during the transition.
* @return True if the ViewGroup should be acted on together during an Activity transition.
* The default value is false when the background is null and true when the background
- * is not null or if {@link #getSharedElementName()} is not null.
+ * is not null or if {@link #getViewName()} is not null.
*/
public boolean isTransitionGroup() {
if ((mGroupFlags & FLAG_IS_TRANSITION_GROUP_SET) != 0) {
return ((mGroupFlags & FLAG_IS_TRANSITION_GROUP) != 0);
} else {
- return getBackground() != null || getSharedElementName() != null;
+ return getBackground() != null || getViewName() != null;
}
}
@@ -5956,15 +5956,15 @@
/** @hide */
@Override
- public void findSharedElements(Map<String, View> sharedElements) {
+ public void findNamedViews(Map<String, View> namedElements) {
if (getVisibility() != VISIBLE) {
return;
}
- super.findSharedElements(sharedElements);
+ super.findNamedViews(namedElements);
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- child.findSharedElements(sharedElements);
+ child.findNamedViews(namedElements);
}
}
diff --git a/core/res/res/layout-xlarge/screen_action_bar.xml b/core/res/res/layout-xlarge/screen_action_bar.xml
index d2fe9fa..02c99fe 100644
--- a/core/res/res/layout-xlarge/screen_action_bar.xml
+++ b/core/res/res/layout-xlarge/screen_action_bar.xml
@@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
style="?android:attr/actionBarStyle"
- android:sharedElementName="android:action_bar"
+ android:viewName="android:action_bar"
android:gravity="top">
<com.android.internal.widget.ActionBarView
android:id="@+id/action_bar"
diff --git a/core/res/res/layout/screen_action_bar.xml b/core/res/res/layout/screen_action_bar.xml
index 77f537b..eb237b3 100644
--- a/core/res/res/layout/screen_action_bar.xml
+++ b/core/res/res/layout/screen_action_bar.xml
@@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
style="?attr/actionBarStyle"
- android:sharedElementName="android:action_bar"
+ android:viewName="android:action_bar"
android:gravity="top">
<com.android.internal.widget.ActionBarView
android:id="@+id/action_bar"
diff --git a/core/res/res/layout/screen_custom_title.xml b/core/res/res/layout/screen_custom_title.xml
index d02cc8b..c8952bf 100644
--- a/core/res/res/layout/screen_custom_title.xml
+++ b/core/res/res/layout/screen_custom_title.xml
@@ -31,7 +31,7 @@
<FrameLayout android:id="@android:id/title_container"
android:layout_width="match_parent"
android:layout_height="?android:attr/windowTitleSize"
- android:sharedElementName="android:title"
+ android:viewName="android:title"
style="?android:attr/windowTitleBackgroundStyle">
</FrameLayout>
<FrameLayout android:id="@android:id/content"
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index cedb92d..0b83ad6 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2355,11 +2355,9 @@
view with a theme override will inherit the themed context. -->
<attr name="theme" />
- <!-- Specifies that the shared name of the View to be shared with another Activity.
- When transitioning between Activities, the name links a UI element in the starting
- Activity to UI element in the called Activity. Names should be unique in the
- View hierarchy. -->
- <attr name="sharedElementName" format="string" />
+ <!-- Names a View such that it can be identified for Transitions. Names should be
+ unique in the View hierarchy. -->
+ <attr name="viewName" format="string" />
<!-- Specifies that this view should permit nested scrolling within a compatible
ancestor view. -->
diff --git a/core/res/res/values/ids.xml b/core/res/res/values/ids.xml
index 889c368..6ea0fae 100644
--- a/core/res/res/values/ids.xml
+++ b/core/res/res/values/ids.xml
@@ -82,7 +82,6 @@
<item type="id" name="action_bar_spinner" />
<item type="id" name="current_scene" />
<item type="id" name="scene_layoutid_cache" />
- <item type="id" name="shared_element_name" />
<item type="id" name="mask" />
<item type="id" name="shared_element" />
</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index dc5efea..1622abb 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2114,7 +2114,7 @@
<public type="attr" name="controlY1" />
<public type="attr" name="controlX2" />
<public type="attr" name="controlY2" />
- <public type="attr" name="sharedElementName" />
+ <public type="attr" name="viewName" />
<public type="attr" name="transitionGroup" />
<public type="attr" name="viewportWidth" />
<public type="attr" name="viewportHeight" />
@@ -2178,7 +2178,6 @@
<public-padding type="id" name="l_resource_pad" end="0x01020040" />
- <public type="id" name="shared_element_name" />
<public type="id" name="mask" />
<public type="id" name="shared_element" />