Skip to content

Commit 32ba8af

Browse files
authored
MV3 UI update (#178)
1 parent fd2427e commit 32ba8af

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • mv3/android/MV3Demo/app/src/main/java/org/pytorch/executorchexamples/mv3

mv3/android/MV3Demo/app/src/main/java/org/pytorch/executorchexamples/mv3/MainActivity.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class MainActivity : ComponentActivity() {
176176
onClick = {
177177
imagePickerLauncher.launch("image/*")
178178
},
179-
enabled = !isLiveCameraMode,
179+
enabled = !isLiveCameraMode && modelReady,
180180
modifier = Modifier.weight(1f)
181181
) {
182182
Icon(
@@ -194,6 +194,7 @@ class MainActivity : ComponentActivity() {
194194
cameraPermissionLauncher.launch(Manifest.permission.CAMERA)
195195
}
196196
},
197+
enabled = modelReady,
197198
modifier = Modifier.weight(1f),
198199
colors = IconButtonDefaults.iconButtonColors(
199200
containerColor = if (isLiveCameraMode) MaterialTheme.colorScheme.secondaryContainer else androidx.compose.ui.graphics.Color.Transparent
@@ -246,7 +247,11 @@ class MainActivity : ComponentActivity() {
246247
modifier = Modifier.fillMaxSize()
247248
)
248249
} else {
249-
Text("Pick an image to start or use Live Camera", style = MaterialTheme.typography.bodyLarge)
250+
if (modelReady) {
251+
Text("Pick an image to start or use Live Camera", style = MaterialTheme.typography.bodyLarge)
252+
} else {
253+
Text("Please download the model to start", style = MaterialTheme.typography.bodyLarge)
254+
}
250255
}
251256
}
252257

0 commit comments

Comments
 (0)