X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FViewSourceActivity.kt;fp=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FViewSourceActivity.kt;h=8868697a37d875e30001b014d3a373ce4d02ff23;hp=3769a6820448a37053a785aa307e6396eb6b8722;hb=f441c077da729e1d3d97c9efb46e8380a0730dd9;hpb=1243964145685f9496b119e71d776efe0e668d5b diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt index 3769a682..8868697a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt @@ -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()