+ } else if (urlString.startsWith("view-source:http://")) { // An insecure source is being viewed.
+ // Check to see if subdomains should be de-emphasized.
+ if (penultimateDotIndex > 0) { // There are subdomains that should be de-emphasized.
+ // De-emphasize the `view-source:` text.
+ urlEditText.text.setSpan(initialGrayColorSpan, 0, penultimateDotIndex + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
+ } else { // There are no subdomains that need to be de-emphasized.
+ // De-emphasize the `view-source:` text.
+ urlEditText.text.setSpan(initialGrayColorSpan, 0, 11, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
+ }
+
+ // Highlight the protocol in red.
+ urlEditText.text.setSpan(redColorSpan, 12, 19, Spanned.SPAN_INCLUSIVE_INCLUSIVE)