1
0
Fork 0

For #13330 - Remove feature flag for swipe to switch tabs.

master
Kainalu Hagiwara 2020-08-14 10:22:00 -07:00
parent cd729b39e5
commit d49ca515f4
5 changed files with 59 additions and 80 deletions

View File

@ -29,11 +29,6 @@ object FeatureFlags {
*/ */
val tabTray = Config.channel.isNightlyOrDebug val tabTray = Config.channel.isNightlyOrDebug
/**
* Enables gestures on the browser chrome that depend on a [SwipeGestureLayout]
*/
val browserChromeGestures = Config.channel.isNightlyOrDebug
/** /**
* Enables viewing tab history * Enables viewing tab history
*/ */

View File

@ -168,11 +168,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
require(arguments != null) require(arguments != null)
customTabSessionId = arguments?.getString(EXTRA_SESSION_ID) customTabSessionId = arguments?.getString(EXTRA_SESSION_ID)
val view = if (FeatureFlags.browserChromeGestures) { val view = inflater.inflate(R.layout.fragment_browser, container, false)
inflater.inflate(R.layout.browser_gesture_wrapper, container, false)
} else {
inflater.inflate(R.layout.fragment_browser, container, false)
}
val activity = activity as HomeActivity val activity = activity as HomeActivity
activity.themeManager.applyStatusBarTheme(activity) activity.themeManager.applyStatusBarTheme(activity)

View File

@ -15,7 +15,6 @@ import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.browser_gesture_wrapper.*
import kotlinx.android.synthetic.main.fragment_browser.* import kotlinx.android.synthetic.main.fragment_browser.*
import kotlinx.android.synthetic.main.fragment_browser.view.* import kotlinx.android.synthetic.main.fragment_browser.view.*
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
@ -32,7 +31,6 @@ import mozilla.components.feature.tab.collections.TabCollection
import mozilla.components.feature.tabs.WindowFeature import mozilla.components.feature.tabs.WindowFeature
import mozilla.components.support.base.feature.UserInteractionHandler import mozilla.components.support.base.feature.UserInteractionHandler
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.addons.runIfFragmentIsAttached import org.mozilla.fenix.addons.runIfFragmentIsAttached
import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FenixSnackbar
@ -77,19 +75,15 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
val components = context.components val components = context.components
return super.initializeUI(view)?.also { return super.initializeUI(view)?.also {
// We need to wrap this whole thing in an if here because gestureLayout will not exist gestureLayout.addGestureListener(
// if the feature flag is off ToolbarGestureHandler(
if (FeatureFlags.browserChromeGestures) { activity = requireActivity(),
gestureLayout.addGestureListener( contentLayout = browserLayout,
ToolbarGestureHandler( tabPreview = tabPreview,
activity = requireActivity(), toolbarLayout = browserToolbarView.view,
contentLayout = browserLayout, sessionManager = components.core.sessionManager
tabPreview = tabPreview,
toolbarLayout = browserToolbarView.view,
sessionManager = components.core.sessionManager
)
) )
} )
val readerModeAction = val readerModeAction =
BrowserToolbar.ToggleButton( BrowserToolbar.ToggleButton(

View File

@ -1,19 +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/. -->
<org.mozilla.fenix.browser.SwipeGestureLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gestureLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/fragment_browser" />
<org.mozilla.fenix.browser.TabPreview
android:id="@+id/tabPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:focusable="false"
android:visibility="gone" />
</org.mozilla.fenix.browser.SwipeGestureLayout>

View File

@ -1,53 +1,66 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
<!-- 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 - 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/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <org.mozilla.fenix.browser.SwipeGestureLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/browserLayout" android:id="@+id/gestureLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
tools:context="browser.BrowserFragment">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/swipeRefresh" android:id="@+id/browserLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0" tools:context="browser.BrowserFragment">
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<mozilla.components.concept.engine.EngineView <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/engineView" android:id="@+id/swipeRefresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<mozilla.components.concept.engine.EngineView
android:id="@+id/engineView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<ViewStub
android:id="@+id/stubFindInPage"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:inflatedId="@+id/findInPageView"
android:layout="@layout/stub_find_in_page" />
<include
android:id="@+id/viewDynamicDownloadDialog"
layout="@layout/download_dialog_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:visibility="gone" /> android:visibility="gone" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<mozilla.components.feature.readerview.view.ReaderViewControlsBar
android:id="@+id/readerViewControlsBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?foundation"
android:elevation="24dp"
android:visibility="gone" />
<ViewStub </androidx.coordinatorlayout.widget.CoordinatorLayout>
android:id="@+id/stubFindInPage"
<org.mozilla.fenix.browser.TabPreview
android:id="@+id/tabPreview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="56dp" android:layout_height="match_parent"
android:layout_gravity="bottom" android:clickable="false"
android:inflatedId="@+id/findInPageView" android:focusable="false"
android:layout="@layout/stub_find_in_page" />
<include
android:id="@+id/viewDynamicDownloadDialog"
layout="@layout/download_dialog_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:visibility="gone" /> android:visibility="gone" />
</org.mozilla.fenix.browser.SwipeGestureLayout>
<mozilla.components.feature.readerview.view.ReaderViewControlsBar
android:id="@+id/readerViewControlsBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?foundation"
android:elevation="24dp"
android:visibility="gone" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>