-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Wallet Ui * Updated dependencies --------- Co-authored-by: Sajal Bansal <[email protected]>
- Loading branch information
Showing
25 changed files
with
601 additions
and
13 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.
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
174 changes: 164 additions & 10 deletions
174
wallet_app/android/app/src/main/java/com/example/walletapp/MainActivity.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,20 +1,174 @@ | ||
package com.example.walletapp | ||
|
||
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.appcompat.app.AppCompatActivity | ||
import androidx.core.view.ViewCompat | ||
import androidx.core.view.WindowInsetsCompat | ||
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.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.Button | ||
import androidx.compose.material.ButtonDefaults | ||
import androidx.compose.material.Card | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.Surface | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Scaffold | ||
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.Color | ||
import androidx.compose.ui.graphics.painter.Painter | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.text.font.Font | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.tooling.preview.Preview | ||
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.theme.WalletappTheme | ||
|
||
class MainActivity : AppCompatActivity() { | ||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
setContentView(R.layout.activity_main) | ||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> | ||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) | ||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) | ||
insets | ||
WindowCompat.setDecorFitsSystemWindows(window, true) | ||
setContent { | ||
WalletappTheme { | ||
Surface(modifier = Modifier.fillMaxSize()) { | ||
Wallet( | ||
modifier = Modifier.padding(10.dp) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun Wallet( modifier: Modifier) { | ||
val context = (LocalContext.current as Activity) | ||
|
||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(Color("#0C0C4F".toColorInt())) | ||
.padding(20.dp) | ||
) { | ||
Text( | ||
text = "$11,625.48", | ||
fontFamily = FontFamily(Font(R.font.inter_regular)), | ||
color = Color.White, | ||
fontSize = 28.sp, | ||
modifier = Modifier | ||
.align(Alignment.CenterHorizontally) | ||
.padding(top = 70.dp) | ||
) | ||
Text( | ||
text = "0xfoo...123", | ||
fontFamily = FontFamily(Font(R.font.inter_regular)), | ||
color = Color.White, | ||
fontSize = 16.sp, | ||
modifier = Modifier.align(Alignment.CenterHorizontally) | ||
) | ||
|
||
Spacer(modifier = Modifier.height(32.dp)) | ||
|
||
WalletCard(icon = painterResource(id = R.drawable.ic_ethereum), amount = "$11,625.7", exchange = 4.44 , type ="ETH" ) | ||
|
||
WalletCard(icon = painterResource(id = R.drawable.token2), amount = "$1.78", exchange = 4.44 , type ="STRK" ) | ||
|
||
|
||
Spacer(modifier = Modifier.weight(1f)) | ||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalArrangement = Arrangement.SpaceEvenly | ||
) { | ||
Button( | ||
onClick = { val i = Intent(context,ReceiverActivity::class.java) | ||
context.startActivity(i) }, | ||
colors = ButtonDefaults.buttonColors(backgroundColor = Color("#1B1B76".toColorInt())), | ||
shape = RoundedCornerShape(15.dp), | ||
) { | ||
Text( | ||
text = "Receive", fontFamily = FontFamily(Font(R.font.publicsans_bold)), | ||
color = Color.White, | ||
fontSize = 14.sp | ||
) | ||
} | ||
Button( | ||
onClick = {val i = Intent(context,SendActivity::class.java) | ||
context.startActivity(i)}, | ||
colors = ButtonDefaults.buttonColors(backgroundColor = Color("#1B1B76".toColorInt())), | ||
shape = RoundedCornerShape(15.dp), | ||
) { | ||
Text(text = "Send", fontFamily = FontFamily(Font(R.font.publicsans_bold)), | ||
color = Color.White, | ||
fontSize = 14.sp) | ||
} | ||
} | ||
Spacer(modifier = Modifier.height(15.dp)) | ||
} | ||
} | ||
|
||
@Composable | ||
fun WalletCard(icon: Painter,amount:String,exchange:Double,type:String){ | ||
Card( | ||
backgroundColor = Color(0xFF1E1E96), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 8.dp) | ||
) { | ||
Row( | ||
verticalAlignment = Alignment.CenterVertically, | ||
modifier = Modifier | ||
.padding(16.dp) | ||
.fillMaxWidth() | ||
) { | ||
Image( | ||
painter = icon, // replace with your Ethereum icon | ||
contentDescription = null, | ||
) | ||
Spacer(modifier = Modifier.weight(1f)) | ||
Column(modifier = Modifier, horizontalAlignment = Alignment.End) { | ||
Text( | ||
text = amount, | ||
fontFamily = FontFamily(Font(R.font.inter_regular)), | ||
color = Color.White, | ||
fontSize = 18.sp | ||
) | ||
Row { | ||
Text( | ||
text = exchange.toString(), | ||
fontFamily = FontFamily(Font(R.font.inter_regular)), | ||
color = Color.White, | ||
fontSize = 10.sp | ||
) | ||
Text( | ||
text = type, | ||
fontFamily = FontFamily(Font(R.font.publicsans_bold)), | ||
color = Color.White, | ||
fontSize = 10.sp | ||
) | ||
|
||
} | ||
|
||
} | ||
} | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
wallet_app/android/app/src/main/java/com/example/walletapp/ReceiverActivity.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,97 @@ | ||
package com.example.walletapp | ||
|
||
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.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
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.foundation.layout.size | ||
import androidx.compose.material.Surface | ||
import androidx.compose.material.Text | ||
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.res.painterResource | ||
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.graphics.toColorInt | ||
import androidx.core.view.WindowCompat | ||
import com.example.walletapp.ui.theme.WalletappTheme | ||
|
||
class ReceiverActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
WindowCompat.setDecorFitsSystemWindows(window, true) | ||
setContent { | ||
WalletappTheme { | ||
Surface(modifier = Modifier.fillMaxSize()) { | ||
ReceiverScreenView( | ||
modifier = Modifier.padding(10.dp) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun ReceiverScreenView(modifier: Modifier){ | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(Color("#0C0C4F".toColorInt())) // Your dark blue background color | ||
.padding(16.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center | ||
) { | ||
// QR Code Image | ||
Box( | ||
modifier = Modifier | ||
.size(300.dp) | ||
.background(Color.White) // White background for QR code | ||
) { | ||
Image( | ||
painter = painterResource(id = R.drawable.scanner), // Replace with actual QR code resource | ||
contentDescription = "QR Code", | ||
modifier = Modifier.fillMaxSize() | ||
) | ||
} | ||
|
||
Spacer(modifier = Modifier.height(24.dp)) | ||
|
||
// Wallet Address | ||
Text( | ||
text = "0xfoo...123", // Replace with actual wallet address | ||
fontFamily = FontFamily(Font(R.font.publicsans_bold)), | ||
color = Color.White, | ||
fontSize = 40.sp | ||
) | ||
|
||
Spacer(modifier = Modifier.height(8.dp)) | ||
|
||
// Clickable Text for Copy | ||
Text( | ||
text = "Click to copy address", | ||
fontFamily = FontFamily(Font(R.font.publicsans_regular)), | ||
color = Color.White, | ||
fontSize = 15.sp, | ||
modifier = Modifier.clickable { | ||
// TODO: Copy address to clipboard | ||
} | ||
) | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.