diff options
| author | Chet Haase <chet@google.com> | 2010-07-30 15:01:32 -0700 |
|---|---|---|
| committer | Chet Haase <chet@google.com> | 2010-07-30 15:01:32 -0700 |
| commit | 8fbf8d2b08a22a8f06abe8cff39d935865ec1c9d (patch) | |
| tree | 91fab96ec112fa8214f6c12d69697f02e542e4cf /core/java | |
| parent | 12517fe56c5be18ef8693fb172c09fb46aa1b316 (diff) | |
| download | frameworks_base-8fbf8d2b08a22a8f06abe8cff39d935865ec1c9d.zip frameworks_base-8fbf8d2b08a22a8f06abe8cff39d935865ec1c9d.tar.gz frameworks_base-8fbf8d2b08a22a8f06abe8cff39d935865ec1c9d.tar.bz2 | |
Fix problems with moving Views around (invalidation, conflict with layout)
Change-Id: I38f8f8a4e8082854a53a2975da258b5d946ed525
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/animation/PropertyAnimator.java | 30 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 98 |
2 files changed, 77 insertions, 51 deletions
diff --git a/core/java/android/animation/PropertyAnimator.java b/core/java/android/animation/PropertyAnimator.java index 4d7ab84..eac9798 100644 --- a/core/java/android/animation/PropertyAnimator.java +++ b/core/java/android/animation/PropertyAnimator.java @@ -447,16 +447,15 @@ public final class PropertyAnimator extends Animator { HashMap<String, Method> propertyMap = sSetterPropertyMap.get(mTarget); if (propertyMap != null) { mSetter = propertyMap.get(mPropertyName); - if (mSetter != null) { - return; - } } - mSetter = getPropertyFunction("set", mValueType); - if (propertyMap == null) { - propertyMap = new HashMap<String, Method>(); - sSetterPropertyMap.put(mTarget, propertyMap); + if (mSetter == null) { + mSetter = getPropertyFunction("set", mValueType); + if (propertyMap == null) { + propertyMap = new HashMap<String, Method>(); + sSetterPropertyMap.put(mTarget, propertyMap); + } + propertyMap.put(mPropertyName, mSetter); } - propertyMap.put(mPropertyName, mSetter); } finally { propertyMapLock.writeLock().unlock(); } @@ -470,16 +469,15 @@ public final class PropertyAnimator extends Animator { HashMap<String, Method> propertyMap = sGetterPropertyMap.get(mTarget); if (propertyMap != null) { mGetter = propertyMap.get(mPropertyName); - if (mGetter != null) { - return; - } } - mGetter = getPropertyFunction("get", null); - if (propertyMap == null) { - propertyMap = new HashMap<String, Method>(); - sGetterPropertyMap.put(mTarget, propertyMap); + if (mGetter == null) { + mGetter = getPropertyFunction("get", null); + if (propertyMap == null) { + propertyMap = new HashMap<String, Method>(); + sGetterPropertyMap.put(mTarget, propertyMap); + } + propertyMap.put(mPropertyName, mGetter); } - propertyMap.put(mPropertyName, mGetter); } finally { propertyMapLock.writeLock().unlock(); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 745839d..7666591d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5117,13 +5117,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (hasIdentityMatrix()) { final ViewParent p = mParent; if (p != null && mAttachInfo != null) { - final int[] location = mAttachInfo.mInvalidateChildLocation; final Rect r = mAttachInfo.mTmpInvalRect; - int minTop = Math.min(mTop, top); - location[0] = mLeft; - location[1] = minTop; - r.set(0, 0, mRight - mLeft, mBottom - minTop); - p.invalidateChildInParent(location, r); + int minTop; + int yLoc; + if (top < mTop) { + minTop = top; + yLoc = top - mTop; + } else { + minTop = mTop; + yLoc = 0; + } + r.set(0, yLoc, mRight - mLeft, mBottom - minTop); + p.invalidateChild(this, r); } } else { // Double-invalidation is necessary to capture view's old and new areas @@ -5159,13 +5164,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (hasIdentityMatrix()) { final ViewParent p = mParent; if (p != null && mAttachInfo != null) { - final int[] location = mAttachInfo.mInvalidateChildLocation; final Rect r = mAttachInfo.mTmpInvalRect; - int maxBottom = Math.max(mBottom, bottom); - location[0] = mLeft; - location[1] = mTop; + int maxBottom; + if (bottom < mBottom) { + maxBottom = mBottom; + } else { + maxBottom = bottom; + } r.set(0, 0, mRight - mLeft, maxBottom - mTop); - p.invalidateChildInParent(location, r); + p.invalidateChild(this, r); } } else { // Double-invalidation is necessary to capture view's old and new areas @@ -5201,13 +5208,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (hasIdentityMatrix()) { final ViewParent p = mParent; if (p != null && mAttachInfo != null) { - final int[] location = mAttachInfo.mInvalidateChildLocation; final Rect r = mAttachInfo.mTmpInvalRect; - int minLeft = Math.min(mLeft, left); - location[0] = minLeft; - location[1] = mTop; - r.set(0, 0, mRight - minLeft, mBottom - mTop); - p.invalidateChildInParent(location, r); + int minLeft; + int xLoc; + if (left < mLeft) { + minLeft = left; + xLoc = left - mLeft; + } else { + minLeft = mLeft; + xLoc = 0; + } + r.set(xLoc, 0, mRight - minLeft, mBottom - mTop); + p.invalidateChild(this, r); } } else { // Double-invalidation is necessary to capture view's old and new areas @@ -5243,13 +5255,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (hasIdentityMatrix()) { final ViewParent p = mParent; if (p != null && mAttachInfo != null) { - final int[] location = mAttachInfo.mInvalidateChildLocation; final Rect r = mAttachInfo.mTmpInvalRect; - int maxRight = Math.max(mRight, right); - location[0] = mLeft; - location[1] = mTop; + int maxRight; + if (right < mRight) { + maxRight = mRight; + } else { + maxRight = right; + } r.set(0, 0, maxRight - mLeft, mBottom - mTop); - p.invalidateChildInParent(location, r); + p.invalidateChild(this, r); } } else { // Double-invalidation is necessary to capture view's old and new areas @@ -5440,14 +5454,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (hasIdentityMatrix()) { final ViewParent p = mParent; if (p != null && mAttachInfo != null) { - final int[] location = mAttachInfo.mInvalidateChildLocation; final Rect r = mAttachInfo.mTmpInvalRect; - int minTop = offset < 0 ? mTop + offset : mTop; - int maxBottom = offset < 0 ? mBottom : mBottom + offset; - location[0] = mLeft; - location[1] = minTop; - r.set(0, 0, mRight - mLeft, maxBottom - minTop); - p.invalidateChildInParent(location, r); + int minTop; + int maxBottom; + int yLoc; + if (offset < 0) { + minTop = mTop + offset; + maxBottom = mBottom; + yLoc = offset; + } else { + minTop = mTop; + maxBottom = mBottom + offset; + yLoc = 0; + } + r.set(0, yLoc, mRight - mLeft, maxBottom - minTop); + p.invalidateChild(this, r); } } else { invalidate(); @@ -5473,14 +5494,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (hasIdentityMatrix()) { final ViewParent p = mParent; if (p != null && mAttachInfo != null) { - final int[] location = mAttachInfo.mInvalidateChildLocation; final Rect r = mAttachInfo.mTmpInvalRect; - int minLeft = offset < 0 ? mLeft + offset : mLeft; - int maxRight = offset < 0 ? mRight : mRight + offset; - location[0] = minLeft; - location[1] = mTop; + int minLeft; + int maxRight; + int xLoc; + if (offset < 0) { + minLeft = mLeft + offset; + maxRight = mRight; + xLoc = offset; + } else { + minLeft = mLeft; + maxRight = mRight + offset; + xLoc = 0; + } r.set(0, 0, maxRight - minLeft, mBottom - mTop); - p.invalidateChildInParent(location, r); + p.invalidateChild(this, r); } } else { invalidate(); |
