Beispiel #1
0
 public boolean onTouch(View view, MotionEvent event) {
   float x = event.getX();
   float y = event.getY();
   switch (event.getAction()) {
     case MotionEvent.ACTION_DOWN:
       path.moveTo(x, y);
       return true;
     case MotionEvent.ACTION_UP:
     case MotionEvent.ACTION_MOVE:
       l = x;
       r = x;
       t = y;
       b = y;
       for (int i = 0; i < event.getHistorySize(); i++) {
         float newX = event.getHistoricalX(i);
         float newY = event.getHistoricalY(i);
         path.lineTo(newX, newY);
         l = newX < l ? newX : l;
         t = newY < t ? newY : t;
         r = newX > r ? newX : r;
         b = newY > b ? newY : b;
       }
       rect.set(l, t, r, b);
       Log.d("TAG", rect.toShortString());
       invalidate(
           (int) rect.left - 5, (int) rect.top - 5, (int) rect.right + 5, (int) rect.bottom + 5);
       break;
     default:
   }
   return super.onTouchEvent(event);
 }
 @Override
 public String toString() {
   return "WheelConfig{"
       + "circleCenter="
       + circleCenter
       + ", circleBoundaries="
       + circleBoundaries.toShortString()
       + ", outerRadius="
       + outerRadius
       + ", innerRadius="
       + innerRadius
       + ", angularRestrictions="
       + angularRestrictions.toString()
       + '}';
 }