Skip to content

Commit

Permalink
Add isProcessing state to ImageScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
codeguru42 committed Aug 8, 2023
1 parent ef9a625 commit 9d2c7c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/main/java/codeguru/gocapture/ui/ImageScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
Expand All @@ -24,11 +28,14 @@ import kotlinx.coroutines.launch
@Composable
fun ImageScreen(navController: NavHostController, modifier: Modifier, imageUri: String?) {
val repository = GoCaptureRepository(LocalContext.current as Activity)
var isProcessing by remember { mutableStateOf(false) }

Scaffold(
modifier = modifier,
floatingActionButton = {
FloatingActionButton(
onClick = {
isProcessing = true
CoroutineScope(Dispatchers.IO).launch {
repository.processImage(Uri.parse(imageUri))
}
Expand Down

0 comments on commit 9d2c7c8

Please sign in to comment.