2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-02 03:40:16 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/10501 - use theme instead of tint to support older APIs

This commit is contained in:
Mihai Branescu 2020-05-08 09:15:46 +03:00
parent dfdad35cca
commit 28a3988ac2
5 changed files with 19 additions and 26 deletions

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/onboardingSelected" android:state_checked="true" />
<item android:color="?attr/onboardingDeselected" />
</selector>

View File

@ -51,11 +51,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/onboarding_theme_light_title" android:contentDescription="@string/onboarding_theme_light_title"
android:elevation="1dp" android:elevation="1dp"
android:theme="@style/Checkable.Colored"
android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x" android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x"
android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y" android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y"
app:layout_constraintStart_toStartOf="@+id/theme_light_image" app:layout_constraintStart_toStartOf="@+id/theme_light_image"
app:layout_constraintTop_toTopOf="@+id/theme_light_image" app:layout_constraintTop_toTopOf="@+id/theme_light_image"
android:buttonTint="@color/onboarding_radio_button_color"
app:onboardingKey="@string/pref_key_light_theme" /> app:onboardingKey="@string/pref_key_light_theme" />
<ImageView <ImageView
@ -64,13 +64,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
app:srcCompat="@drawable/onboarding_light_theme"
android:contentDescription="@string/onboarding_theme_light_title" android:contentDescription="@string/onboarding_theme_light_title"
android:foreground="@drawable/rounded_ripple" android:foreground="@drawable/rounded_ripple"
app:layout_constraintEnd_toStartOf="@+id/theme_dark_image" app:layout_constraintEnd_toStartOf="@+id/theme_dark_image"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/description_text" /> app:layout_constraintTop_toBottomOf="@+id/description_text"
app:srcCompat="@drawable/onboarding_light_theme" />
<org.mozilla.fenix.onboarding.OnboardingRadioButton <org.mozilla.fenix.onboarding.OnboardingRadioButton
android:id="@+id/theme_dark_radio_button" android:id="@+id/theme_dark_radio_button"
@ -78,11 +78,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/onboarding_theme_dark_title" android:contentDescription="@string/onboarding_theme_dark_title"
android:elevation="1dp" android:elevation="1dp"
android:theme="@style/Checkable.Colored"
android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x" android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x"
android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y" android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y"
app:layout_constraintStart_toStartOf="@+id/theme_dark_image" app:layout_constraintStart_toStartOf="@+id/theme_dark_image"
app:layout_constraintTop_toTopOf="@+id/theme_dark_image" app:layout_constraintTop_toTopOf="@+id/theme_dark_image"
android:buttonTint="@color/onboarding_radio_button_color"
app:onboardingKey="@string/pref_key_dark_theme" /> app:onboardingKey="@string/pref_key_dark_theme" />
<ImageView <ImageView
@ -92,13 +92,13 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
app:srcCompat="@drawable/onboarding_dark_theme"
android:contentDescription="@string/onboarding_theme_dark_title" android:contentDescription="@string/onboarding_theme_dark_title"
android:foreground="@drawable/rounded_ripple" android:foreground="@drawable/rounded_ripple"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/theme_light_image" app:layout_constraintStart_toEndOf="@+id/theme_light_image"
app:layout_constraintTop_toBottomOf="@+id/description_text" /> app:layout_constraintTop_toBottomOf="@+id/description_text"
app:srcCompat="@drawable/onboarding_dark_theme" />
<TextView <TextView
android:id="@+id/dark_theme_title" android:id="@+id/dark_theme_title"
@ -143,10 +143,10 @@
android:contentDescription="@string/onboarding_theme_automatic_title" android:contentDescription="@string/onboarding_theme_automatic_title"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:theme="@style/Checkable.Colored"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider" app:layout_constraintTop_toBottomOf="@+id/divider"
android:buttonTint="@color/onboarding_radio_button_color"
app:onboardingKey="@string/pref_key_follow_device_theme" /> app:onboardingKey="@string/pref_key_follow_device_theme" />
<TextView <TextView

View File

@ -53,12 +53,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/preference_top_toolbar" android:contentDescription="@string/preference_top_toolbar"
android:elevation="1dp" android:elevation="1dp"
android:theme="@style/Checkable.Colored"
android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x" android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x"
android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y" android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y"
app:layout_constraintStart_toStartOf="@+id/toolbar_top_image" app:layout_constraintStart_toStartOf="@+id/toolbar_top_image"
app:layout_constraintTop_toBottomOf="@+id/description_text" app:layout_constraintTop_toBottomOf="@+id/description_text"
app:layout_constraintTop_toTopOf="@+id/toolbar_top_image" app:layout_constraintTop_toTopOf="@+id/toolbar_top_image"
android:buttonTint="@color/onboarding_radio_button_color"
app:onboardingKey="@string/pref_key_toolbar_top" /> app:onboardingKey="@string/pref_key_toolbar_top" />
<ImageView <ImageView
@ -67,13 +67,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
app:srcCompat="@drawable/onboarding_toolbar_top"
android:contentDescription="@string/preference_top_toolbar" android:contentDescription="@string/preference_top_toolbar"
android:foreground="@drawable/rounded_ripple" android:foreground="@drawable/rounded_ripple"
app:layout_constraintEnd_toStartOf="@+id/toolbar_bottom_image" app:layout_constraintEnd_toStartOf="@+id/toolbar_bottom_image"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/description_text" /> app:layout_constraintTop_toBottomOf="@+id/description_text"
app:srcCompat="@drawable/onboarding_toolbar_top" />
<org.mozilla.fenix.onboarding.OnboardingRadioButton <org.mozilla.fenix.onboarding.OnboardingRadioButton
android:id="@+id/toolbar_bottom_radio_button" android:id="@+id/toolbar_bottom_radio_button"
@ -81,12 +81,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/preference_bottom_toolbar" android:contentDescription="@string/preference_bottom_toolbar"
android:elevation="1dp" android:elevation="1dp"
android:theme="@style/Checkable.Colored"
android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x" android:translationX="@dimen/onboarding_dual_pane_radio_button_translation_x"
android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y" android:translationY="@dimen/onboarding_dual_pane_radio_button_translation_y"
app:layout_constraintStart_toStartOf="@+id/toolbar_bottom_image" app:layout_constraintStart_toStartOf="@+id/toolbar_bottom_image"
app:layout_constraintTop_toTopOf="@+id/toolbar_bottom_image"
app:layout_constraintTop_toBottomOf="@+id/description_text" app:layout_constraintTop_toBottomOf="@+id/description_text"
android:buttonTint="@color/onboarding_radio_button_color" app:layout_constraintTop_toTopOf="@+id/toolbar_bottom_image"
app:onboardingKey="@string/pref_key_toolbar_bottom" /> app:onboardingKey="@string/pref_key_toolbar_bottom" />
<ImageView <ImageView
@ -96,13 +96,13 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
app:srcCompat="@drawable/onboarding_toolbar_bottom"
android:contentDescription="@string/preference_bottom_toolbar" android:contentDescription="@string/preference_bottom_toolbar"
android:foreground="@drawable/rounded_ripple" android:foreground="@drawable/rounded_ripple"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/toolbar_top_image" app:layout_constraintStart_toEndOf="@+id/toolbar_top_image"
app:layout_constraintTop_toBottomOf="@+id/description_text" /> app:layout_constraintTop_toBottomOf="@+id/description_text"
app:srcCompat="@drawable/onboarding_toolbar_bottom" />
<TextView <TextView
android:id="@+id/toolbar_bottom_title" android:id="@+id/toolbar_bottom_title"

View File

@ -29,7 +29,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/header_text" app:layout_constraintBottom_toBottomOf="@id/header_text"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:theme="@style/Switch.Colored" android:theme="@style/Checkable.Colored"
app:layout_constraintTop_toTopOf="@id/header_text" /> app:layout_constraintTop_toTopOf="@id/header_text" />
<TextView <TextView
@ -62,9 +62,9 @@
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:theme="@style/Checkable.Colored"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/description_text" app:layout_constraintTop_toBottomOf="@id/description_text"
android:buttonTint="@color/onboarding_radio_button_color"
app:onboardingKey="@string/pref_key_tracking_protection_standard_option" /> app:onboardingKey="@string/pref_key_tracking_protection_standard_option" />
<TextView <TextView
@ -108,10 +108,10 @@
android:checked="true" android:checked="true"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:theme="@style/Checkable.Colored"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tracking_protection_standard_option" app:layout_constraintTop_toBottomOf="@id/tracking_protection_standard_option"
android:buttonTint="@color/onboarding_radio_button_color"
app:onboardingKey="@string/pref_key_tracking_protection_strict_default" /> app:onboardingKey="@string/pref_key_tracking_protection_strict_default" />
<TextView <TextView

View File

@ -104,8 +104,9 @@
<item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyleLight</item> <item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyleLight</item>
</style> </style>
<style name="Switch.Colored" parent="Theme.AppCompat"> <style name="Checkable.Colored" parent="Theme.AppCompat">
<item name="colorControlActivated">?attr/onboardingSelected</item> <item name="colorControlActivated">?attr/onboardingSelected</item>
<item name="colorControlNormal">?attr/onboardingDeselected</item>
</style> </style>
<style name="DialogStyleDark" parent="BaseDialogStyle"> <style name="DialogStyleDark" parent="BaseDialogStyle">