-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c1a323
commit 42ddfde
Showing
4 changed files
with
98 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
...plication/src/main/java/com/inkapplications/ack/android/capture/CaptureScreenViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package com.inkapplications.ack.android.capture | ||
|
||
import com.inkapplications.android.extensions.control.ControlState | ||
|
||
data class CaptureScreenViewModel( | ||
val recordingEnabled: Boolean = false, | ||
val internetServiceEnabled: Boolean = false, | ||
val internetServiceVisible: Boolean = false, | ||
val transmitState: Boolean = false, | ||
val recordingState: ControlState = ControlState.Hidden, | ||
val internetServiceState: ControlState = ControlState.Hidden, | ||
val transmitState: ControlState = ControlState.Hidden, | ||
) |
29 changes: 29 additions & 0 deletions
29
...d-extensions/src/main/java/com/inkapplications/android/extensions/control/ControlState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.inkapplications.android.extensions.control | ||
|
||
import androidx.compose.runtime.Composable | ||
|
||
enum class ControlState { | ||
Enabled, | ||
Disabled, | ||
Hidden, | ||
} | ||
|
||
@Composable | ||
inline fun ControlState.whenEnabled(action: @Composable () -> Unit) { | ||
if (this == ControlState.Enabled) action() | ||
} | ||
|
||
@Composable | ||
inline fun ControlState.whenDisabled(action: @Composable () -> Unit) { | ||
if (this == ControlState.Disabled) action() | ||
} | ||
|
||
@Composable | ||
inline fun ControlState.whenHidden(action: @Composable () -> Unit) { | ||
if (this == ControlState.Hidden) action() | ||
} | ||
|
||
@Composable | ||
inline fun ControlState.whenVisible(action: @Composable () -> Unit) { | ||
if (this != ControlState.Hidden) action() | ||
} |