Skip to content

Commit

Permalink
Move utils.kt content to CameraMode.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
SuLG-ik committed Mar 6, 2024
1 parent b3af80e commit d1fb1b3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,26 @@ sealed class CameraMode {
*/
data object Back : CameraMode()
}


internal fun CameraMode.inverse(): CameraMode {
return when (this) {
CameraMode.Back -> CameraMode.Front
CameraMode.Front -> CameraMode.Back
}
}

internal fun CameraMode.id(): Int {
return when (this) {
CameraMode.Back -> 0
CameraMode.Front -> 1
}
}

internal fun cameraModeFromId(id: Int): CameraMode {
return when (id) {
0 -> CameraMode.Back
1 -> CameraMode.Front
else -> throw IllegalArgumentException("CameraMode with id=${id} does not exists")
}
}

This file was deleted.

0 comments on commit d1fb1b3

Please sign in to comment.