Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import com.simprints.infra.uibase.annotations.ExcludedFromGeneratedTestCoverageR
@StringRes
internal fun CaptureState.buttonTextId(isAskingRescan: Boolean): Int = when (this) {
is CaptureState.NotCollected -> R.string.fingerprint_capture_scan
is CaptureState.Scanning -> R.string.fingerprint_capture_cancel_button
is CaptureState.TransferringImage -> R.string.fingerprint_capture_please_wait
is CaptureState.ScanProcess.Scanning -> R.string.fingerprint_capture_cancel_button
is CaptureState.ScanProcess.TransferringImage -> R.string.fingerprint_capture_please_wait
is CaptureState.Skipped,
is CaptureState.NotDetected -> R.string.fingerprint_capture_rescan
is CaptureState.ScanProcess.NotDetected -> R.string.fingerprint_capture_rescan

is CaptureState.Collected -> if (scanResult.isGoodScan()) {
is CaptureState.ScanProcess.Collected -> if (scanResult.isGoodScan()) {
if (isAskingRescan) {
R.string.fingerprint_capture_rescan_question
} else {
Expand All @@ -30,13 +30,13 @@ internal fun CaptureState.buttonTextId(isAskingRescan: Boolean): Int = when (thi
@ColorRes
internal fun CaptureState.buttonBackgroundColour(): Int = when (this) {
is CaptureState.NotCollected -> R.color.simprints_grey
is CaptureState.Scanning,
is CaptureState.TransferringImage -> R.color.simprints_blue
is CaptureState.ScanProcess.Scanning,
is CaptureState.ScanProcess.TransferringImage -> R.color.simprints_blue

is CaptureState.Skipped,
is CaptureState.NotDetected -> R.color.simprints_red
is CaptureState.ScanProcess.NotDetected -> R.color.simprints_red

is CaptureState.Collected -> if (scanResult.isGoodScan()) {
is CaptureState.ScanProcess.Collected -> if (scanResult.isGoodScan()) {
R.color.simprints_green
} else {
R.color.simprints_red
Expand All @@ -47,16 +47,16 @@ internal fun CaptureState.buttonBackgroundColour(): Int = when (this) {
@StringRes
internal fun CaptureState.resultTextId(): Int = when (this) {
is CaptureState.NotCollected -> R.string.fingerprint_capture_empty
is CaptureState.Scanning -> R.string.fingerprint_capture_empty
is CaptureState.TransferringImage -> if (scanResult.isGoodScan()) {
is CaptureState.ScanProcess.Scanning -> R.string.fingerprint_capture_empty
is CaptureState.ScanProcess.TransferringImage -> if (scanResult.isGoodScan()) {
R.string.fingerprint_capture_good_scan_message
} else {
R.string.fingerprint_capture_poor_scan_message
}

is CaptureState.Skipped -> R.string.fingerprint_capture_finger_skipped_message
is CaptureState.NotDetected -> R.string.fingerprint_capture_no_finger_detected_message
is CaptureState.Collected -> if (scanResult.isGoodScan()) {
is CaptureState.ScanProcess.NotDetected -> R.string.fingerprint_capture_no_finger_detected_message
is CaptureState.ScanProcess.Collected -> if (scanResult.isGoodScan()) {
R.string.fingerprint_capture_good_scan_message
} else {
R.string.fingerprint_capture_poor_scan_message
Expand All @@ -67,18 +67,18 @@ internal fun CaptureState.resultTextId(): Int = when (this) {
@ColorRes
internal fun CaptureState.resultTextColour(): Int = when (this) {
is CaptureState.NotCollected,
is CaptureState.Scanning -> android.R.color.white
is CaptureState.ScanProcess.Scanning -> android.R.color.white

is CaptureState.TransferringImage -> if (scanResult.isGoodScan()) {
is CaptureState.ScanProcess.TransferringImage -> if (scanResult.isGoodScan()) {
R.color.simprints_green
} else {
R.color.simprints_red
}

is CaptureState.Skipped,
is CaptureState.NotDetected -> R.color.simprints_red
is CaptureState.ScanProcess.NotDetected -> R.color.simprints_red

is CaptureState.Collected -> if (scanResult.isGoodScan()) {
is CaptureState.ScanProcess.Collected -> if (scanResult.isGoodScan()) {
R.color.simprints_green
} else {
R.color.simprints_red
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ internal fun FingerState.indicatorDrawableId(selected: Boolean): Int =
@DrawableRes
internal fun FingerState.indicatorSelectedDrawableId(): Int = when (this.currentCapture()) {
is CaptureState.NotCollected,
is CaptureState.Scanning,
is CaptureState.TransferringImage -> R.drawable.blank_selected
is CaptureState.ScanProcess.Scanning,
is CaptureState.ScanProcess.TransferringImage -> R.drawable.blank_selected

is CaptureState.Skipped,
is CaptureState.NotDetected -> R.drawable.alert_selected
is CaptureState.ScanProcess.NotDetected -> R.drawable.alert_selected

is CaptureState.Collected -> when {
captures.all { it is CaptureState.Collected && it.scanResult.isGoodScan() } -> R.drawable.ok_selected
is CaptureState.ScanProcess.Collected -> when {
captures.all { it is CaptureState.ScanProcess.Collected && it.scanResult.isGoodScan() } -> R.drawable.ok_selected
captures.any { it is CaptureState.NotCollected } -> R.drawable.blank_selected
else -> R.drawable.alert_selected
}
Expand All @@ -35,14 +35,14 @@ internal fun FingerState.indicatorSelectedDrawableId(): Int = when (this.current
@DrawableRes
internal fun FingerState.indicatorDeselectedDrawableId(): Int = when (this.currentCapture()) {
is CaptureState.NotCollected,
is CaptureState.Scanning,
is CaptureState.TransferringImage -> R.drawable.blank_deselected
is CaptureState.ScanProcess.Scanning,
is CaptureState.ScanProcess.TransferringImage -> R.drawable.blank_deselected

is CaptureState.Skipped,
is CaptureState.NotDetected -> R.drawable.alert_deselected
is CaptureState.ScanProcess.NotDetected -> R.drawable.alert_deselected

is CaptureState.Collected -> when {
captures.all { it is CaptureState.Collected && it.scanResult.isGoodScan() } -> R.drawable.ok_deselected
is CaptureState.ScanProcess.Collected -> when {
captures.all { it is CaptureState.ScanProcess.Collected && it.scanResult.isGoodScan() } -> R.drawable.ok_deselected
captures.any { it is CaptureState.NotCollected } -> R.drawable.blank_deselected
else -> R.drawable.alert_deselected
}
Expand All @@ -62,11 +62,11 @@ internal fun FingerState.captureNumberTextId(): Int = IDR.string.fingerprint_cap
@StringRes
internal fun FingerState.directionTextId(isLastFinger: Boolean): Int = when (val currentCapture = this.currentCapture()) {
is CaptureState.NotCollected -> if (currentCaptureIndex == 0) IDR.string.fingerprint_capture_please_scan else IDR.string.fingerprint_capture_please_scan_again
is CaptureState.Scanning -> IDR.string.fingerprint_capture_scanning
is CaptureState.TransferringImage -> IDR.string.fingerprint_capture_transfering_data
is CaptureState.ScanProcess.Scanning -> IDR.string.fingerprint_capture_scanning
is CaptureState.ScanProcess.TransferringImage -> IDR.string.fingerprint_capture_transfering_data
is CaptureState.Skipped -> IDR.string.fingerprint_capture_good_scan_direction
is CaptureState.NotDetected -> IDR.string.fingerprint_capture_poor_scan_direction
is CaptureState.Collected -> if (currentCapture.scanResult.isGoodScan()) {
is CaptureState.ScanProcess.NotDetected -> IDR.string.fingerprint_capture_poor_scan_direction
is CaptureState.ScanProcess.Collected -> if (currentCapture.scanResult.isGoodScan()) {
if (isLastFinger || currentCaptureIndex + 1 < captures.size) IDR.string.fingerprint_capture_empty else IDR.string.fingerprint_capture_good_scan_direction
} else {
IDR.string.fingerprint_capture_poor_scan_direction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ internal class FingerprintCaptureFragment : Fragment(R.layout.fragment_fingerpri
val dialogItems = state.fingerStates.map {
ConfirmFingerprintsDialog.Item(
it.id,
it.captures.count { capture -> capture is CaptureState.Collected && capture.scanResult.isGoodScan() },
it.captures.count { capture -> capture is CaptureState.ScanProcess.Collected && capture.scanResult.isGoodScan() },
it.captures.size
)
}
Expand Down
Loading