@@ -35,6 +35,8 @@ public class DeadZone extends View {
3535 public static final int HORIZONTAL = 0 ;
3636 public static final int VERTICAL = 1 ;
3737
38+ private static final boolean CHATTY = true ; // print to logcat when we eat a click
39+
3840 private boolean mShouldFlash ;
3941 private float mFlashFrac = 0f ;
4042
@@ -76,7 +78,7 @@ public DeadZone(Context context, AttributeSet attrs, int defStyle) {
7678 Slog .v (TAG , this + " size=[" + mSizeMin + "-" + mSizeMax + "] hold=" + mHold
7779 + (mVertical ? " vertical" : " horizontal" ));
7880
79- setFlashOnTouchCapture (true );
81+ setFlashOnTouchCapture (context . getResources (). getBoolean ( R . bool . config_dead_zone_flash ) );
8082 }
8183
8284 static float lerp (float a , float b , float f ) {
@@ -100,27 +102,30 @@ public void setFlashOnTouchCapture(boolean dbg) {
100102 postInvalidate ();
101103 }
102104
103- // I made you a touch event
105+ // I made you a touch event...
104106 @ Override
105107 public boolean onTouchEvent (MotionEvent event ) {
106- if (DEBUG )
108+ if (DEBUG ) {
107109 Slog .v (TAG , this + " onTouch: " + MotionEvent .actionToString (event .getAction ()));
110+ }
108111
109112 final int action = event .getAction ();
110113 if (action == MotionEvent .ACTION_OUTSIDE ) {
111114 poke (event );
112115 } else if (action == MotionEvent .ACTION_DOWN ) {
113- if (DEBUG )
116+ if (DEBUG ) {
114117 Slog .v (TAG , this + " ACTION_DOWN: " + event .getX () + "," + event .getY ());
118+ }
115119 int size = (int ) getSize (event .getEventTime ());
116120 if ((mVertical && event .getX () < size ) || event .getY () < size ) {
117- if (DEBUG )
118- Slog .v (TAG , "eating click!" );
121+ if (CHATTY ) {
122+ Slog .v (TAG , "consuming errant click: (" + event .getX () + "," + event .getY () + ")" );
123+ }
119124 if (mShouldFlash ) {
120125 post (mDebugFlash );
121126 postInvalidate ();
122127 }
123- return true ; // but I eated it
128+ return true ; // ... but I eated it
124129 }
125130 }
126131 return false ;
0 commit comments