feat: navigate to history screen from camera
This commit is contained in:
parent
99d76703e7
commit
b6f232f655
|
|
@ -111,6 +111,9 @@ fun CameraScreen(
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
onHistoryClick = {
|
||||||
|
navController.navigate("history")
|
||||||
|
}
|
||||||
)
|
)
|
||||||
Image(
|
Image(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import android.util.Log
|
||||||
import androidx.camera.view.LifecycleCameraController
|
import androidx.camera.view.LifecycleCameraController
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import com.syaroful.agrilinkvocpro.plant_disease_detection_feature.core.extention.cropToSquare
|
import com.syaroful.agrilinkvocpro.plant_disease_detection_feature.core.extention.cropToSquare
|
||||||
|
import com.syaroful.agrilinkvocpro.plant_disease_detection_feature.core.extention.resize
|
||||||
import com.syaroful.agrilinkvocpro.plant_disease_detection_feature.data.repository.CameraRepository
|
import com.syaroful.agrilinkvocpro.plant_disease_detection_feature.data.repository.CameraRepository
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
|
@ -35,7 +36,7 @@ class CameraViewModel(
|
||||||
cameraRepository.takePicture(controller, executor) { bitmap ->
|
cameraRepository.takePicture(controller, executor) { bitmap ->
|
||||||
Log.d(TAG, "Picture taken, updating state")
|
Log.d(TAG, "Picture taken, updating state")
|
||||||
val croppedImage = cropToSquare(bitmap)
|
val croppedImage = cropToSquare(bitmap)
|
||||||
_bitmap.value = croppedImage
|
_bitmap.value = croppedImage.resize()
|
||||||
// croppedImage.let {
|
// croppedImage.let {
|
||||||
// diagnosisViewModel.analyzePlant(bitmap = it, prompt = prompt)
|
// diagnosisViewModel.analyzePlant(bitmap = it, prompt = prompt)
|
||||||
// Log.d(TAG, "analyzePlant() called")
|
// Log.d(TAG, "analyzePlant() called")
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ fun CustomCameraShutter(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onShutterClick: () -> Unit = {},
|
onShutterClick: () -> Unit = {},
|
||||||
onFlashClick: () -> Unit = {},
|
onFlashClick: () -> Unit = {},
|
||||||
onGalleryClick: () -> Unit = {}
|
onHistoryClick: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
|
|
@ -66,12 +66,12 @@ fun CustomCameraShutter(
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = onGalleryClick,
|
onClick = onHistoryClick,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.size(32.dp),
|
modifier = Modifier.size(32.dp),
|
||||||
painter = painterResource(id = R.drawable.solar_gallery_broken),
|
painter = painterResource(id = R.drawable.solar_history),
|
||||||
contentDescription = "Gallery",
|
contentDescription = "Gallery",
|
||||||
tint = MaterialTheme.colorScheme.onBackground
|
tint = MaterialTheme.colorScheme.onBackground
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user