private Point getActionViewCoordinates ( ) { int [ ] coords = new int [ 2 ] ; // This method returns a x and y values that can be larger than the dimensions of the device screen. mainActionView . getLocationOnScreen ( coords ) ; // So, we need to deduce the offsets. if ( systemOverlay ) { coords [ 1 ] -= getStatusBarHeight ( ) ; } else { Rect activityFrame = new Rect ( ) ; getActivityContentView ( ) . getWindowVisibleDisplayFrame ( activityFrame ) ; coords [ 0 ] -= ( getScreenSize ( ) . x - getActivityContentView ( ) . getMeasuredWidth ( ) ) ; coords [ 1 ] -= ( activityFrame . height ( ) + activityFrame . top - getActivityContentView ( ) . getMeasuredHeight ( ) ) ; } return new Point ( coords [ 0 ] , coords [ 1 ] ) ; }
Gets the coordinates of the main action view This method should only be called after the main layout of the Activity is drawn such as when a user clicks the action button .