arrows: fix all lint findings
- Commit
c91edc93d8e7190bd3f7b6c1f219bab87cd91bbd- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-17 04:48 UTC (19 days ago)
- Parents
25f2778
Fix every lint error and warning reported for the arrows module's own sources by :games:arrows:lintDev, now 0 errors / 0 warnings for games/arrows/** (remaining report entries are transitive library/** findings owned by other clusters). - InlinedApi: guard the POST_NOTIFICATIONS reference in SettingsPage with an SDK_INT >= TIRAMISU check, falling back to an empty permission string below API 33. The constant is a String inlined at compile time, so the guarded reference is safe; it is only requested on API 33+ when the reminder is enabled. - PluralsCandidate: converted heart_hint from <string> to <plurals> with one/other quantities (adding the heart/hearts noun), and updated the Compose call site to pluralStringResource(R.plurals.heart_hint, count, count) and the unit-test lookup to resources.getQuantityString. No locale file carried heart_hint, so no locale conversion was needed. No @SuppressLint added; no lint config or baseline changed. Verified: /tmp/run-gradle-f-arrows.sh --no-daemon :games:arrows:lintDev :games:arrows:testDevUnitTest green; lint report has 0 own-module errors/warnings/hints (71 total entries, all under library/**).
Diff
games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/ArrowsGameScreen.kt
diff --git a/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/ArrowsGameScreen.kt b/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/ArrowsGameScreen.ktindex 16418c347e..0ee7bd7183 100644--- a/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/ArrowsGameScreen.kt+++ b/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/ArrowsGameScreen.kt@@ -19,6 +19,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier+import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp@@ -267,7 +268,7 @@ private fun GameStatus(state: ArrowsUiState, actions: ArrowsGameActions, onResta else -> { if (state.showHeartHint) { Text(- stringResource(R.string.heart_hint, STARTING_HEARTS),+ pluralStringResource(R.plurals.heart_hint, STARTING_HEARTS, STARTING_HEARTS), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error, textAlign = TextAlign.Center,
games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/SettingsPage.kt
diff --git a/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/SettingsPage.kt b/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/SettingsPage.ktindex 419670da81..fc94bfbee3 100644--- a/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/SettingsPage.kt+++ b/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/SettingsPage.kt@@ -25,7 +25,14 @@ fun SettingsPage(viewModel: ArrowsViewModel, onBack: () -> Unit) { val uiState by viewModel.uiState.collectAsState() val reminderEnabled by viewModel.reminderEnabled.collectAsState() val reminderMinutes by viewModel.reminderMinutesOfDay.collectAsState()- val requestNotifications = rememberPermissionRequest(Manifest.permission.POST_NOTIFICATIONS)+ // POST_NOTIFICATIONS is a String constant inlined at compile time, so referencing+ // it below API 33 is safe; it is only requested on API 33+ (see setReminderEnabled).+ val notificationPermission = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {+ Manifest.permission.POST_NOTIFICATIONS+ } else {+ ""+ }+ val requestNotifications = rememberPermissionRequest(notificationPermission) SettingsScreen( state = SettingsUiState(
games/arrows/src/main/res/values/strings.xml
diff --git a/games/arrows/src/main/res/values/strings.xml b/games/arrows/src/main/res/values/strings.xmlindex 0e95cc18b1..95370268f4 100644--- a/games/arrows/src/main/res/values/strings.xml+++ b/games/arrows/src/main/res/values/strings.xml@@ -30,7 +30,10 @@ <!-- ArrowsGameScreen: Dismisses the one-time redirector explanation. Short verb phrase --> <string name="got_it">Got it</string> <!-- ArrowsGameScreen: Shown once, the first time a blocked arrow costs a heart. %1$d = hearts per board, e.g. 3. Sentence -->- <string name="heart_hint">That arrow was blocked, so it cost a heart. Lose all <xliff:g id="hearts" example="3">%1$d</xliff:g> and the board starts over.</string>+ <plurals name="heart_hint">+ <item quantity="one">That arrow was blocked, so it cost a heart. Lose all <xliff:g id="hearts" example="3">%1$d</xliff:g> heart and the board starts over.</item>+ <item quantity="other">That arrow was blocked, so it cost a heart. Lose all <xliff:g id="hearts" example="3">%1$d</xliff:g> hearts and the board starts over.</item>+ </plurals> <!-- ArrowsGameScreen: Shown when no clearable board could be generated for this level. Sentence --> <string name="generation_failed">Could not build a board for this level.</string>
games/arrows/src/test/java/com/vayunmathur/games/arrows/ui/ArrowsScreensTest.kt
diff --git a/games/arrows/src/test/java/com/vayunmathur/games/arrows/ui/ArrowsScreensTest.kt b/games/arrows/src/test/java/com/vayunmathur/games/arrows/ui/ArrowsScreensTest.ktindex f6d3a46f30..3f4202ac88 100644--- a/games/arrows/src/test/java/com/vayunmathur/games/arrows/ui/ArrowsScreensTest.kt+++ b/games/arrows/src/test/java/com/vayunmathur/games/arrows/ui/ArrowsScreensTest.kt@@ -298,6 +298,6 @@ class ArrowsScreensTest { rule.setContent { ArrowsGameScreen(ArrowsUiState(game = game(hearts = 2, blockedId = 0), showHeartHint = true), RecordingActions(), {}, {}) }- rule.onNodeWithText(ctx.getString(R.string.heart_hint, STARTING_HEARTS)).assertIsDisplayed()+ rule.onNodeWithText(ctx.resources.getQuantityString(R.plurals.heart_hint, STARTING_HEARTS, STARTING_HEARTS)).assertIsDisplayed() } }