]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt
Update the night mode red text color. https://redmine.stoutner.com/issues/691
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / ViewSourceActivity.kt
index 3769a6820448a37053a785aa307e6396eb6b8722..8868697a37d875e30001b014d3a373ce4d02ff23 100644 (file)
@@ -19,7 +19,6 @@
 
 package com.stoutner.privacybrowser.activities
 
-import android.content.res.Configuration
 import android.os.Build
 import android.os.Bundle
 import android.text.SpannableStringBuilder
@@ -139,23 +138,10 @@ class ViewSourceActivity: AppCompatActivity(), UntrustedSslCertificateListener {
         // Populate the URL text box.
         urlEditText.setText(currentUrl)
 
-        // Initialize the gray foreground color spans for highlighting the URLs.  The deprecated `getColor()` must be used until the minimum API >= 23.
-        @Suppress("DEPRECATION")
-        initialGrayColorSpan = ForegroundColorSpan(resources.getColor(R.color.gray_500))
-        @Suppress("DEPRECATION")
-        finalGrayColorSpan = ForegroundColorSpan(resources.getColor(R.color.gray_500))
-
-        // Get the current theme status.
-        val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
-
-        // Set the red color span according to the theme.  The deprecated `getColor()` must be used until the minimum API >= 23.
-        redColorSpan = if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-            @Suppress("DEPRECATION")
-            ForegroundColorSpan(resources.getColor(R.color.red_a700))
-        } else {
-            @Suppress("DEPRECATION")
-            ForegroundColorSpan(resources.getColor(R.color.red_900))
-        }
+        // Initialize the gray foreground color spans for highlighting the URLs.
+        initialGrayColorSpan = ForegroundColorSpan(getColor(R.color.gray_500))
+        finalGrayColorSpan = ForegroundColorSpan(getColor(R.color.gray_500))
+        redColorSpan = ForegroundColorSpan(getColor(R.color.red_text))
 
         // Apply text highlighting to the URL.
         highlightUrlText()