public static List < Point > computeDialogPositions ( final int dialogWidth , final int dialogHeight ) { List < Point > dialogPosition = null ; final int windowBesides = ScreenSizeExtensions . getScreenWidth ( ) / dialogWidth ; final int windowBelow = ScreenSizeExtensions . getScreenHeight ( ) / dialogHeight ; final int listSize = windowBesides * windowBelow ; dialogPosition = new ArrayList <> ( listSize ) ; int dotWidth = 0 ; int dotHeight = 0 ; for ( int y = 0 ; y < windowBelow ; y ++ ) { dotWidth = 0 ; for ( int x = 0 ; x < windowBesides ; x ++ ) { final Point p = new Point ( dotWidth , dotHeight ) ; dialogPosition . add ( p ) ; dotWidth = dotWidth + dialogWidth ; } dotHeight = dotHeight + dialogHeight ; } return dialogPosition ; }
Compute how much dialog can be put into the screen and returns a list with the coordinates from the dialog positions as Point objects .