1
0
Fork 0

For #11918: Take a screenshot when clicking the tab tray

We looked into taking a screenshot right before leaving the
BrowserFragment, however this call will always fail since it's
non-blocking (we never want it to be blocking too), and we will never
receive a screenshot when a session is detached from an EngineView
before the callback is complete.

In Fenix, we can nicely evade this by taking a screenshot when click
the tabs tray icon, which is where you would want to see the most
up-to-date thumbnail of the tab and also does not leave the
BrowserFragment as well.
master
Jonathan Almeida 2020-08-21 18:11:16 -04:00 committed by Emily Kager
parent 5ecab0f48a
commit f3b870d356
2 changed files with 3 additions and 1 deletions

View File

@ -42,6 +42,7 @@ import mozilla.components.browser.state.selector.findTabOrCustomTabOrSelectedTab
import mozilla.components.browser.state.state.SessionState
import mozilla.components.browser.state.state.content.DownloadState
import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.browser.thumbnails.BrowserThumbnails
import mozilla.components.concept.engine.prompt.ShareData
import mozilla.components.feature.accounts.FxaCapability
import mozilla.components.feature.accounts.FxaWebChannelFeature
@ -132,6 +133,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
get() = _browserToolbarView!!
protected val readerViewFeature = ViewBoundFeatureWrapper<ReaderViewFeature>()
protected val thumbnailsFeature = ViewBoundFeatureWrapper<BrowserThumbnails>()
private val sessionFeature = ViewBoundFeatureWrapper<SessionFeature>()
private val contextMenuFeature = ViewBoundFeatureWrapper<ContextMenuFeature>()
@ -231,6 +233,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
tabCollectionStorage = requireComponents.core.tabCollectionStorage,
topSiteStorage = requireComponents.core.topSiteStorage,
onTabCounterClicked = {
thumbnailsFeature.get()?.requestScreenshot()
findNavController().nav(
R.id.browserFragment,
BrowserFragmentDirections.actionGlobalTabTrayDialogFragment()

View File

@ -54,7 +54,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
private val windowFeature = ViewBoundFeatureWrapper<WindowFeature>()
private val searchFeature = ViewBoundFeatureWrapper<SearchFeature>()
private val thumbnailsFeature = ViewBoundFeatureWrapper<BrowserThumbnails>()
private var readerModeAvailable = false