Conversation
Every Vibrator.vibrate() call in CustomHapticEffects.kt failed lint with MissingPermission, because the views manifest declared no permission at all. That was 17 of the 21 lint errors on this branch.
The page creates two state objects on every recomposition, in DrawSpring(mutableStateOf(springX), mutableStateOf(springY)). Pass the values, and let the placeholder take Dp. That is what UnrememberedMutableState exists to catch. The page reads a colour with context.getColor() through LocalContext, which is not configuration-aware. Use colorResource() instead, which drops the LocalContext lookup with it. arePrimitivesSupported() takes a vararg, so the Kotlin snippet needs the spread operator, and lint cannot follow it to the constants. The page omits the spread, and that version does not compile. Suppress WrongConstant on the function, outside the region tag, so the page snippet is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code snippets are for:
List of modifications:
Deviations from the page:
DrawSpring(springX, springY). The page callsDrawSpring(mutableStateOf(springX), mutableStateOf(springY)), which creates two state objects on every recomposition. The page text needs the same change.colorResource(R.color.background). The page usesColor(context.getColor(R.color.background)), which is not configuration-aware and can return a stale value after a configuration change. TheLocalContext.currentlookup goes with it.arePrimitivesSupported()takes a vararg, so the Kotlin snippet passes*primitives. The page omits the spread operator, and that version does not compile.Snippets not migrated: