From 5861fe5f8480944ce9f0dff29632ba7741d38090 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Fri, 12 Dec 2025 10:34:05 -0300 Subject: [PATCH 1/2] feat: add new share icon and add share button to details --- .../wallets/receive/ReceiveQrScreen.kt | 64 +++++++++++++------ app/src/main/res/drawable/ic_share.xml | 23 ++++--- 2 files changed, 57 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt b/app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt index 095c77f7f..f99ca7aee 100644 --- a/app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt +++ b/app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt @@ -236,6 +236,7 @@ fun ReceiveQrScreen( tab = tab, walletState = walletState, cjitInvoice = cjitInvoice, + onClickEditInvoice = onClickEditInvoice, modifier = Modifier.weight(1f) ) } @@ -458,6 +459,7 @@ private fun ReceiveDetailsView( tab: ReceiveTab, walletState: MainUiState, cjitInvoice: String?, + onClickEditInvoice: () -> Unit, modifier: Modifier = Modifier, ) { Card( @@ -477,6 +479,7 @@ private fun ReceiveDetailsView( ), body = walletState.onchainAddress, type = CopyAddressType.ONCHAIN, + onClickEditInvoice = onClickEditInvoice, testTag = "ReceiveOnchainAddress", ) } @@ -493,6 +496,7 @@ private fun ReceiveDetailsView( ), body = walletState.onchainAddress, type = CopyAddressType.ONCHAIN, + onClickEditInvoice = onClickEditInvoice, testTag = "ReceiveOnchainAddress", ) } @@ -501,6 +505,7 @@ private fun ReceiveDetailsView( title = stringResource(R.string.wallet__receive_lightning_invoice), address = cjitInvoice ?: walletState.bolt11, type = CopyAddressType.LIGHTNING, + onClickEditInvoice = onClickEditInvoice, testTag = "ReceiveLightningAddress", ) } @@ -512,6 +517,7 @@ private fun ReceiveDetailsView( title = stringResource(R.string.wallet__receive_lightning_invoice), address = cjitInvoice ?: walletState.bolt11, type = CopyAddressType.LIGHTNING, + onClickEditInvoice = onClickEditInvoice, testTag = "ReceiveLightningAddress", ) } @@ -529,6 +535,7 @@ private fun CopyAddressCard( title: String, address: String, type: CopyAddressType, + onClickEditInvoice: () -> Unit, body: String? = null, testTag: String? = null, ) { @@ -559,28 +566,48 @@ private fun CopyAddressCard( Row( horizontalArrangement = Arrangement.spacedBy(16.dp) ) { + PrimaryButton( + text = stringResource(R.string.common__edit), + size = ButtonSize.Small, + onClick = onClickEditInvoice, + fullWidth = false, + color = Colors.White10, + icon = { + Icon( + painter = painterResource(R.drawable.ic_pencil_simple), + contentDescription = null, + tint = if (type == CopyAddressType.ONCHAIN) Colors.Brand else Colors.Purple, + modifier = Modifier.size(18.dp) + ) + }, + modifier = Modifier + .weight(1f) + .testTag("SpecifyInvoiceButton") + ) Tooltip( text = stringResource(R.string.wallet__receive_copied), tooltipState = tooltipState, ) { - PrimaryButton( - text = stringResource(R.string.common__copy), - size = ButtonSize.Small, - onClick = { - context.setClipboardText(address) - coroutineScope.launch { tooltipState.show() } - }, - fullWidth = false, - color = Colors.White10, - icon = { - Icon( - painter = painterResource(R.drawable.ic_copy), - contentDescription = null, - tint = if (type == CopyAddressType.ONCHAIN) Colors.Brand else Colors.Purple, - modifier = Modifier.size(18.dp) - ) - }, - ) + Box(modifier = Modifier.weight(1f)) { + PrimaryButton( + text = stringResource(R.string.common__copy), + size = ButtonSize.Small, + onClick = { + context.setClipboardText(address) + coroutineScope.launch { tooltipState.show() } + }, + fullWidth = false, + color = Colors.White10, + icon = { + Icon( + painter = painterResource(R.drawable.ic_copy), + contentDescription = null, + tint = if (type == CopyAddressType.ONCHAIN) Colors.Brand else Colors.Purple, + modifier = Modifier.size(18.dp) + ) + }, + ) + } } PrimaryButton( text = stringResource(R.string.common__share), @@ -810,6 +837,7 @@ private fun PreviewDetailsMode() { bolt11 = "lnbcrt500u1pn7umn7pp5x0s9lt9fwrff6rp70pz3guwnjgw97sjuv79...", ), cjitInvoice = null, + onClickEditInvoice = {}, modifier = Modifier.weight(1f) ) } diff --git a/app/src/main/res/drawable/ic_share.xml b/app/src/main/res/drawable/ic_share.xml index b7aa4ce87..e63379543 100644 --- a/app/src/main/res/drawable/ic_share.xml +++ b/app/src/main/res/drawable/ic_share.xml @@ -1,19 +1,18 @@ + android:width="16dp" + android:height="16dp" + android:viewportWidth="16" + android:viewportHeight="16"> + android:pathData="M10.646,3.146C10.842,2.951 11.158,2.951 11.354,3.146L14.354,6.146C14.549,6.342 14.549,6.658 14.354,6.854L11.354,9.854C11.158,10.049 10.842,10.049 10.646,9.854C10.451,9.658 10.451,9.342 10.646,9.146L13.293,6.5L10.646,3.854C10.451,3.658 10.451,3.342 10.646,3.146Z" + android:fillColor="#FF4400" + android:fillType="evenOdd"/> From 2a1a8b8d5defe3bdcbebabbf1a4a69f17823d29a Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Fri, 12 Dec 2025 10:39:33 -0300 Subject: [PATCH 2/2] feat: add new share icon and add share button to details --- .idea/codeStyles/Project.xml | 1 - .../ui/screens/wallets/receive/ReceiveQrScreen.kt | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index f8c8fa315..b175032ad 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -39,7 +39,6 @@ diff --git a/app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt b/app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt index f99ca7aee..0b23f52f9 100644 --- a/app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt +++ b/app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt @@ -18,7 +18,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.rememberLazyListState @@ -549,14 +548,7 @@ private fun CopyAddressCard( .fillMaxWidth() .padding(24.dp) ) { - Row { - Caption13Up(text = title, color = Colors.White64) - - Spacer(modifier = Modifier.width(3.dp)) - - val iconRes = if (type == CopyAddressType.ONCHAIN) R.drawable.ic_bitcoin else R.drawable.ic_lightning_alt - Icon(painter = painterResource(iconRes), contentDescription = null, tint = Colors.White64) - } + Caption13Up(text = title, color = Colors.White64) Spacer(modifier = Modifier.height(16.dp)) BodyS( text = (body ?: address).truncate(32).uppercase(),