diff options
author | 2013-07-16 05:43:15 +0000 | |
---|---|---|
committer | 2013-07-16 05:43:15 +0000 | |
commit | 988a1f3132d2e13fcd108ef945f91d9f30d8e222 (patch) | |
tree | 52815c9cb1289dafc0af1884aa3150e08cedd98f /java/src | |
parent | 4d4310df755a12be7b93f18c25f8e2389c33831c (diff) | |
parent | 6912342a48b9ebf6f4dcd714b697eadac48afbde (diff) | |
download | latinime-988a1f3132d2e13fcd108ef945f91d9f30d8e222.tar.gz latinime-988a1f3132d2e13fcd108ef945f91d9f30d8e222.tar.xz latinime-988a1f3132d2e13fcd108ef945f91d9f30d8e222.zip |
Merge "Fix a bug with bad view reuse."
Diffstat (limited to 'java/src')
3 files changed, 9 insertions, 2 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); diff --git a/java/src/com/android/inputmethod/dictionarypack/DictionaryListInterfaceState.java b/java/src/com/android/inputmethod/dictionarypack/DictionaryListInterfaceState.java index f1a2a8333..13c07de35 100644 --- a/java/src/com/android/inputmethod/dictionarypack/DictionaryListInterfaceState.java +++ b/java/src/com/android/inputmethod/dictionarypack/DictionaryListInterfaceState.java @@ -80,4 +80,8 @@ public class DictionaryListInterfaceState { mViewCache.add(view); return view; } + + public void removeFromCache(final View view) { + mViewCache.remove(view); + } } diff --git a/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java b/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java index 7ec7e9c13..ba1fce1a8 100644 --- a/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java +++ b/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java @@ -224,7 +224,7 @@ public final class WordListPreference extends Preference { (ButtonSwitcher)view.findViewById(R.id.wordlist_button_switcher); // We need to clear the state of the button switcher, because we reuse views; if we didn't // reset it would animate from whatever its old state was. - buttonSwitcher.reset(); + buttonSwitcher.reset(mInterfaceState); if (mInterfaceState.isOpen(mWordlistId)) { // The button is open. final int previousStatus = mInterfaceState.getStatus(mWordlistId); |