diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingPrivacyNoticeViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingPrivacyNoticeViewHolder.kt
index b041d51aba..b5c4b8c754 100644
--- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingPrivacyNoticeViewHolder.kt
+++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingPrivacyNoticeViewHolder.kt
@@ -6,14 +6,29 @@ package org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding
import android.view.View
import androidx.recyclerview.widget.RecyclerView
-import kotlinx.android.synthetic.main.onboarding_theme_picker.view.*
+import kotlinx.android.synthetic.main.onboarding_privacy_notice.view.*
+import kotlinx.android.synthetic.main.onboarding_privacy_notice.view.description_text
+import kotlinx.android.synthetic.main.onboarding_privacy_notice.view.header_text
+import org.jetbrains.anko.dimen
import org.mozilla.fenix.R
+import org.mozilla.fenix.settings.SupportUtils
class OnboardingPrivacyNoticeViewHolder(view: View) : RecyclerView.ViewHolder(view) {
init {
+ val icon = view.context.getDrawable(R.drawable.ic_onboarding_privacy_notice)
+ val size = view.context.dimen(R.dimen.onboarding_privacy_notice_icon_height_width)
+ icon?.setBounds(0, 0, size, size)
+
+ view.header_text.setCompoundDrawables(icon, null, null, null)
+
val appName = view.context.getString(R.string.app_name)
view.description_text.text = view.context.getString(R.string.onboarding_privacy_notice_description, appName)
+
+ view.read_button.setOnClickListener {
+ val intent = SupportUtils.createCustomTabIntent(view.context, SupportUtils.PRIVACY_NOTICE_URL)
+ view.context.startActivity(intent)
+ }
}
companion object {
diff --git a/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt b/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt
index 7036badfa2..d48023d57a 100644
--- a/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt
+++ b/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt
@@ -5,8 +5,11 @@
package org.mozilla.fenix.settings
import android.content.Context
+import android.content.Intent
import android.content.pm.PackageManager
+import android.net.Uri
import org.mozilla.fenix.BuildConfig
+import org.mozilla.fenix.IntentReceiverActivity
import java.io.UnsupportedEncodingException
import java.net.URLEncoder
import java.util.Locale
@@ -15,6 +18,8 @@ object SupportUtils {
const val FEEDBACK_URL = "https://input.mozilla.org"
const val RATE_APP_URL = "market://details?id=" + BuildConfig.APPLICATION_ID
const val MOZILLA_MANIFESTO_URL = "https://www.mozilla.org/en-GB/about/manifesto/"
+ val PRIVACY_NOTICE_URL: String
+ get() = "https://www.mozilla.org/${getLanguageTag(Locale.getDefault())}/privacy/firefox/"
enum class SumoTopic(
internal val topicStr: String
@@ -38,6 +43,14 @@ object SupportUtils {
return "https://support.mozilla.org/$langTag/kb/$escapedTopic"
}
+ fun createCustomTabIntent(context: Context, url: String) = Intent(Intent.ACTION_VIEW).apply {
+ putExtra("android.support.customtabs.extra.SESSION", true)
+ setClassName(context.applicationContext, IntentReceiverActivity::class.java.name)
+ data = Uri.parse(url)
+ setPackage(context.packageName)
+ }
+
+
private fun getEncodedTopicUTF8(topic: String): String {
try {
return URLEncoder.encode(topic, "UTF-8")
diff --git a/app/src/main/res/layout/onboarding_privacy_notice.xml b/app/src/main/res/layout/onboarding_privacy_notice.xml
index 31de083190..28bb7e8937 100644
--- a/app/src/main/res/layout/onboarding_privacy_notice.xml
+++ b/app/src/main/res/layout/onboarding_privacy_notice.xml
@@ -30,7 +30,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/button_background"
- android:backgroundTint="?shadow"
+ android:backgroundTint="?neutralFaded"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 801bbeb2ca..ace7e1e69e 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -33,4 +33,6 @@
46dp
+ 32dp
+
\ No newline at end of file