API Review: Improve javadoc.
Bug 17189781
Also rename PatternMotion to PatternPathMotion
Change-Id: I1c4dcbdd65e33cf9de1504277e31f9f7ede0380d
diff --git a/api/current.txt b/api/current.txt
index d7ddcf1..616b192 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -968,6 +968,7 @@
field public static final int pathData = 16843807; // 0x101041f
field public static final int pathPattern = 16842796; // 0x101002c
field public static final int pathPrefix = 16842795; // 0x101002b
+ field public static final int patternPathData = 16843979; // 0x10104cb
field public static final int permission = 16842758; // 0x1010006
field public static final int permissionFlags = 16843719; // 0x10103c7
field public static final int permissionGroup = 16842762; // 0x101000a
@@ -31493,13 +31494,13 @@
method public abstract android.graphics.Path getPath(float, float, float, float);
}
- public class PatternMotion extends android.transition.PathMotion {
- ctor public PatternMotion();
- ctor public PatternMotion(android.content.Context, android.util.AttributeSet);
- ctor public PatternMotion(android.graphics.Path);
+ public class PatternPathMotion extends android.transition.PathMotion {
+ ctor public PatternPathMotion();
+ ctor public PatternPathMotion(android.content.Context, android.util.AttributeSet);
+ ctor public PatternPathMotion(android.graphics.Path);
method public android.graphics.Path getPath(float, float, float, float);
- method public android.graphics.Path getPattern();
- method public void setPattern(android.graphics.Path);
+ method public android.graphics.Path getPatternPath();
+ method public void setPatternPath(android.graphics.Path);
}
public final class Scene {
diff --git a/core/java/android/transition/ArcMotion.java b/core/java/android/transition/ArcMotion.java
index a27063d..f95fb49 100644
--- a/core/java/android/transition/ArcMotion.java
+++ b/core/java/android/transition/ArcMotion.java
@@ -41,9 +41,9 @@
* {@code
* <changeBounds>
* <arcMotion android:minimumHorizontalAngle="15"
- * android:minimumVerticalAngle="0" android:maximumAngle="90"/>
- * </changeBounds>
- * }
+ * android:minimumVerticalAngle="0"
+ * android:maximumAngle="90"/>
+ * </changeBounds>}
* </pre>
*/
public class ArcMotion extends PathMotion {
diff --git a/core/java/android/transition/ChangeTransform.java b/core/java/android/transition/ChangeTransform.java
index cb0a875..1b8d57c 100644
--- a/core/java/android/transition/ChangeTransform.java
+++ b/core/java/android/transition/ChangeTransform.java
@@ -99,6 +99,7 @@
* @return <code>true</code> when a changed parent should execute the transition
* inside the scene root's overlay or <code>false</code> if a parent change only
* affects the transform of the transitioning view.
+ * @attr ref android.R.styleable#ChangeTransform_reparentWithOverlay
*/
public boolean getReparentWithOverlay() {
return mUseOverlay;
@@ -120,6 +121,7 @@
* @return <code>true</code> when a changed parent should execute the transition
* inside the scene root's overlay or <code>false</code> if a parent change only
* affects the transform of the transitioning view.
+ * @attr ref android.R.styleable#ChangeTransform_reparentWithOverlay
*/
public void setReparentWithOverlay(boolean reparentWithOverlay) {
mUseOverlay = reparentWithOverlay;
@@ -132,6 +134,7 @@
* view will be tracked. Default is true.
*
* @return whether parent changes will be tracked by the ChangeTransform.
+ * @attr ref android.R.styleable#ChangeTransform_reparent
*/
public boolean getReparent() {
return mReparent;
@@ -145,6 +148,7 @@
*
* @param reparent Set to true to track parent changes or false to only track changes
* of the transitioning view without considering the parent change.
+ * @attr ref android.R.styleable#ChangeTransform_reparent
*/
public void setReparent(boolean reparent) {
mReparent = reparent;
diff --git a/core/java/android/transition/PatternMotion.java b/core/java/android/transition/PatternPathMotion.java
similarity index 68%
rename from core/java/android/transition/PatternMotion.java
rename to core/java/android/transition/PatternPathMotion.java
index e4045b4..a609df6 100644
--- a/core/java/android/transition/PatternMotion.java
+++ b/core/java/android/transition/PatternPathMotion.java
@@ -34,36 +34,35 @@
* <pre>
* {@code
* <changeBounds>
- * <patternMotion android:pathData="M0 0 L0 100 L100 100"/>
- * </changeBounds>
- * }
+ * <patternPathMotion android:patternPathData="M0 0 L0 100 L100 100"/>
+ * </changeBounds>}
* </pre>
*/
-public class PatternMotion extends PathMotion {
+public class PatternPathMotion extends PathMotion {
- private Path mOriginalPattern;
+ private Path mOriginalPatternPath;
- private final Path mPattern = new Path();
+ private final Path mPatternPath = new Path();
private final Matrix mTempMatrix = new Matrix();
/**
- * Constructs a PatternMotion with a straight-line pattern.
+ * Constructs a PatternPathMotion with a straight-line pattern.
*/
- public PatternMotion() {
- mPattern.lineTo(1, 0);
- mOriginalPattern = mPattern;
+ public PatternPathMotion() {
+ mPatternPath.lineTo(1, 0);
+ mOriginalPatternPath = mPatternPath;
}
- public PatternMotion(Context context, AttributeSet attrs) {
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PatternMotion);
+ public PatternPathMotion(Context context, AttributeSet attrs) {
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PatternPathMotion);
try {
- String pathData = a.getString(R.styleable.PatternMotion_pathData);
+ String pathData = a.getString(R.styleable.PatternPathMotion_patternPathData);
if (pathData == null) {
- throw new RuntimeException("pathData must be supplied for patternMotion");
+ throw new RuntimeException("pathData must be supplied for patternPathMotion");
}
Path pattern = PathParser.createPathFromPathData(pathData);
- setPattern(pattern);
+ setPatternPath(pattern);
} finally {
a.recycle();
}
@@ -71,14 +70,15 @@
}
/**
- * Creates a PatternMotion with the Path defining a pattern of motion between two coordinates.
- * The pattern will be translated, rotated, and scaled to fit between the start and end points.
- * The pattern must not be empty and must have the end point differ from the start point.
+ * Creates a PatternPathMotion with the Path defining a pattern of motion between two
+ * coordinates. The pattern will be translated, rotated, and scaled to fit between the start
+ * and end points. The pattern must not be empty and must have the end point differ from the
+ * start point.
*
- * @param pattern A Path to be used as a pattern for two-dimensional motion.
+ * @param patternPath A Path to be used as a pattern for two-dimensional motion.
*/
- public PatternMotion(Path pattern) {
- setPattern(pattern);
+ public PatternPathMotion(Path patternPath) {
+ setPatternPath(patternPath);
}
/**
@@ -87,10 +87,10 @@
* The pattern must not be empty and must have the end point differ from the start point.
*
* @return the Path defining a pattern of motion between two coordinates.
- * @attr ref android.R.styleable#PatternMotion_pathData
+ * @attr ref android.R.styleable#PatternPathMotion_patternPathData
*/
- public Path getPattern() {
- return mOriginalPattern;
+ public Path getPatternPath() {
+ return mOriginalPatternPath;
}
/**
@@ -98,11 +98,11 @@
* The pattern will be translated, rotated, and scaled to fit between the start and end points.
* The pattern must not be empty and must have the end point differ from the start point.
*
- * @param pattern A Path to be used as a pattern for two-dimensional motion.
- * @attr ref android.R.styleable#PatternMotion_pathData
+ * @param patternPath A Path to be used as a pattern for two-dimensional motion.
+ * @attr ref android.R.styleable#PatternPathMotion_patternPathData
*/
- public void setPattern(Path pattern) {
- PathMeasure pathMeasure = new PathMeasure(pattern, false);
+ public void setPatternPath(Path patternPath) {
+ PathMeasure pathMeasure = new PathMeasure(patternPath, false);
float length = pathMeasure.getLength();
float[] pos = new float[2];
pathMeasure.getPosTan(length, pos, null);
@@ -124,8 +124,8 @@
mTempMatrix.postScale(scale, scale);
double angle = Math.atan2(dy, dx);
mTempMatrix.postRotate((float) Math.toDegrees(-angle));
- pattern.transform(mTempMatrix, mPattern);
- mOriginalPattern = pattern;
+ patternPath.transform(mTempMatrix, mPatternPath);
+ mOriginalPatternPath = patternPath;
}
@Override
@@ -139,7 +139,7 @@
mTempMatrix.postRotate((float) Math.toDegrees(angle));
mTempMatrix.postTranslate(startX, startY);
Path path = new Path();
- mPattern.transform(mTempMatrix, path);
+ mPatternPath.transform(mTempMatrix, path);
return path;
}
diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java
index bd52e71..0d1b568 100644
--- a/core/java/android/transition/Transition.java
+++ b/core/java/android/transition/Transition.java
@@ -1989,8 +1989,33 @@
* by extending PathMotion and implementing
* {@link android.transition.PathMotion#getPath(float, float, float, float)}.
* </p>
+ * <p>
+ * When describing in XML, use a nested XML tag for the path motion. It can be one of
+ * the built-in tags <code>arcMotion</code> or <code>patternPathMotion</code> or it can
+ * be a custom PathMotion using <code>pathMotion</code> with the <code>class</code>
+ * attributed with the fully-described class name. For example:</p>
+ * <pre>
+ * {@code
+ * <changeBounds>
+ * <pathMotion class="my.app.transition.MyPathMotion"/>
+ * </changeBounds>
+ * }
+ * </pre>
+ * <p>or</p>
+ * <pre>
+ * {@code
+ * <changeBounds>
+ * <arcMotion android:minimumHorizontalAngle="15"
+ * android:minimumVerticalAngle="0" android:maximumAngle="90"/>
+ * </changeBounds>
+ * }
+ * </pre>
+ *
* @param pathMotion Algorithm object to use for determining how to interpolate in two
* dimensions. If null, a straight-path algorithm will be used.
+ * @see android.transition.ArcMotion
+ * @see PatternPathMotion
+ * @see android.transition.PathMotion
*/
public void setPathMotion(PathMotion pathMotion) {
if (pathMotion == null) {
@@ -2004,7 +2029,31 @@
* Returns the algorithm object used to interpolate along two dimensions. This is typically
* used to determine the View motion between two points.
*
+ * <p>
+ * When describing in XML, use a nested XML tag for the path motion. It can be one of
+ * the built-in tags <code>arcMotion</code> or <code>patternPathMotion</code> or it can
+ * be a custom PathMotion using <code>pathMotion</code> with the <code>class</code>
+ * attributed with the fully-described class name. For example:</p>
+ * <pre>
+ * {@code
+ * <changeBounds>
+ * <pathMotion class="my.app.transition.MyPathMotion"/>
+ * </changeBounds>}
+ * </pre>
+ * <p>or</p>
+ * <pre>
+ * {@code
+ * <changeBounds>
+ * <arcMotion android:minimumHorizontalAngle="15"
+ * android:minimumVerticalAngle="0"
+ * android:maximumAngle="90"/>
+ * </changeBounds>}
+ * </pre>
+ *
* @return The algorithm object used to interpolate along two dimensions.
+ * @see android.transition.ArcMotion
+ * @see PatternPathMotion
+ * @see android.transition.PathMotion
*/
public PathMotion getPathMotion() {
return mPathMotion;
diff --git a/core/java/android/transition/TransitionInflater.java b/core/java/android/transition/TransitionInflater.java
index 760ffe1..9009d6a 100644
--- a/core/java/android/transition/TransitionInflater.java
+++ b/core/java/android/transition/TransitionInflater.java
@@ -171,8 +171,8 @@
parent.setPathMotion(new ArcMotion(mContext, attrs));
} else if ("pathMotion".equals(name)) {
parent.setPathMotion((PathMotion)createCustom(attrs, PathMotion.class, "pathMotion"));
- } else if ("patternMotion".equals(name)) {
- parent.setPathMotion(new PatternMotion(mContext, attrs));
+ } else if ("patternPathMotion".equals(name)) {
+ parent.setPathMotion(new PatternPathMotion(mContext, attrs));
} else {
throw new RuntimeException("Unknown scene name: " + parser.getName());
}
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 3629cbb..d1cc1fd 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -5686,12 +5686,12 @@
<attr name="maximumAngle" format="float" />
</declare-styleable>
- <!-- Use <code>patternMotion</code> as the root tag of the XML resource that
- describes a {@link android.transition.PatternMotion}. This must be used
+ <!-- Use <code>patternPathMotion</code> as the root tag of the XML resource that
+ describes a {@link android.transition.PatternPathMotion}. This must be used
within a transition with which the PathMotion should be associated. -->
- <declare-styleable name="PatternMotion">
- <!-- The path string describing the pattern to use for the PathMotion. -->
- <attr name="pathData" />
+ <declare-styleable name="PatternPathMotion">
+ <!-- The path string describing the pattern to use for the PathPathMotion. -->
+ <attr name="patternPathData" format="string" />
</declare-styleable>
<!-- ========================== -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 4bf4531..a4c3474 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2290,6 +2290,7 @@
<public type="attr" name="fragmentReenterTransition" />
<public type="attr" name="fragmentAllowEnterTransitionOverlap" />
<public type="attr" name="fragmentAllowReturnTransitionOverlap" />
+ <public type="attr" name="patternPathData" />
<public-padding type="dimen" name="l_resource_pad" end="0x01050010" />