Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean onFling(MotionEvent event1, MotionEvent event2,
- float velocityX, float velocityY) {
- int[] location = new int[2];
- int xLoc, yLoc;
- for(int idx = 0; idx < numBubbles; idx++) {
- View bubble = mFrame.getChildAt(idx);
- bubble.getLocationOnScreen(location);
- xLoc = (int) event1.getX();
- yLoc = (int) event1.getY();
- if (xLoc == location[0] && yLoc == location[1]) {
- ((BubbleView) bubble).deflect(velocityX, velocityY); // Deflect is a method that increases the speed
- // and translates the View object
- break;
- }
- return true;
- }
- }
Add Comment
Please, Sign In to add comment