diff --git a/app/src/main/java/org/mozilla/fenix/settings/RadioButtonPreference.kt b/app/src/main/java/org/mozilla/fenix/settings/RadioButtonPreference.kt index a195b3d4d..08f3e35e3 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/RadioButtonPreference.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/RadioButtonPreference.kt @@ -7,11 +7,11 @@ package org.mozilla.fenix.settings import android.content.Context import android.util.AttributeSet import android.view.View -import android.widget.LinearLayout import android.widget.RadioButton import android.widget.TextView import androidx.core.content.res.TypedArrayUtils.getAttr import androidx.core.content.withStyledAttributes +import androidx.core.text.HtmlCompat import androidx.preference.Preference import androidx.preference.PreferenceViewHolder import org.mozilla.fenix.R @@ -22,9 +22,10 @@ open class RadioButtonPreference @JvmOverloads constructor( attrs: AttributeSet? = null ) : Preference(context, attrs) { private val radioGroups = mutableListOf() - private var summaryView: LinearLayout? = null + private var summaryView: TextView? = null private var titleView: TextView? = null private var radioButton: RadioButton? = null + private var shouldSummaryBeParsedAsHtmlContent: Boolean = true private var defaultValue: Boolean = false private var clickListener: (() -> Unit)? = null @@ -126,11 +127,17 @@ open class RadioButtonPreference @JvmOverloads constructor( } private fun bindSummaryView(holder: PreferenceViewHolder) { - summaryView = holder.findViewById(R.id.widget_summary) as LinearLayout + summaryView = holder.findViewById(R.id.widget_summary) as TextView summaryView?.alpha = if (isEnabled) FULL_ALPHA else HALF_ALPHA summaryView?.let { if (!summary.isNullOrEmpty()) { + it.text = if (shouldSummaryBeParsedAsHtmlContent) { + HtmlCompat.fromHtml(summary.toString(), HtmlCompat.FROM_HTML_MODE_COMPACT) + } else { + summary + } + it.visibility = View.VISIBLE } else { it.visibility = View.GONE diff --git a/app/src/main/res/layout/preference_widget_radiobutton.xml b/app/src/main/res/layout/preference_widget_radiobutton.xml index e3beb6a9d..f3555203a 100644 --- a/app/src/main/res/layout/preference_widget_radiobutton.xml +++ b/app/src/main/res/layout/preference_widget_radiobutton.xml @@ -4,84 +4,51 @@ - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/constraintLayout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:baselineAligned="false"> + android:id="@+id/radio_button" + android:layout_width="@dimen/radio_button_preference_height" + android:layout_height="@dimen/radio_button_preference_height" + android:background="@android:color/transparent" + android:layout_gravity="start" + android:button="@null" + android:clickable="false" + android:focusable="false" + android:layout_marginStart="@dimen/radio_button_preference_horizontal" + tools:drawableStart="?android:attr/listChoiceIndicatorSingle" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"/> + android:id="@+id/title" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:gravity="center|start" + android:layout_marginEnd="@dimen/radio_button_preference_horizontal" + tools:text="@tools:sample/lorem" + android:textAppearance="?android:attr/textAppearanceListItem" + app:layout_constraintTop_toTopOf="@id/radio_button" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/radio_button" + app:layout_constraintBottom_toBottomOf="@id/radio_button"/> - - - - - - - - - - - + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?android:attr/textColorSecondary" + tools:text="@tools:sample/lorem/random" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@id/title" + app:layout_constraintTop_toBottomOf="@id/radio_button" + app:layout_constraintStart_toStartOf="@id/title" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2d42719dd..0bb4436f2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1175,33 +1175,6 @@ Passwords - - - Optimize - - Lower image quality, throttle streaming bandwidth, and platform-level optimizations - - Use recommended settings - - Blocked - - Ads, autoplay sound and video (block playing media with sound), cookies (block third-party trackers cookies), trackers (allow some trackers), pop-up, website redirects. - - Ask to allow - - Camera, location, microphone and notification. - - Allowed - - DRM audio and video, JavaScript, cache and site data, images. - - - Use custom settings - - Phone Feature - - No Decision - To allow it: