Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve links clickable in tracker description #384

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.eu.exodus_privacy.exodusprivacy.fragments.trackerdetail
import android.content.res.Configuration
import android.os.Bundle
import android.text.method.LinkMovementMethod
import android.text.util.Linkify
import android.view.View
import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.view.doOnPreDraw
Expand All @@ -22,6 +23,7 @@ import org.eu.exodus_privacy.exodusprivacy.databinding.FragmentTrackerDetailBind
import org.eu.exodus_privacy.exodusprivacy.fragments.apps.model.AppsRVAdapter
import org.eu.exodus_privacy.exodusprivacy.utils.copyToClipboard
import org.eu.exodus_privacy.exodusprivacy.utils.openURL
import java.util.regex.Pattern
import javax.inject.Inject

@AndroidEntryPoint
Expand All @@ -33,6 +35,8 @@ class TrackerDetailFragment : Fragment(R.layout.fragment_tracker_detail) {
private val args: TrackerDetailFragmentArgs by navArgs()
private val viewModel: TrackerDetailViewModel by viewModels()

private val httpPattern: Pattern = Pattern.compile("[a-z]+:\\/\\/[^ \\n]*")

@Inject
lateinit var customTabsIntent: CustomTabsIntent

Expand Down Expand Up @@ -109,6 +113,7 @@ class TrackerDetailFragment : Fragment(R.layout.fragment_tracker_detail) {
movementMethod = LinkMovementMethod.getInstance()
isClickable = true
}
Linkify.addLinks(trackerDescTV, httpPattern, "")
} else {
trackerDescTV.visibility = View.GONE
}
Expand Down