|
|
@ -75,6 +75,13 @@ import androidx.compose.ui.platform.LocalInspectionMode
|
|
|
|
import androidx.compose.ui.platform.testTag
|
|
|
|
import androidx.compose.ui.platform.testTag
|
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
|
|
|
|
|
import androidx.compose.ui.semantics.clearAndSetSemantics
|
|
|
|
|
|
|
|
import androidx.compose.ui.semantics.contentDescription
|
|
|
|
|
|
|
|
import androidx.compose.ui.semantics.semantics
|
|
|
|
|
|
|
|
import androidx.compose.ui.semantics.stateDescription
|
|
|
|
|
|
|
|
import androidx.compose.ui.semantics.toggleableState
|
|
|
|
|
|
|
|
import androidx.compose.ui.state.ToggleableState.Off
|
|
|
|
|
|
|
|
import androidx.compose.ui.state.ToggleableState.On
|
|
|
|
import androidx.compose.ui.text.style.TextAlign
|
|
|
|
import androidx.compose.ui.text.style.TextAlign
|
|
|
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
|
|
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
@ -268,23 +275,30 @@ private fun LazyStaggeredGridScope.onboarding(
|
|
|
|
|
|
|
|
|
|
|
|
is OnboardingUiState.Shown -> {
|
|
|
|
is OnboardingUiState.Shown -> {
|
|
|
|
item(span = StaggeredGridItemSpan.FullLine, contentType = "onboarding") {
|
|
|
|
item(span = StaggeredGridItemSpan.FullLine, contentType = "onboarding") {
|
|
|
|
Column(modifier = interestsItemModifier) {
|
|
|
|
Column(
|
|
|
|
Text(
|
|
|
|
modifier = interestsItemModifier,
|
|
|
|
text = stringResource(R.string.feature_foryou_onboarding_guidance_title),
|
|
|
|
) {
|
|
|
|
textAlign = TextAlign.Center,
|
|
|
|
Column(
|
|
|
|
modifier = Modifier
|
|
|
|
modifier = Modifier
|
|
|
|
.fillMaxWidth()
|
|
|
|
.semantics(mergeDescendants = true) { },
|
|
|
|
.padding(top = 24.dp),
|
|
|
|
) {
|
|
|
|
style = MaterialTheme.typography.titleMedium,
|
|
|
|
Text(
|
|
|
|
)
|
|
|
|
text = stringResource(R.string.feature_foryou_onboarding_guidance_title),
|
|
|
|
Text(
|
|
|
|
textAlign = TextAlign.Center,
|
|
|
|
text = stringResource(R.string.feature_foryou_onboarding_guidance_subtitle),
|
|
|
|
modifier = Modifier
|
|
|
|
modifier = Modifier
|
|
|
|
.fillMaxWidth()
|
|
|
|
.fillMaxWidth()
|
|
|
|
.padding(top = 24.dp),
|
|
|
|
.padding(top = 8.dp, start = 24.dp, end = 24.dp),
|
|
|
|
style = MaterialTheme.typography.titleMedium,
|
|
|
|
textAlign = TextAlign.Center,
|
|
|
|
)
|
|
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
|
|
Text(
|
|
|
|
)
|
|
|
|
text = stringResource(R.string.feature_foryou_onboarding_guidance_subtitle),
|
|
|
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
|
|
|
.fillMaxWidth()
|
|
|
|
|
|
|
|
.padding(top = 8.dp, start = 24.dp, end = 24.dp),
|
|
|
|
|
|
|
|
textAlign = TextAlign.Center,
|
|
|
|
|
|
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
TopicSelection(
|
|
|
|
TopicSelection(
|
|
|
|
onboardingUiState,
|
|
|
|
onboardingUiState,
|
|
|
|
onTopicCheckedChanged,
|
|
|
|
onTopicCheckedChanged,
|
|
|
@ -384,7 +398,21 @@ private fun SingleTopicButton(
|
|
|
|
Surface(
|
|
|
|
Surface(
|
|
|
|
modifier = Modifier
|
|
|
|
modifier = Modifier
|
|
|
|
.width(312.dp)
|
|
|
|
.width(312.dp)
|
|
|
|
.heightIn(min = 56.dp),
|
|
|
|
.heightIn(min = 56.dp)
|
|
|
|
|
|
|
|
.semantics(mergeDescendants = true) {
|
|
|
|
|
|
|
|
toggleableState = if (isSelected) {
|
|
|
|
|
|
|
|
On
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Off
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stateDescription = if (isSelected) {
|
|
|
|
|
|
|
|
"Following"
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
"Not Following"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contentDescription = name
|
|
|
|
|
|
|
|
},
|
|
|
|
shape = RoundedCornerShape(corner = CornerSize(8.dp)),
|
|
|
|
shape = RoundedCornerShape(corner = CornerSize(8.dp)),
|
|
|
|
color = MaterialTheme.colorScheme.surface,
|
|
|
|
color = MaterialTheme.colorScheme.surface,
|
|
|
|
selected = isSelected,
|
|
|
|
selected = isSelected,
|
|
|
@ -394,7 +422,9 @@ private fun SingleTopicButton(
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
|
|
modifier = Modifier.padding(start = 12.dp, end = 8.dp),
|
|
|
|
modifier = Modifier
|
|
|
|
|
|
|
|
.padding(start = 12.dp, end = 8.dp)
|
|
|
|
|
|
|
|
.clearAndSetSemantics { },
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
TopicIcon(
|
|
|
|
TopicIcon(
|
|
|
|
imageUrl = imageUrl,
|
|
|
|
imageUrl = imageUrl,
|
|
|
@ -413,13 +443,19 @@ private fun SingleTopicButton(
|
|
|
|
icon = {
|
|
|
|
icon = {
|
|
|
|
Icon(
|
|
|
|
Icon(
|
|
|
|
imageVector = NiaIcons.Add,
|
|
|
|
imageVector = NiaIcons.Add,
|
|
|
|
contentDescription = name,
|
|
|
|
contentDescription = stringResource(
|
|
|
|
|
|
|
|
id = R.string.feature_foryou_topic_icon_add,
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
checkedIcon = {
|
|
|
|
checkedIcon = {
|
|
|
|
Icon(
|
|
|
|
Icon(
|
|
|
|
imageVector = NiaIcons.Check,
|
|
|
|
imageVector = NiaIcons.Check,
|
|
|
|
contentDescription = name,
|
|
|
|
contentDescription = stringResource(
|
|
|
|
|
|
|
|
id = R.string.feature_foryou_topic_icon_checked,
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|