+ @Override
+ public boolean onTouchEvent(MotionEvent event)
+ {
+ boolean up = event.getActionMasked() == MotionEvent.ACTION_UP;
+
+ float x = event.getX() / this.getWidth();
+ float y = 1-(event.getY() / this.getHeight());
+
+ this.ypos = y;
+ if (y < this.ylim) {
+ int num = this.hand.length;
+ this.xpos = x;
+ this.pick = (int)Math.floor((x*num));
+ if (this.pick < 0) this.pick = 0;
+ if (this.pick >= num) this.pick = num-1;
+ }
+ if (y < this.ylim && !this.drag) {
+ Os.debug("Cards: onTouchEvent - starting drag");
+ this.drag = true;
+ }
+ if (this.drag) {
+ Os.debug("Cards: onTouchEvent - move "
+ + x + "," + y);
+ this.requestRender();
+ }
+ if (y >= this.ylim && this.drag && up) {
+ Os.debug("Cards: onTouchEvent - playing card");
+ }
+ if (up) {
+ Os.debug("Cards: onTouchEvent - ending drag");
+ this.drag = false;
+ }
+ return true;
+ }
+