Skip to content

Commit

Permalink
Some minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sajalbnl committed Dec 12, 2024
1 parent 248dc50 commit 66a0fcf
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 53 deletions.
3 changes: 2 additions & 1 deletion wallet_app/app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
android/app/build
build
build
local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ fun WalletApp(tokenViewModel: TokenViewModel) {
}

composable<Send> {
SendScreen(walletViewModel)
SendScreen(walletViewModel,navController)
}
composable<Receive> {
ReceiveScreen(modifier = Modifier)
ReceiveScreen(modifier = Modifier,navController)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
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.Row
Expand All @@ -27,7 +26,6 @@ import androidx.compose.material3.Card
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.graphics.Color
import androidx.compose.ui.platform.LocalContext
Expand All @@ -52,6 +50,8 @@ import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import android.content.ClipData
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.ui.Alignment
import androidx.compose.ui.text.toUpperCase
import androidx.compose.ui.window.Popup
import androidx.compose.ui.window.PopupProperties
Expand Down Expand Up @@ -174,35 +174,38 @@ fun Wallet(modifier: Modifier, onNewTokenPress: () -> Unit, onReceivePress: () -

}.sum()
val formatter = NumberFormat.getCurrencyInstance(Locale.US)
Text(
text = formatter.format(totalBalance),
fontFamily = FontFamily(Font(R.font.publicsans_bold)),
color = Color.White,
fontSize = 26.sp,
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(top = 70.dp)
)
Row(
modifier = Modifier.align(Alignment.CenterHorizontally)) {
Column(verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.fillMaxWidth()) {
Text(
text = address.take(8) + "....",
fontFamily = FontFamily(Font(R.font.inter_regular)),
text = formatter.format(totalBalance),
fontFamily = FontFamily(Font(R.font.publicsans_bold)),
color = Color.White,
fontSize = 12.sp,
)
Icon(
painter = painterResource(R.drawable.copy),// replace with your Ethereum icon
contentDescription = null,
tint=Color.White,
modifier = Modifier.padding(start=5.dp)
.size(15.dp).clickable {
val clip = ClipEntry(ClipData.newPlainText("Wallet Address", address))
clipboard.setClip(clip)
Toast.makeText(context, "Address Copied", Toast.LENGTH_LONG).show()
}
fontSize = 26.sp,
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(top = 70.dp)
)
Row(
modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center
) {
Text(
text = address.take(8) + "...",
fontFamily = FontFamily(Font(R.font.inter_regular)),
color = Color.White,
fontSize = 12.sp,
)
Icon(
painter = painterResource(R.drawable.copy),// replace with your Ethereum icon
contentDescription = null,
tint = Color.White,
modifier = Modifier.padding(start = 5.dp)
.size(15.dp).clickable {
val clip = ClipEntry(ClipData.newPlainText("Wallet Address", address))
clipboard.setClip(clip)
Toast.makeText(context, "Address Copied", Toast.LENGTH_LONG).show()
}
)

}
}

Spacer(modifier = Modifier.height(32.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ 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.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.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -29,11 +35,12 @@ 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.navigation.NavController
import com.example.walletapp.BuildConfig
import com.example.walletapp.R

@Composable
fun ReceiveScreen(modifier: Modifier) {
fun ReceiveScreen(modifier: Modifier,navController: NavController) {
val clipboard: ClipboardManager = LocalClipboardManager.current
val context= LocalContext.current
val address= BuildConfig.ACCOUNT_ADDRESS
Expand All @@ -45,8 +52,19 @@ fun ReceiveScreen(modifier: Modifier) {
.background(Color("#0C0C4F".toColorInt())) // Your dark blue background color
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
// Back Button
IconButton(
onClick = { navController.navigateUp() },
modifier = Modifier.align(Alignment.Start)
) {
Icon(
imageVector = Icons.Default.ArrowBack,
contentDescription = "Back",
tint = Color.White
)
}
Spacer(modifier = Modifier.height(40.dp))
// QR Code Image
Box(
modifier = Modifier
Expand All @@ -62,28 +80,27 @@ fun ReceiveScreen(modifier: Modifier) {

Spacer(modifier = Modifier.height(24.dp))

// Wallet Address
Text(
text = address.take(8) + "....",
fontFamily = FontFamily(Font(R.font.publicsans_bold)),
color = Color.White,
fontSize = 40.sp
)

Spacer(modifier = Modifier.height(8.dp))
Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center) {
Text(
text = address.take(8) + "...",
fontFamily = FontFamily(Font(R.font.publicsans_bold)),
color = Color.White,
fontSize = 30.sp
)
Icon(
painter = painterResource(R.drawable.copy),// replace with your Ethereum icon
contentDescription = null,
tint=Color.White,
modifier = Modifier.padding(start=5.dp)
.size(25.dp).clickable {
val clip = ClipEntry(ClipData.newPlainText("Wallet Address", address))
clipboard.setClip(clip)
Toast.makeText(context, "Address Copied", Toast.LENGTH_LONG).show()
}
)

// 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 {
val clip = ClipEntry(ClipData.newPlainText("Wallet Address", address))
clipboard.setClip(clip)
Toast.makeText(context, "Address Copied", Toast.LENGTH_LONG).show()
}
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ import com.example.walletapp.R
import com.example.walletapp.ui.account.WalletViewModel
import android.widget.Toast
import androidx.compose.foundation.layout.Box
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.IconButton
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.navigation.NavController
import com.example.walletapp.utils.etherToWei
import com.example.walletapp.utils.isValidEthereumAddress
import com.swmansion.starknet.account.StandardAccount
Expand All @@ -63,7 +66,7 @@ import java.math.BigDecimal


@Composable
fun SendScreen(walletViewModel: WalletViewModel) {
fun SendScreen(walletViewModel: WalletViewModel,navController: NavController) {

val balances by walletViewModel.balances.collectAsState()
val address= BuildConfig.ACCOUNT_ADDRESS
Expand Down Expand Up @@ -143,6 +146,17 @@ fun SendScreen(walletViewModel: WalletViewModel) {
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
// Back Button
IconButton(
onClick = { navController.navigateUp() },
modifier = Modifier.align(Alignment.Start)
) {
Icon(
imageVector = Icons.Default.ArrowBack,
contentDescription = "Back",
tint = Color.White
)
}
Spacer(modifier = Modifier.height(40.dp))

// "From" label above the wallet address field (readonly)
Expand Down

0 comments on commit 66a0fcf

Please sign in to comment.