Merge "API Review: Improve javadoc." into lmp-dev

This commit is contained in:
George Mount
2014-09-05 17:29:28 +00:00
committed by Android (Google) Code Review
8 changed files with 102 additions and 47 deletions

View File

@@ -968,6 +968,7 @@ package android {
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
@@ -31507,13 +31508,13 @@ package android.transition {
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 {

View File

@@ -41,9 +41,9 @@ import android.util.FloatMath;
* {@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 {

View File

@@ -99,6 +99,7 @@ public class ChangeTransform extends Transition {
* @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 @@ public class ChangeTransform extends Transition {
* @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 @@ public class ChangeTransform extends Transition {
* 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 @@ public class ChangeTransform extends Transition {
*
* @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;

View File

@@ -34,36 +34,35 @@ import android.util.PathParser;
* <pre>
* {@code
* &lt;changeBounds>
* &lt;patternMotion android:pathData="M0 0 L0 100 L100 100"/>
* &lt;/changeBounds>
* }
* &lt;patternPathMotion android:patternPathData="M0 0 L0 100 L100 100"/>
* &lt;/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 @@ public class PatternMotion extends PathMotion {
}
/**
* 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 @@ public class PatternMotion extends PathMotion {
* 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 @@ public class PatternMotion extends PathMotion {
* 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 @@ public class PatternMotion extends PathMotion {
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 @@ public class PatternMotion extends PathMotion {
mTempMatrix.postRotate((float) Math.toDegrees(angle));
mTempMatrix.postTranslate(startX, startY);
Path path = new Path();
mPattern.transform(mTempMatrix, path);
mPatternPath.transform(mTempMatrix, path);
return path;
}

View File

@@ -1989,8 +1989,33 @@ public abstract class Transition implements Cloneable {
* 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
* &lt;changeBounds>
* &lt;pathMotion class="my.app.transition.MyPathMotion"/>
* &lt;/changeBounds>
* }
* </pre>
* <p>or</p>
* <pre>
* {@code
* &lt;changeBounds>
* &lt;arcMotion android:minimumHorizontalAngle="15"
* android:minimumVerticalAngle="0" android:maximumAngle="90"/>
* &lt;/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 @@ public abstract class Transition implements Cloneable {
* 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
* &lt;changeBounds>
* &lt;pathMotion class="my.app.transition.MyPathMotion"/>
* &lt;/changeBounds>}
* </pre>
* <p>or</p>
* <pre>
* {@code
* &lt;changeBounds>
* &lt;arcMotion android:minimumHorizontalAngle="15"
* android:minimumVerticalAngle="0"
* android:maximumAngle="90"/>
* &lt;/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;

View File

@@ -171,8 +171,8 @@ public class TransitionInflater {
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());
}

View File

@@ -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>
<!-- ========================== -->

View File

@@ -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" />