public void setOffsetByMotionEvent ( MotionEvent event ) { int x = ( int ) event . getRawX ( ) ; int y = ( int ) event . getRawY ( ) ; if ( x + contentParams . width + FINGER_SIZE < screenWidth ) { setContentOffset ( x , y , Translation . HORIZONTAL , FINGER_SIZE ) ; } else if ( x - FINGER_SIZE - contentParams . width > 0 ) { setContentOffset ( x , y , Translation . HORIZONTAL , - 1 * FINGER_SIZE ) ; } else if ( y + contentParams . height + FINGER_SIZE < screenHeight ) { setContentOffset ( x , y , Translation . VERTICAL , FINGER_SIZE ) ; } else if ( y - FINGER_SIZE - contentParams . height > 0 ) { setContentOffset ( x , y , Translation . VERTICAL , - 1 * FINGER_SIZE ) ; } else { // it won't fit anywhere if ( x < screenWidth / 2 ) { setContentOffset ( x , y , Translation . HORIZONTAL , FINGER_SIZE ) ; } else { setContentOffset ( x , y , Translation . HORIZONTAL , - 1 * FINGER_SIZE ) ; } } }
Places the peek view over the top of a motion event . This will translate the motion event s start points so that the PeekView isn t covered by the finger .