From 4c21e083b0dff95e242599cc0783bd885cfbd732 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 09:13:30 +0000 Subject: [PATCH] chore: replace deprecated Resources.getColor and Gradle space-assignment DSL Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- app/build.gradle | 16 ++++++++-------- .../launchdarkly/hello_android/MainActivity.kt | 11 ++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3ac7af8..2735caa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,24 +3,24 @@ plugins { } android { - namespace "com.launchdarkly.hello_android" - compileSdk 37 + namespace = "com.launchdarkly.hello_android" + compileSdk = 37 defaultConfig { - applicationId "com.launchdarkly.hello_android" + applicationId = "com.launchdarkly.hello_android" minSdkVersion(24) targetSdkVersion(34) - versionCode 1 - versionName "1.0" + versionCode = 1 + versionName = "1.0" } buildTypes { release { - minifyEnabled false + minifyEnabled = false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } } diff --git a/app/src/main/java/com/launchdarkly/hello_android/MainActivity.kt b/app/src/main/java/com/launchdarkly/hello_android/MainActivity.kt index 0130da4..b540819 100644 --- a/app/src/main/java/com/launchdarkly/hello_android/MainActivity.kt +++ b/app/src/main/java/com/launchdarkly/hello_android/MainActivity.kt @@ -5,6 +5,7 @@ import android.view.View import android.widget.TextView import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat import com.launchdarkly.hello_android.MainApplication.Companion.LAUNCHDARKLY_MOBILE_KEY import com.launchdarkly.sdk.android.LDClient @@ -36,11 +37,11 @@ class MainActivity : AppCompatActivity() { ) // Style the display - textView.setTextColor(resources.getColor(R.color.colorText)) + textView.setTextColor(ContextCompat.getColor(this, R.color.colorText)) if(flagValue) { - fullView.setBackgroundColor(resources.getColor(R.color.colorBackgroundTrue)) + fullView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackgroundTrue)) } else { - fullView.setBackgroundColor(resources.getColor(R.color.colorBackgroundFalse)) + fullView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackgroundFalse)) } // to register a listener to get updates in real time @@ -52,9 +53,9 @@ class MainActivity : AppCompatActivity() { changedFlagValue.toString() ) if(changedFlagValue) { - fullView.setBackgroundColor(resources.getColor(R.color.colorBackgroundTrue)) + fullView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackgroundTrue)) } else { - fullView.setBackgroundColor(resources.getColor(R.color.colorBackgroundFalse)) + fullView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackgroundFalse)) } } }