diff options
author | 2013-07-08 18:46:33 +0900 | |
---|---|---|
committer | 2013-07-16 14:12:55 +0900 | |
commit | 6912342a48b9ebf6f4dcd714b697eadac48afbde (patch) | |
tree | a56c8276e21f78703ab1fbd3b98adf3f27771133 /java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java | |
parent | b6f286bfa549ed91c67d591fc1725e35b114742b (diff) | |
download | latinime-6912342a48b9ebf6f4dcd714b697eadac48afbde.tar.gz latinime-6912342a48b9ebf6f4dcd714b697eadac48afbde.tar.xz latinime-6912342a48b9ebf6f4dcd714b697eadac48afbde.zip |
Fix a bug with bad view reuse.
There are many ways to fix this problem but this is the most
direct way. Removing a view from the cache when any animation
is started will ensure it won't be used again, and will be garbage
collected when it's possible. Since views are created on demand
anyway, a new one will just get created when needed, and that's
it.
Bug: 9400128
Change-Id: I4945d2859d642e79694d51ae90cf4f5bde9a5f1d
Diffstat (limited to 'java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java')
-rw-r--r-- | java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java b/java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java index c5aca174a..6d6c8f5c6 100644 --- a/java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java +++ b/java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java @@ -47,6 +47,7 @@ public class ButtonSwitcher extends FrameLayout { private Button mInstallButton; private Button mCancelButton; private Button mDeleteButton; + private DictionaryListInterfaceState mInterfaceState; private OnClickListener mOnClickListener; public ButtonSwitcher(Context context, AttributeSet attrs) { @@ -57,9 +58,10 @@ public class ButtonSwitcher extends FrameLayout { super(context, attrs, defStyle); } - public void reset() { + public void reset(final DictionaryListInterfaceState interfaceState) { mStatus = NOT_INITIALIZED; mAnimateToStatus = NOT_INITIALIZED; + mInterfaceState = interfaceState; } @Override @@ -153,6 +155,7 @@ public class ButtonSwitcher extends FrameLayout { private ViewPropertyAnimator animateButton(final View button, final int direction) { final float outerX = getWidth(); final float innerX = button.getX() - button.getTranslationX(); + mInterfaceState.removeFromCache((View)getParent()); if (ANIMATION_IN == direction) { button.setClickable(true); return button.animate().translationX(0); |