|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
package org.mozilla.fenix
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import mozilla.components.support.locale.LocaleManager
|
|
|
|
import mozilla.components.support.locale.LocaleManager.getSystemDefault
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A single source for setting feature flags that are mostly based on build type.
|
|
|
|
*/
|
|
|
|
object FeatureFlags {
|
|
|
|
/**
|
|
|
|
* Pull-to-refresh allows you to pull the web content down far enough to have the page to
|
|
|
|
* reload.
|
|
|
|
*/
|
|
|
|
val pullToRefreshEnabled = Config.channel.isNightlyOrDebug
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables the Addresses autofill feature.
|
|
|
|
*/
|
|
|
|
val addressesFeature = Config.channel.isNightlyOrDebug
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables the "recent" tabs feature in the home screen.
|
|
|
|
*/
|
|
|
|
const val showRecentTabsFeature = true
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables UI features based on history metadata.
|
|
|
|
*/
|
|
|
|
const val historyMetadataUIFeature = true
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables the recently saved bookmarks feature in the home screen.
|
|
|
|
*/
|
|
|
|
const val recentBookmarksFeature = true
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Identifies and separates the tabs list with a secondary section containing least used tabs.
|
|
|
|
*/
|
|
|
|
const val inactiveTabs = true
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables showing the home screen behind the search dialog
|
|
|
|
*/
|
|
|
|
const val showHomeBehindSearch = true
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Identifies and separates the tabs list with a group containing search term tabs.
|
|
|
|
*/
|
|
|
|
val tabGroupFeature = Config.channel.isNightlyOrDebug
|
|
|
|
|
Support tab movement/reordering (#22751)
* Adds basic support for tab reordering via drag-and-drop selected tabs
* ktlint/detekt formatting
* Use defaultTabsFilter (now not private) instead of getter
* Convert from position+filter API to target+placeAfter
Unfortunately I still need the filter passed around a bit
* Handle inactive tabs' holder being children of the RecyclerView of the normal tabs
Don't go through LayoutManager needlessly
* Non-working use tabID the whole way. Does not compile.
* Fix to do direct tab ID and use grid setting directly
* Remove non-null assertion. Now fully works for "other" tabs.
* Prevent grouped tabs from being dragged
* Remove unused import
* Add/fix comments
* Do API version check and use deprecated startDrag if too old.
* Build process fails: both outdated and too new, so reverting to just too new
* Use deprecated function and suppress warning
* fix space
* Suppress "TooManyFunctions" on DefaultTabsTrayController
* Repeatedly update tab movement during drag
* Remove multi-tab movement, only allow dragging if tab groups disabled, fix tab positioning during movement
I'm forced to suppress LongParameterList to get the settings information where it needs to go though
* Remove settings argument and corresponding long args suppression: instead get settings from parent AbstractBrowserTrayList's context
* New UI: Select a tab and then, while holding down, start dragging
* Revert to using before/after boolean to accomodate delays
Move drag transparency to start of drag
* Use new BlankDragShadowBuilder and DraggableItemAnimator to handle tab movement
* Replace Pair<>s with data classes
* Only drag if exactly 1 tab selected, don't consume drag event if not used
* Auto-scroll tab tray while dragging near top/bottom edge
* Remove unexpected scrolling on tab bind (triggered when tab is selected)
* Fix broken scroll behavior during dragging
* Cleanup for ktlint/detekt
* Constantly set elevation during drag in case of update
Clean code at drag start
* Add custom drag start behavior
* Add drag distance constant, do all touch-drag behavior in OnTouchListener
* Disable parent vertical scrolling on drag start, fix detekt ComplexCondition
* Minor cleanup/comments
* Revert removal of scroll on bind, this was related to something different
* Correction to prepareForDrop to match documentation- doesn't seem to have any effect
* Simplify via unchecked typecast, use ViewCompat
* Use ViewConfiguration.scaledTouchSlop instead of arbitrary 30px
* Added tabReorderingFeature flag, split drag interactor to separate function to satisfy complexity requirement
Co-authored-by: Steven Knipe <ssk97@case.edu>
Co-authored-by: ssk97 <knipesteven@gmail.com>
Co-authored-by: Sebastian Kaspari <s.kaspari@gmail.com>
3 years ago
|
|
|
/**
|
|
|
|
* Allows tabs to be dragged around as long as tab groups are disabled
|
|
|
|
*/
|
|
|
|
val tabReorderingFeature = Config.channel.isNightlyOrDebug
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show Pocket recommended stories on home.
|
|
|
|
*/
|
|
|
|
fun isPocketRecommendationsFeatureEnabled(context: Context): Boolean {
|
|
|
|
val langTag = LocaleManager.getCurrentLocale(context)
|
|
|
|
?.toLanguageTag() ?: getSystemDefault().toLanguageTag()
|
|
|
|
return listOf("en-US", "en-CA").contains(langTag)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables showing the homescreen onboarding card.
|
|
|
|
*/
|
|
|
|
const val showHomeOnboarding = false
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables showing the option to clear site data.
|
|
|
|
*/
|
|
|
|
val showClearSiteData = Config.channel.isNightlyOrDebug
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables showing the wallpaper functionality.
|
|
|
|
*/
|
|
|
|
const val showWallpapers = true
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables the Contile top sites.
|
|
|
|
*/
|
|
|
|
val contileFeature = Config.channel.isDebug
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables history improvement features.
|
|
|
|
*/
|
|
|
|
val historyImprovementFeatures = Config.channel.isNightlyOrDebug
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables themed wallpapers feature.
|
|
|
|
*/
|
|
|
|
fun isThemedWallpapersFeatureEnabled(context: Context): Boolean {
|
|
|
|
val langTag = LocaleManager.getCurrentLocale(context)
|
|
|
|
?.toLanguageTag() ?: getSystemDefault().toLanguageTag()
|
|
|
|
return listOf("en-US", "es-US").contains(langTag)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables the Task Continuity enhancements.
|
|
|
|
*/
|
|
|
|
val taskContinuityFeature = Config.channel.isDebug
|
|
|
|
}
|