mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/14119 - Add a setting to toggle the display of frequently visited top sites (https://github.com/mozilla-mobile/fenix/pull/14183)
This commit is contained in:
parent
eeadfb67e6
commit
188ba0b421
@ -9,7 +9,10 @@ import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.preference.PreferenceCategory
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.SwitchPreference
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.components.toolbar.ToolbarPosition
|
||||
@ -47,6 +50,7 @@ class CustomizationFragment : PreferenceFragmentCompat() {
|
||||
bindAutoBatteryTheme()
|
||||
setupRadioGroups()
|
||||
setupToolbarCategory()
|
||||
setupHomeCategory()
|
||||
}
|
||||
|
||||
private fun setupRadioGroups() {
|
||||
@ -129,4 +133,15 @@ class CustomizationFragment : PreferenceFragmentCompat() {
|
||||
|
||||
addToRadioGroup(topPreference, bottomPreference)
|
||||
}
|
||||
|
||||
private fun setupHomeCategory() {
|
||||
requirePreference<PreferenceCategory>(R.string.pref_home_category).apply {
|
||||
isVisible = FeatureFlags.topFrecentSite
|
||||
}
|
||||
requirePreference<SwitchPreference>(R.string.pref_key_enable_top_frecent_sites).apply {
|
||||
isVisible = FeatureFlags.topFrecentSite
|
||||
isChecked = context.settings().showTopFrecentSites
|
||||
onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,6 +122,9 @@
|
||||
<string name="pref_key_auto_battery_theme" translatable="false">pref_key_auto_battery_theme</string>
|
||||
<string name="pref_key_follow_device_theme" translatable="false">pref_key_follow_device_theme</string>
|
||||
|
||||
<!-- Customization Settings -->
|
||||
<string name="pref_home_category" translatable="false">pref_home_category</string>
|
||||
|
||||
<!-- Tracking Protection Settings -->
|
||||
<string name="pref_key_etp_learn_more" translatable="false">pref_key_etp_learn_more</string>
|
||||
<string name="pref_key_tracking_protection_settings" translatable="false">pref_key_tracking_protection_settings</string>
|
||||
|
@ -280,6 +280,8 @@
|
||||
<string name="preferences_toolbar">Toolbar</string>
|
||||
<!-- Preference for changing default theme to dark or light mode -->
|
||||
<string name="preferences_theme">Theme</string>
|
||||
<!-- Preference for customizing the home screen -->
|
||||
<string name="preferences_home">Home</string>
|
||||
<!-- Preference for settings related to visual options -->
|
||||
<string name="preferences_customize">Customize</string>
|
||||
<!-- Preference description for banner about signing in -->
|
||||
@ -1488,6 +1490,8 @@
|
||||
<string name="top_sites_max_limit_content">To add a new top site, remove one. Long press the site and select remove.</string>
|
||||
<!-- Confirmation dialog button text when top sites limit is reached. -->
|
||||
<string name="top_sites_max_limit_confirmation_button">OK, Got It</string>
|
||||
<!-- Label for the show most visited sites preference -->
|
||||
<string name="top_sites_toggle_top_frecent_sites">Show most visited sites</string>
|
||||
|
||||
<!-- Content description for close button in collection placeholder. -->
|
||||
<string name="remove_home_collection_placeholder_content_description">Remove</string>
|
||||
|
@ -5,10 +5,10 @@
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<androidx.preference.PreferenceCategory
|
||||
android:layout="@layout/preference_cat_style"
|
||||
android:title="@string/preferences_theme"
|
||||
app:iconSpaceReserved="false"
|
||||
app:allowDividerBelow="false"
|
||||
android:layout="@layout/preference_cat_style">
|
||||
app:iconSpaceReserved="false">
|
||||
<org.mozilla.fenix.settings.RadioButtonPreference
|
||||
android:defaultValue="@bool/underAPI28"
|
||||
android:key="@string/pref_key_light_theme"
|
||||
@ -33,10 +33,10 @@
|
||||
</androidx.preference.PreferenceCategory>
|
||||
|
||||
<androidx.preference.PreferenceCategory
|
||||
android:layout="@layout/preference_cat_style"
|
||||
android:title="@string/preferences_toolbar"
|
||||
app:iconSpaceReserved="false"
|
||||
app:allowDividerAbove="false"
|
||||
android:layout="@layout/preference_cat_style">
|
||||
app:iconSpaceReserved="false">
|
||||
<org.mozilla.fenix.settings.RadioButtonPreference
|
||||
android:key="@string/pref_key_toolbar_top"
|
||||
android:title="@string/preference_top_toolbar" />
|
||||
@ -44,4 +44,16 @@
|
||||
android:key="@string/pref_key_toolbar_bottom"
|
||||
android:title="@string/preference_bottom_toolbar" />
|
||||
</androidx.preference.PreferenceCategory>
|
||||
|
||||
<androidx.preference.PreferenceCategory
|
||||
android:key="@string/pref_home_category"
|
||||
android:layout="@layout/preference_cat_style"
|
||||
android:title="@string/preferences_home"
|
||||
app:allowDividerAbove="false"
|
||||
app:iconSpaceReserved="false"
|
||||
app:isPreferenceVisible="false">
|
||||
<androidx.preference.SwitchPreference
|
||||
android:key="@string/pref_key_enable_top_frecent_sites"
|
||||
android:title="@string/top_sites_toggle_top_frecent_sites" />
|
||||
</androidx.preference.PreferenceCategory>
|
||||
</androidx.preference.PreferenceScreen>
|
||||
|
Loading…
Reference in New Issue
Block a user