-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1823 from HedvigInsurance/feature/inform-and-deflect
Add steps for inform and deflect
- Loading branch information
Showing
24 changed files
with
1,327 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...hedvig/android/apollo/octopus/graphql/claimflow/MutationFlowClaimConfirmEmergency.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mutation FlowClaimConfirmEmergency($isUrgentEmergency: Boolean!, $context: FlowContext!) { | ||
flowClaimConfirmEmergencyNext(input: { confirmEmergency: $isUrgentEmergency }, context: $context) { | ||
id | ||
context | ||
...ClaimFlowStepFragment | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
app/core/core-ui/src/main/kotlin/com/hedvig/android/core/ui/HedvigChip.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package com.hedvig.android.core.ui | ||
|
||
import androidx.compose.animation.animateColorAsState | ||
import androidx.compose.animation.core.Animatable | ||
import androidx.compose.animation.core.AnimationVector1D | ||
import androidx.compose.animation.core.tween | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.foundation.interaction.PressInteraction | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.LocalContentColor | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.compositeOver | ||
import androidx.compose.ui.graphics.graphicsLayer | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.hedvig.android.core.designsystem.material3.motion.MotionTokens | ||
import com.hedvig.android.core.designsystem.material3.onTypeContainer | ||
import com.hedvig.android.core.designsystem.material3.squircleMedium | ||
import com.hedvig.android.core.designsystem.material3.typeContainer | ||
import kotlinx.coroutines.flow.collectLatest | ||
import kotlinx.coroutines.flow.filterIsInstance | ||
|
||
@Composable | ||
fun <T> HedvigChip( | ||
item: T, | ||
itemDisplayName: (T) -> String, | ||
isSelected: Boolean, | ||
onItemClick: (T) -> Unit, | ||
modifier: Modifier = Modifier, | ||
showChipAnimatable: Animatable<Float, AnimationVector1D>, | ||
) { | ||
Box( | ||
// TODO replace with space on the flow row itself https://kotlinlang.slack.com/archives/CJLTWPH7S/p1687442185827989?thread_ts=1679515354.462029&cid=CJLTWPH7S | ||
modifier = modifier | ||
.padding(bottom = 8.dp) | ||
.graphicsLayer { | ||
scaleX = showChipAnimatable.value | ||
scaleY = showChipAnimatable.value | ||
}, | ||
contentAlignment = Alignment.Center, | ||
) { | ||
val surfaceColor by animateColorAsState( | ||
if (isSelected) { | ||
MaterialTheme.colorScheme.typeContainer.compositeOver(MaterialTheme.colorScheme.background) | ||
} else { | ||
MaterialTheme.colorScheme.surface | ||
}, | ||
) | ||
val contentColor by animateColorAsState( | ||
if (isSelected) { | ||
MaterialTheme.colorScheme.onTypeContainer.compositeOver(surfaceColor) | ||
} else { | ||
MaterialTheme.colorScheme.onSurface | ||
}, | ||
) | ||
val backgroundScale = remember { Animatable(1f) } | ||
val interactionSource = remember { MutableInteractionSource() } | ||
LaunchedEffect(interactionSource) { | ||
interactionSource | ||
.interactions | ||
.filterIsInstance<PressInteraction.Release>() | ||
.collectLatest { | ||
backgroundScale.animateTo( | ||
targetValue = 1.05f, | ||
animationSpec = tween( | ||
durationMillis = MotionTokens.DurationShort3.toInt(), | ||
easing = MotionTokens.EasingStandardCubicBezier, | ||
), | ||
) | ||
backgroundScale.animateTo( | ||
targetValue = 1f, | ||
animationSpec = tween( | ||
durationMillis = MotionTokens.DurationShort3.toInt(), | ||
easing = MotionTokens.EasingStandardCubicBezier, | ||
), | ||
) | ||
} | ||
} | ||
Box( | ||
modifier = Modifier | ||
.matchParentSize() | ||
.graphicsLayer { | ||
scaleX = backgroundScale.value | ||
scaleY = backgroundScale.value | ||
} | ||
.clip(MaterialTheme.shapes.squircleMedium) | ||
.background(surfaceColor, MaterialTheme.shapes.squircleMedium) | ||
.clickable( | ||
interactionSource = interactionSource, | ||
indication = null, | ||
onClick = { onItemClick(item) }, | ||
), | ||
) | ||
CompositionLocalProvider(LocalContentColor provides contentColor) { | ||
Text( | ||
text = itemDisplayName(item), | ||
style = MaterialTheme.typography.bodyLarge.copy( | ||
fontSize = 18.sp, | ||
), | ||
maxLines = 1, | ||
textAlign = TextAlign.Center, | ||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), | ||
) | ||
} | ||
} | ||
} |
106 changes: 106 additions & 0 deletions
106
app/core/core-ui/src/main/kotlin/com/hedvig/android/core/ui/infocard/WarningCard.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package com.hedvig.android.core.ui.infocard | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material3.CardColors | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.unit.dp | ||
import com.hedvig.android.core.designsystem.component.card.HedvigInfoCard | ||
import com.hedvig.android.core.designsystem.material3.onWarningContainer | ||
import com.hedvig.android.core.designsystem.material3.warningContainer | ||
import com.hedvig.android.core.designsystem.material3.warningElement | ||
import com.hedvig.android.core.designsystem.preview.HedvigPreview | ||
import com.hedvig.android.core.designsystem.theme.HedvigTheme | ||
import com.hedvig.android.core.icons.Hedvig | ||
import com.hedvig.android.core.icons.hedvig.normal.WarningFilled | ||
|
||
@Composable | ||
fun VectorWarningCard( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
icon: ImageVector = Icons.Hedvig.WarningFilled, | ||
iconColor: Color = MaterialTheme.colorScheme.warningElement, | ||
colors: CardColors = CardDefaults.outlinedCardColors( | ||
containerColor = MaterialTheme.colorScheme.warningContainer, | ||
contentColor = MaterialTheme.colorScheme.onWarningContainer, | ||
), | ||
) { | ||
VectorWarningCard( | ||
text = text, | ||
modifier = modifier, | ||
icon = icon, | ||
iconColor = iconColor, | ||
colors = colors, | ||
underTextContent = null, | ||
) | ||
} | ||
|
||
@Composable | ||
fun VectorWarningCard( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
icon: ImageVector = Icons.Hedvig.WarningFilled, | ||
iconColor: Color = MaterialTheme.colorScheme.warningElement, | ||
colors: CardColors = CardDefaults.outlinedCardColors( | ||
containerColor = MaterialTheme.colorScheme.warningContainer, | ||
contentColor = MaterialTheme.colorScheme.onWarningContainer, | ||
), | ||
underTextContent: @Composable (ColumnScope.() -> Unit)?, | ||
) { | ||
HedvigInfoCard( | ||
modifier = modifier, | ||
contentPadding = PaddingValues( | ||
start = 12.dp, | ||
top = 12.dp, | ||
end = 16.dp, | ||
bottom = 12.dp, | ||
), | ||
colors = colors, | ||
) { | ||
Icon( | ||
imageVector = icon, | ||
contentDescription = "info", | ||
modifier = Modifier | ||
.padding(top = 2.dp) | ||
.size(16.dp), | ||
tint = iconColor, | ||
) | ||
Spacer(Modifier.width(8.dp)) | ||
Column { | ||
Text( | ||
text = text, | ||
style = MaterialTheme.typography.bodyMedium, | ||
) | ||
if (underTextContent != null) { | ||
Spacer(Modifier.height(12.dp)) | ||
underTextContent() | ||
Spacer(Modifier.height(4.dp)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@HedvigPreview | ||
@Composable | ||
private fun PreviewVectorInfoCard() { | ||
HedvigTheme { | ||
Surface(color = MaterialTheme.colorScheme.background) { | ||
VectorInfoCard("Lorem ipsum") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.