Pass the torch... initial commit.
This commit is contained in:
commit
0652c6add4
68 files changed
+2794
No files matched your search
@@ -0,0 +1,44 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="450dp"
|
||||
android:height="450dp"
|
||||
android:viewportWidth="64"
|
||||
android:viewportHeight="64">
|
||||
<path
|
||||
android:pathData="M56.25,18V46L32,60 7.75,46V18L32,4Z"
|
||||
android:fillColor="#6075f2"/>
|
||||
<path
|
||||
android:pathData="m41.5,26.5v11L32,43V60L56.25,46V18Z"
|
||||
android:fillColor="#6b57ff"/>
|
||||
<path
|
||||
android:pathData="m32,43 l-9.5,-5.5v-11L7.75,18V46L32,60Z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:centerX="23.131"
|
||||
android:centerY="18.441"
|
||||
android:gradientRadius="42.132"
|
||||
android:type="radial">
|
||||
<item android:offset="0" android:color="#FF5383EC"/>
|
||||
<item android:offset="0.867" android:color="#FF7F52FF"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:pathData="M22.5,26.5 L32,21 41.5,26.5 56.25,18 32,4 7.75,18Z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startX="44.172"
|
||||
android:startY="4.377"
|
||||
android:endX="17.973"
|
||||
android:endY="34.035"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#FF33C3FF"/>
|
||||
<item android:offset="0.878" android:color="#FF5383EC"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:pathData="m32,21 l9.526,5.5v11L32,43 22.474,37.5v-11z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,66 @@
|
||||
package ac.aux.compose
|
||||
|
||||
import ac.aux.compose.ui.composable.navigation.AuxNavHost
|
||||
import ac.aux.compose.ui.theme.AuxTheme
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.safeContentPadding
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.navigation.NavHostController
|
||||
import org.jetbrains.compose.resources.painterResource
|
||||
|
||||
import aux.composeapp.generated.resources.Res
|
||||
import aux.composeapp.generated.resources.compose_multiplatform
|
||||
|
||||
@Composable
|
||||
fun AuxApp(
|
||||
navController: NavHostController,
|
||||
) {
|
||||
AuxTheme {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
AuxNavHost(
|
||||
|
||||
navController = navController,
|
||||
startDestination = LandingRoute
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
MaterialTheme {
|
||||
var showContent by remember { mutableStateOf(false) }
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(MaterialTheme.colorScheme.primaryContainer)
|
||||
.safeContentPadding()
|
||||
.fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Button(onClick = { showContent = !showContent }) {
|
||||
Text("Click me!")
|
||||
}
|
||||
AnimatedVisibility(showContent) {
|
||||
val greeting = remember { Greeting().greet() }
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Image(painterResource(Res.drawable.compose_multiplatform), null)
|
||||
Text("Compose: $greeting")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package ac.aux.compose
|
||||
|
||||
class Greeting {
|
||||
private val platform = getPlatform()
|
||||
|
||||
fun greet(): String {
|
||||
return "Hello, ${platform.name}!"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package ac.aux.compose
|
||||
|
||||
interface Platform {
|
||||
val name: String
|
||||
}
|
||||
|
||||
expect fun getPlatform(): Platform
|
||||
@@ -0,0 +1,282 @@
|
||||
package ac.aux.compose.ui.composable
|
||||
|
||||
import ac.aux.compose.ui.theme.AuxTheme
|
||||
import ac.aux.compose.ui.view.model.CreateProfileViewModel
|
||||
import ac.aux.compose.ui.view.state.CreateProfileUIState
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Badge
|
||||
import androidx.compose.material.icons.filled.Description
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
|
||||
@Composable
|
||||
fun CreateProfileScreen(
|
||||
initialCreateProfileUIState: CreateProfileUIState = CreateProfileUIState.Declaration,
|
||||
onNavigateToChatListRoute: () -> Unit
|
||||
) {
|
||||
val createProfileViewModel: CreateProfileViewModel = viewModel (
|
||||
factory = CreateProfileViewModel.factory(
|
||||
initialCreateProfileUIState
|
||||
)
|
||||
)
|
||||
Scaffold { innerPadding ->
|
||||
Column(
|
||||
modifier = Modifier.padding(innerPadding)
|
||||
) {
|
||||
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(
|
||||
10.dp
|
||||
),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(20.dp)
|
||||
) {
|
||||
|
||||
when (val createAccountUIState = createProfileViewModel.createProfileUIState.value) {
|
||||
is CreateProfileUIState.Declaration -> {
|
||||
|
||||
Text(
|
||||
"Create Profile",
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)
|
||||
|
||||
Text(
|
||||
"You are about to create a NOSTR profile.",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Text(
|
||||
"It is cryptographical secure, and decentralized, putting you in total control of your digital profile",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Spacer(
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
|
||||
createProfileViewModel.createProfileUIState.value = CreateProfileUIState.InputPrompt
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
text = "Start"
|
||||
)
|
||||
}
|
||||
}
|
||||
is CreateProfileUIState.InputPrompt -> {
|
||||
Text(
|
||||
"Create Profile",
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)
|
||||
|
||||
TextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = createProfileViewModel.createProfileFormState.nameField.text.value,
|
||||
onValueChange = {
|
||||
|
||||
},
|
||||
isError = createProfileViewModel.createProfileFormState.nameField.errorMessage.value != null,
|
||||
supportingText = createProfileViewModel.createProfileFormState.nameField.errorMessage.value?.let {
|
||||
{
|
||||
Text(
|
||||
text = it,
|
||||
modifier = Modifier.padding(
|
||||
bottom = 8.dp
|
||||
)
|
||||
)
|
||||
}
|
||||
},
|
||||
maxLines = 1,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = KeyboardType.Phone,
|
||||
),
|
||||
label = {
|
||||
Text(
|
||||
text = "Name (eg. Alan Turin)",
|
||||
maxLines = 1,
|
||||
)
|
||||
},
|
||||
placeholder = {
|
||||
Text(
|
||||
text = "Enter the name you want to use for your profile",
|
||||
maxLines = 1,
|
||||
)
|
||||
},
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
Icons.Default.Badge,
|
||||
contentDescription = "Name"
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "This will be the display name for your profile and also important for search.",
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
TextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = createProfileViewModel.createProfileFormState.biographyField.text.value,
|
||||
onValueChange = {
|
||||
|
||||
},
|
||||
isError = createProfileViewModel.createProfileFormState.biographyField.errorMessage.value != null,
|
||||
supportingText = createProfileViewModel.createProfileFormState.biographyField.errorMessage.value?.let {
|
||||
{
|
||||
Text(
|
||||
text = it,
|
||||
modifier = Modifier.padding(
|
||||
bottom = 8.dp
|
||||
)
|
||||
)
|
||||
}
|
||||
},
|
||||
maxLines = 1,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = KeyboardType.Phone,
|
||||
),
|
||||
label = {
|
||||
Text(
|
||||
text = "Introduce yourself",
|
||||
maxLines = 1,
|
||||
|
||||
)
|
||||
},
|
||||
placeholder = {
|
||||
Text(
|
||||
text = "What should people know about you?",
|
||||
maxLines = 1,
|
||||
)
|
||||
},
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
Icons.Default.Description,
|
||||
contentDescription = "Name"
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "This will be shown when people open your profile.",
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
|
||||
createProfileViewModel.createProfileUIState.value =
|
||||
CreateProfileUIState.ConfirmInput(
|
||||
name = createProfileViewModel.createProfileFormState.nameField.text.value,
|
||||
bio = createProfileViewModel.createProfileFormState.biographyField.text.value
|
||||
)
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
"Next"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
is CreateProfileUIState.ConfirmInput -> {
|
||||
|
||||
Text(
|
||||
text = "Name",
|
||||
style = MaterialTheme.typography.labelLarge
|
||||
)
|
||||
|
||||
Text(
|
||||
text = createAccountUIState.name,
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "Bio",
|
||||
style = MaterialTheme.typography.labelLarge
|
||||
)
|
||||
|
||||
Text(
|
||||
text = createAccountUIState.bio,
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
|
||||
|
||||
Text(
|
||||
text = "The above will be your profile.",
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
|
||||
Spacer(
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "You will be in full control of this profile. If you would like to use it for the long term please remember to backup the profile/keys.",
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = onNavigateToChatListRoute
|
||||
) {
|
||||
Text(
|
||||
text = "Create Profile"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun CreateAccountScreenPreview() {
|
||||
AuxTheme {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
CreateProfileScreen(
|
||||
initialCreateProfileUIState =
|
||||
// CreateProfileUIState.InputPrompt
|
||||
CreateProfileUIState.ConfirmInput(
|
||||
name = "Alan Turing",
|
||||
bio = "Polyglot: Math... is my middle name, computer scientist. cryptographer, and gold hider."
|
||||
),
|
||||
onNavigateToChatListRoute = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package ac.aux.compose.ui.composable
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.jetbrains.compose.ui.tooling.preview.Preview
|
||||
|
||||
@Composable
|
||||
fun ImplementationPendingScreen(
|
||||
text: String
|
||||
) {
|
||||
|
||||
Scaffold { innerPadding ->
|
||||
Column(
|
||||
modifier = Modifier.padding(innerPadding).fillMaxSize()
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(20.dp).fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Text(
|
||||
"\"$text\" functionality coming soon",
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun ImplementationPendingScreenPreview() {
|
||||
AuxTheme {
|
||||
Surface(
|
||||
modifier = Modifier.padding(20.dp)
|
||||
) {
|
||||
ImplementationPendingScreen(
|
||||
"Sign in"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package ac.aux.compose.ui.composable
|
||||
|
||||
import ac.aux.compose.ui.theme.AuxTheme
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun LandingScreen(
|
||||
onNavigateToLearnMore: () -> Unit,
|
||||
onNavigateToSignIn: () -> Unit,
|
||||
onNavigateToCreateProfile: () -> Unit
|
||||
) {
|
||||
Scaffold { innerPadding ->
|
||||
Column(
|
||||
modifier = Modifier.padding(innerPadding)
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Aux",
|
||||
style = MaterialTheme.typography.headlineLarge
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "Keep the feed alive."
|
||||
)
|
||||
|
||||
TextButton(
|
||||
onClick = onNavigateToLearnMore
|
||||
) {
|
||||
Text(
|
||||
text = "Learn More",
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = onNavigateToSignIn
|
||||
) {
|
||||
|
||||
Text(
|
||||
"Sign in",
|
||||
style = MaterialTheme.typography.bodyLarge
|
||||
)
|
||||
}
|
||||
|
||||
Text(
|
||||
text = "Sign in to Torch via nsec, or remote signer",
|
||||
modifier = Modifier.padding(10.dp),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Spacer(
|
||||
modifier = Modifier.height(20.dp)
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = onNavigateToCreateProfile
|
||||
) {
|
||||
Text(
|
||||
"Create Profile",
|
||||
style = MaterialTheme.typography.bodyLarge
|
||||
)
|
||||
|
||||
}
|
||||
Text(
|
||||
text = "If you are new to Torch or just want to create a fresh profile",
|
||||
modifier = Modifier.padding(10.dp),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun LandingScreenPreview() {
|
||||
AuxTheme {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
LandingScreen(
|
||||
onNavigateToSignIn = {},
|
||||
onNavigateToLearnMore = {},
|
||||
onNavigateToCreateProfile = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package ac.aux.compose.ui.composable.navigation
|
||||
|
||||
import ac.aux.compose.ui.composable.CreateProfileScreen
|
||||
import ac.aux.compose.ui.composable.ImplementationPendingScreen
|
||||
import ac.aux.compose.ui.composable.LandingScreen
|
||||
import ac.aux.compose.ui.composable.navigation.routes.CreateProfileRoute
|
||||
import ac.aux.compose.ui.composable.navigation.routes.ImplementationPendingRoute
|
||||
import ac.aux.compose.ui.composable.navigation.routes.LandingRoute
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.toRoute
|
||||
import ac.aux.compose.ui.composable.navigation.routes.Route
|
||||
|
||||
@Composable
|
||||
fun AuxNavHost(
|
||||
navController: NavHostController,
|
||||
startDestination: Route
|
||||
) {
|
||||
|
||||
NavHost(
|
||||
navController = navController,
|
||||
startDestination = startDestination
|
||||
) {
|
||||
composable<LandingRoute> {
|
||||
LandingScreen(
|
||||
onNavigateToLearnMore = {
|
||||
navController.navigate(
|
||||
route = ImplementationPendingRoute("Learn more")
|
||||
)
|
||||
},
|
||||
onNavigateToSignIn = {
|
||||
navController.navigate(
|
||||
route = ImplementationPendingRoute("Sign in")
|
||||
)
|
||||
},
|
||||
onNavigateToCreateProfile = {
|
||||
navController.navigate(
|
||||
route = CreateProfileRoute
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
composable<CreateProfileRoute> {
|
||||
CreateProfileScreen(
|
||||
onNavigateToChatListRoute = {
|
||||
navController.navigate(
|
||||
route = ImplementationPendingRoute("Chat List")
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
composable<ImplementationPendingRoute> { backStackEntry ->
|
||||
val route: ImplementationPendingRoute = backStackEntry.toRoute()
|
||||
ImplementationPendingScreen(
|
||||
route.name
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package ac.aux.compose.ui.composable.navigation.routes
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
object CreateProfileRoute: Route() {
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package ac.aux.compose.ui.composable.navigation.routes
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ImplementationPendingRoute(
|
||||
val name: String
|
||||
): Route() {
|
||||
}
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
package ac.aux.compose.ui.composable.navigation.routes
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
object LandingRoute: Route() {
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package ac.aux.compose.ui.composable.navigation.routes
|
||||
|
||||
abstract class Route
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
package ac.aux.compose.ui.composable.widgets
|
||||
|
||||
import ac.aux.compose.ui.theme.AuxTheme
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
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.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun LoadingDataIndicator(
|
||||
modifier: Modifier = Modifier.fillMaxWidth(),
|
||||
color: Color = MaterialTheme.colorScheme.secondary,
|
||||
fillScreen: Boolean = true,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
if (fillScreen) {
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
}
|
||||
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.width(80.dp).aspectRatio(1f),
|
||||
color = color,
|
||||
trackColor = MaterialTheme.colorScheme.surfaceVariant,
|
||||
)
|
||||
|
||||
if (fillScreen) {
|
||||
Spacer(modifier = Modifier.weight(3f))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun TransferHistoryScreenPreview() {
|
||||
AuxTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize()) {
|
||||
LoadingDataIndicator()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package ac.aux.compose.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val primaryLight = Color(0xFF000000)
|
||||
val onPrimaryLight = Color(0xFFFFFFFF)
|
||||
val primaryContainerLight = Color(0xFF1B1B1B)
|
||||
val onPrimaryContainerLight = Color(0xFF848484)
|
||||
val secondaryLight = Color(0xFF745B00)
|
||||
val onSecondaryLight = Color(0xFFFFFFFF)
|
||||
val secondaryContainerLight = Color(0xFFEFBF04)
|
||||
val onSecondaryContainerLight = Color(0xFF644F00)
|
||||
val tertiaryLight = Color(0xFF000000)
|
||||
val onTertiaryLight = Color(0xFFFFFFFF)
|
||||
val tertiaryContainerLight = Color(0xFF1B1B1B)
|
||||
val onTertiaryContainerLight = Color(0xFF848484)
|
||||
val errorLight = Color(0xFFBA1A1A)
|
||||
val onErrorLight = Color(0xFFFFFFFF)
|
||||
val errorContainerLight = Color(0xFFFFDAD6)
|
||||
val onErrorContainerLight = Color(0xFF93000A)
|
||||
val backgroundLight = Color(0xFFF9F9F9)
|
||||
val onBackgroundLight = Color(0xFF1B1B1B)
|
||||
val surfaceLight = Color(0xFFF9F9F9)
|
||||
val onSurfaceLight = Color(0xFF1B1B1B)
|
||||
val surfaceVariantLight = Color(0xFFEBE0E1)
|
||||
val onSurfaceVariantLight = Color(0xFF4C4546)
|
||||
val outlineLight = Color(0xFF7E7576)
|
||||
val outlineVariantLight = Color(0xFFCFC4C5)
|
||||
val scrimLight = Color(0xFF000000)
|
||||
val inverseSurfaceLight = Color(0xFF303030)
|
||||
val inverseOnSurfaceLight = Color(0xFFF1F1F1)
|
||||
val inversePrimaryLight = Color(0xFFC6C6C6)
|
||||
val surfaceDimLight = Color(0xFFDADADA)
|
||||
val surfaceBrightLight = Color(0xFFF9F9F9)
|
||||
val surfaceContainerLowestLight = Color(0xFFFFFFFF)
|
||||
val surfaceContainerLowLight = Color(0xFFF3F3F3)
|
||||
val surfaceContainerLight = Color(0xFFEEEEEE)
|
||||
val surfaceContainerHighLight = Color(0xFFE8E8E8)
|
||||
val surfaceContainerHighestLight = Color(0xFFE2E2E2)
|
||||
|
||||
val primaryLightMediumContrast = Color(0xFF000000)
|
||||
val onPrimaryLightMediumContrast = Color(0xFFFFFFFF)
|
||||
val primaryContainerLightMediumContrast = Color(0xFF1B1B1B)
|
||||
val onPrimaryContainerLightMediumContrast = Color(0xFFA7A7A7)
|
||||
val secondaryLightMediumContrast = Color(0xFF443400)
|
||||
val onSecondaryLightMediumContrast = Color(0xFFFFFFFF)
|
||||
val secondaryContainerLightMediumContrast = Color(0xFF866A00)
|
||||
val onSecondaryContainerLightMediumContrast = Color(0xFFFFFFFF)
|
||||
val tertiaryLightMediumContrast = Color(0xFF000000)
|
||||
val onTertiaryLightMediumContrast = Color(0xFFFFFFFF)
|
||||
val tertiaryContainerLightMediumContrast = Color(0xFF1B1B1B)
|
||||
val onTertiaryContainerLightMediumContrast = Color(0xFFA7A7A7)
|
||||
val errorLightMediumContrast = Color(0xFF740006)
|
||||
val onErrorLightMediumContrast = Color(0xFFFFFFFF)
|
||||
val errorContainerLightMediumContrast = Color(0xFFCF2C27)
|
||||
val onErrorContainerLightMediumContrast = Color(0xFFFFFFFF)
|
||||
val backgroundLightMediumContrast = Color(0xFFF9F9F9)
|
||||
val onBackgroundLightMediumContrast = Color(0xFF1B1B1B)
|
||||
val surfaceLightMediumContrast = Color(0xFFF9F9F9)
|
||||
val onSurfaceLightMediumContrast = Color(0xFF111111)
|
||||
val surfaceVariantLightMediumContrast = Color(0xFFEBE0E1)
|
||||
val onSurfaceVariantLightMediumContrast = Color(0xFF3B3436)
|
||||
val outlineLightMediumContrast = Color(0xFF585152)
|
||||
val outlineVariantLightMediumContrast = Color(0xFF736B6C)
|
||||
val scrimLightMediumContrast = Color(0xFF000000)
|
||||
val inverseSurfaceLightMediumContrast = Color(0xFF303030)
|
||||
val inverseOnSurfaceLightMediumContrast = Color(0xFFF1F1F1)
|
||||
val inversePrimaryLightMediumContrast = Color(0xFFC6C6C6)
|
||||
val surfaceDimLightMediumContrast = Color(0xFFC6C6C6)
|
||||
val surfaceBrightLightMediumContrast = Color(0xFFF9F9F9)
|
||||
val surfaceContainerLowestLightMediumContrast = Color(0xFFFFFFFF)
|
||||
val surfaceContainerLowLightMediumContrast = Color(0xFFF3F3F3)
|
||||
val surfaceContainerLightMediumContrast = Color(0xFFE8E8E8)
|
||||
val surfaceContainerHighLightMediumContrast = Color(0xFFDDDDDD)
|
||||
val surfaceContainerHighestLightMediumContrast = Color(0xFFD1D1D1)
|
||||
|
||||
val primaryLightHighContrast = Color(0xFF000000)
|
||||
val onPrimaryLightHighContrast = Color(0xFFFFFFFF)
|
||||
val primaryContainerLightHighContrast = Color(0xFF1B1B1B)
|
||||
val onPrimaryContainerLightHighContrast = Color(0xFFD0D0D0)
|
||||
val secondaryLightHighContrast = Color(0xFF382A00)
|
||||
val onSecondaryLightHighContrast = Color(0xFFFFFFFF)
|
||||
val secondaryContainerLightHighContrast = Color(0xFF5A4700)
|
||||
val onSecondaryContainerLightHighContrast = Color(0xFFFFFFFF)
|
||||
val tertiaryLightHighContrast = Color(0xFF000000)
|
||||
val onTertiaryLightHighContrast = Color(0xFFFFFFFF)
|
||||
val tertiaryContainerLightHighContrast = Color(0xFF1B1B1B)
|
||||
val onTertiaryContainerLightHighContrast = Color(0xFFD0D0D0)
|
||||
val errorLightHighContrast = Color(0xFF600004)
|
||||
val onErrorLightHighContrast = Color(0xFFFFFFFF)
|
||||
val errorContainerLightHighContrast = Color(0xFF98000A)
|
||||
val onErrorContainerLightHighContrast = Color(0xFFFFFFFF)
|
||||
val backgroundLightHighContrast = Color(0xFFF9F9F9)
|
||||
val onBackgroundLightHighContrast = Color(0xFF1B1B1B)
|
||||
val surfaceLightHighContrast = Color(0xFFF9F9F9)
|
||||
val onSurfaceLightHighContrast = Color(0xFF000000)
|
||||
val surfaceVariantLightHighContrast = Color(0xFFEBE0E1)
|
||||
val onSurfaceVariantLightHighContrast = Color(0xFF000000)
|
||||
val outlineLightHighContrast = Color(0xFF312B2C)
|
||||
val outlineVariantLightHighContrast = Color(0xFF4F4749)
|
||||
val scrimLightHighContrast = Color(0xFF000000)
|
||||
val inverseSurfaceLightHighContrast = Color(0xFF303030)
|
||||
val inverseOnSurfaceLightHighContrast = Color(0xFFFFFFFF)
|
||||
val inversePrimaryLightHighContrast = Color(0xFFC6C6C6)
|
||||
val surfaceDimLightHighContrast = Color(0xFFB9B9B9)
|
||||
val surfaceBrightLightHighContrast = Color(0xFFF9F9F9)
|
||||
val surfaceContainerLowestLightHighContrast = Color(0xFFFFFFFF)
|
||||
val surfaceContainerLowLightHighContrast = Color(0xFFF1F1F1)
|
||||
val surfaceContainerLightHighContrast = Color(0xFFE2E2E2)
|
||||
val surfaceContainerHighLightHighContrast = Color(0xFFD4D4D4)
|
||||
val surfaceContainerHighestLightHighContrast = Color(0xFFC6C6C6)
|
||||
|
||||
val primaryDark = Color(0xFFC6C6C6)
|
||||
val onPrimaryDark = Color(0xFF303030)
|
||||
val primaryContainerDark = Color(0xFF000000)
|
||||
val onPrimaryContainerDark = Color(0xFF757575)
|
||||
val secondaryDark = Color(0xFFFFDE82)
|
||||
val onSecondaryDark = Color(0xFF3D2F00)
|
||||
val secondaryContainerDark = Color(0xFFEFBF04)
|
||||
val onSecondaryContainerDark = Color(0xFF644F00)
|
||||
val tertiaryDark = Color(0xFFC6C6C6)
|
||||
val onTertiaryDark = Color(0xFF303030)
|
||||
val tertiaryContainerDark = Color(0xFF000000)
|
||||
val onTertiaryContainerDark = Color(0xFF757575)
|
||||
val errorDark = Color(0xFFFFB4AB)
|
||||
val onErrorDark = Color(0xFF690005)
|
||||
val errorContainerDark = Color(0xFF93000A)
|
||||
val onErrorContainerDark = Color(0xFFFFDAD6)
|
||||
val backgroundDark = Color(0xFF131313)
|
||||
val onBackgroundDark = Color(0xFFE2E2E2)
|
||||
val surfaceDark = Color(0xFF131313)
|
||||
val onSurfaceDark = Color(0xFFE2E2E2)
|
||||
val surfaceVariantDark = Color(0xFF4C4546)
|
||||
val onSurfaceVariantDark = Color(0xFFCFC4C5)
|
||||
val outlineDark = Color(0xFF988E90)
|
||||
val outlineVariantDark = Color(0xFF4C4546)
|
||||
val scrimDark = Color(0xFF000000)
|
||||
val inverseSurfaceDark = Color(0xFFE2E2E2)
|
||||
val inverseOnSurfaceDark = Color(0xFF303030)
|
||||
val inversePrimaryDark = Color(0xFF5E5E5E)
|
||||
val surfaceDimDark = Color(0xFF131313)
|
||||
val surfaceBrightDark = Color(0xFF393939)
|
||||
val surfaceContainerLowestDark = Color(0xFF0E0E0E)
|
||||
val surfaceContainerLowDark = Color(0xFF1B1B1B)
|
||||
val surfaceContainerDark = Color(0xFF1F1F1F)
|
||||
val surfaceContainerHighDark = Color(0xFF2A2A2A)
|
||||
val surfaceContainerHighestDark = Color(0xFF353535)
|
||||
|
||||
val primaryDarkMediumContrast = Color(0xFFDCDCDC)
|
||||
val onPrimaryDarkMediumContrast = Color(0xFF262626)
|
||||
val primaryContainerDarkMediumContrast = Color(0xFF919191)
|
||||
val onPrimaryContainerDarkMediumContrast = Color(0xFF000000)
|
||||
val secondaryDarkMediumContrast = Color(0xFFFFDE82)
|
||||
val onSecondaryDarkMediumContrast = Color(0xFF342700)
|
||||
val secondaryContainerDarkMediumContrast = Color(0xFFEFBF04)
|
||||
val onSecondaryContainerDarkMediumContrast = Color(0xFF423300)
|
||||
val tertiaryDarkMediumContrast = Color(0xFFDCDCDC)
|
||||
val onTertiaryDarkMediumContrast = Color(0xFF262626)
|
||||
val tertiaryContainerDarkMediumContrast = Color(0xFF919191)
|
||||
val onTertiaryContainerDarkMediumContrast = Color(0xFF000000)
|
||||
val errorDarkMediumContrast = Color(0xFFFFD2CC)
|
||||
val onErrorDarkMediumContrast = Color(0xFF540003)
|
||||
val errorContainerDarkMediumContrast = Color(0xFFFF5449)
|
||||
val onErrorContainerDarkMediumContrast = Color(0xFF000000)
|
||||
val backgroundDarkMediumContrast = Color(0xFF131313)
|
||||
val onBackgroundDarkMediumContrast = Color(0xFFE2E2E2)
|
||||
val surfaceDarkMediumContrast = Color(0xFF131313)
|
||||
val onSurfaceDarkMediumContrast = Color(0xFFFFFFFF)
|
||||
val surfaceVariantDarkMediumContrast = Color(0xFF4C4546)
|
||||
val onSurfaceVariantDarkMediumContrast = Color(0xFFE5DADB)
|
||||
val outlineDarkMediumContrast = Color(0xFFBAAFB1)
|
||||
val outlineVariantDarkMediumContrast = Color(0xFF988E8F)
|
||||
val scrimDarkMediumContrast = Color(0xFF000000)
|
||||
val inverseSurfaceDarkMediumContrast = Color(0xFFE2E2E2)
|
||||
val inverseOnSurfaceDarkMediumContrast = Color(0xFF2A2A2A)
|
||||
val inversePrimaryDarkMediumContrast = Color(0xFF484848)
|
||||
val surfaceDimDarkMediumContrast = Color(0xFF131313)
|
||||
val surfaceBrightDarkMediumContrast = Color(0xFF444444)
|
||||
val surfaceContainerLowestDarkMediumContrast = Color(0xFF070707)
|
||||
val surfaceContainerLowDarkMediumContrast = Color(0xFF1D1D1D)
|
||||
val surfaceContainerDarkMediumContrast = Color(0xFF282828)
|
||||
val surfaceContainerHighDarkMediumContrast = Color(0xFF323232)
|
||||
val surfaceContainerHighestDarkMediumContrast = Color(0xFF3E3E3E)
|
||||
|
||||
val primaryDarkHighContrast = Color(0xFFF0F0F0)
|
||||
val onPrimaryDarkHighContrast = Color(0xFF000000)
|
||||
val primaryContainerDarkHighContrast = Color(0xFFC2C2C2)
|
||||
val onPrimaryContainerDarkHighContrast = Color(0xFF0B0B0B)
|
||||
val secondaryDarkHighContrast = Color(0xFFFFEFCA)
|
||||
val onSecondaryDarkHighContrast = Color(0xFF000000)
|
||||
val secondaryContainerDarkHighContrast = Color(0xFFEFBF04)
|
||||
val onSecondaryContainerDarkHighContrast = Color(0xFF140E00)
|
||||
val tertiaryDarkHighContrast = Color(0xFFF0F0F0)
|
||||
val onTertiaryDarkHighContrast = Color(0xFF000000)
|
||||
val tertiaryContainerDarkHighContrast = Color(0xFFC2C2C2)
|
||||
val onTertiaryContainerDarkHighContrast = Color(0xFF0B0B0B)
|
||||
val errorDarkHighContrast = Color(0xFFFFECE9)
|
||||
val onErrorDarkHighContrast = Color(0xFF000000)
|
||||
val errorContainerDarkHighContrast = Color(0xFFFFAEA4)
|
||||
val onErrorContainerDarkHighContrast = Color(0xFF220001)
|
||||
val backgroundDarkHighContrast = Color(0xFF131313)
|
||||
val onBackgroundDarkHighContrast = Color(0xFFE2E2E2)
|
||||
val surfaceDarkHighContrast = Color(0xFF131313)
|
||||
val onSurfaceDarkHighContrast = Color(0xFFFFFFFF)
|
||||
val surfaceVariantDarkHighContrast = Color(0xFF4C4546)
|
||||
val onSurfaceVariantDarkHighContrast = Color(0xFFFFFFFF)
|
||||
val outlineDarkHighContrast = Color(0xFFF9EDEF)
|
||||
val outlineVariantDarkHighContrast = Color(0xFFCBC0C1)
|
||||
val scrimDarkHighContrast = Color(0xFF000000)
|
||||
val inverseSurfaceDarkHighContrast = Color(0xFFE2E2E2)
|
||||
val inverseOnSurfaceDarkHighContrast = Color(0xFF000000)
|
||||
val inversePrimaryDarkHighContrast = Color(0xFF484848)
|
||||
val surfaceDimDarkHighContrast = Color(0xFF131313)
|
||||
val surfaceBrightDarkHighContrast = Color(0xFF505050)
|
||||
val surfaceContainerLowestDarkHighContrast = Color(0xFF000000)
|
||||
val surfaceContainerLowDarkHighContrast = Color(0xFF1F1F1F)
|
||||
val surfaceContainerDarkHighContrast = Color(0xFF303030)
|
||||
val surfaceContainerHighDarkHighContrast = Color(0xFF3B3B3B)
|
||||
val surfaceContainerHighestDarkHighContrast = Color(0xFF474747)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
package ac.aux.compose.ui.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.ColorScheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import com.example.ui.theme.AuxTypography
|
||||
|
||||
private val lightScheme = lightColorScheme(
|
||||
primary = primaryLight,
|
||||
onPrimary = onPrimaryLight,
|
||||
primaryContainer = primaryContainerLight,
|
||||
onPrimaryContainer = onPrimaryContainerLight,
|
||||
secondary = secondaryLight,
|
||||
onSecondary = onSecondaryLight,
|
||||
secondaryContainer = secondaryContainerLight,
|
||||
onSecondaryContainer = onSecondaryContainerLight,
|
||||
tertiary = tertiaryLight,
|
||||
onTertiary = onTertiaryLight,
|
||||
tertiaryContainer = tertiaryContainerLight,
|
||||
onTertiaryContainer = onTertiaryContainerLight,
|
||||
error = errorLight,
|
||||
onError = onErrorLight,
|
||||
errorContainer = errorContainerLight,
|
||||
onErrorContainer = onErrorContainerLight,
|
||||
background = backgroundLight,
|
||||
onBackground = onBackgroundLight,
|
||||
surface = surfaceLight,
|
||||
onSurface = onSurfaceLight,
|
||||
surfaceVariant = surfaceVariantLight,
|
||||
onSurfaceVariant = onSurfaceVariantLight,
|
||||
outline = outlineLight,
|
||||
outlineVariant = outlineVariantLight,
|
||||
scrim = scrimLight,
|
||||
inverseSurface = inverseSurfaceLight,
|
||||
inverseOnSurface = inverseOnSurfaceLight,
|
||||
inversePrimary = inversePrimaryLight,
|
||||
surfaceDim = surfaceDimLight,
|
||||
surfaceBright = surfaceBrightLight,
|
||||
surfaceContainerLowest = surfaceContainerLowestLight,
|
||||
surfaceContainerLow = surfaceContainerLowLight,
|
||||
surfaceContainer = surfaceContainerLight,
|
||||
surfaceContainerHigh = surfaceContainerHighLight,
|
||||
surfaceContainerHighest = surfaceContainerHighestLight,
|
||||
)
|
||||
|
||||
private val darkScheme = darkColorScheme(
|
||||
primary = primaryDark,
|
||||
onPrimary = onPrimaryDark,
|
||||
primaryContainer = primaryContainerDark,
|
||||
onPrimaryContainer = onPrimaryContainerDark,
|
||||
secondary = secondaryDark,
|
||||
onSecondary = onSecondaryDark,
|
||||
secondaryContainer = secondaryContainerDark,
|
||||
onSecondaryContainer = onSecondaryContainerDark,
|
||||
tertiary = tertiaryDark,
|
||||
onTertiary = onTertiaryDark,
|
||||
tertiaryContainer = tertiaryContainerDark,
|
||||
onTertiaryContainer = onTertiaryContainerDark,
|
||||
error = errorDark,
|
||||
onError = onErrorDark,
|
||||
errorContainer = errorContainerDark,
|
||||
onErrorContainer = onErrorContainerDark,
|
||||
background = backgroundDark,
|
||||
onBackground = onBackgroundDark,
|
||||
surface = surfaceDark,
|
||||
onSurface = onSurfaceDark,
|
||||
surfaceVariant = surfaceVariantDark,
|
||||
onSurfaceVariant = onSurfaceVariantDark,
|
||||
outline = outlineDark,
|
||||
outlineVariant = outlineVariantDark,
|
||||
scrim = scrimDark,
|
||||
inverseSurface = inverseSurfaceDark,
|
||||
inverseOnSurface = inverseOnSurfaceDark,
|
||||
inversePrimary = inversePrimaryDark,
|
||||
surfaceDim = surfaceDimDark,
|
||||
surfaceBright = surfaceBrightDark,
|
||||
surfaceContainerLowest = surfaceContainerLowestDark,
|
||||
surfaceContainerLow = surfaceContainerLowDark,
|
||||
surfaceContainer = surfaceContainerDark,
|
||||
surfaceContainerHigh = surfaceContainerHighDark,
|
||||
surfaceContainerHighest = surfaceContainerHighestDark,
|
||||
)
|
||||
|
||||
private val mediumContrastLightColorScheme = lightColorScheme(
|
||||
primary = primaryLightMediumContrast,
|
||||
onPrimary = onPrimaryLightMediumContrast,
|
||||
primaryContainer = primaryContainerLightMediumContrast,
|
||||
onPrimaryContainer = onPrimaryContainerLightMediumContrast,
|
||||
secondary = secondaryLightMediumContrast,
|
||||
onSecondary = onSecondaryLightMediumContrast,
|
||||
secondaryContainer = secondaryContainerLightMediumContrast,
|
||||
onSecondaryContainer = onSecondaryContainerLightMediumContrast,
|
||||
tertiary = tertiaryLightMediumContrast,
|
||||
onTertiary = onTertiaryLightMediumContrast,
|
||||
tertiaryContainer = tertiaryContainerLightMediumContrast,
|
||||
onTertiaryContainer = onTertiaryContainerLightMediumContrast,
|
||||
error = errorLightMediumContrast,
|
||||
onError = onErrorLightMediumContrast,
|
||||
errorContainer = errorContainerLightMediumContrast,
|
||||
onErrorContainer = onErrorContainerLightMediumContrast,
|
||||
background = backgroundLightMediumContrast,
|
||||
onBackground = onBackgroundLightMediumContrast,
|
||||
surface = surfaceLightMediumContrast,
|
||||
onSurface = onSurfaceLightMediumContrast,
|
||||
surfaceVariant = surfaceVariantLightMediumContrast,
|
||||
onSurfaceVariant = onSurfaceVariantLightMediumContrast,
|
||||
outline = outlineLightMediumContrast,
|
||||
outlineVariant = outlineVariantLightMediumContrast,
|
||||
scrim = scrimLightMediumContrast,
|
||||
inverseSurface = inverseSurfaceLightMediumContrast,
|
||||
inverseOnSurface = inverseOnSurfaceLightMediumContrast,
|
||||
inversePrimary = inversePrimaryLightMediumContrast,
|
||||
surfaceDim = surfaceDimLightMediumContrast,
|
||||
surfaceBright = surfaceBrightLightMediumContrast,
|
||||
surfaceContainerLowest = surfaceContainerLowestLightMediumContrast,
|
||||
surfaceContainerLow = surfaceContainerLowLightMediumContrast,
|
||||
surfaceContainer = surfaceContainerLightMediumContrast,
|
||||
surfaceContainerHigh = surfaceContainerHighLightMediumContrast,
|
||||
surfaceContainerHighest = surfaceContainerHighestLightMediumContrast,
|
||||
)
|
||||
|
||||
private val highContrastLightColorScheme = lightColorScheme(
|
||||
primary = primaryLightHighContrast,
|
||||
onPrimary = onPrimaryLightHighContrast,
|
||||
primaryContainer = primaryContainerLightHighContrast,
|
||||
onPrimaryContainer = onPrimaryContainerLightHighContrast,
|
||||
secondary = secondaryLightHighContrast,
|
||||
onSecondary = onSecondaryLightHighContrast,
|
||||
secondaryContainer = secondaryContainerLightHighContrast,
|
||||
onSecondaryContainer = onSecondaryContainerLightHighContrast,
|
||||
tertiary = tertiaryLightHighContrast,
|
||||
onTertiary = onTertiaryLightHighContrast,
|
||||
tertiaryContainer = tertiaryContainerLightHighContrast,
|
||||
onTertiaryContainer = onTertiaryContainerLightHighContrast,
|
||||
error = errorLightHighContrast,
|
||||
onError = onErrorLightHighContrast,
|
||||
errorContainer = errorContainerLightHighContrast,
|
||||
onErrorContainer = onErrorContainerLightHighContrast,
|
||||
background = backgroundLightHighContrast,
|
||||
onBackground = onBackgroundLightHighContrast,
|
||||
surface = surfaceLightHighContrast,
|
||||
onSurface = onSurfaceLightHighContrast,
|
||||
surfaceVariant = surfaceVariantLightHighContrast,
|
||||
onSurfaceVariant = onSurfaceVariantLightHighContrast,
|
||||
outline = outlineLightHighContrast,
|
||||
outlineVariant = outlineVariantLightHighContrast,
|
||||
scrim = scrimLightHighContrast,
|
||||
inverseSurface = inverseSurfaceLightHighContrast,
|
||||
inverseOnSurface = inverseOnSurfaceLightHighContrast,
|
||||
inversePrimary = inversePrimaryLightHighContrast,
|
||||
surfaceDim = surfaceDimLightHighContrast,
|
||||
surfaceBright = surfaceBrightLightHighContrast,
|
||||
surfaceContainerLowest = surfaceContainerLowestLightHighContrast,
|
||||
surfaceContainerLow = surfaceContainerLowLightHighContrast,
|
||||
surfaceContainer = surfaceContainerLightHighContrast,
|
||||
surfaceContainerHigh = surfaceContainerHighLightHighContrast,
|
||||
surfaceContainerHighest = surfaceContainerHighestLightHighContrast,
|
||||
)
|
||||
|
||||
private val mediumContrastDarkColorScheme = darkColorScheme(
|
||||
primary = primaryDarkMediumContrast,
|
||||
onPrimary = onPrimaryDarkMediumContrast,
|
||||
primaryContainer = primaryContainerDarkMediumContrast,
|
||||
onPrimaryContainer = onPrimaryContainerDarkMediumContrast,
|
||||
secondary = secondaryDarkMediumContrast,
|
||||
onSecondary = onSecondaryDarkMediumContrast,
|
||||
secondaryContainer = secondaryContainerDarkMediumContrast,
|
||||
onSecondaryContainer = onSecondaryContainerDarkMediumContrast,
|
||||
tertiary = tertiaryDarkMediumContrast,
|
||||
onTertiary = onTertiaryDarkMediumContrast,
|
||||
tertiaryContainer = tertiaryContainerDarkMediumContrast,
|
||||
onTertiaryContainer = onTertiaryContainerDarkMediumContrast,
|
||||
error = errorDarkMediumContrast,
|
||||
onError = onErrorDarkMediumContrast,
|
||||
errorContainer = errorContainerDarkMediumContrast,
|
||||
onErrorContainer = onErrorContainerDarkMediumContrast,
|
||||
background = backgroundDarkMediumContrast,
|
||||
onBackground = onBackgroundDarkMediumContrast,
|
||||
surface = surfaceDarkMediumContrast,
|
||||
onSurface = onSurfaceDarkMediumContrast,
|
||||
surfaceVariant = surfaceVariantDarkMediumContrast,
|
||||
onSurfaceVariant = onSurfaceVariantDarkMediumContrast,
|
||||
outline = outlineDarkMediumContrast,
|
||||
outlineVariant = outlineVariantDarkMediumContrast,
|
||||
scrim = scrimDarkMediumContrast,
|
||||
inverseSurface = inverseSurfaceDarkMediumContrast,
|
||||
inverseOnSurface = inverseOnSurfaceDarkMediumContrast,
|
||||
inversePrimary = inversePrimaryDarkMediumContrast,
|
||||
surfaceDim = surfaceDimDarkMediumContrast,
|
||||
surfaceBright = surfaceBrightDarkMediumContrast,
|
||||
surfaceContainerLowest = surfaceContainerLowestDarkMediumContrast,
|
||||
surfaceContainerLow = surfaceContainerLowDarkMediumContrast,
|
||||
surfaceContainer = surfaceContainerDarkMediumContrast,
|
||||
surfaceContainerHigh = surfaceContainerHighDarkMediumContrast,
|
||||
surfaceContainerHighest = surfaceContainerHighestDarkMediumContrast,
|
||||
)
|
||||
|
||||
private val highContrastDarkColorScheme = darkColorScheme(
|
||||
primary = primaryDarkHighContrast,
|
||||
onPrimary = onPrimaryDarkHighContrast,
|
||||
primaryContainer = primaryContainerDarkHighContrast,
|
||||
onPrimaryContainer = onPrimaryContainerDarkHighContrast,
|
||||
secondary = secondaryDarkHighContrast,
|
||||
onSecondary = onSecondaryDarkHighContrast,
|
||||
secondaryContainer = secondaryContainerDarkHighContrast,
|
||||
onSecondaryContainer = onSecondaryContainerDarkHighContrast,
|
||||
tertiary = tertiaryDarkHighContrast,
|
||||
onTertiary = onTertiaryDarkHighContrast,
|
||||
tertiaryContainer = tertiaryContainerDarkHighContrast,
|
||||
onTertiaryContainer = onTertiaryContainerDarkHighContrast,
|
||||
error = errorDarkHighContrast,
|
||||
onError = onErrorDarkHighContrast,
|
||||
errorContainer = errorContainerDarkHighContrast,
|
||||
onErrorContainer = onErrorContainerDarkHighContrast,
|
||||
background = backgroundDarkHighContrast,
|
||||
onBackground = onBackgroundDarkHighContrast,
|
||||
surface = surfaceDarkHighContrast,
|
||||
onSurface = onSurfaceDarkHighContrast,
|
||||
surfaceVariant = surfaceVariantDarkHighContrast,
|
||||
onSurfaceVariant = onSurfaceVariantDarkHighContrast,
|
||||
outline = outlineDarkHighContrast,
|
||||
outlineVariant = outlineVariantDarkHighContrast,
|
||||
scrim = scrimDarkHighContrast,
|
||||
inverseSurface = inverseSurfaceDarkHighContrast,
|
||||
inverseOnSurface = inverseOnSurfaceDarkHighContrast,
|
||||
inversePrimary = inversePrimaryDarkHighContrast,
|
||||
surfaceDim = surfaceDimDarkHighContrast,
|
||||
surfaceBright = surfaceBrightDarkHighContrast,
|
||||
surfaceContainerLowest = surfaceContainerLowestDarkHighContrast,
|
||||
surfaceContainerLow = surfaceContainerLowDarkHighContrast,
|
||||
surfaceContainer = surfaceContainerDarkHighContrast,
|
||||
surfaceContainerHigh = surfaceContainerHighDarkHighContrast,
|
||||
surfaceContainerHighest = surfaceContainerHighestDarkHighContrast,
|
||||
)
|
||||
|
||||
@Immutable
|
||||
data class ColorFamily(
|
||||
val color: Color,
|
||||
val onColor: Color,
|
||||
val colorContainer: Color,
|
||||
val onColorContainer: Color
|
||||
)
|
||||
|
||||
val unspecified_scheme = ColorFamily(
|
||||
Color.Unspecified, Color.Unspecified, Color.Unspecified, Color.Unspecified
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun AuxTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
// Dynamic color is available on Android 12+
|
||||
dynamicColor: Boolean = true,
|
||||
content: @Composable() () -> Unit
|
||||
) {
|
||||
val colorScheme = themeColorScheme(
|
||||
darkTheme,
|
||||
dynamicColor,
|
||||
darkScheme,
|
||||
lightScheme
|
||||
)
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
typography = AuxTypography,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
expect fun themeColorScheme(
|
||||
darkTheme: Boolean,
|
||||
dynamicColor: Boolean,
|
||||
darkScheme: ColorScheme,
|
||||
lightScheme: ColorScheme
|
||||
): ColorScheme
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.example.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
val AuxTypography = Typography()
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package ac.aux.compose.ui.view.model
|
||||
|
||||
import ac.aux.compose.ui.view.state.CreateProfileUIState
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.viewmodel.initializer
|
||||
import androidx.lifecycle.viewmodel.viewModelFactory
|
||||
import ac.aux.compose.ui.view.state.form.CreateProfileFormState
|
||||
import co.touchlab.kermit.Logger
|
||||
|
||||
class CreateProfileViewModel(
|
||||
val initialCreateProfileUIState: CreateProfileUIState,
|
||||
val createProfileFormState: CreateProfileFormState = CreateProfileFormState(),
|
||||
): ViewModel() {
|
||||
companion object {
|
||||
private const val TAG = "CreateAccountViewModel"
|
||||
|
||||
fun factory(
|
||||
initialCreateProfileUIState: CreateProfileUIState
|
||||
): ViewModelProvider.Factory = viewModelFactory {
|
||||
initializer {
|
||||
CreateProfileViewModel(
|
||||
initialCreateProfileUIState
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val logger = Logger.withTag(TAG)
|
||||
|
||||
val isActionPending: MutableState<Boolean> = mutableStateOf(false)
|
||||
|
||||
var createProfileUIState: MutableState<CreateProfileUIState> = mutableStateOf(
|
||||
initialCreateProfileUIState
|
||||
)
|
||||
|
||||
public fun createAccount(
|
||||
onSuccess: () -> Unit,
|
||||
onFailure: () -> Unit
|
||||
) {
|
||||
logger.d { "createAccount" }
|
||||
onFailure.invoke()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package ac.aux.compose.ui.view.state
|
||||
|
||||
abstract class CreateProfileUIState {
|
||||
|
||||
data object Declaration: CreateProfileUIState()
|
||||
|
||||
data object InputPrompt: CreateProfileUIState()
|
||||
|
||||
data class ConfirmInput(
|
||||
val name: String,
|
||||
val bio: String
|
||||
) : CreateProfileUIState()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package ac.aux.compose.ui.view.state.form
|
||||
|
||||
data class CreateProfileFormState(
|
||||
val nameField: TextField = TextField(),
|
||||
val biographyField: TextField = TextField()
|
||||
)
|
||||
@@ -0,0 +1,9 @@
|
||||
package ac.aux.compose.ui.view.state.form
|
||||
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
|
||||
data class TextField(
|
||||
val text: MutableState<String> = mutableStateOf(""),
|
||||
val errorMessage: MutableState<String?> = mutableStateOf(null)
|
||||
)
|
||||
Reference in new issue
Block a user