Merge "Turn off deadzone flash, replacing it with logcat." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0dd248ea61
@@ -76,5 +76,7 @@
|
|||||||
<!-- decay duration (from size_max -> size), in ms -->
|
<!-- decay duration (from size_max -> size), in ms -->
|
||||||
<integer name="navigation_bar_deadzone_hold">333</integer>
|
<integer name="navigation_bar_deadzone_hold">333</integer>
|
||||||
<integer name="navigation_bar_deadzone_decay">333</integer>
|
<integer name="navigation_bar_deadzone_decay">333</integer>
|
||||||
|
|
||||||
|
<bool name="config_dead_zone_flash">false</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class DeadZone extends View {
|
|||||||
public static final int HORIZONTAL = 0;
|
public static final int HORIZONTAL = 0;
|
||||||
public static final int VERTICAL = 1;
|
public static final int VERTICAL = 1;
|
||||||
|
|
||||||
|
private static final boolean CHATTY = true; // print to logcat when we eat a click
|
||||||
|
|
||||||
private boolean mShouldFlash;
|
private boolean mShouldFlash;
|
||||||
private float mFlashFrac = 0f;
|
private float mFlashFrac = 0f;
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ public class DeadZone extends View {
|
|||||||
Slog.v(TAG, this + " size=[" + mSizeMin + "-" + mSizeMax + "] hold=" + mHold
|
Slog.v(TAG, this + " size=[" + mSizeMin + "-" + mSizeMax + "] hold=" + mHold
|
||||||
+ (mVertical ? " vertical" : " horizontal"));
|
+ (mVertical ? " vertical" : " horizontal"));
|
||||||
|
|
||||||
setFlashOnTouchCapture(true);
|
setFlashOnTouchCapture(context.getResources().getBoolean(R.bool.config_dead_zone_flash));
|
||||||
}
|
}
|
||||||
|
|
||||||
static float lerp(float a, float b, float f) {
|
static float lerp(float a, float b, float f) {
|
||||||
@@ -100,27 +102,30 @@ public class DeadZone extends View {
|
|||||||
postInvalidate();
|
postInvalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// I made you a touch event
|
// I made you a touch event...
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
if (DEBUG)
|
if (DEBUG) {
|
||||||
Slog.v(TAG, this + " onTouch: " + MotionEvent.actionToString(event.getAction()));
|
Slog.v(TAG, this + " onTouch: " + MotionEvent.actionToString(event.getAction()));
|
||||||
|
}
|
||||||
|
|
||||||
final int action = event.getAction();
|
final int action = event.getAction();
|
||||||
if (action == MotionEvent.ACTION_OUTSIDE) {
|
if (action == MotionEvent.ACTION_OUTSIDE) {
|
||||||
poke(event);
|
poke(event);
|
||||||
} else if (action == MotionEvent.ACTION_DOWN) {
|
} else if (action == MotionEvent.ACTION_DOWN) {
|
||||||
if (DEBUG)
|
if (DEBUG) {
|
||||||
Slog.v(TAG, this + " ACTION_DOWN: " + event.getX() + "," + event.getY());
|
Slog.v(TAG, this + " ACTION_DOWN: " + event.getX() + "," + event.getY());
|
||||||
|
}
|
||||||
int size = (int) getSize(event.getEventTime());
|
int size = (int) getSize(event.getEventTime());
|
||||||
if ((mVertical && event.getX() < size) || event.getY() < size) {
|
if ((mVertical && event.getX() < size) || event.getY() < size) {
|
||||||
if (DEBUG)
|
if (CHATTY) {
|
||||||
Slog.v(TAG, "eating click!");
|
Slog.v(TAG, "consuming errant click: (" + event.getX() + "," + event.getY() + ")");
|
||||||
|
}
|
||||||
if (mShouldFlash) {
|
if (mShouldFlash) {
|
||||||
post(mDebugFlash);
|
post(mDebugFlash);
|
||||||
postInvalidate();
|
postInvalidate();
|
||||||
}
|
}
|
||||||
return true; // but I eated it
|
return true; // ...but I eated it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user