diff --git a/wallet_app/android/.idea/other.xml b/wallet_app/android/.idea/other.xml deleted file mode 100644 index 94c96f63..00000000 --- a/wallet_app/android/.idea/other.xml +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/wallet_app/android/app/src/main/AndroidManifest.xml b/wallet_app/android/app/src/main/AndroidManifest.xml index 03489b78..9e23fdb2 100644 --- a/wallet_app/android/app/src/main/AndroidManifest.xml +++ b/wallet_app/android/app/src/main/AndroidManifest.xml @@ -43,10 +43,20 @@ + + + + + + diff --git a/wallet_app/android/app/src/main/java/com/example/walletapp/MainActivity.kt b/wallet_app/android/app/src/main/java/com/example/walletapp/MainActivity.kt index 15ce801d..4a5bcf6f 100644 --- a/wallet_app/android/app/src/main/java/com/example/walletapp/MainActivity.kt +++ b/wallet_app/android/app/src/main/java/com/example/walletapp/MainActivity.kt @@ -36,8 +36,8 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.core.graphics.toColorInt import androidx.core.view.WindowCompat +import com.example.walletapp.ui.activity.CreateAccountActivity import com.example.walletapp.ui.theme.WalletappTheme - import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -98,7 +98,7 @@ fun CreateAccount( modifier: Modifier) { verticalArrangement = Arrangement.spacedBy(8.dp) // Adjust space between buttons ) { Button( - onClick = { val i = Intent(context, AccountPasswordActivity::class.java) + onClick = { val i = Intent(context, CreateAccountActivity::class.java) context.startActivity(i) }, colors = ButtonDefaults.buttonColors(backgroundColor = Color("#1B1B76".toColorInt())), shape = RoundedCornerShape(10.dp), diff --git a/wallet_app/android/app/src/main/java/com/example/walletapp/ui/activity/AccountInfoActivity.kt b/wallet_app/android/app/src/main/java/com/example/walletapp/ui/activity/AccountInfoActivity.kt new file mode 100644 index 00000000..b3fb6ec4 --- /dev/null +++ b/wallet_app/android/app/src/main/java/com/example/walletapp/ui/activity/AccountInfoActivity.kt @@ -0,0 +1,350 @@ +package com.example.walletapp.ui.activity + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.* +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.filled.ArrowForward +import androidx.compose.material.icons.filled.Refresh +import androidx.compose.material.icons.outlined.Info +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.core.graphics.toColorInt +import com.example.walletapp.R +import com.example.walletapp.ui.theme.WalletappTheme +import org.bouncycastle.math.raw.Mod + +class AccountInfoActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContent { + WalletappTheme { + Scaffold( + topBar = { + TopAppBar( + backgroundColor = Color("#0C0C4F".toColorInt()), + contentColor = Color.White, + elevation = 4.dp + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(top = 32.dp, start = 16.dp, end = 16.dp), + + ) { + Icon( + imageVector = Icons.Filled.ArrowBack, + contentDescription = "Backward Arrow", + modifier = Modifier.padding(start = 8.dp), + tint = Color.White + ) + Box( + modifier = Modifier.fillMaxWidth(), + contentAlignment = Alignment.Center, + ) { + + Text( + text = "Create Account", + color = Color.White, + fontSize = 20.sp + ) + + } + + } + } + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .background(color = Color("#0C0C4F".toColorInt())) + .padding(top = 30.dp, start = 16.dp, end = 16.dp ) + + ) { + + Spacer(modifier = Modifier.height(5.dp)) + AccountInfoView() + + + } + } + } + + } + } +} + +@Composable +fun AccountInfoView() { + + var checked by remember { mutableStateOf(true) } + + + Column ( + verticalArrangement = Arrangement.Center, + modifier = Modifier.padding(16.dp) + + ) { + + Text(text= "Account Information", style = TextStyle(color = Color.White, fontWeight = FontWeight.ExtraBold, fontSize = 22.sp)) + Spacer(modifier = Modifier.height(10.dp)) + Card ( + backgroundColor = Color("#141462".toColorInt()), + shape = RoundedCornerShape(size = 8.dp), + modifier = Modifier.fillMaxWidth() + .background(color = Color("#141462".toColorInt())) + .padding(top = 15.dp, start = 15.dp, end = 15.dp, bottom = 15.dp) + ) { + Column { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Box(){ + Column { + Text(text= "Account name", style = TextStyle(color = Color("#8D8DBB".toColorInt()), fontWeight = FontWeight.Medium, fontSize = 15.sp)) + Spacer(modifier = Modifier.height(4.dp)) + Text(text= "Starknet", style = TextStyle(color = Color.White, fontWeight = FontWeight.Medium, fontSize = 15.sp)) + + } + } + + + Box( + modifier = Modifier + .width(30.dp) + .height(30.dp) + .background(color = Color.Transparent) + .border(width = 1.dp, color = Color.White, shape = RoundedCornerShape(4.dp)) + .padding(4.dp), + ) { + Image( + painter = painterResource(id = R.drawable.content_copy), + contentDescription = "Copy", + modifier = Modifier.size(20.dp) + ) + } + + + } + + Spacer(modifier = Modifier.height(30.dp)) + + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Box(){ + Column { + Text(text= "Private key", style = TextStyle(color = Color("#8D8DBB".toColorInt()), fontWeight = FontWeight.Medium, fontSize = 15.sp)) + Spacer(modifier = Modifier.height(4.dp)) + Text(text= "q78ggh277ibckewjtnM", style = TextStyle(color = Color.White, fontWeight = FontWeight.Medium, fontSize = 15.sp)) + + } + } + + + Box( + modifier = Modifier + .width(30.dp) + .height(30.dp) + .background(color = Color.Transparent) + .border(width = 1.dp, color = Color.White, shape = RoundedCornerShape(4.dp)) + .padding(4.dp), + ) { + Image( + painter = painterResource(id = R.drawable.content_copy), + contentDescription = "Copy", + modifier = Modifier + .size(20.dp) + ) + } + + + + } + } + } + + Spacer(modifier = Modifier.height(30.dp)) + Button( + onClick = {}, + colors = ButtonDefaults.buttonColors(backgroundColor = Color("#1B1B76".toColorInt()), contentColor = Color.White), + modifier = Modifier.fillMaxWidth() + .background(color = Color("#141462".toColorInt())) + .height(51.dp) + .border(width = 1.dp, color = Color("#1B1B76".toColorInt()), shape = RoundedCornerShape(8.dp)) + + ) { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center + + + ){ + + Icon( + imageVector = Icons.Filled.Refresh, + contentDescription = "Backward Arrow", + modifier = Modifier.padding(start = 8.dp), + tint = Color.White + ) + + Spacer(modifier = Modifier.width(10.dp)) + + Text(text = "Generate new private key", style = TextStyle(color = Color("#A3A3C1".toColorInt()), fontSize = 15.sp)) + } + } + + + Spacer(modifier = Modifier.height(8.dp)) + + + + Button( + onClick = {}, + colors = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent, contentColor = Color.White), + modifier = Modifier.fillMaxWidth() + .background(color = Color("#1B1B76".toColorInt())) + .height(51.dp) + .border(width = 1.dp, color = Color("#CBC5C5".toColorInt()), shape = RoundedCornerShape(8.dp)) + + + ) { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center + ){ + + Icon( + imageVector = Icons.Outlined.Info, + contentDescription = "Backward Arrow", + modifier = Modifier.padding(start = 8.dp), + tint = Color.White + ) + + Spacer(modifier = Modifier.width(10.dp)) + + Text(text = "Use existing private key", style = TextStyle(color = Color.White, fontSize = 15.sp)) + } + } + + Spacer(modifier = Modifier.height(13.dp)) + + Box( + modifier = Modifier + .background(color = Color("#221451".toColorInt(), )) + .height(74.dp) + .border(width = 1.dp, color = Color("#221451".toColorInt()), shape = RoundedCornerShape(16.dp)) + .padding(16.dp) + + ){ + Row(){ + + + Icon( + imageVector = Icons.Outlined.Info, + contentDescription = "Info", + tint = Color("#E45F61".toColorInt()) + ) + + + Spacer(modifier = Modifier.width(10.dp)) + + + + Text( + text = "Store your private key securely. In case of its lost or stolen, access to funds will be lost without the possibility of recovery", + style = TextStyle(color = Color("#E45F61".toColorInt()), fontSize = 12.sp) + ) + } + } + + + Spacer(modifier = Modifier.height(20.dp)) + + + + Row( + verticalAlignment = Alignment.CenterVertically, + + ) { + + Checkbox( + modifier = Modifier.border(width = 1.dp, color = Color("#54DC84".toColorInt()), shape = RoundedCornerShape(30.dp)) + .height(25.dp) + .width(25.dp), + checked = checked, + onCheckedChange = { checked = it }, + colors = CheckboxDefaults.colors(checkedColor = Color.Transparent, checkmarkColor = Color("#54DC84".toColorInt())), + + ) + + + Spacer(modifier = Modifier.width(10.dp)) + Text( + "I have read the information and saved the private key", + style = TextStyle(color = Color.White, fontWeight = FontWeight.Medium, fontSize = 15.sp) + ) + } + + + Spacer(modifier = Modifier.height(72.dp)) + + Button( + onClick = { }, + contentPadding = ButtonDefaults.ContentPadding, + shape = RoundedCornerShape(8.dp), + colors = ButtonDefaults.buttonColors(backgroundColor = Color("#EC796B".toColorInt()), contentColor = Color.White), + modifier = Modifier + .fillMaxWidth() + .height(49.dp) + ) { + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Text("Continue") + Icon( + imageVector = Icons.Filled.ArrowForward, + contentDescription = "Forward Arrow", + modifier = Modifier.padding(start = 8.dp), + tint = Color.White + ) + } + } + + } + +} + + + + + + + diff --git a/wallet_app/android/app/src/main/java/com/example/walletapp/ui/activity/CreateAccountActivity.kt b/wallet_app/android/app/src/main/java/com/example/walletapp/ui/activity/CreateAccountActivity.kt new file mode 100644 index 00000000..9599eea2 --- /dev/null +++ b/wallet_app/android/app/src/main/java/com/example/walletapp/ui/activity/CreateAccountActivity.kt @@ -0,0 +1,343 @@ +package com.example.walletapp.ui.activity + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.core.graphics.toColorInt +import androidx.compose.material.OutlinedTextField +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.filled.ArrowForward +import androidx.compose.material.icons.filled.Refresh +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ModalBottomSheet +import androidx.compose.material3.SheetState +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.material3.rememberModalBottomSheetState +import androidx.compose.runtime.setValue +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import com.example.walletapp.R +import com.example.walletapp.ui.theme.WalletappTheme +import kotlinx.coroutines.CoroutineScope + +class CreateAccountActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContent { + WalletappTheme { + var progress by remember { mutableStateOf(0.5f) } + Scaffold( + topBar = { + TopAppBar( + backgroundColor = Color("#0C0C4F".toColorInt()), + contentColor = Color.White, + elevation = 4.dp + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(top = 32.dp, start = 16.dp, end = 16.dp), + + ) { + Icon( + imageVector = Icons.Filled.ArrowBack, + contentDescription = "Backward Arrow", + modifier = Modifier.padding(start = 8.dp), + tint = Color.White + ) + + Box( + modifier = Modifier.fillMaxWidth(), + contentAlignment = Alignment.Center, + ) { + + Text( + text = "Create Account", + color = Color.White, + fontSize = 20.sp + ) + + } + + } + } + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .background(color = Color("#0C0C4F".toColorInt())) + .padding(top = 30.dp, start = 16.dp, end = 16.dp ) + + ) { + + Text( + text = if (progress < 1.0f) "1 of 2" else "2 of 2", + style = TextStyle(color = Color("#EC796B".toColorInt()), fontWeight = FontWeight.ExtraBold, fontSize = 16.sp, textAlign = TextAlign.Center ) + + ) + + + Spacer(modifier = Modifier.height(5.dp)) + + + + LinearProgressIndicator( + progress = progress, + modifier = Modifier.fillMaxWidth(), + color = Color("#EC796B".toColorInt()) + + + ) + + if (progress < 1.0f) { + CreateWallet( + modifier = Modifier.padding(top = 16.dp), + onNext = { + progress = 1.0f + } + ) + } else { + GenerateKey(modifier = Modifier.padding(top = 16.dp)) + } + + + } + } + } + } + } +} + +@Composable +fun CreateWallet(modifier: Modifier = Modifier, onNext: () -> Unit) { + val borderColor = Color("#1B1B76".toColorInt()) + var accountName by remember { mutableStateOf("") } + Column( + modifier = modifier + .fillMaxSize() + .background(Color("#0C0C4F".toColorInt())) + .padding(16.dp) + ) { + + Box( + modifier = Modifier.padding(top = 5.dp, bottom = 16.dp) + ) { + Column( + ) { + + Text( + text = "Create account name", + style = TextStyle( + fontWeight = FontWeight.ExtraBold, + fontSize = 22.sp, + color = Color.White, + ) + ) + Spacer(modifier = Modifier.height(16.dp)) + + OutlinedTextField( + value = accountName, + onValueChange = { accountName = it }, + placeholder = { Text("Starknet", style = TextStyle(color = Color.White)) }, + modifier = Modifier + .fillMaxWidth() + .background(Color.Transparent), + shape = RoundedCornerShape(8.dp), + colors = TextFieldDefaults.outlinedTextFieldColors( + backgroundColor = Color(0xFF1B1B76), + focusedBorderColor = borderColor, + unfocusedBorderColor = borderColor + ) + ) + } + } + Spacer(modifier = Modifier.height(16.dp)) + + Button( + onClick = { onNext() }, + contentPadding = ButtonDefaults.ContentPadding, + shape = RoundedCornerShape(8.dp), + colors = ButtonDefaults.buttonColors(backgroundColor = Color("#EC796B".toColorInt()), contentColor = Color.White), + modifier = Modifier + .fillMaxWidth() + .height(49.dp) + ) { + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Text("Continue") + Icon( + imageVector = Icons.Filled.ArrowForward, + contentDescription = "Forward Arrow", + modifier = Modifier.padding(start = 8.dp), + tint = Color.White + ) + } + } + } +} + + +@OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class) +@Composable +fun GenerateKey(modifier: Modifier = Modifier) { + val scope = rememberCoroutineScope() + var openBottomSheet by remember { mutableStateOf(false) } + val sheetState = rememberModalBottomSheetState() + Column( + modifier = modifier + .fillMaxSize() + .background(Color("#0C0C4F".toColorInt())) + + ) { + Column( + + ) { + } + Box( + modifier = Modifier.padding(top = 16.dp, bottom = 16.dp) + ) { + Column( + modifier = Modifier.padding(8.dp) + ) { + Text( + text = "Generate private key", + style = TextStyle( + fontWeight = FontWeight.ExtraBold, + fontSize = 22.sp, + color = Color.White, + ) + ) + + } + } + Button( + onClick = { openBottomSheet = true }, + contentPadding = ButtonDefaults.ContentPadding, + shape = RoundedCornerShape(8.dp), + colors = ButtonDefaults.buttonColors( + backgroundColor = Color("#EC796B".toColorInt()), + contentColor = Color.White + ), + modifier = Modifier + .fillMaxWidth() + .height(49.dp) + ) { + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Filled.Refresh, + contentDescription = "Forward Arrow", + modifier = Modifier.padding(start = 8.dp), + tint = Color.White + ) + Spacer(modifier = Modifier.width(8.dp)) + Text("Generate new private key") + + } + } + } + + if (openBottomSheet) { + GeneratekeySheet( + openBottomSheet = openBottomSheet, + onDismissRequest = { openBottomSheet = false }, + sheetState = sheetState, + scope = scope + ) + } + + + +} + + + +@OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class) +@Composable +fun GeneratekeySheet( + openBottomSheet: Boolean, + onDismissRequest: () -> Unit, + sheetState: SheetState , + scope: CoroutineScope +) { + + val context = (LocalContext.current as Activity) + + if (openBottomSheet) { + ModalBottomSheet( + onDismissRequest = onDismissRequest, + sheetState = sheetState, + containerColor = Color("#141462".toColorInt()), + modifier= Modifier.height(364.dp), + + ) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, + modifier = Modifier + .padding(16.dp) + .background(color = Color("#141462".toColorInt())) + ) { + + Text( text = "Generating private key", style = TextStyle(fontWeight = FontWeight.ExtraBold, fontSize = 25.sp, textAlign = TextAlign.Center, color = Color.White)) + Spacer(modifier = Modifier.height(8.dp)) + Text( text = "Private key generated successfully", style = TextStyle(fontWeight = FontWeight.Medium, fontSize = 16.sp, textAlign = TextAlign.Center, color = Color("#8D8DBB".toColorInt()))) + + Spacer(modifier = Modifier.height(30.dp)) + + Image( + painter = painterResource(id = R.drawable.approved), + contentDescription = "QR Code", + modifier = Modifier + .size(93.dp) + + ) + + Spacer(modifier = Modifier.height(40.dp)) + + Button( + onClick = { val i = Intent(context, AccountInfoActivity::class.java) + context.startActivity(i) }, + contentPadding = ButtonDefaults.ContentPadding, + shape = RoundedCornerShape(8.dp), + colors = ButtonDefaults.buttonColors(backgroundColor = Color("#EC796B".toColorInt()), contentColor = Color.White), + modifier = Modifier + .fillMaxWidth() + .height(49.dp) + ) { + Text(text = "Continue") + } + + } + } + } + + +} + diff --git a/wallet_app/android/app/src/main/res/drawable/approved.png b/wallet_app/android/app/src/main/res/drawable/approved.png new file mode 100644 index 00000000..524703a6 Binary files /dev/null and b/wallet_app/android/app/src/main/res/drawable/approved.png differ diff --git a/wallet_app/android/app/src/main/res/drawable/content_copy.png b/wallet_app/android/app/src/main/res/drawable/content_copy.png new file mode 100644 index 00000000..bce14f0a Binary files /dev/null and b/wallet_app/android/app/src/main/res/drawable/content_copy.png differ