Skip to content

Commit 5861fe5

Browse files
committed
feat: add new share icon and add share button to details
1 parent 102ccea commit 5861fe5

File tree

2 files changed

+57
-30
lines changed

2 files changed

+57
-30
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ fun ReceiveQrScreen(
236236
tab = tab,
237237
walletState = walletState,
238238
cjitInvoice = cjitInvoice,
239+
onClickEditInvoice = onClickEditInvoice,
239240
modifier = Modifier.weight(1f)
240241
)
241242
}
@@ -458,6 +459,7 @@ private fun ReceiveDetailsView(
458459
tab: ReceiveTab,
459460
walletState: MainUiState,
460461
cjitInvoice: String?,
462+
onClickEditInvoice: () -> Unit,
461463
modifier: Modifier = Modifier,
462464
) {
463465
Card(
@@ -477,6 +479,7 @@ private fun ReceiveDetailsView(
477479
),
478480
body = walletState.onchainAddress,
479481
type = CopyAddressType.ONCHAIN,
482+
onClickEditInvoice = onClickEditInvoice,
480483
testTag = "ReceiveOnchainAddress",
481484
)
482485
}
@@ -493,6 +496,7 @@ private fun ReceiveDetailsView(
493496
),
494497
body = walletState.onchainAddress,
495498
type = CopyAddressType.ONCHAIN,
499+
onClickEditInvoice = onClickEditInvoice,
496500
testTag = "ReceiveOnchainAddress",
497501
)
498502
}
@@ -501,6 +505,7 @@ private fun ReceiveDetailsView(
501505
title = stringResource(R.string.wallet__receive_lightning_invoice),
502506
address = cjitInvoice ?: walletState.bolt11,
503507
type = CopyAddressType.LIGHTNING,
508+
onClickEditInvoice = onClickEditInvoice,
504509
testTag = "ReceiveLightningAddress",
505510
)
506511
}
@@ -512,6 +517,7 @@ private fun ReceiveDetailsView(
512517
title = stringResource(R.string.wallet__receive_lightning_invoice),
513518
address = cjitInvoice ?: walletState.bolt11,
514519
type = CopyAddressType.LIGHTNING,
520+
onClickEditInvoice = onClickEditInvoice,
515521
testTag = "ReceiveLightningAddress",
516522
)
517523
}
@@ -529,6 +535,7 @@ private fun CopyAddressCard(
529535
title: String,
530536
address: String,
531537
type: CopyAddressType,
538+
onClickEditInvoice: () -> Unit,
532539
body: String? = null,
533540
testTag: String? = null,
534541
) {
@@ -559,28 +566,48 @@ private fun CopyAddressCard(
559566
Row(
560567
horizontalArrangement = Arrangement.spacedBy(16.dp)
561568
) {
569+
PrimaryButton(
570+
text = stringResource(R.string.common__edit),
571+
size = ButtonSize.Small,
572+
onClick = onClickEditInvoice,
573+
fullWidth = false,
574+
color = Colors.White10,
575+
icon = {
576+
Icon(
577+
painter = painterResource(R.drawable.ic_pencil_simple),
578+
contentDescription = null,
579+
tint = if (type == CopyAddressType.ONCHAIN) Colors.Brand else Colors.Purple,
580+
modifier = Modifier.size(18.dp)
581+
)
582+
},
583+
modifier = Modifier
584+
.weight(1f)
585+
.testTag("SpecifyInvoiceButton")
586+
)
562587
Tooltip(
563588
text = stringResource(R.string.wallet__receive_copied),
564589
tooltipState = tooltipState,
565590
) {
566-
PrimaryButton(
567-
text = stringResource(R.string.common__copy),
568-
size = ButtonSize.Small,
569-
onClick = {
570-
context.setClipboardText(address)
571-
coroutineScope.launch { tooltipState.show() }
572-
},
573-
fullWidth = false,
574-
color = Colors.White10,
575-
icon = {
576-
Icon(
577-
painter = painterResource(R.drawable.ic_copy),
578-
contentDescription = null,
579-
tint = if (type == CopyAddressType.ONCHAIN) Colors.Brand else Colors.Purple,
580-
modifier = Modifier.size(18.dp)
581-
)
582-
},
583-
)
591+
Box(modifier = Modifier.weight(1f)) {
592+
PrimaryButton(
593+
text = stringResource(R.string.common__copy),
594+
size = ButtonSize.Small,
595+
onClick = {
596+
context.setClipboardText(address)
597+
coroutineScope.launch { tooltipState.show() }
598+
},
599+
fullWidth = false,
600+
color = Colors.White10,
601+
icon = {
602+
Icon(
603+
painter = painterResource(R.drawable.ic_copy),
604+
contentDescription = null,
605+
tint = if (type == CopyAddressType.ONCHAIN) Colors.Brand else Colors.Purple,
606+
modifier = Modifier.size(18.dp)
607+
)
608+
},
609+
)
610+
}
584611
}
585612
PrimaryButton(
586613
text = stringResource(R.string.common__share),
@@ -810,6 +837,7 @@ private fun PreviewDetailsMode() {
810837
bolt11 = "lnbcrt500u1pn7umn7pp5x0s9lt9fwrff6rp70pz3guwnjgw97sjuv79...",
811838
),
812839
cjitInvoice = null,
840+
onClickEditInvoice = {},
813841
modifier = Modifier.weight(1f)
814842
)
815843
}
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
android:width="32dp"
3-
android:height="32dp"
4-
android:viewportWidth="32"
5-
android:viewportHeight="32">
2+
android:width="16dp"
3+
android:height="16dp"
4+
android:viewportWidth="16"
5+
android:viewportHeight="16">
66
<path
7-
android:pathData="M22,29a4,4 0,1 0,0 -8,4 4,0 0,0 0,8M22,11a4,4 0,1 0,0 -8,4 4,0 0,0 0,8"
8-
android:strokeAlpha="0.2"
9-
android:fillColor="#FFFFFF"
10-
android:fillAlpha="0.2"/>
7+
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"
8+
android:fillColor="#FF4400"
9+
android:fillType="evenOdd"/>
1110
<path
12-
android:pathData="M8,13a3,3 0,1 0,0 6,3 3,0 0,0 0,-6m-5,3a5,5 0,1 1,10 0,5 5,0 0,1 -10,0M22,22a3,3 0,1 0,0 6,3 3,0 0,0 0,-6m-5,3a5,5 0,1 1,10 0,5 5,0 0,1 -10,0M22,4a3,3 0,1 0,0 6,3 3,0 0,0 0,-6m-5,3a5,5 0,1 1,10 0,5 5,0 0,1 -10,0"
13-
android:fillColor="#FFFFFF"
11+
android:pathData="M2,5C2.276,5 2.5,5.224 2.5,5.5V13H12C12.276,13 12.5,13.224 12.5,13.5C12.5,13.776 12.276,14 12,14H2.5C2.235,14 1.98,13.895 1.793,13.707C1.605,13.52 1.5,13.265 1.5,13V5.5C1.5,5.224 1.724,5 2,5Z"
12+
android:fillColor="#FF4400"
1413
android:fillType="evenOdd"/>
1514
<path
16-
android:pathData="M19.477,8.622a1,1 0,0 1,-0.3 1.382l-7.272,4.675a1,1 0,1 1,-1.082 -1.683l7.272,-4.674a1,1 0,0 1,1.382 0.3M10.523,17.622a1,1 0,0 1,1.382 -0.3l7.271,4.674a1,1 0,1 1,-1.081 1.682l-7.272,-4.674a1,1 0,0 1,-0.3 -1.382"
17-
android:fillColor="#FFFFFF"
15+
android:pathData="M10.5,7C9.28,7 8.095,7.405 7.131,8.152C6.167,8.899 5.478,9.944 5.173,11.125C5.104,11.392 4.831,11.553 4.563,11.484C4.296,11.415 4.135,11.142 4.205,10.875C4.565,9.48 5.379,8.244 6.519,7.361C7.658,6.479 9.058,6 10.5,6H14C14.276,6 14.5,6.224 14.5,6.5C14.5,6.776 14.276,7 14,7H10.5C10.5,7 10.5,7 10.5,7Z"
16+
android:fillColor="#FF4400"
1817
android:fillType="evenOdd"/>
1918
</vector>

0 commit comments

Comments
 (0)