aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2013-05-15 11:25:59 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-05-15 11:25:59 -0700
commit2f6851d9da1c3ff7ef6b146a125508114f275cc6 (patch)
treeb6ba45f82351f9cdf9d4f9de45232ac5248d12fd /java/src
parent6cf492e4a4a6e729f556fd8d38646c8a5ab7e4ba (diff)
parentf405dc87a8e61fe95c8e4ee5b81a2f4cd005dfd0 (diff)
downloadlatinime-2f6851d9da1c3ff7ef6b146a125508114f275cc6.tar.gz
latinime-2f6851d9da1c3ff7ef6b146a125508114f275cc6.tar.xz
latinime-2f6851d9da1c3ff7ef6b146a125508114f275cc6.zip
am f405dc87: am 17a35383: Merge "Override View.drawableStateChanged to detect state_pressed"
* commit 'f405dc87a8e61fe95c8e4ee5b81a2f4cd005dfd0': Override View.drawableStateChanged to detect state_pressed
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java b/java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java
index ca974f6b8..974dfddd3 100644
--- a/java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java
+++ b/java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java
@@ -51,11 +51,32 @@ public final class SetupStartIndicatorView extends LinearLayout {
mIndicatorView = indicatorView;
}
+ // TODO: Once we stop supporting ICS, uncomment {@link #setPressed(boolean)} method and
+ // remove this method.
@Override
- public void setPressed(final boolean pressed) {
- super.setPressed(pressed);
+ protected void drawableStateChanged() {
+ super.drawableStateChanged();
+ for (final int state : getDrawableState()) {
+ if (state == android.R.attr.state_pressed) {
+ updateIndicatorView(true /* pressed */);
+ return;
+ }
+ }
+ updateIndicatorView(false /* pressed */);
+ }
+
+ // TODO: Once we stop supporting ICS, uncomment this method and remove
+ // {@link #drawableStateChanged()} method.
+// @Override
+// public void setPressed(final boolean pressed) {
+// super.setPressed(pressed);
+// updateIndicatorView(pressed);
+// }
+
+ private void updateIndicatorView(final boolean pressed) {
if (mIndicatorView != null) {
mIndicatorView.setPressed(pressed);
+ mIndicatorView.invalidate();
}
}
}
@@ -73,12 +94,6 @@ public final class SetupStartIndicatorView extends LinearLayout {
}
@Override
- public void setPressed(final boolean pressed) {
- super.setPressed(pressed);
- invalidate();
- }
-
- @Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
final int layoutDirection = ViewCompatUtils.getLayoutDirection(this);