diff options
author | George Mount <mount@google.com> | 2014-06-18 13:34:35 -0700 |
---|---|---|
committer | George Mount <mount@google.com> | 2014-06-20 11:01:01 -0700 |
commit | 125578a8637a9ad5e7430d16b9fc0096a8b596d7 (patch) | |
tree | b508aacc5f6964060cb81d761073360e4d06be8c /core | |
parent | 45b161d24d82ef1df3ff854a1d97db0c9bad187a (diff) | |
download | frameworks_base-125578a8637a9ad5e7430d16b9fc0096a8b596d7.zip frameworks_base-125578a8637a9ad5e7430d16b9fc0096a8b596d7.tar.gz frameworks_base-125578a8637a9ad5e7430d16b9fc0096a8b596d7.tar.bz2 |
API Review: Change View viewName attribute to transitionName.
Bug 15548520
Change-Id: I4009458d83dbffb20ff0100aaa42eea44d943378
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/ActivityOptions.java | 10 | ||||
-rw-r--r-- | core/java/android/app/ActivityTransitionCoordinator.java | 8 | ||||
-rw-r--r-- | core/java/android/app/BackStackRecord.java | 18 | ||||
-rw-r--r-- | core/java/android/app/FragmentTransaction.java | 8 | ||||
-rw-r--r-- | core/java/android/app/SharedElementListener.java | 2 | ||||
-rw-r--r-- | core/java/android/transition/Transition.java | 86 | ||||
-rw-r--r-- | core/java/android/transition/TransitionInflater.java | 23 | ||||
-rw-r--r-- | core/java/android/transition/TransitionSet.java | 6 | ||||
-rw-r--r-- | core/java/android/view/View.java | 42 | ||||
-rw-r--r-- | core/java/android/view/ViewGroup.java | 4 | ||||
-rw-r--r-- | core/res/res/layout/screen_action_bar.xml | 2 | ||||
-rw-r--r-- | core/res/res/layout/screen_custom_title.xml | 2 | ||||
-rw-r--r-- | core/res/res/layout/screen_toolbar.xml | 2 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 14 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 6 |
15 files changed, 127 insertions, 106 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index 9160452..0ecead9 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -29,8 +29,6 @@ import android.view.View; import android.view.Window; import java.util.ArrayList; -import java.util.List; -import java.util.Map; /** * Helper class for building an options Bundle that can be used with @@ -398,14 +396,14 @@ public class ActivityOptions { if (sharedElementName == null) { throw new IllegalArgumentException("Shared element name must not be null"); } - String viewName = sharedElement.first.getViewName(); - if (viewName == null) { + String name = sharedElement.first.getTransitionName(); + if (name == null) { throw new IllegalArgumentException("Shared elements must have non-null " + - "viewNames"); + "transitionNames"); } names.add(sharedElementName); - mappedNames.add(viewName); + mappedNames.add(name); } } diff --git a/core/java/android/app/ActivityTransitionCoordinator.java b/core/java/android/app/ActivityTransitionCoordinator.java index c7030b0..4d3183b 100644 --- a/core/java/android/app/ActivityTransitionCoordinator.java +++ b/core/java/android/app/ActivityTransitionCoordinator.java @@ -274,7 +274,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { public ArrayList<String> getMappedNames() { ArrayList<String> names = new ArrayList<String>(mSharedElements.size()); for (int i = 0; i < mSharedElements.size(); i++) { - names.add(mSharedElements.get(i).getViewName()); + names.add(mSharedElements.get(i).getTransitionName()); } return names; } @@ -351,9 +351,9 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { String name = mAllSharedElementNames.get(i); View sharedElement = sharedElements.get(name); if (sharedElement != null) { - if (sharedElement.getViewName() == null) { + if (sharedElement.getTransitionName() == null) { throw new IllegalArgumentException("Shared elements must have " + - "non-null viewNames"); + "non-null transitionNames"); } mSharedElementNames.add(name); mSharedElements.add(sharedElement); @@ -487,7 +487,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver { if (bitmap != null) { snapshot.setBackground(new BitmapDrawable(resources, bitmap)); } - snapshot.setViewName(name); + snapshot.setTransitionName(name); setSharedElementState(snapshot, name, state, parentLoc); snapshots.add(snapshot); } diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java index 01a388f..4433a3a 100644 --- a/core/java/android/app/BackStackRecord.java +++ b/core/java/android/app/BackStackRecord.java @@ -581,13 +581,13 @@ final class BackStackRecord extends FragmentTransaction implements @Override public FragmentTransaction setSharedElement(View sharedElement, String name) { - String viewName = sharedElement.getViewName(); - if (viewName == null) { - throw new IllegalArgumentException("Unique viewNames are required for all" + + String transitionName = sharedElement.getTransitionName(); + if (transitionName == null) { + throw new IllegalArgumentException("Unique transitionNames are required for all" + " sharedElements"); } mSharedElementSourceNames = new ArrayList<String>(1); - mSharedElementSourceNames.add(viewName); + mSharedElementSourceNames.add(transitionName); mSharedElementTargetNames = new ArrayList<String>(1); mSharedElementTargetNames.add(name); @@ -603,12 +603,12 @@ final class BackStackRecord extends FragmentTransaction implements ArrayList<String> sourceNames = new ArrayList<String>(sharedElements.length); ArrayList<String> targetNames = new ArrayList<String>(sharedElements.length); for (int i = 0; i < sharedElements.length; i++) { - String viewName = sharedElements[i].first.getViewName(); - if (viewName == null) { - throw new IllegalArgumentException("Unique viewNames are required for all" + - " sharedElements"); + String transitionName = sharedElements[i].first.getTransitionName(); + if (transitionName == null) { + throw new IllegalArgumentException("Unique transitionNames are required for all" + + " sharedElements"); } - sourceNames.add(viewName); + sourceNames.add(transitionName); targetNames.add(sharedElements[i].second); } mSharedElementSourceNames = sourceNames; diff --git a/core/java/android/app/FragmentTransaction.java b/core/java/android/app/FragmentTransaction.java index 7479ecd..b6ea3c3 100644 --- a/core/java/android/app/FragmentTransaction.java +++ b/core/java/android/app/FragmentTransaction.java @@ -184,10 +184,10 @@ public abstract class FragmentTransaction { /** * Used with {@link #setCustomTransition(int, int)} to map a View from a removed or hidden * Fragment to a View from a shown or added Fragment. - * <var>sharedElement</var> must have a unique viewName in the View hierarchy. + * <var>sharedElement</var> must have a unique transitionName in the View hierarchy. * @param sharedElement A View in a disappearing Fragment to match with a View in an * appearing Fragment. - * @param name The viewName for a View in an appearing Fragment to match to the shared + * @param name The transitionName for a View in an appearing Fragment to match to the shared * element. */ public abstract FragmentTransaction setSharedElement(View sharedElement, String name); @@ -195,8 +195,8 @@ public abstract class FragmentTransaction { /** * Used with {@link #setCustomTransition(int, int)} to map multiple Views from removed or hidden * Fragments to a Views from a shown or added Fragments. Views in - * <var>sharedElements</var> must have unique viewNames in the View hierarchy. - * @param sharedElements Pairs of Views in disappearing Fragments to viewNames in + * <var>sharedElements</var> must have unique transitionNames in the View hierarchy. + * @param sharedElements Pairs of Views in disappearing Fragments to transitionNames in * appearing Fragments. */ public abstract FragmentTransaction setSharedElements(Pair<View, String>... sharedElements); diff --git a/core/java/android/app/SharedElementListener.java b/core/java/android/app/SharedElementListener.java index e03e42e..14fbfab 100644 --- a/core/java/android/app/SharedElementListener.java +++ b/core/java/android/app/SharedElementListener.java @@ -108,7 +108,7 @@ public abstract class SharedElementListener { * @param names The names of all shared elements transferred from the calling Activity * to the started Activity. * @param sharedElements The mapping of shared element names to Views. The best guess - * will be filled into sharedElements based on the View names. + * will be filled into sharedElements based on the transitionNames. */ public void remapSharedElements(List<String> names, Map<String, View> sharedElements) {} } diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java index e936232..0017eb1 100644 --- a/core/java/android/transition/Transition.java +++ b/core/java/android/transition/Transition.java @@ -89,8 +89,8 @@ import java.util.List; * out-in behavior. Finally, note the use of the <code>targets</code> sub-tag, which * takes a set of {@link android.R.styleable#TransitionTarget target} tags, each * of which lists a specific <code>targetId</code>, <code>targetClass</code>, - * <code>targetViewName</code>, <code>excludeId</code>, <code>excludeClass</code>, or - * <code>excludeViewName</code>, which this transition acts upon. + * <code>targetName</code>, <code>excludeId</code>, <code>excludeClass</code>, or + * <code>excludeName</code>, which this transition acts upon. * Use of targets is optional, but can be used to either limit the time spent checking * attributes on unchanging views, or limiting the types of animations run on specific views. * In this case, we know that only the <code>grayscaleContainer</code> will be @@ -115,9 +115,9 @@ public abstract class Transition implements Cloneable { /** * With {@link #setMatchOrder(int...)}, chooses to match by - * {@link android.view.View#getViewName()}. Null names will not be matched. + * {@link android.view.View#getTransitionName()}. Null names will not be matched. */ - public static final int MATCH_VIEW_NAME = 0x2; + public static final int MATCH_NAME = 0x2; /** * With {@link #setMatchOrder(int...)}, chooses to match by @@ -135,7 +135,7 @@ public abstract class Transition implements Cloneable { private static final int MATCH_LAST = MATCH_ITEM_ID; private static final int[] DEFAULT_MATCH_ORDER = { - MATCH_VIEW_NAME, + MATCH_NAME, MATCH_INSTANCE, MATCH_ID, MATCH_ITEM_ID, @@ -207,7 +207,7 @@ public abstract class Transition implements Cloneable { EpicenterCallback mEpicenterCallback; // For Fragment shared element transitions, linking views explicitly by mismatching - // viewNames. + // transitionNames. ArrayMap<String, String> mNameOverrides; /** @@ -378,17 +378,17 @@ public abstract class Transition implements Cloneable { /** * Sets the order in which Transition matches View start and end values. * <p> - * The default behavior is to match first by {@link android.view.View#getViewName()}, + * The default behavior is to match first by {@link android.view.View#getTransitionName()}, * then by View instance, then by {@link android.view.View#getId()} and finally * by its item ID if it is in a direct child of ListView. The caller can * choose to have only some or all of the values of {@link #MATCH_INSTANCE}, - * {@link #MATCH_VIEW_NAME}, {@link #MATCH_ITEM_ID}, and {@link #MATCH_ID}. Only + * {@link #MATCH_NAME}, {@link #MATCH_ITEM_ID}, and {@link #MATCH_ID}. Only * the match algorithms supplied will be used to determine whether Views are the * the same in both the start and end Scene. Views that do not match will be considered * as entering or leaving the Scene. * </p> * @param matches A list of zero or more of {@link #MATCH_INSTANCE}, - * {@link #MATCH_VIEW_NAME}, {@link #MATCH_ITEM_ID}, and {@link #MATCH_ID}. + * {@link #MATCH_NAME}, {@link #MATCH_ITEM_ID}, and {@link #MATCH_ID}. * If none are provided, then the default match order will be set. */ public void setMatchOrder(int... matches) { @@ -500,9 +500,9 @@ public abstract class Transition implements Cloneable { } /** - * Match start/end values by Adapter viewName. Adds matched values to startValuesList + * Match start/end values by Adapter transitionName. Adds matched values to startValuesList * and endValuesList and removes them from unmatchedStart and unmatchedEnd, using - * startNames and endNames as a guide for which Views have unique viewNames. + * startNames and endNames as a guide for which Views have unique transitionNames. */ private void matchNames(ArrayList<TransitionValues> startValuesList, ArrayList<TransitionValues> endValuesList, @@ -563,7 +563,7 @@ public abstract class Transition implements Cloneable { case MATCH_INSTANCE: matchInstances(startValuesList, endValuesList, unmatchedStart, unmatchedEnd); break; - case MATCH_VIEW_NAME: + case MATCH_NAME: matchNames(startValuesList, endValuesList, unmatchedStart, unmatchedEnd, startValues.nameValues, endValues.nameValues); break; @@ -718,8 +718,8 @@ public abstract class Transition implements Cloneable { } } } - if (mTargetNameExcludes != null && target != null && target.getViewName() != null) { - if (mTargetNameExcludes.contains(target.getViewName())) { + if (mTargetNameExcludes != null && target != null && target.getTransitionName() != null) { + if (mTargetNameExcludes.contains(target.getTransitionName())) { return false; } } @@ -731,7 +731,7 @@ public abstract class Transition implements Cloneable { if (mTargetIds.contains(targetId) || mTargets.contains(target)) { return true; } - if (mTargetNames != null && mTargetNames.contains(target.getViewName())) { + if (mTargetNames != null && mTargetNames.contains(target.getTransitionName())) { return true; } if (mTargetTypes != null) { @@ -882,18 +882,18 @@ public abstract class Transition implements Cloneable { } /** - * Adds the viewName of a target view that this Transition is interested in + * Adds the transitionName of a target view that this Transition is interested in * animating. By default, there are no targetNames, and a Transition will * listen for changes on every view in the hierarchy below the sceneRoot * of the Scene being transitioned into. Setting targetNames constrains - * the Transition to only listen for, and act on, views with these viewNames. - * Views with different viewNames, or no viewName whatsoever, will be ignored. + * the Transition to only listen for, and act on, views with these transitionNames. + * Views with different transitionNames, or no transitionName whatsoever, will be ignored. * - * <p>Note that viewNames should be unique within the view hierarchy.</p> + * <p>Note that transitionNames should be unique within the view hierarchy.</p> * - * @see android.view.View#getViewName() - * @param targetName The viewName of a target view, must be non-null. - * @return The Transition to which the target viewName is added. + * @see android.view.View#getTransitionName() + * @param targetName The transitionName of a target view, must be non-null. + * @return The Transition to which the target transitionName is added. * Returning the same object makes it easier to chain calls during * construction, such as * <code>transitionSet.addTransitions(new Fade()).addTarget(someName);</code> @@ -958,10 +958,10 @@ public abstract class Transition implements Cloneable { } /** - * Removes the given targetName from the list of viewNames that this Transition + * Removes the given targetName from the list of transitionNames that this Transition * is interested in animating. * - * @param targetName The viewName of a target view, must not be null. + * @param targetName The transitionName of a target view, must not be null. * @return The Transition from which the targetName is removed. * Returning the same object makes it easier to chain calls during * construction, such as @@ -1003,28 +1003,28 @@ public abstract class Transition implements Cloneable { } /** - * Whether to add the given viewName to the list of target viewNames to exclude from this - * transition. The <code>exclude</code> parameter specifies whether the target + * Whether to add the given transitionName to the list of target transitionNames to exclude + * from this transition. The <code>exclude</code> parameter specifies whether the target * should be added to or removed from the excluded list. * * <p>Excluding targets is a general mechanism for allowing transitions to run on * a view hierarchy while skipping target views that should not be part of * the transition. For example, you may want to avoid animating children * of a specific ListView or Spinner. Views can be excluded by their - * id, their instance reference, their viewName, or by the Class of that view + * id, their instance reference, their transitionName, or by the Class of that view * (eg, {@link Spinner}).</p> * * @see #excludeTarget(View, boolean) * @see #excludeTarget(int, boolean) * @see #excludeTarget(Class, boolean) * - * @param targetViewName The name of a target to ignore when running this transition. + * @param targetName The name of a target to ignore when running this transition. * @param exclude Whether to add the target to or remove the target from the * current list of excluded targets. * @return This transition object. */ - public Transition excludeTarget(String targetViewName, boolean exclude) { - mTargetNameExcludes = excludeObject(mTargetNameExcludes, targetViewName, exclude); + public Transition excludeTarget(String targetName, boolean exclude) { + mTargetNameExcludes = excludeObject(mTargetNameExcludes, targetName, exclude); return this; } @@ -1248,7 +1248,7 @@ public abstract class Transition implements Cloneable { /** * Returns the list of target IDs that this transition limits itself to * tracking and animating. If the list is null or empty for - * {@link #getTargetIds()}, {@link #getTargets()}, {@link #getTargetViewNames()}, and + * {@link #getTargetIds()}, {@link #getTargets()}, {@link #getTargetNames()}, and * {@link #getTargetTypes()} then this transition is * not limited to specific views, and will handle changes to any views * in the hierarchy of a scene change. @@ -1262,7 +1262,7 @@ public abstract class Transition implements Cloneable { /** * Returns the list of target views that this transition limits itself to * tracking and animating. If the list is null or empty for - * {@link #getTargetIds()}, {@link #getTargets()}, {@link #getTargetViewNames()}, and + * {@link #getTargetIds()}, {@link #getTargets()}, {@link #getTargetNames()}, and * {@link #getTargetTypes()} then this transition is * not limited to specific views, and will handle changes to any views * in the hierarchy of a scene change. @@ -1274,23 +1274,31 @@ public abstract class Transition implements Cloneable { } /** - * Returns the list of target viewNames that this transition limits itself to + * Returns the list of target transitionNames that this transition limits itself to * tracking and animating. If the list is null or empty for - * {@link #getTargetIds()}, {@link #getTargets()}, {@link #getTargetViewNames()}, and + * {@link #getTargetIds()}, {@link #getTargets()}, {@link #getTargetNames()}, and * {@link #getTargetTypes()} then this transition is * not limited to specific views, and will handle changes to any views * in the hierarchy of a scene change. * - * @return the list of target viewNames + * @return the list of target transitionNames + */ + public List<String> getTargetNames() { + return mTargetNames; + } + + /** + * To be removed before L release. + * @hide */ public List<String> getTargetViewNames() { return mTargetNames; } /** - * Returns the list of target viewNames that this transition limits itself to + * Returns the list of target transitionNames that this transition limits itself to * tracking and animating. If the list is null or empty for - * {@link #getTargetIds()}, {@link #getTargets()}, {@link #getTargetViewNames()}, and + * {@link #getTargetIds()}, {@link #getTargets()}, {@link #getTargetNames()}, and * {@link #getTargetTypes()} then this transition is * not limited to specific views, and will handle changes to any views * in the hierarchy of a scene change. @@ -1380,10 +1388,10 @@ public abstract class Transition implements Cloneable { transitionValuesMaps.idValues.put(id, view); } } - String name = view.getViewName(); + String name = view.getTransitionName(); if (name != null) { if (transitionValuesMaps.nameValues.containsKey(name)) { - // Duplicate viewNames: cannot match by viewName. + // Duplicate transitionNames: cannot match by transitionName. transitionValuesMaps.nameValues.put(name, null); } else { transitionValuesMaps.nameValues.put(name, view); diff --git a/core/java/android/transition/TransitionInflater.java b/core/java/android/transition/TransitionInflater.java index 5b7c737..551f78c 100644 --- a/core/java/android/transition/TransitionInflater.java +++ b/core/java/android/transition/TransitionInflater.java @@ -30,7 +30,6 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; -import java.util.ArrayList; import java.util.StringTokenizer; /** @@ -43,6 +42,8 @@ import java.util.StringTokenizer; */ public class TransitionInflater { private static final String MATCH_INSTANCE = "instance"; + private static final String MATCH_NAME = "name"; + /** To be removed before L release */ private static final String MATCH_VIEW_NAME = "viewName"; private static final String MATCH_ID = "id"; private static final String MATCH_ITEM_ID = "itemId"; @@ -90,8 +91,6 @@ public class TransitionInflater { /** * Loads a {@link TransitionManager} object from a resource * - * - * * @param resource The resource id of the transition manager to load * @return The loaded TransitionManager object * @throws android.content.res.Resources.NotFoundException when the @@ -235,20 +234,20 @@ public class TransitionInflater { com.android.internal.R.styleable.TransitionTarget); int id = a.getResourceId( com.android.internal.R.styleable.TransitionTarget_targetId, -1); - String viewName; + String transitionName; if (id >= 0) { transition.addTarget(id); } else if ((id = a.getResourceId( com.android.internal.R.styleable.TransitionTarget_excludeId, -1)) >= 0) { transition.excludeTarget(id, true); - } else if ((viewName = a.getString( - com.android.internal.R.styleable.TransitionTarget_targetViewName)) + } else if ((transitionName = a.getString( + com.android.internal.R.styleable.TransitionTarget_targetName)) != null) { - transition.addTarget(viewName); - } else if ((viewName = a.getString( - com.android.internal.R.styleable.TransitionTarget_excludeViewName)) + transition.addTarget(transitionName); + } else if ((transitionName = a.getString( + com.android.internal.R.styleable.TransitionTarget_excludeName)) != null) { - transition.excludeTarget(viewName, true); + transition.excludeTarget(transitionName, true); } else { String className = a.getString( com.android.internal.R.styleable.TransitionTarget_excludeClass); @@ -282,8 +281,10 @@ public class TransitionInflater { matches[index] = Transition.MATCH_ID; } else if (MATCH_INSTANCE.equalsIgnoreCase(token)) { matches[index] = Transition.MATCH_INSTANCE; + } else if (MATCH_NAME.equalsIgnoreCase(token)) { + matches[index] = Transition.MATCH_NAME; } else if (MATCH_VIEW_NAME.equalsIgnoreCase(token)) { - matches[index] = Transition.MATCH_VIEW_NAME; + matches[index] = Transition.MATCH_NAME; } else if (MATCH_ITEM_ID.equalsIgnoreCase(token)) { matches[index] = Transition.MATCH_ITEM_ID; } else if (token.isEmpty()) { diff --git a/core/java/android/transition/TransitionSet.java b/core/java/android/transition/TransitionSet.java index c04be4f..495814a 100644 --- a/core/java/android/transition/TransitionSet.java +++ b/core/java/android/transition/TransitionSet.java @@ -244,11 +244,11 @@ public class TransitionSet extends Transition { } @Override - public Transition excludeTarget(String targetViewName, boolean exclude) { + public Transition excludeTarget(String targetName, boolean exclude) { for (int i = 0; i < mTransitions.size(); i++) { - mTransitions.get(i).excludeTarget(targetViewName, exclude); + mTransitions.get(i).excludeTarget(targetName, exclude); } - return super.excludeTarget(targetViewName, exclude); + return super.excludeTarget(targetName, exclude); } @Override diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 89c2f37..b2a60b6 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -672,7 +672,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_viewName + * @attr ref android.R.styleable#View_transitionName * @attr ref android.R.styleable#View_soundEffectsEnabled * @attr ref android.R.styleable#View_tag * @attr ref android.R.styleable#View_textAlignment @@ -3204,7 +3204,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, private int mBackgroundResource; private boolean mBackgroundSizeChanged; - private String mViewName; + private String mTransitionName; static class ListenerInfo { /** @@ -4016,8 +4016,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_viewName: - setViewName(a.getString(attr)); + case R.styleable.View_transitionName: + setTransitionName(a.getString(attr)); break; case R.styleable.View_nestedScrollingEnabled: setNestedScrollingEnabled(a.getBoolean(attr, false)); @@ -18915,15 +18915,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Adds all Views that have {@link #getViewName()} non-null to namedElements. - * @param namedElements Will contain all Views in the hierarchy having a view name. + * Adds all Views that have {@link #getTransitionName()} non-null to namedElements. + * @param namedElements Will contain all Views in the hierarchy having a transitionName. * @hide */ public void findNamedViews(Map<String, View> namedElements) { if (getVisibility() == VISIBLE) { - String viewName = getViewName(); - if (viewName != null) { - namedElements.put(viewName, this); + String transitionName = getTransitionName(); + if (transitionName != null) { + namedElements.put(transitionName, this); } } } @@ -19325,10 +19325,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Sets the name of the View to be used to identify Views in Transitions. * Names should be unique in the View hierarchy. * - * @param viewName The name of the View to uniquely identify it for Transitions. + * @param transitionName The name of the View to uniquely identify it for Transitions. */ - public final void setViewName(String viewName) { - mViewName = viewName; + public final void setTransitionName(String transitionName) { + mTransitionName = transitionName; + } + + /** + * To be removed before L release. + * @hide + */ + public final void setViewName(String transitionName) { + setTransitionName(transitionName); } /** @@ -19340,11 +19348,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @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 getViewName() { - return mViewName; + public String getTransitionName() { + return mTransitionName; } /** + * To be removed before L release. + * @hide + */ + public String getViewName() { return getTransitionName(); } + + /** * Interface definition for a callback to be invoked when a hardware key event is * dispatched to this view. The callback will be invoked before the key event is * given to the view. This is only useful for hardware keyboards; a software input diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index a02e76b..3f84696 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2326,13 +2326,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 #getViewName()} is not null. + * is not null or if {@link #getTransitionName()} 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 || getViewName() != null; + return getBackground() != null || getTransitionName() != null; } } diff --git a/core/res/res/layout/screen_action_bar.xml b/core/res/res/layout/screen_action_bar.xml index 8bf8416..5acb588 100644 --- a/core/res/res/layout/screen_action_bar.xml +++ b/core/res/res/layout/screen_action_bar.xml @@ -34,7 +34,7 @@ This is an optimized layout for a screen with the Action Bar enabled. android:layout_height="wrap_content" android:layout_alignParentTop="true" style="?attr/actionBarStyle" - android:viewName="android:action_bar" + android:transitionName="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 c8952bf..b385bed 100644 --- a/core/res/res/layout/screen_custom_title.xml +++ b/core/res/res/layout/screen_custom_title.xml @@ -31,7 +31,7 @@ This is a custom layout for a screen. <FrameLayout android:id="@android:id/title_container" android:layout_width="match_parent" android:layout_height="?android:attr/windowTitleSize" - android:viewName="android:title" + android:transitionName="android:title" style="?android:attr/windowTitleBackgroundStyle"> </FrameLayout> <FrameLayout android:id="@android:id/content" diff --git a/core/res/res/layout/screen_toolbar.xml b/core/res/res/layout/screen_toolbar.xml index 290c7da..56815f8 100644 --- a/core/res/res/layout/screen_toolbar.xml +++ b/core/res/res/layout/screen_toolbar.xml @@ -34,7 +34,7 @@ This is an optimized layout for a screen with a toolbar enabled. android:layout_height="wrap_content" android:layout_alignParentTop="true" style="?attr/actionBarStyle" - android:viewName="android:action_bar" + android:transitionName="android:action_bar" android:gravity="top"> <Toolbar android:id="@+id/action_bar" diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 8d8f69e..3385605 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2424,7 +2424,7 @@ <!-- Names a View such that it can be identified for Transitions. Names should be unique in the View hierarchy. --> - <attr name="viewName" format="string" /> + <attr name="transitionName" format="string" /> <!-- Specifies that this view should permit nested scrolling within a compatible ancestor view. --> @@ -5273,10 +5273,10 @@ <attr name="interpolator" /> <!-- The match order to use for the transition. This is a comma-separated list of values, containing one or more of the following: - id, itemId, viewName, instance. These correspond to + id, itemId, name, instance. These correspond to {@link android.transition.Transition#MATCH_ID}, {@link android.transition.Transition#MATCH_ITEM_ID}, - {@link android.transition.Transition#MATCH_VIEW_NAME}, and + {@link android.transition.Transition#MATCH_NAME}, and {@link android.transition.Transition#MATCH_INSTANCE}, respectively. This corresponds to {@link android.transition.Transition#setMatchOrder(int...)}. --> <attr name="matchOrder" format="string" /> @@ -5331,10 +5331,10 @@ <attr name="targetClass" /> <!-- The fully-qualified name of the Class to exclude from this transition. --> <attr name="excludeClass" format="string" /> - <!-- The viewName of the target on which this transition will animation changes. --> - <attr name="targetViewName" format="string" /> - <!-- The viewName of the target to exclude from this transition. --> - <attr name="excludeViewName" format="string" /> + <!-- The transitionName of the target on which this transition will animation changes. --> + <attr name="targetName" format="string" /> + <!-- The transitionName of the target to exclude from this transition. --> + <attr name="excludeName" format="string" /> </declare-styleable> <!-- Use <code>set</code> as the root tag of the XML resource that diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index f6ad78b..f2dd0cb 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2115,7 +2115,7 @@ <public type="attr" name="controlY1" /> <public type="attr" name="controlX2" /> <public type="attr" name="controlY2" /> - <public type="attr" name="viewName" /> + <public type="attr" name="transitionName" /> <public type="attr" name="transitionGroup" /> <public type="attr" name="viewportWidth" /> <public type="attr" name="viewportHeight" /> @@ -2168,8 +2168,8 @@ <public type="attr" name="fromId" /> <public type="attr" name="reversible" /> <public type="attr" name="splitTrack" /> - <public type="attr" name="targetViewName" /> - <public type="attr" name="excludeViewName" /> + <public type="attr" name="targetName" /> + <public type="attr" name="excludeName" /> <public type="attr" name="matchOrder" /> <public type="attr" name="windowDrawsSystemBarBackgrounds" /> <public type="attr" name="statusBarColor"/> |