Commit 4b9f07c5 authored by David Walsh's avatar David Walsh Committed by Jeff Boek
Browse files

For #7965 - Remove CDATA strings

parent 095477e0
......@@ -222,7 +222,10 @@ class DefaultToolbarMenu(
}
private val addToFirefoxHome = BrowserMenuImageText(
label = context.getString(R.string.browser_menu_add_to_firefox_home),
label = context.getString(
R.string.browser_menu_add_to_firefox_home,
context.getString(R.string.app_name)
),
imageResource = R.drawable.ic_home,
iconTintColorResource = primaryTextColor()
) {
......
......@@ -43,12 +43,16 @@ fun initBlockedByAndroidView(phoneFeature: PhoneFeature, blockedByAndroidView: V
if (!phoneFeature.isAndroidPermissionGranted(context)) {
blockedByAndroidView.visibility = View.VISIBLE
val descriptionLabel = blockedByAndroidView.findViewById<TextView>(R.id.blocked_by_android_explanation_label)
val text = context.getString(
R.string.phone_feature_blocked_by_android_explanation,
val descriptionLabel = blockedByAndroidView.findViewById<TextView>(R.id.blocked_by_android_feature_label)
val descriptionText = context.getString(
R.string.phone_feature_blocked_step_feature,
phoneFeature.getLabel(context)
)
descriptionLabel.text = HtmlCompat.fromHtml(text, HtmlCompat.FROM_HTML_MODE_COMPACT)
descriptionLabel.text = HtmlCompat.fromHtml(descriptionText, HtmlCompat.FROM_HTML_MODE_COMPACT)
val permissionsLabel = blockedByAndroidView.findViewById<TextView>(R.id.blocked_by_android_permissions_label)
val permissionsText = context.getString(R.string.phone_feature_blocked_step_permissions)
permissionsLabel.text = HtmlCompat.fromHtml(permissionsText, HtmlCompat.FROM_HTML_MODE_COMPACT)
} else {
blockedByAndroidView.visibility = View.GONE
}
......
......@@ -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,10 +22,9 @@ open class RadioButtonPreference @JvmOverloads constructor(
attrs: AttributeSet? = null
) : Preference(context, attrs) {
private val radioGroups = mutableListOf<RadioButtonPreference>()
private var summaryView: TextView? = null
private var summaryView: LinearLayout? = 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
......@@ -127,17 +126,11 @@ open class RadioButtonPreference @JvmOverloads constructor(
}
private fun bindSummaryView(holder: PreferenceViewHolder) {
summaryView = holder.findViewById(R.id.widget_summary) as TextView
summaryView = holder.findViewById(R.id.widget_summary) as LinearLayout
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
......
......@@ -17,18 +17,40 @@
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
android:text="@string/phone_feature_blocked_by_android"
android:layout_marginBottom="16dp"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
android:text="@string/phone_feature_blocked_by_android"
android:layout_marginBottom="16dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:text="@string/phone_feature_blocked_intro"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:text="@string/phone_feature_blocked_step_settings"
android:layout_marginBottom="8dp"/>
<TextView
android:id="@+id/blocked_by_android_permissions_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
tools:text="@string/phone_feature_blocked_step_permissions"
android:layout_marginBottom="8dp" />
<TextView
android:id="@+id/blocked_by_android_explanation_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
tools:text="@string/phone_feature_blocked_by_android_explanation"/>
android:id="@+id/blocked_by_android_feature_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
tools:text="@string/phone_feature_blocked_step_feature"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/settings_button"
......
......@@ -9,7 +9,6 @@
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
<RadioButton
......@@ -36,19 +35,53 @@
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_constraintStart_toEndOf="@id/radio_button"
app:layout_constraintBottom_toBottomOf="@id/radio_button"/>
<TextView
android:id="@+id/widget_summary"
android:layout_width="0dp"
<LinearLayout
android:id="@+id/widget_summary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/radio_button_preference_horizontal"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="@id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/radio_button">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="@string/preference_recommended_settings_blocked_title"
android:textStyle="bold" />
<TextView
android:text="@string/preference_recommended_settings_blocked_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="@string/preference_recommended_settings_allow_title"
android:textStyle="bold" />
<TextView
android:text="@string/preference_recommended_settings_allow_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
tools:text="@string/preference_recommended_settings_summary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/title"
app:layout_constraintTop_toBottomOf="@id/radio_button"
app:layout_constraintStart_toStartOf="@id/title" />
android:layout_marginBottom="8dp"
android:text="@string/preference_recommended_settings_allowed_title"
android:textStyle="bold" />
<TextView
android:text="@string/preference_recommended_settings_allowed_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
......@@ -64,7 +64,7 @@
<string name="browser_menu_bookmark">Bookmark</string>
<!-- Content description (not visible, for screen readers etc.): Un-bookmark the current page -->
<string name="browser_menu_edit_bookmark">Edit bookmark</string>
<!-- Browser menu button that sends a user to help articles -->
<!-- Browser menu button that opens the addon manager -->
<string name="browser_menu_addon_manager">Add-ons Manager</string>
<!-- Text displayed when there are no add-ons to be shown -->
<string name="no_add_ons">No add-ons here</string>
......@@ -78,8 +78,8 @@
<string name="browser_menu_your_library">Your Library</string>
<!-- Browser menu toggle that requests a desktop site -->
<string name="browser_menu_desktop_site">Desktop site</string>
<!-- Browser menu button that adds a top site to the home fragment -->
<string name="browser_menu_add_to_firefox_home">Add to Firefox home</string>
<!-- Browser menu button that adds a top site to the home fragment (for example: Fenix) -->
<string name="browser_menu_add_to_firefox_home">Add to %s home</string>
<!-- Browser menu toggle that adds a shortcut to the site on the device home screen. -->
<string name="browser_menu_add_to_homescreen">Add to Home screen</string>
<!-- Browser menu toggle that installs a Progressive Web App shortcut to the site on the device home screen. -->
......@@ -1170,7 +1170,7 @@
<string name="migration_updating_app_button_text">Updating %s…</string>
<!-- Text on the enabled button. Placeholder replaced with app name-->
<string name="migration_update_app_button">Start %s</string>
<!-- Accessibility description text for completed migration item (e.g. Bookmarks, History). Placeholder replaced with app name -->
<!-- Accessibility description text for completed migration item (e.g. Bookmarks, History). Placeholder example: complete -->
<string name="migration_icon_description">Migration status: %s</string>
<!--Text on list of migrated items (e.g. Settings, History, etc.)-->
<string name="migration_text_passwords">Passwords</string>
......@@ -1182,25 +1182,34 @@
<string name="preference_optimize_summary">Lower image quality, throttle streaming bandwidth, and platform-level optimizations</string>
<!-- Preference for applying recommend rules to all sites -->
<string name="preference_recommended_settings">Use recommended settings</string>
<!-- Label summary to explain how the recommended settings work -->
<string name="preference_recommended_settings_summary"><![CDATA[
<b>Blocked</b>
<br/> Ads, autoplay sound and video (block playing media with sound), cookies (block third-party trackers cookies), trackers (allow some trackers), pop-up, website redirects. <br/><br/> <b>Ask to allow</b>
<!-- Title for the blocked permission explanation -->
<string name="preference_recommended_settings_blocked_title">Blocked</string>
<!-- Description for the blocked permission explanation -->
<string name="preference_recommended_settings_blocked_description">Ads, autoplay sound and video (block playing media with sound), cookies (block third-party trackers cookies), trackers (allow some trackers), pop-up, website redirects.</string>
<!-- Title for the "Ask to Allow" permission explanation -->
<string name="preference_recommended_settings_allow_title">Ask to allow</string>
<!-- Description for the "Ask to Allow" permission explanation -->
<string name="preference_recommended_settings_allow_description">Camera, location, microphone and notification.</string>
<!-- Title for the allowed permission explanation -->
<string name="preference_recommended_settings_allowed_title">Allowed</string>
<!-- Description for the allowed permission explanation -->
<string name="preference_recommended_settings_allowed_description">DRM audio and video, JavaScript, cache and site data, images.</string>
<br/> Camera, location, microphone and notification. <br/><br/> <b>Allowed</b>
<br/> DRM audio and video, JavaScript, cache and site data, images.]]></string>
<!-- Preference for applying custom rules to all sites -->
<string name="preference_custom_settings">Use custom settings</string>
<!-- Preference category for feature phone permissions likes Camera,Microphone, Location ... etc -->
<string name="preference_category_phone_feature">Phone Feature</string>
<!--Label that indicates that a user hasn't select a value for a site permission-->
<string name="phone_feature_no_decision">No Decision</string>
<!-- Explanation that is shown when a permissions like (camera,location and microphone) is required. Informs the user to enable the permission via Android settings. %1$s indicates the name of the permission (camera,location and microphone) -->
<string name="phone_feature_blocked_by_android_explanation"><![CDATA[
To allow it: <br/><br/> 1. Go to Android Settings <br/><br/>2. Tap <b>Permissions</b> <br/><br/> 3. Toggle <b>%1$s</b> to ON
]]></string>
<!-- Heading for the instructions to allow a permission -->
<string name="phone_feature_blocked_intro">To allow it:</string>
<!-- First step for the allowing a permission -->
<string name="phone_feature_blocked_step_settings">1. Go to Android Settings</string>
<!-- Second step for the allowing a permission -->
<string name="phone_feature_blocked_step_permissions"><![CDATA[2. Tap <b>Permissions</b>]]></string>
<!-- Third step for the allowing a permission (Fore example: Camera) -->
<string name="phone_feature_blocked_step_feature"><![CDATA[3. Toggle <b>%1$s</b> to ON]]></string>
<!-- Label that indicates a site is using a secure connection -->
<string name="quick_settings_sheet_secure_connection">Secure Connection</string>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment