|
@@ -1,22 +1,19 @@
|
1
|
1
|
package com.reactnativenavigation.parse.params;
|
2
|
2
|
|
3
|
3
|
import android.content.pm.ActivityInfo;
|
4
|
|
-import android.content.res.Configuration;
|
5
|
4
|
import android.support.annotation.Nullable;
|
6
|
5
|
|
7
|
6
|
public enum Orientation {
|
8
|
|
- Portrait("portrait", Configuration.ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT),
|
9
|
|
- Landscape("landscape", Configuration.ORIENTATION_LANDSCAPE, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE),
|
10
|
|
- Default("default", Configuration.ORIENTATION_UNDEFINED, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED),
|
11
|
|
- PortraitLandscape("sensor", Configuration.ORIENTATION_UNDEFINED, ActivityInfo.SCREEN_ORIENTATION_USER);
|
|
7
|
+ Portrait("portrait", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT),
|
|
8
|
+ Landscape("landscape", ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE),
|
|
9
|
+ Default("default", ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED),
|
|
10
|
+ PortraitLandscape("sensor", ActivityInfo.SCREEN_ORIENTATION_USER);
|
12
|
11
|
|
13
|
12
|
public String name;
|
14
|
|
- public int configurationCode;
|
15
|
13
|
public int orientationCode;
|
16
|
14
|
|
17
|
|
- Orientation(String name, int configurationCode, int orientationCode) {
|
|
15
|
+ Orientation(String name, int orientationCode) {
|
18
|
16
|
this.name = name;
|
19
|
|
- this.configurationCode = configurationCode;
|
20
|
17
|
this.orientationCode = orientationCode;
|
21
|
18
|
}
|
22
|
19
|
|
|
@@ -29,13 +26,4 @@ public enum Orientation {
|
29
|
26
|
}
|
30
|
27
|
return null;
|
31
|
28
|
}
|
32
|
|
-
|
33
|
|
- public static String fromConfigurationCode(int configurationCode) {
|
34
|
|
- for (Orientation orientation : values()) {
|
35
|
|
- if (orientation.configurationCode == configurationCode) {
|
36
|
|
- return orientation.name;
|
37
|
|
- }
|
38
|
|
- }
|
39
|
|
- throw new RuntimeException();
|
40
|
|
- }
|
41
|
29
|
}
|