@@ -10,7 +10,10 @@ import androidx.activity.result.contract.ActivityResultContracts
10
10
import androidx.annotation.RequiresApi
11
11
import androidx.compose.foundation.layout.Box
12
12
import androidx.compose.foundation.layout.Column
13
+ import androidx.compose.foundation.layout.Spacer
13
14
import androidx.compose.foundation.layout.fillMaxSize
15
+ import androidx.compose.foundation.layout.height
16
+ import androidx.compose.material3.CircularProgressIndicator
14
17
import androidx.compose.material3.LinearProgressIndicator
15
18
import androidx.compose.material3.Text
16
19
import androidx.compose.runtime.Composable
@@ -22,6 +25,7 @@ import androidx.compose.runtime.setValue
22
25
import androidx.compose.ui.Alignment
23
26
import androidx.compose.ui.Modifier
24
27
import androidx.compose.ui.platform.LocalContext
28
+ import androidx.compose.ui.unit.dp
25
29
import androidx.core.content.FileProvider
26
30
import androidx.lifecycle.ViewModel
27
31
import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -313,7 +317,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
313
317
onResult = { success: Boolean ->
314
318
hasImage = success
315
319
316
- if (imageUri != null ) {
320
+ if (imageUri != null && success ) {
317
321
loading.value = true
318
322
val prescriptionAI = PrescriptionAI .getInstance(context)
319
323
val prediction = prescriptionAI.analyse(
@@ -334,7 +338,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
334
338
" DrugQuantity" -> treatment.posology + = " $word "
335
339
" DrugForm" -> treatment.posology + = " $word "
336
340
" DrugFrequency" -> treatment.posology + = " $word "
337
- " DrugDuration" -> treatment.posology + = " $word "
341
+ " DrugDuration" -> treatment.renew + = " $word "
338
342
}
339
343
}
340
344
@@ -344,7 +348,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
344
348
" DrugQuantity" -> treatment.posology + = " $word "
345
349
" DrugForm" -> treatment.posology + = " $word "
346
350
" DrugFrequency" -> treatment.posology + = " $word "
347
- " DrugDuration" -> treatment.posology + = " $word "
351
+ " DrugDuration" -> treatment.renew + = " $word "
348
352
}
349
353
}
350
354
}
@@ -367,6 +371,9 @@ fun NavGraphBuilder.prescriptionNavGraph(
367
371
Box (modifier = Modifier .fillMaxSize(), contentAlignment = Alignment .Center ) {
368
372
Column (horizontalAlignment = Alignment .CenterHorizontally ) {
369
373
Text (text = " Traitement de l'ordonnance en cours..." )
374
+
375
+ Spacer (modifier = Modifier .height(10 .dp))
376
+
370
377
LinearProgressIndicator ()
371
378
}
372
379
}
0 commit comments