-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathOrientation.java
More file actions
31 lines (26 loc) · 1.03 KB
/
Orientation.java
File metadata and controls
31 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.reactnativenavigation.options;
import android.content.pm.ActivityInfo;
import androidx.annotation.Nullable;
public enum Orientation {
Default("default", ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED),
Landscape("landscape", ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE),
Portrait("portrait", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT),
PortraitLandscape("sensor", ActivityInfo.SCREEN_ORIENTATION_USER),
SensorLandscape("sensorLandscape", ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE),
SensorPortrait("sensorPortrait", ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
public String name;
public int orientationCode;
Orientation(String name, int orientationCode) {
this.name = name;
this.orientationCode = orientationCode;
}
@Nullable
public static Orientation fromString(String name) {
for (Orientation orientation : values()) {
if (orientation.name.equals(name)) {
return orientation;
}
}
return null;
}
}