-
-
Notifications
You must be signed in to change notification settings - Fork 3
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 #57 from aritra-tech/account_screen_v2
Account screen v2
- Loading branch information
Showing
58 changed files
with
2,035 additions
and
357 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
61 changes: 61 additions & 0 deletions
61
app/src/main/java/com/geekymusketeers/uncrack/components/AccountOption.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,61 @@ | ||
package com.geekymusketeers.uncrack.components | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import coil.compose.AsyncImage | ||
import coil.request.ImageRequest | ||
import com.geekymusketeers.uncrack.presentation.account.AccountItems | ||
import com.geekymusketeers.uncrack.ui.theme.OnSurfaceLight | ||
import com.geekymusketeers.uncrack.ui.theme.normal16 | ||
|
||
@Composable | ||
fun AccountOption( | ||
accountItem: AccountItems, | ||
modifier: Modifier = Modifier, | ||
onClick: (AccountItems) -> Unit | ||
) { | ||
|
||
val context = LocalContext.current | ||
|
||
Row( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.clickable { onClick(accountItem) } | ||
.padding(16.dp), | ||
horizontalArrangement = Arrangement.spacedBy(16.dp, Alignment.Start), | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
|
||
AsyncImage( | ||
model = ImageRequest.Builder(context) | ||
.data(accountItem.icon) | ||
.size(coil.size.Size.ORIGINAL) | ||
.build(), contentDescription = null, | ||
modifier = Modifier.size(24.dp) | ||
) | ||
|
||
Text( | ||
text = accountItem.itemsName, | ||
style = normal16.copy(color = OnSurfaceLight) | ||
) | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
private fun SettingsItemPreview() { | ||
AccountOption(AccountItems.BIOMETRIC) { | ||
// Do something | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
app/src/main/java/com/geekymusketeers/uncrack/components/OnboardingComponent.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
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/geekymusketeers/uncrack/components/ProfileContainer.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,48 @@ | ||
package com.geekymusketeers.uncrack.components | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.Add | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
import com.geekymusketeers.uncrack.R | ||
|
||
@Composable | ||
fun ProfileContainer( | ||
modifier: Modifier = Modifier, | ||
onEditButtonClick: () -> Unit | ||
) { | ||
Box(contentAlignment = Alignment.BottomEnd) { | ||
Image( | ||
painter = painterResource(id = R.drawable.no_user_profile_picture), | ||
contentDescription = null, | ||
contentScale = ContentScale.Crop, | ||
modifier = modifier | ||
.size(120.dp) | ||
.clip(CircleShape) | ||
) | ||
|
||
Button( | ||
modifier = Modifier.size(25.dp), | ||
shape = CircleShape, | ||
colors = ButtonDefaults.buttonColors(containerColor = Color.Blue), | ||
contentPadding = PaddingValues(0.dp), | ||
onClick = { onEditButtonClick() } | ||
) { | ||
Icon(imageVector = Icons.Outlined.Add, contentDescription = null, tint = Color.White) | ||
} | ||
} | ||
} |
116 changes: 116 additions & 0 deletions
116
app/src/main/java/com/geekymusketeers/uncrack/components/ThemeDialog.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,116 @@ | ||
package com.geekymusketeers.uncrack.components | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.BasicAlertDialog | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TextButton | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.vectorResource | ||
import androidx.compose.ui.unit.dp | ||
import com.geekymusketeers.uncrack.R | ||
import com.geekymusketeers.uncrack.ui.theme.light16 | ||
import com.geekymusketeers.uncrack.ui.theme.medium14 | ||
import com.geekymusketeers.uncrack.ui.theme.normal24 | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun ThemeDialog( | ||
onDismissRequest: () -> Unit | ||
) { | ||
|
||
BasicAlertDialog( | ||
onDismissRequest = { onDismissRequest() } | ||
) { | ||
Column( | ||
Modifier | ||
.background(MaterialTheme.colorScheme.background, RoundedCornerShape(28.dp)) | ||
.padding(vertical = 24.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy(16.dp) | ||
) { | ||
|
||
Icon( | ||
imageVector = ImageVector.vectorResource(id = R.drawable.themes), | ||
contentDescription = null, | ||
tint = MaterialTheme.colorScheme.onPrimaryContainer | ||
) | ||
|
||
Text( | ||
text = "Change Theme", | ||
style = normal24.copy(MaterialTheme.colorScheme.onSurface) | ||
) | ||
|
||
Column { | ||
|
||
|
||
Text( | ||
text = "Dark Mode", | ||
modifier = Modifier | ||
.clickable { | ||
// TODO: Impl the logic | ||
onDismissRequest() | ||
} | ||
.fillMaxWidth() | ||
.padding(vertical = 16.dp, horizontal = 32.dp), | ||
style = light16.copy(color = MaterialTheme.colorScheme.onSurfaceVariant), | ||
) | ||
|
||
Text( | ||
text = "Light Mode", | ||
modifier = Modifier | ||
.clickable { | ||
// TODO: Impl the logic | ||
onDismissRequest() | ||
} | ||
.fillMaxWidth() | ||
.padding(vertical = 16.dp, horizontal = 32.dp), | ||
style = light16.copy(color = MaterialTheme.colorScheme.onSurfaceVariant), | ||
) | ||
|
||
Text( | ||
text = "Dynamic Theme", | ||
modifier = Modifier | ||
.clickable { | ||
// TODO: Impl the logic | ||
onDismissRequest() | ||
} | ||
.fillMaxWidth() | ||
.padding(vertical = 16.dp, horizontal = 32.dp), | ||
style = light16.copy(color = MaterialTheme.colorScheme.onSurfaceVariant), | ||
) | ||
} | ||
|
||
TextButton( | ||
onClick = { | ||
onDismissRequest() | ||
}, | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = Color.Transparent, | ||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer | ||
), | ||
modifier = Modifier | ||
.align(Alignment.End) | ||
.padding(end = 24.dp) | ||
) { | ||
Text( | ||
text = "Dismiss", | ||
style = medium14 | ||
) | ||
} | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/geekymusketeers/uncrack/components/UCTopAppBar.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,59 @@ | ||
package com.geekymusketeers.uncrack.components | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.filled.ArrowBack | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBar | ||
import androidx.compose.material3.TopAppBarColors | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.unit.TextUnit | ||
import androidx.compose.ui.unit.sp | ||
import com.geekymusketeers.uncrack.ui.theme.BackgroundLight | ||
import com.geekymusketeers.uncrack.ui.theme.DMSansFontFamily | ||
import com.geekymusketeers.uncrack.ui.theme.OnSurfaceLight | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun UCTopAppBar( | ||
modifier: Modifier = Modifier, | ||
title: String = "", | ||
navigationIcon: ImageVector = Icons.AutoMirrored.Filled.ArrowBack, | ||
shouldShowBackButton: Boolean = true, | ||
fontSize: TextUnit = 22.sp, | ||
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(BackgroundLight), | ||
onBackPress: () -> Unit = {}, | ||
) { | ||
TopAppBar( | ||
modifier = modifier, | ||
title = { | ||
Text( | ||
text = title, | ||
fontFamily = DMSansFontFamily, | ||
fontSize = fontSize, | ||
color = OnSurfaceLight, | ||
overflow = TextOverflow.Ellipsis, | ||
maxLines = 1, | ||
) | ||
}, | ||
navigationIcon = { | ||
if (shouldShowBackButton) { | ||
IconButton(onClick = { | ||
onBackPress() | ||
}) { | ||
Icon( | ||
imageVector = navigationIcon, | ||
contentDescription = null | ||
) | ||
} | ||
} | ||
}, | ||
colors = colors | ||
) | ||
} |
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.