Public Member Functions | |
DisplayRotationHelper (Context context) | |
float | getCameraSensorRelativeViewportAspectRatio (String cameraId) |
int | getCameraSensorToDisplayRotation (String cameraId) |
void | onDisplayAdded (int displayId) |
void | onDisplayChanged (int displayId) |
void | onDisplayRemoved (int displayId) |
void | onPause () |
void | onResume () |
void | onSurfaceChanged (int width, int height) |
void | updateSessionIfNeeded (ARCoreSharedCamera session) |
Private Member Functions | |
int | toDegrees (int rotation) |
Private Attributes | |
final CameraManager | cameraManager |
final Display | display |
final DisplayManager | displayManager |
boolean | viewportChanged |
int | viewportHeight |
int | viewportWidth |
Helper to track the display rotations. In particular, the 180 degree rotations are not notified by the onSurfaceChanged() callback, and thus they require listening to the android display events.
Definition at line 36 of file DisplayRotationHelper.java.
|
inline |
Constructs the DisplayRotationHelper but does not register the listener yet.
context | the Android Context. |
Definition at line 49 of file DisplayRotationHelper.java.
|
inline |
Returns the aspect ratio of the GL surface viewport while accounting for the display rotation relative to the device camera sensor orientation.
Definition at line 101 of file DisplayRotationHelper.java.
|
inline |
Returns the rotation of the back-facing camera with respect to the display. The value is one of 0, 90, 180, 270.
Definition at line 123 of file DisplayRotationHelper.java.
|
inline |
Definition at line 157 of file DisplayRotationHelper.java.
|
inline |
Definition at line 163 of file DisplayRotationHelper.java.
|
inline |
Definition at line 160 of file DisplayRotationHelper.java.
|
inline |
Unregisters the display listener. Should be called from Activity#onPause().
Definition at line 62 of file DisplayRotationHelper.java.
|
inline |
Registers the display listener. Should be called from Activity#onResume().
Definition at line 57 of file DisplayRotationHelper.java.
Records a change in surface dimensions. This will be later used by {}. Should be called from { android.opengl.GLSurfaceView.Renderer #onSurfaceChanged(javax.microedition.khronos.opengles.GL10, int, int)}. width the updated width of the surface. height the updated height of the surface.
Definition at line 75 of file DisplayRotationHelper.java.
Definition at line 141 of file DisplayRotationHelper.java.
|
inline |
Updates the session display geometry if a change was posted either by {} call or by #onDisplayChanged(int)} system callback. This function should be called explicitly before each call to Session#update()}. This function will also clear the 'pending update' (viewportChanged) flag. session the Session} object to update if display geometry changed.
Definition at line 89 of file DisplayRotationHelper.java.
|
private |
Definition at line 42 of file DisplayRotationHelper.java.
|
private |
Definition at line 40 of file DisplayRotationHelper.java.
|
private |
Definition at line 41 of file DisplayRotationHelper.java.
|
private |
Definition at line 37 of file DisplayRotationHelper.java.
|
private |
Definition at line 39 of file DisplayRotationHelper.java.
|
private |
Definition at line 38 of file DisplayRotationHelper.java.