diff options
author | 2013-05-28 20:28:52 +0900 | |
---|---|---|
committer | 2013-05-29 11:52:04 +0900 | |
commit | 2b34b4eab6b04299205f47a92311d4d00f9d805f (patch) | |
tree | 61a4d90138c074f5cb082a37eb12fd66e8fb5efb /java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java | |
parent | 305509ed2feffa5c57cd21bb7cc137e444df3390 (diff) | |
download | latinime-2b34b4eab6b04299205f47a92311d4d00f9d805f.tar.gz latinime-2b34b4eab6b04299205f47a92311d4d00f9d805f.tar.xz latinime-2b34b4eab6b04299205f47a92311d4d00f9d805f.zip |
Rub some butter on dictionary list scrolling.
The default implementation for preferences refuses to
cache the views for custom preferences at all. We can
do it, but the system won't do it for us, so this does it.
This makes the screen scrolling smooth again.
Incidentally it also fixes the bug where the button may
not animate on the first element.
Bug: 8882722
Bug: 8883108
Change-Id: I9b2306ac4bf93761a808ebfee3477a65f017cddf
Diffstat (limited to 'java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java')
-rw-r--r-- | java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java b/java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java index 5ab94a429..c5aca174a 100644 --- a/java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java +++ b/java/src/com/android/inputmethod/dictionarypack/ButtonSwitcher.java @@ -57,6 +57,11 @@ public class ButtonSwitcher extends FrameLayout { super(context, attrs, defStyle); } + public void reset() { + mStatus = NOT_INITIALIZED; + mAnimateToStatus = NOT_INITIALIZED; + } + @Override protected void onLayout(final boolean changed, final int left, final int top, final int right, final int bottom) { @@ -64,9 +69,7 @@ public class ButtonSwitcher extends FrameLayout { mInstallButton = (Button)findViewById(R.id.dict_install_button); mCancelButton = (Button)findViewById(R.id.dict_cancel_button); mDeleteButton = (Button)findViewById(R.id.dict_delete_button); - mInstallButton.setOnClickListener(mOnClickListener); - mCancelButton.setOnClickListener(mOnClickListener); - mDeleteButton.setOnClickListener(mOnClickListener); + setInternalOnClickListener(mOnClickListener); setButtonPositionWithoutAnimation(mStatus); if (mAnimateToStatus != NOT_INITIALIZED) { // We have been asked to animate before we were ready, so we took a note of it. @@ -139,6 +142,12 @@ public class ButtonSwitcher extends FrameLayout { public void setInternalOnClickListener(final OnClickListener listener) { mOnClickListener = listener; + if (null != mInstallButton) { + // Already laid out : do it now + mInstallButton.setOnClickListener(mOnClickListener); + mCancelButton.setOnClickListener(mOnClickListener); + mDeleteButton.setOnClickListener(mOnClickListener); + } } private ViewPropertyAnimator animateButton(final View button, final int direction) { |