summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2014-05-09 10:27:20 -0700
committerGeorge Mount <mount@google.com>2014-05-12 13:58:25 -0700
commitabb352a941cbd87c14cce9ccfa83157b913d41f2 (patch)
tree9578dcb268199b75226c59dae3f9092cd844dd86 /core/java
parent82f421ad83cea68df9803d5cd85ed7b190497d5d (diff)
downloadframeworks_base-abb352a941cbd87c14cce9ccfa83157b913d41f2.zip
frameworks_base-abb352a941cbd87c14cce9ccfa83157b913d41f2.tar.gz
frameworks_base-abb352a941cbd87c14cce9ccfa83157b913d41f2.tar.bz2
Change sharedElementName to viewName.
Bug 14624181 Change-Id: Ic98554c257d4115a917481eb50505373f6d58fa8
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityTransitionCoordinator.java6
-rw-r--r--core/java/android/view/View.java50
-rw-r--r--core/java/android/view/ViewGroup.java10
3 files changed, 31 insertions, 35 deletions
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 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
if (getViewsTransition() != null) {
setViewVisibility(mEnteringViews, View.VISIBLE);
}
- getDecor().findSharedElements(map);
+ getDecor().findNamedViews(map);
if (getViewsTransition() != null) {
setViewVisibility(mEnteringViews, View.INVISIBLE);
}
@@ -712,7 +712,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
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 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
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 @@ import java.util.concurrent.atomic.AtomicInteger;
* @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 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
private int mBackgroundResource;
private boolean mBackgroundSizeChanged;
+ private String mViewName;
+
static class ListenerInfo {
/**
* Listener used to dispatch focus change events.
@@ -3997,8 +3999,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
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 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
/**
- * 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 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
/**
- * 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 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* 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 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
/** @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);
}
}