@Composable
fun composeManualView(data: IdenfyManualReviewingIdentificationResultsStatusWaitingComposeViewData) {
//All needed resources for the view
val resources = data.resources
//A base for the composable
val composeBases = data.idenfyComposeBases
//States of the view
val state = resources.state.collectAsState()
composeBases.manualReviewingIdentificationResultsStatusWaitingComposableBase(
resources,
manualReviewingWaitingStatusViewTitle = { title ->
Text(
modifier = Modifier
.padding(16.dp, 32.dp, 16.dp, 0.dp),
text = title,
textAlign = TextAlign.Center,
color = colorResource(R.color.idenfyManualReviewingStatusWaitingCommonInformationTitleTextColor),
fontSize = TextUnit(20f, TextUnitType.Sp),
fontWeight = FontWeight.Bold,
fontFamily = IdenfyFonts.hkGrotesk
)
},
manualReviewingWaitingStatusViewDescription = { description ->
Text(
modifier = Modifier
.padding(16.dp, 0.dp, 16.dp, 0.dp),
text = description,
textAlign = TextAlign.Center,
color = colorResource(R.color.idenfyManualReviewingStatusWaitingCommonInformationDescriptionTextColor),
fontSize = TextUnit(15f, TextUnitType.Sp),
fontWeight = FontWeight.Normal,
fontFamily = IdenfyFonts.hkGrotesk
)
},
manualReviewingWaitingStatusViewAutomatedReviewBox = { firstCardTitle ->
Surface(
elevation = 4.dp,
shape = RoundedCornerShape(4.dp),
color = colorResource(R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxFinishedBackgroundColor),
modifier = Modifier
.height(IntrinsicSize.Min)
.padding(start = 16.dp, end = 16.dp)
.fillMaxWidth()
) {
Box {
Row(
horizontalArrangement = Arrangement.End,
modifier = Modifier
.requiredHeight(60.dp)
) {
Text(
modifier = Modifier
.weight(weight = 1f)
.padding(start = 16.dp, end = 16.dp)
.align(Alignment.CenterVertically),
textAlign = TextAlign.Start,
text = firstCardTitle,
color = colorResource(R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxFinishedTitleColor),
fontSize = TextUnit(13f, TextUnitType.Sp),
fontWeight = FontWeight.SemiBold,
fontFamily = IdenfyFonts.hkGrotesk
)
Image(
painterResource(R.drawable.idenfy_ic_language_selection_language_selected_tick),
contentDescription = "",
colorFilter = ColorFilter.tint(colorResource(R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxFinishedTickImageTintColor)),
modifier = Modifier
.padding(end = 16.dp)
.align(Alignment.CenterVertically)
.wrapContentWidth(Alignment.End)
.requiredSize(20.dp),
)
}
}
}
},
manualReviewingWaitingStatusViewManualReviewBox = { secondCardTitle ->
Surface(
elevation = 4.dp,
shape = RoundedCornerShape(4.dp),
color = if (state.value == ManualWaitingScreenState.WAITING) colorResource(
R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxWaitingBackgroundColor
) else colorResource(R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxFinishedBackgroundColor),
modifier = Modifier
.height(IntrinsicSize.Min)
.padding(start = 16.dp, end = 16.dp)
.fillMaxWidth()
) {
Box {
Row(
horizontalArrangement = Arrangement.End,
modifier = Modifier
.requiredHeight(60.dp)
) {
Text(
modifier = Modifier
.weight(weight = 1f)
.padding(start = 16.dp, end = 16.dp)
.align(Alignment.CenterVertically),
textAlign = TextAlign.Start,
text = secondCardTitle,
color = if (state.value == ManualWaitingScreenState.WAITING) colorResource(
R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxWaitingTitleColor
) else colorResource(R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxFinishedTitleColor),
fontSize = TextUnit(13f, TextUnitType.Sp),
fontWeight = FontWeight.SemiBold,
fontFamily = IdenfyFonts.hkGrotesk
)
if (state.value == ManualWaitingScreenState.WAITING) {
CircularProgressIndicator(
modifier = Modifier
.padding(end = 16.dp)
.align(Alignment.CenterVertically)
.wrapContentWidth(Alignment.End)
.requiredSize(20.dp),
color = colorResource(R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxWaitingSpinnerColor)
)
} else {
Image(
painterResource(R.drawable.idenfy_ic_language_selection_language_selected_tick),
contentDescription = "",
colorFilter = ColorFilter.tint(colorResource(R.color.idenfyManualReviewingStatusWaitingCommonReviewBoxFinishedTickImageTintColor)),
modifier = Modifier
.padding(end = 16.dp)
.align(Alignment.CenterVertically)
.wrapContentWidth(Alignment.End)
.requiredSize(20.dp),
)
}
}
}
}
},
manualReviewingWaitingStatusViewWaitingDurationTitle = { waitingDurationTitle ->
Text(
modifier = Modifier
.padding(bottom = 8.dp)
.wrapContentWidth(Alignment.Start),
text = waitingDurationTitle,
textAlign = TextAlign.Center,
color = colorResource(R.color.idenfyManualReviewingStatusWaitingCommonWaitingDurationTitleColor),
fontSize = TextUnit(13f, TextUnitType.Sp),
fontWeight = FontWeight.Normal,
fontFamily = IdenfyFonts.hkGrotesk
)
},
manualReviewingWaitingStatusViewWaitingTimerBox = { timeState ->
val time = timeState.collectAsState()
Surface(
shape = RoundedCornerShape(4.dp),
color = colorResource(R.color.idenfyManualReviewingStatusWaitingCommonWaitingTimerBoxBackgroundColor),
modifier = Modifier
.height(42.dp)
.padding(start = 16.dp, end = 16.dp)
.fillMaxWidth()
) {
Row(horizontalArrangement = Arrangement.Center) {
Image(
painterResource(R.drawable.idenfy_ic_waiting_results_timer_clock_v2),
contentDescription = "",
modifier = Modifier
.size(25.dp)
.align(Alignment.CenterVertically),
colorFilter = ColorFilter.tint(colorResource(R.color.idenfyManualReviewingStatusWaitingCommonWaitingTimerImageTintColor))
)
Text(
text = time.value,
color = colorResource(R.color.idenfyManualReviewingStatusWaitingCommonWaitingTimerTitleColor),
fontSize = TextUnit(12f, TextUnitType.Sp),
fontWeight = FontWeight.Bold,
fontFamily = IdenfyFonts.hkGrotesk,
modifier = Modifier
.align(Alignment.CenterVertically)
.padding(start = 8.dp)
)
}
}
},
manualReviewingWaitingStatusViewBackToAccountButton = { buttonResources ->
when (buttonResources) {
BackToAccountButtonResources.Hidden -> {
}
is BackToAccountButtonResources.Visible -> {
Surface(
shape = RoundedCornerShape(4.dp),
color = colorResource(R.color.idenfyManualReviewingStatusWaitingBackToAccountButtonBackgroundColor),
modifier = Modifier
.height(42.dp)
.padding(start = 16.dp, end = 16.dp)
.clickable(onClick = buttonResources.buttonAction)
.fillMaxWidth()
) {
Row(horizontalArrangement = Arrangement.Center) {
Text(
text = buttonResources.title,
color = colorResource(R.color.idenfyManualReviewingStatusWaitingBackToAccountButtonTextColor),
fontSize = TextUnit(12f, TextUnitType.Sp),
fontWeight = FontWeight.Bold,
fontFamily = IdenfyFonts.hkGrotesk,
modifier = Modifier
.align(Alignment.CenterVertically)
)
}
}
}
}
})
}