1
0
Fork 0

For #7965 - Remove CDATA strings

master
David Walsh 2020-02-05 16:09:25 -06:00 committed by Jeff Boek
parent 095477e0ef
commit 4b9f07c511
6 changed files with 117 additions and 53 deletions

View File

@ -222,7 +222,10 @@ class DefaultToolbarMenu(
} }
private val addToFirefoxHome = BrowserMenuImageText( 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, imageResource = R.drawable.ic_home,
iconTintColorResource = primaryTextColor() iconTintColorResource = primaryTextColor()
) { ) {

View File

@ -43,12 +43,16 @@ fun initBlockedByAndroidView(phoneFeature: PhoneFeature, blockedByAndroidView: V
if (!phoneFeature.isAndroidPermissionGranted(context)) { if (!phoneFeature.isAndroidPermissionGranted(context)) {
blockedByAndroidView.visibility = View.VISIBLE blockedByAndroidView.visibility = View.VISIBLE
val descriptionLabel = blockedByAndroidView.findViewById<TextView>(R.id.blocked_by_android_explanation_label) val descriptionLabel = blockedByAndroidView.findViewById<TextView>(R.id.blocked_by_android_feature_label)
val text = context.getString( val descriptionText = context.getString(
R.string.phone_feature_blocked_by_android_explanation, R.string.phone_feature_blocked_step_feature,
phoneFeature.getLabel(context) 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 { } else {
blockedByAndroidView.visibility = View.GONE blockedByAndroidView.visibility = View.GONE
} }

View File

@ -7,11 +7,11 @@ package org.mozilla.fenix.settings
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import android.widget.LinearLayout
import android.widget.RadioButton import android.widget.RadioButton
import android.widget.TextView import android.widget.TextView
import androidx.core.content.res.TypedArrayUtils.getAttr import androidx.core.content.res.TypedArrayUtils.getAttr
import androidx.core.content.withStyledAttributes import androidx.core.content.withStyledAttributes
import androidx.core.text.HtmlCompat
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder import androidx.preference.PreferenceViewHolder
import org.mozilla.fenix.R import org.mozilla.fenix.R
@ -22,10 +22,9 @@ open class RadioButtonPreference @JvmOverloads constructor(
attrs: AttributeSet? = null attrs: AttributeSet? = null
) : Preference(context, attrs) { ) : Preference(context, attrs) {
private val radioGroups = mutableListOf<RadioButtonPreference>() private val radioGroups = mutableListOf<RadioButtonPreference>()
private var summaryView: TextView? = null private var summaryView: LinearLayout? = null
private var titleView: TextView? = null private var titleView: TextView? = null
private var radioButton: RadioButton? = null private var radioButton: RadioButton? = null
private var shouldSummaryBeParsedAsHtmlContent: Boolean = true
private var defaultValue: Boolean = false private var defaultValue: Boolean = false
private var clickListener: (() -> Unit)? = null private var clickListener: (() -> Unit)? = null
@ -127,17 +126,11 @@ open class RadioButtonPreference @JvmOverloads constructor(
} }
private fun bindSummaryView(holder: PreferenceViewHolder) { 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?.alpha = if (isEnabled) FULL_ALPHA else HALF_ALPHA
summaryView?.let { summaryView?.let {
if (!summary.isNullOrEmpty()) { if (!summary.isNullOrEmpty()) {
it.text = if (shouldSummaryBeParsedAsHtmlContent) {
HtmlCompat.fromHtml(summary.toString(), HtmlCompat.FROM_HTML_MODE_COMPACT)
} else {
summary
}
it.visibility = View.VISIBLE it.visibility = View.VISIBLE
} else { } else {
it.visibility = View.GONE it.visibility = View.GONE

View File

@ -17,18 +17,40 @@
tools:visibility="visible"> tools:visibility="visible">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem" android:textAppearance="?android:attr/textAppearanceListItem"
android:text="@string/phone_feature_blocked_by_android" android:text="@string/phone_feature_blocked_by_android"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp" />
<TextView <TextView
android:id="@+id/blocked_by_android_explanation_label" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textAppearance="?android:attr/textAppearanceListItemSmall" android:text="@string/phone_feature_blocked_intro"
tools:text="@string/phone_feature_blocked_by_android_explanation"/> 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_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 <com.google.android.material.button.MaterialButton
android:id="@+id/settings_button" android:id="@+id/settings_button"

View File

@ -9,7 +9,6 @@
android:id="@+id/constraintLayout" android:id="@+id/constraintLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false"> android:baselineAligned="false">
<RadioButton <RadioButton
@ -36,19 +35,53 @@
android:textAppearance="?android:attr/textAppearanceListItem" android:textAppearance="?android:attr/textAppearanceListItem"
app:layout_constraintTop_toTopOf="@id/radio_button" app:layout_constraintTop_toTopOf="@id/radio_button"
app:layout_constraintEnd_toEndOf="parent" 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"/> app:layout_constraintBottom_toBottomOf="@id/radio_button"/>
<TextView <LinearLayout
android:id="@+id/widget_summary" android:id="@+id/widget_summary"
android:layout_width="0dp" 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_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:layout_marginBottom="8dp"
android:textColor="?android:attr/textColorSecondary" android:text="@string/preference_recommended_settings_blocked_title"
tools:text="@string/preference_recommended_settings_summary" android:textStyle="bold" />
app:layout_constraintBottom_toBottomOf="parent" <TextView
app:layout_constraintEnd_toEndOf="@id/title" android:text="@string/preference_recommended_settings_blocked_description"
app:layout_constraintTop_toBottomOf="@id/radio_button" android:layout_width="match_parent"
app:layout_constraintStart_toStartOf="@id/title" /> 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: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> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -64,7 +64,7 @@
<string name="browser_menu_bookmark">Bookmark</string> <string name="browser_menu_bookmark">Bookmark</string>
<!-- Content description (not visible, for screen readers etc.): Un-bookmark the current page --> <!-- Content description (not visible, for screen readers etc.): Un-bookmark the current page -->
<string name="browser_menu_edit_bookmark">Edit bookmark</string> <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> <string name="browser_menu_addon_manager">Add-ons Manager</string>
<!-- Text displayed when there are no add-ons to be shown --> <!-- Text displayed when there are no add-ons to be shown -->
<string name="no_add_ons">No add-ons here</string> <string name="no_add_ons">No add-ons here</string>
@ -78,8 +78,8 @@
<string name="browser_menu_your_library">Your Library</string> <string name="browser_menu_your_library">Your Library</string>
<!-- Browser menu toggle that requests a desktop site --> <!-- Browser menu toggle that requests a desktop site -->
<string name="browser_menu_desktop_site">Desktop site</string> <string name="browser_menu_desktop_site">Desktop site</string>
<!-- Browser menu button that adds a top site to the home fragment --> <!-- 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 Firefox home</string> <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. --> <!-- 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> <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. --> <!-- 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> <string name="migration_updating_app_button_text">Updating %s…</string>
<!-- Text on the enabled button. Placeholder replaced with app name--> <!-- Text on the enabled button. Placeholder replaced with app name-->
<string name="migration_update_app_button">Start %s</string> <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> <string name="migration_icon_description">Migration status: %s</string>
<!--Text on list of migrated items (e.g. Settings, History, etc.)--> <!--Text on list of migrated items (e.g. Settings, History, etc.)-->
<string name="migration_text_passwords">Passwords</string> <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> <string name="preference_optimize_summary">Lower image quality, throttle streaming bandwidth, and platform-level optimizations</string>
<!-- Preference for applying recommend rules to all sites --> <!-- Preference for applying recommend rules to all sites -->
<string name="preference_recommended_settings">Use recommended settings</string> <string name="preference_recommended_settings">Use recommended settings</string>
<!-- Label summary to explain how the recommended settings work --> <!-- Title for the blocked permission explanation -->
<string name="preference_recommended_settings_summary"><![CDATA[ <string name="preference_recommended_settings_blocked_title">Blocked</string>
<b>Blocked</b> <!-- 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/> 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>
<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 --> <!-- Preference for applying custom rules to all sites -->
<string name="preference_custom_settings">Use custom settings</string> <string name="preference_custom_settings">Use custom settings</string>
<!-- Preference category for feature phone permissions likes Camera,Microphone, Location ... etc --> <!-- Preference category for feature phone permissions likes Camera,Microphone, Location ... etc -->
<string name="preference_category_phone_feature">Phone Feature</string> <string name="preference_category_phone_feature">Phone Feature</string>
<!--Label that indicates that a user hasn't select a value for a site permission--> <!--Label that indicates that a user hasn't select a value for a site permission-->
<string name="phone_feature_no_decision">No Decision</string> <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[ <!-- Heading for the instructions to allow a permission -->
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 name="phone_feature_blocked_intro">To allow it:</string>
]]></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 --> <!-- Label that indicates a site is using a secure connection -->
<string name="quick_settings_sheet_secure_connection">Secure Connection</string> <string name="quick_settings_sheet_secure_connection">Secure Connection</string>