-
Notifications
You must be signed in to change notification settings - Fork 0
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 #265 from PermanentOrg/feature/VSP-1347
Implementation of onboarding screen: ...
- Loading branch information
Showing
20 changed files
with
346 additions
and
25 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
98 changes: 96 additions & 2 deletions
98
app/src/main/java/org/permanent/permanent/ui/archiveOnboarding/compose/TypeSelectionPage.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 |
---|---|---|
@@ -1,40 +1,134 @@ | ||
@file:OptIn(ExperimentalFoundationApi::class) | ||
|
||
package org.permanent.permanent.ui.archiveOnboarding.compose | ||
|
||
import androidx.compose.foundation.ExperimentalFoundationApi | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxHeight | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.pager.PagerState | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.AnnotatedString | ||
import androidx.compose.ui.text.SpanStyle | ||
import androidx.compose.ui.text.font.Font | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import androidx.core.content.ContextCompat | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.launch | ||
import org.permanent.permanent.R | ||
import org.permanent.permanent.ui.composeComponents.ButtonColor | ||
import org.permanent.permanent.ui.composeComponents.ButtonIconAlignment | ||
import org.permanent.permanent.ui.composeComponents.CustomDropdown | ||
import org.permanent.permanent.ui.composeComponents.SmallTextAndIconButton | ||
|
||
@Composable | ||
fun TypeSelectionPage() { | ||
fun TypeSelectionPage(isTablet: Boolean, pagerState: PagerState) { | ||
val context = LocalContext.current | ||
val coroutineScope = rememberCoroutineScope() | ||
val whiteColor = Color(ContextCompat.getColor(context, R.color.white)) | ||
val regularFont = FontFamily(Font(R.font.open_sans_regular_ttf)) | ||
|
||
// if (isTablet) { | ||
// TabletBody(whiteColor, regularFont) | ||
// } else { | ||
PhoneBody(whiteColor, regularFont, coroutineScope, pagerState) | ||
// } | ||
} | ||
|
||
@Composable | ||
private fun PhoneBody( | ||
whiteColor: Color, | ||
regularFont: FontFamily, | ||
coroutineScope: CoroutineScope, | ||
pagerState: PagerState | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxHeight() | ||
.padding(vertical = 32.dp), | ||
verticalArrangement = Arrangement.spacedBy(24.dp) | ||
) { | ||
val titleText = stringResource(id = R.string.create_your_first_archive_title) | ||
val boldedWord = "archive" | ||
val start = titleText.indexOf(boldedWord) | ||
val spanStyles = listOf( | ||
AnnotatedString.Range( | ||
SpanStyle(fontWeight = FontWeight.Bold), | ||
start = start, | ||
end = start + boldedWord.length | ||
) | ||
) | ||
|
||
Text( | ||
text = stringResource(id = R.string.create_your_first_archive_title), | ||
text = AnnotatedString(text = titleText, spanStyles = spanStyles), | ||
fontSize = 32.sp, | ||
lineHeight = 48.sp, | ||
color = whiteColor, | ||
fontFamily = regularFont | ||
) | ||
|
||
Text( | ||
text = stringResource(id = R.string.create_your_first_archive_description), | ||
fontSize = 14.sp, | ||
lineHeight = 24.sp, | ||
color = whiteColor, | ||
fontFamily = regularFont | ||
) | ||
|
||
CustomDropdown() | ||
|
||
Spacer(modifier = Modifier.weight(1f)) | ||
|
||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalArrangement = Arrangement.spacedBy(24.dp) | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.weight(1f) | ||
) { | ||
SmallTextAndIconButton( | ||
ButtonColor.TRANSPARENT, | ||
text = stringResource(id = R.string.back), | ||
icon = painterResource(id = R.drawable.ic_arrow_back_rounded_white), | ||
iconAlignment = ButtonIconAlignment.START | ||
) { | ||
coroutineScope.launch { | ||
pagerState.animateScrollToPage(0) | ||
} | ||
} | ||
} | ||
|
||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.weight(1f) | ||
) { | ||
SmallTextAndIconButton( | ||
ButtonColor.LIGHT, | ||
text = stringResource(id = R.string.next) | ||
) { | ||
coroutineScope.launch { | ||
pagerState.animateScrollToPage(2) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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
91 changes: 91 additions & 0 deletions
91
app/src/main/java/org/permanent/permanent/ui/composeComponents/CustomDropdown.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,91 @@ | ||
package org.permanent.permanent.ui.composeComponents | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Brush | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.font.Font | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import androidx.core.content.ContextCompat | ||
import org.permanent.permanent.R | ||
|
||
@Composable | ||
fun CustomDropdown() { | ||
val context = LocalContext.current | ||
val whiteColor = Color(ContextCompat.getColor(context, R.color.white)) | ||
val purpleColor = Color(ContextCompat.getColor(context, R.color.barneyPurple)) | ||
val accentColor = Color(ContextCompat.getColor(context, R.color.colorAccent)) | ||
val semiboldFont = FontFamily(Font(R.font.open_sans_semibold_ttf)) | ||
val regularFont = FontFamily(Font(R.font.open_sans_regular_ttf)) | ||
|
||
Button(modifier = Modifier | ||
.fillMaxWidth() | ||
.height(112.dp) | ||
.background( | ||
Brush.horizontalGradient(listOf(purpleColor, accentColor)), | ||
RoundedCornerShape(12.dp) | ||
), | ||
colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent), | ||
shape = RoundedCornerShape(12.dp), | ||
onClick = { }) { | ||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
verticalAlignment = Alignment.Top, | ||
horizontalArrangement = Arrangement.spacedBy(24.dp) | ||
) { | ||
Image( | ||
painter = painterResource(id = R.drawable.ic_heart_white), | ||
colorFilter = ColorFilter.tint(whiteColor), | ||
contentDescription = "", | ||
modifier = Modifier.size(16.dp) | ||
) | ||
|
||
Column( | ||
modifier = Modifier.weight(1.0f, fill = false), | ||
verticalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
Text( | ||
text = stringResource(id = R.string.individual), | ||
color = whiteColor, | ||
fontSize = 14.sp, | ||
lineHeight = 24.sp, | ||
fontFamily = semiboldFont, | ||
) | ||
|
||
Text( | ||
text = stringResource(id = R.string.individual_description), | ||
color = whiteColor, | ||
fontSize = 12.sp, | ||
lineHeight = 16.sp, | ||
fontFamily = regularFont, | ||
) | ||
} | ||
|
||
Image( | ||
painter = painterResource(id = R.drawable.ic_arrow_drop_down), | ||
colorFilter = ColorFilter.tint(whiteColor), | ||
contentDescription = "Drop down", | ||
modifier = Modifier.size(12.dp) | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.