From 2a4ab2f49f597ea4a4a632735139d07d504ee18f Mon Sep 17 00:00:00 2001 From: Phil Oliver <3497406+poliver@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:30:00 -0400 Subject: [PATCH] Fix lint in `Main.kt` (#3484) --- .../main/java/com/geeksville/mesh/ui/Main.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/ui/Main.kt b/app/src/main/java/com/geeksville/mesh/ui/Main.kt index 08e59c7ed..49c5c733f 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/Main.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/Main.kt @@ -34,6 +34,7 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.imePadding +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.recalculateWindowInsets import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.foundation.rememberScrollState @@ -73,6 +74,7 @@ import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalResources import androidx.compose.ui.res.stringResource import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -371,8 +373,8 @@ fun MainScreen(uIViewModel: UIViewModel = hiltViewModel(), scanModel: BTScanMode } }, ) { - Scaffold(snackbarHost = { SnackbarHost(uIViewModel.snackBarHostState) }) { _ -> - Column(modifier = Modifier.fillMaxSize()) { + Scaffold(snackbarHost = { SnackbarHost(uIViewModel.snackBarHostState) }) { paddingValues -> + Column(modifier = Modifier.fillMaxSize().padding(paddingValues)) { NavHost( navController = navController, startDestination = NodesRoutes.NodesGraph, @@ -396,6 +398,7 @@ private fun VersionChecks(viewModel: UIViewModel) { val connectionState by viewModel.connectionState.collectAsStateWithLifecycle() val myNodeInfo by viewModel.myNodeInfo.collectAsStateWithLifecycle() val context = LocalContext.current + val resources = LocalResources.current val myFirmwareVersion = myNodeInfo?.firmwareVersion @@ -427,8 +430,8 @@ private fun VersionChecks(viewModel: UIViewModel) { val isOld = info.minAppVersion > BuildConfig.VERSION_CODE && BuildConfig.DEBUG.not() if (isOld) { viewModel.showAlert( - context.getString(R.string.app_too_old), - context.getString(R.string.must_update), + resources.getString(R.string.app_too_old), + resources.getString(R.string.must_update), dismissable = false, onConfirm = { val service = viewModel.meshService ?: return@showAlert @@ -439,8 +442,8 @@ private fun VersionChecks(viewModel: UIViewModel) { myFirmwareVersion?.let { val curVer = DeviceVersion(it) if (curVer < MeshService.absoluteMinDeviceVersion) { - val title = context.getString(R.string.firmware_too_old) - val message = context.getString(R.string.firmware_old) + val title = resources.getString(R.string.firmware_too_old) + val message = resources.getString(R.string.firmware_old) viewModel.showAlert( title = title, html = message, @@ -451,9 +454,9 @@ private fun VersionChecks(viewModel: UIViewModel) { }, ) } else if (curVer < MeshService.minDeviceVersion) { - val title = context.getString(R.string.should_update_firmware) + val title = resources.getString(R.string.should_update_firmware) val message = - context.getString(R.string.should_update, latestStableFirmwareRelease.asString) + resources.getString(R.string.should_update, latestStableFirmwareRelease.asString) viewModel.showAlert(title = title, message = message, dismissable = false, onConfirm = {}) } }