1
0
Fork 0

For #7965 - removed unused strings, reverted changes to radiobutton widget

master
Jeff Boek 2020-02-06 17:16:33 -08:00
parent 4b9f07c511
commit 62d540257f
3 changed files with 48 additions and 101 deletions

View File

@ -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<RadioButtonPreference>()
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

View File

@ -4,84 +4,51 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<androidx.constraintlayout.widget.ConstraintLayout
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:baselineAligned="false">
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">
<RadioButton
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/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"/>
<TextView
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="Use recommended settings"
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: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"/>
<LinearLayout
<TextView
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: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>
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" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1175,33 +1175,6 @@
<!--Text on list of migrated items (e.g. Settings, History, etc.)-->
<string name="migration_text_passwords">Passwords</string>
<!-- Site Permissions Preferences -->
<!-- Preference for reducing image sizes, bandwidth and platform-level optimizations -->
<string name="preference_optimize">Optimize</string>
<!-- Label summary to explain how the optimize preference works -->
<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>
<!-- 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>
<!-- 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>
<!-- 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 -->