Merge "Make behavior of ABSOLUTE pivot values more intuitive"
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index 0d57c9b..e8c0239 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -323,7 +323,7 @@
/**
* Initialize this animation with the dimensions of the object being
* animated as well as the objects parents. (This is to support animation
- * sizes being specifed relative to these dimensions.)
+ * sizes being specified relative to these dimensions.)
*
* <p>Objects that interpret Animations should call this method when
* the sizes of the object being animated and its parent are known, and
diff --git a/core/java/android/view/animation/RotateAnimation.java b/core/java/android/view/animation/RotateAnimation.java
index 58bf084..67e0374 100644
--- a/core/java/android/view/animation/RotateAnimation.java
+++ b/core/java/android/view/animation/RotateAnimation.java
@@ -66,6 +66,8 @@
mPivotYValue = d.value;
a.recycle();
+
+ initializePivotPoint();
}
/**
@@ -107,6 +109,7 @@
mPivotYType = ABSOLUTE;
mPivotXValue = pivotX;
mPivotYValue = pivotY;
+ initializePivotPoint();
}
/**
@@ -143,6 +146,20 @@
mPivotXType = pivotXType;
mPivotYValue = pivotYValue;
mPivotYType = pivotYType;
+ initializePivotPoint();
+ }
+
+ /**
+ * Called at the end of constructor methods to initialize, if possible, values for
+ * the pivot point. This is only possible for ABSOLUTE pivot values.
+ */
+ private void initializePivotPoint() {
+ if (mPivotXType == ABSOLUTE) {
+ mPivotX = mPivotXValue;
+ }
+ if (mPivotYType == ABSOLUTE) {
+ mPivotY = mPivotYValue;
+ }
}
@Override
diff --git a/core/java/android/view/animation/ScaleAnimation.java b/core/java/android/view/animation/ScaleAnimation.java
index 1dd250f..e9a8436 100644
--- a/core/java/android/view/animation/ScaleAnimation.java
+++ b/core/java/android/view/animation/ScaleAnimation.java
@@ -128,6 +128,8 @@
mPivotYValue = d.value;
a.recycle();
+
+ initializePivotPoint();
}
/**
@@ -178,6 +180,7 @@
mPivotYType = ABSOLUTE;
mPivotXValue = pivotX;
mPivotYValue = pivotY;
+ initializePivotPoint();
}
/**
@@ -218,6 +221,20 @@
mPivotXType = pivotXType;
mPivotYValue = pivotYValue;
mPivotYType = pivotYType;
+ initializePivotPoint();
+ }
+
+ /**
+ * Called at the end of constructor methods to initialize, if possible, values for
+ * the pivot point. This is only possible for ABSOLUTE pivot values.
+ */
+ private void initializePivotPoint() {
+ if (mPivotXType == ABSOLUTE) {
+ mPivotX = mPivotXValue;
+ }
+ if (mPivotYType == ABSOLUTE) {
+ mPivotY = mPivotYValue;
+ }
}
@Override