Merge "Fix pressed states on system bar buttons."

This commit is contained in:
Daniel Sandler
2010-07-22 06:19:21 -07:00
committed by Android (Google) Code Review
4 changed files with 4 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -72,6 +72,7 @@ public class KeyButtonView extends ImageView {
mRepeat = 0;
mSending = true;
sendEvent(KeyEvent.ACTION_DOWN, mDownTime);
setPressed(true);
break;
case MotionEvent.ACTION_MOVE:
if (mSending) {
@@ -80,14 +81,16 @@ public class KeyButtonView extends ImageView {
if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) {
mSending = false;
sendEvent(KeyEvent.ACTION_UP);
setPressed(false);
}
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mSending) {
sendEvent(KeyEvent.ACTION_UP);
mSending = false;
sendEvent(KeyEvent.ACTION_UP);
setPressed(false);
}
break;
}