@@ -21,17 +21,6 @@ public class ScreenSize {
2121 public static final int SCREEN_SIZE_MIN_HEIGHT = 700 ;
2222 public static final int SCREEN_SIZE_MIN_WIDTH = 1244 ;
2323
24- /**
25- * Сортировщик размеров экрана.
26- */
27- private static final ArrayComparator <ScreenSize > COMPARATOR = (first , second ) -> {
28-
29- final int firstTotal = first .getHeight () * first .getWidth ();
30- final int secondTotal = second .getHeight () * second .getWidth ();
31-
32- return -(firstTotal - secondTotal );
33- };
34-
3524 /**
3625 * Таблица доступных расширений экрана.
3726 */
@@ -42,27 +31,6 @@ public class ScreenSize {
4231 */
4332 private static ScreenSize [] values ;
4433
45- /**
46- * Строковый вид.
47- */
48- private final String size ;
49-
50- /**
51- * Ширина экрана.
52- */
53- private final int width ;
54-
55- /**
56- * Высота кэрана.
57- */
58- private final int height ;
59-
60- private ScreenSize (final int width , final int height ) {
61- this .width = width ;
62- this .height = height ;
63- this .size = width + "x" + height ;
64- }
65-
6634 /**
6735 * Инициализация списка доступных разрешений экрана.
6836 */
@@ -83,25 +51,27 @@ public static void init() {
8351
8452 if (mode .getWidth () < SCREEN_SIZE_MIN_WIDTH || mode .getHeight () < SCREEN_SIZE_MIN_HEIGHT ) {
8553 continue ;
86- } else if (mode .getWidth () > SCREEN_SIZE_MAX_WIDTH ) {
54+ }
55+
56+ if (mode .getWidth () > SCREEN_SIZE_MAX_WIDTH ) {
8757 continue ;
8858 }
8959
90- container .add (new ScreenSize (mode .getWidth (), mode .getHeight ()));
60+ container .add (new ScreenSize (mode .getWidth (), mode .getHeight (), device . isFullScreenSupported () ));
9161 }
9262
93- container .add (new ScreenSize (SCREEN_SIZE_MIN_WIDTH , SCREEN_SIZE_MIN_HEIGHT ));
63+ container .add (new ScreenSize (SCREEN_SIZE_MIN_WIDTH , SCREEN_SIZE_MIN_HEIGHT , false ));
9464
9565 if (maxWidth >= 1600 && maxHeight >= 900 ) {
96- container .add (new ScreenSize (1600 , 900 ));
66+ container .add (new ScreenSize (1600 , 900 , false ));
9767 }
9868
9969 if (maxWidth >= 1850 && maxHeight >= 1000 ) {
100- container .add (new ScreenSize (1850 , 1000 ));
70+ container .add (new ScreenSize (1850 , 1000 , false ));
10171 }
10272
10373 if (maxWidth >= 1366 && maxHeight >= 768 ) {
104- container .add (new ScreenSize (1366 , 768 ));
74+ container .add (new ScreenSize (1366 , 768 , false ));
10575 }
10676
10777 container .sort (COMPARATOR );
@@ -119,7 +89,7 @@ public static void init() {
11989 */
12090 public static ScreenSize sizeOf (final String size ) {
12191 final ScreenSize screenSize = SCREEN_SIZE_TABLE .get (size );
122- return screenSize == null ? new ScreenSize (SCREEN_SIZE_MIN_WIDTH , SCREEN_SIZE_MIN_HEIGHT ) : screenSize ;
92+ return screenSize == null ? new ScreenSize (SCREEN_SIZE_MIN_WIDTH , SCREEN_SIZE_MIN_HEIGHT , false ) : screenSize ;
12393 }
12494
12595 /**
@@ -129,6 +99,44 @@ public static ScreenSize[] values() {
12999 return values ;
130100 }
131101
102+ /**
103+ * Строковый вид.
104+ */
105+ private final String size ;
106+
107+ /**
108+ * Ширина экрана.
109+ */
110+ private final int width ;
111+
112+ /**
113+ * Высота кэрана.
114+ */
115+ private final int height ;
116+
117+ /**
118+ * Сортировщик размеров экрана.
119+ */
120+ private static final ArrayComparator <ScreenSize > COMPARATOR = (first , second ) -> {
121+
122+ final int firstTotal = first .getHeight () * first .getWidth ();
123+ final int secondTotal = second .getHeight () * second .getWidth ();
124+
125+ return -(firstTotal - secondTotal );
126+ };
127+
128+ /**
129+ * Поддерживается ли полный экран.
130+ */
131+ private final boolean fullscreenSupported ;
132+
133+ private ScreenSize (final int width , final int height , final boolean fullscreenSupported ) {
134+ this .width = width ;
135+ this .height = height ;
136+ this .size = width + "x" + height ;
137+ this .fullscreenSupported = fullscreenSupported ;
138+ }
139+
132140 @ Override
133141 public boolean equals (final Object obj ) {
134142
@@ -174,6 +182,13 @@ public int hashCode() {
174182 return result ;
175183 }
176184
185+ /**
186+ * @return поддерживается ли полноэкранный режим.
187+ */
188+ public boolean isFullscreenSupported () {
189+ return fullscreenSupported ;
190+ }
191+
177192 @ Override
178193 public String toString () {
179194 return size ;
0 commit comments