mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-09-14 06:11:20 -04:00
perf(ui): render QR codes at display density instead of fixed 960px (#6793)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b677d4275d
commit
4d4070c8e1
1 file changed
+4
-2
@@ -38,6 +38,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalClipboard
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -63,13 +64,14 @@ import org.meshtastic.core.ui.util.createClipEntry
|
||||
import org.meshtastic.core.ui.util.rememberQrCodePainter
|
||||
|
||||
private const val QR_DISPLAY_SIZE = 320
|
||||
private const val QR_RENDER_SIZE = 960
|
||||
|
||||
@Composable
|
||||
fun QrDialog(title: String, uriString: String, onDismiss: () -> Unit) {
|
||||
val clipboardManager = LocalClipboard.current
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val qrPainter = rememberQrCodePainter(uriString, QR_RENDER_SIZE)
|
||||
// Render at the actual on-screen pixel size so low-density devices don't over-allocate bitmap memory.
|
||||
val qrRenderSizePx = with(LocalDensity.current) { QR_DISPLAY_SIZE.dp.roundToPx() }
|
||||
val qrPainter = rememberQrCodePainter(uriString, qrRenderSizePx)
|
||||
|
||||
val nfcSupported = LocalNfcScannerSupported.current
|
||||
val nfcWriter = LocalNfcWriterProvider.current
|
||||
|
||||
Reference in new issue
Block a user