diff --git a/app/src/main/java/org/mozilla/fenix/exceptions/ExceptionsView.kt b/app/src/main/java/org/mozilla/fenix/exceptions/ExceptionsView.kt index a01cc910e..82cbc1b47 100644 --- a/app/src/main/java/org/mozilla/fenix/exceptions/ExceptionsView.kt +++ b/app/src/main/java/org/mozilla/fenix/exceptions/ExceptionsView.kt @@ -6,8 +6,7 @@ package org.mozilla.fenix.exceptions import android.text.SpannableString import android.text.method.LinkMovementMethod -import android.text.style.ClickableSpan -import android.text.style.ForegroundColorSpan +import android.text.style.UnderlineSpan import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -58,25 +57,15 @@ class ExceptionsView( adapter = ExceptionsAdapter(interactor) layoutManager = LinearLayoutManager(container.context) } - val descriptionText = String - .format( - view.exceptions_empty_view.text.toString(), - System.getProperty("line.separator") - ) - val linkStartIndex = descriptionText.indexOf("\n\n") + 2 - val linkAction = object : ClickableSpan() { - override fun onClick(widget: View?) { - interactor.onLearnMore() - } + val learnMoreText = view.exceptions_learn_more.text.toString() + val textWithLink = SpannableString(learnMoreText).apply { + setSpan(UnderlineSpan(), 0, learnMoreText.length, 0) } - val textWithLink = SpannableString(descriptionText).apply { - setSpan(linkAction, linkStartIndex, descriptionText.length, 0) - val colorSpan = ForegroundColorSpan(view.exceptions_empty_view.currentTextColor) - setSpan(colorSpan, linkStartIndex, descriptionText.length, 0) + with(view.exceptions_learn_more) { + movementMethod = LinkMovementMethod.getInstance() + text = textWithLink + setOnClickListener { interactor.onLearnMore() } } - - view.exceptions_empty_view.movementMethod = LinkMovementMethod.getInstance() - view.exceptions_empty_view.text = textWithLink } fun update(state: ExceptionsFragmentState) { diff --git a/app/src/main/res/layout/component_exceptions.xml b/app/src/main/res/layout/component_exceptions.xml index 8570ae2bb..7f6c16958 100644 --- a/app/src/main/res/layout/component_exceptions.xml +++ b/app/src/main/res/layout/component_exceptions.xml @@ -3,26 +3,45 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - - - + android:layout_margin="@dimen/exceptions_description_margin"> + + + + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 97738c215..cbd9bdab0 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -31,6 +31,7 @@ 18sp 56dp 16dp + 12dp 48dp 8dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4d8fc3794..05a50b51b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -238,8 +238,11 @@ Tracking Protection is off for these websites Turn on for all sites - - Exceptions let you disable tracking protection for selected sites.\n\nLearn more + + Exceptions let you disable tracking protection for selected sites. + + Learn more + Turned off globally, go to Settings to turn it on.