Fix QR code padding and icon

This commit is contained in:
Andrew 2024-06-26 23:15:19 +09:30
parent aa5e46ff44
commit 9831758060
3 changed files with 10 additions and 3 deletions

View File

@ -83,7 +83,11 @@ internal fun StartConversationScreen(
style = small
)
Spacer(modifier = Modifier.height(LocalDimensions.current.smallItemSpacing))
QrImage(string = accountId, Modifier.contentDescription(R.string.AccessibilityId_qr_code))
QrImage(
string = accountId,
Modifier.contentDescription(R.string.AccessibilityId_qr_code),
icon = R.drawable.session
)
}
}
}

View File

@ -23,6 +23,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import network.loki.messenger.R
import org.thoughtcrime.securesms.ui.CellWithPaddingAndMargin
import org.thoughtcrime.securesms.ui.LocalDimensions
@ -100,6 +101,7 @@ private fun RecoveryPasswordCell(
modifier = Modifier
.padding(vertical = LocalDimensions.current.smallMargin)
.contentDescription(R.string.AccessibilityId_qr_code),
contentPadding = 10.dp,
icon = R.drawable.session_shield
)
}

View File

@ -27,6 +27,7 @@ import androidx.compose.ui.graphics.FilterQuality
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@ -39,6 +40,7 @@ import org.thoughtcrime.securesms.util.QRCodeUtilities
fun QrImage(
string: String?,
modifier: Modifier = Modifier,
contentPadding: Dp = LocalDimensions.current.smallItemSpacing,
icon: Int = R.drawable.session_shield
) {
var bitmap: Bitmap? by remember {
@ -58,7 +60,7 @@ fun QrImage(
backgroundColor = LocalColors.current.qrCodeBackground,
elevation = 0.dp,
modifier = modifier
) { Content(bitmap, icon, backgroundColor = LocalColors.current.qrCodeBackground) }
) { Content(bitmap, icon, Modifier.padding(contentPadding), backgroundColor = LocalColors.current.qrCodeBackground) }
}
@Composable
@ -71,7 +73,6 @@ private fun Content(
) {
Box(
modifier = modifier
.padding(LocalDimensions.current.xxxsItemSpacing)
.fillMaxWidth()
.aspectRatio(1f)
) {