Skip to content

Commit 741c925

Browse files
romtsncodex
andcommitted
fix(android): Make replay animation sample colors API-safe
Use ContextCompat.getColor in ReplayAnimationsActivity so release lint passes with the sample app minSdk. Refs GH-5489 Co-Authored-By: Codex <noreply@openai.com>
1 parent 05247b6 commit 741c925

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import androidx.compose.ui.graphics.drawscope.Stroke
5252
import androidx.compose.ui.text.font.FontWeight
5353
import androidx.compose.ui.unit.dp
5454
import androidx.compose.ui.viewinterop.AndroidView
55+
import androidx.core.content.ContextCompat
5556
import com.airbnb.lottie.compose.LottieAnimation
5657
import com.airbnb.lottie.compose.LottieCompositionSpec
5758
import com.airbnb.lottie.compose.LottieConstants
@@ -68,19 +69,13 @@ class ReplayAnimationsActivity : ComponentActivity() {
6869
super.onCreate(savedInstanceState)
6970

7071
setContent {
72+
val primaryColor = Color(ContextCompat.getColor(this, R.color.colorPrimary))
73+
val accentColor = Color(ContextCompat.getColor(this, R.color.colorAccent))
7174
val colorScheme =
7275
if (isSystemInDarkTheme())
73-
darkColorScheme(
74-
primary = Color(resources.getColor(R.color.colorPrimary, theme)),
75-
secondary = Color(resources.getColor(R.color.colorAccent, theme)),
76-
tertiary = Color(resources.getColor(R.color.colorPrimary, theme)),
77-
)
76+
darkColorScheme(primary = primaryColor, secondary = accentColor, tertiary = primaryColor)
7877
else
79-
lightColorScheme(
80-
primary = Color(resources.getColor(R.color.colorPrimary, theme)),
81-
secondary = Color(resources.getColor(R.color.colorAccent, theme)),
82-
tertiary = Color(resources.getColor(R.color.colorPrimary, theme)),
83-
)
78+
lightColorScheme(primary = primaryColor, secondary = accentColor, tertiary = primaryColor)
8479

8580
MaterialTheme(colorScheme = colorScheme) { ReplayAnimationsScreen(onClose = { finish() }) }
8681
}

0 commit comments

Comments
 (0)