Closes #510: Adds private browsing myths SUMO link
parent
e57aa67d60
commit
84a2b24554
|
@ -8,6 +8,7 @@ import android.content.res.Resources
|
|||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.text.style.ClickableSpan
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.LayoutInflater
|
||||
|
@ -41,6 +42,7 @@ import org.mozilla.fenix.home.tabs.toSessionViewState
|
|||
import org.mozilla.fenix.mvi.ActionBusFactory
|
||||
import org.mozilla.fenix.mvi.getAutoDisposeObservable
|
||||
import org.mozilla.fenix.mvi.getManagedEmitter
|
||||
import org.mozilla.fenix.settings.SupportUtils
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
fun SessionBundleStorage.archive(sessionManager: SessionManager) {
|
||||
|
@ -233,7 +235,9 @@ class HomeFragment : Fragment() {
|
|||
val linkStartIndex = descriptionText.indexOf("\n\n") + 2
|
||||
val linkAction = object : ClickableSpan() {
|
||||
override fun onClick(widget: View?) {
|
||||
// TODO Go to SUMO page
|
||||
requireComponents.useCases.tabsUseCases.addPrivateTab
|
||||
.invoke(SupportUtils.getSumoURLForTopic(context!!, SupportUtils.SumoTopic.PRIVATE_BROWSING_MYTHS))
|
||||
(activity as HomeActivity).openToBrowser(requireComponents.core.sessionManager.selectedSession?.id)
|
||||
}
|
||||
}
|
||||
val textWithLink = SpannableString(descriptionText).apply {
|
||||
|
@ -242,6 +246,7 @@ class HomeFragment : Fragment() {
|
|||
val colorSpan = ForegroundColorSpan(private_session_description.currentTextColor)
|
||||
setSpan(colorSpan, linkStartIndex, descriptionText.length, 0)
|
||||
}
|
||||
private_session_description.movementMethod = LinkMovementMethod.getInstance()
|
||||
private_session_description.text = textWithLink
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ object SupportUtils {
|
|||
enum class SumoTopic(
|
||||
internal val topicStr: String
|
||||
) {
|
||||
HELP("firefox-android-help")
|
||||
HELP("firefox-android-help"),
|
||||
PRIVATE_BROWSING_MYTHS("private-browsing-myths")
|
||||
}
|
||||
|
||||
fun getSumoURLForTopic(context: Context, topic: SumoTopic): String {
|
||||
|
|
Loading…
Reference in New Issue