session-android/src/org/thoughtcrime/securesms/webrtc/CameraState.java
Greyson Parrelli ca8fecea9c Clean up camera flipping, handle having missing cameras.
Did a refactor to better organize the camera flipping code. Also, I
wanted to make sure we handle the cases where the user doesn't have two
cameras (or no cameras, for that matter). In these cases, we just don't
show the appropriate buttons.
2018-05-21 15:45:22 -04:00

32 lines
727 B
Java

package org.thoughtcrime.securesms.webrtc;
import android.support.annotation.NonNull;
public class CameraState {
public static final CameraState UNKNOWN = new CameraState(Direction.NONE, 0);
private final Direction activeDirection;
private final int cameraCount;
public CameraState(@NonNull Direction activeDirection, int cameraCount) {
this.activeDirection = activeDirection;
this.cameraCount = cameraCount;
}
public int getCameraCount() {
return cameraCount;
}
public Direction getActiveDirection() {
return activeDirection;
}
public boolean isEnabled() {
return this.activeDirection != Direction.NONE;
}
public enum Direction {
FRONT, BACK, NONE, PENDING
}
}