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 095c77f7f..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 @@ -236,6 +235,7 @@ fun ReceiveQrScreen( tab = tab, walletState = walletState, cjitInvoice = cjitInvoice, + onClickEditInvoice = onClickEditInvoice, modifier = Modifier.weight(1f) ) } @@ -458,6 +458,7 @@ private fun ReceiveDetailsView( tab: ReceiveTab, walletState: MainUiState, cjitInvoice: String?, + onClickEditInvoice: () -> Unit, modifier: Modifier = Modifier, ) { Card( @@ -477,6 +478,7 @@ private fun ReceiveDetailsView( ), body = walletState.onchainAddress, type = CopyAddressType.ONCHAIN, + onClickEditInvoice = onClickEditInvoice, testTag = "ReceiveOnchainAddress", ) } @@ -493,6 +495,7 @@ private fun ReceiveDetailsView( ), body = walletState.onchainAddress, type = CopyAddressType.ONCHAIN, + onClickEditInvoice = onClickEditInvoice, testTag = "ReceiveOnchainAddress", ) } @@ -501,6 +504,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 +516,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 +534,7 @@ private fun CopyAddressCard( title: String, address: String, type: CopyAddressType, + onClickEditInvoice: () -> Unit, body: String? = null, testTag: String? = null, ) { @@ -542,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(), @@ -559,28 +558,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 +829,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"/>