For #15115 - Part 8: Add a feature flag for showing the grid view in the tabs setting

pull/216/head
Gabriel Luong 4 years ago
parent af0af7f88a
commit 2dd019c05f

@ -26,6 +26,11 @@ object FeatureFlags {
*/
const val topFrecentSite = true
/**
* Shows the grid view settings for the tabs tray.
*/
val showGridViewInTabsSettings = Config.channel.isNightlyOrDebug
/**
* Enables wait til first contentful paint
*/

@ -25,6 +25,12 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.secret_settings_preferences, rootKey)
requirePreference<SwitchPreference>(R.string.pref_key_show_grid_view_tabs_settings).apply {
isVisible = FeatureFlags.showGridViewInTabsSettings
isChecked = context.settings().showGridViewInTabsSettings
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_enable_top_frecent_sites).apply {
isVisible = FeatureFlags.topFrecentSite
isChecked = context.settings().showTopFrecentSites

@ -5,8 +5,10 @@
package org.mozilla.fenix.settings
import android.os.Bundle
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.showToolbar
import org.mozilla.fenix.utils.view.addToRadioGroup
@ -41,6 +43,10 @@ class TabsSettingsFragment : PreferenceFragmentCompat() {
radioOneMonth = requirePreference(R.string.pref_key_close_tabs_after_one_month)
setupRadioGroups()
requirePreference<PreferenceCategory>(R.string.pref_key_tab_view_category).apply {
isVisible = context.settings().showGridViewInTabsSettings
}
}
private fun setupRadioGroups() {

@ -124,6 +124,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
val canShowCfr: Boolean
get() = (System.currentTimeMillis() - lastCfrShownTimeInMillis) > THREE_DAYS_MS
var showGridViewInTabsSettings by featureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_show_grid_view_tabs_settings),
default = false,
featureFlag = FeatureFlags.showGridViewInTabsSettings
)
var waitToShowPageUntilFirstPaint by featureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_wait_first_paint),
default = false,

@ -224,6 +224,7 @@
<string name="pref_key_show_collections_placeholder_home" translatable="false">pref_key_show_collections_home</string>
<!-- Tabs Settings -->
<string name="pref_key_tab_view_category" translatable="false">pref_key_tab_view_category</string>
<string name="pref_key_tab_view_list" translatable="false">pref_key_tab_view_list</string>
<string name="pref_key_tab_view_grid" translatable="false">pref_key_tab_view_grid</string>
<string name="pref_key_tabs" translatable="false">pref_key_tabs</string>
@ -231,6 +232,7 @@
<string name="pref_key_close_tabs_after_one_day" translatable="false">pref_key_close_tabs_after_one_day</string>
<string name="pref_key_close_tabs_after_one_week" translatable="false">pref_key_close_tabs_after_one_week</string>
<string name="pref_key_close_tabs_after_one_month" translatable="false">pref_key_close_tabs_after_one_month</string>
<string name="pref_key_show_grid_view_tabs_settings" translatable="false">pref_key_show_grid_view_tabs_settings</string>
<string name="pref_key_camera_permissions_needed" translatable="false">pref_key_camera_permissions_needed</string>
</resources>

@ -32,6 +32,8 @@
<!-- Label for the secret settings preference -->
<string name="preferences_debug_settings">Secret Settings</string>
<!-- Label for the show grid view in tabs setting preference -->
<string name="preferences_debug_settings_show_grid_view_tabs_settings">Show Grid View in Tabs Settings</string>
<!-- Label for the show top frequently visited sites preference -->
<string name="preferences_debug_settings_enable_top_frecent_sites">Show Top Frequently Visited Sites</string>
<!-- Label for the wait until first paint preference -->

@ -4,6 +4,11 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_show_grid_view_tabs_settings"
android:title="@string/preferences_debug_settings_show_grid_view_tabs_settings"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_enable_top_frecent_sites"

@ -5,10 +5,12 @@
<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:key="@string/pref_key_tab_view_category"
android:layout="@layout/preference_cat_style"
android:title="@string/preferences_tab_view"
app:allowDividerAbove="false"
app:iconSpaceReserved="false">
app:iconSpaceReserved="false"
app:isPreferenceVisible="false">
<org.mozilla.fenix.settings.RadioButtonPreference
android:defaultValue="true"
android:key="@string/pref_key_tab_view_list"

Loading…
Cancel
Save