No issue: Fix indenting in onViewCreated.

upstream-sync
mcarare 3 years ago committed by Mihai Adrian Carare
parent 80d2bec150
commit 0ac78665d5

@ -362,82 +362,82 @@ class HomeFragment : Fragment() {
@Suppress("LongMethod", "ComplexMethod") @Suppress("LongMethod", "ComplexMethod")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) = override fun onViewCreated(view: View, savedInstanceState: Bundle?) =
PerfStartup.homeFragmentOnViewCreated.measureNoInline { // weird indent so we don't have to break blame. PerfStartup.homeFragmentOnViewCreated.measureNoInline {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
observeSearchEngineChanges() observeSearchEngineChanges()
createHomeMenu(requireContext(), WeakReference(view.menuButton)) createHomeMenu(requireContext(), WeakReference(view.menuButton))
createTabCounterMenu(view) createTabCounterMenu(view)
view.menuButton.setColorFilter( view.menuButton.setColorFilter(
ContextCompat.getColor( ContextCompat.getColor(
requireContext(), requireContext(),
ThemeManager.resolveAttribute(R.attr.primaryText, requireContext()) ThemeManager.resolveAttribute(R.attr.primaryText, requireContext())
)
) )
)
view.toolbar.compoundDrawablePadding =
view.resources.getDimensionPixelSize(R.dimen.search_bar_search_engine_icon_padding)
view.toolbar_wrapper.setOnClickListener {
navigateToSearch()
requireComponents.analytics.metrics.track(Event.SearchBarTapped(Event.SearchBarTapped.Source.HOME))
}
view.toolbar_wrapper.setOnLongClickListener { view.toolbar.compoundDrawablePadding =
ToolbarPopupWindow.show( view.resources.getDimensionPixelSize(R.dimen.search_bar_search_engine_icon_padding)
WeakReference(it), view.toolbar_wrapper.setOnClickListener {
handlePasteAndGo = sessionControlInteractor::onPasteAndGo, navigateToSearch()
handlePaste = sessionControlInteractor::onPaste, requireComponents.analytics.metrics.track(Event.SearchBarTapped(Event.SearchBarTapped.Source.HOME))
copyVisible = false }
)
true
}
view.tab_button.setOnClickListener { view.toolbar_wrapper.setOnLongClickListener {
openTabTray() ToolbarPopupWindow.show(
} WeakReference(it),
handlePasteAndGo = sessionControlInteractor::onPasteAndGo,
handlePaste = sessionControlInteractor::onPaste,
copyVisible = false
)
true
}
PrivateBrowsingButtonView( view.tab_button.setOnClickListener {
privateBrowsingButton, openTabTray()
browsingModeManager
) { newMode ->
if (newMode == BrowsingMode.Private) {
requireContext().settings().incrementNumTimesPrivateModeOpened()
} }
if (onboarding.userHasBeenOnboarded()) { PrivateBrowsingButtonView(
homeFragmentStore.dispatch( privateBrowsingButton,
HomeFragmentAction.ModeChange(Mode.fromBrowsingMode(newMode)) browsingModeManager
) ) { newMode ->
if (newMode == BrowsingMode.Private) {
requireContext().settings().incrementNumTimesPrivateModeOpened()
}
if (onboarding.userHasBeenOnboarded()) {
homeFragmentStore.dispatch(
HomeFragmentAction.ModeChange(Mode.fromBrowsingMode(newMode))
)
}
} }
}
consumeFrom(requireComponents.core.store) { consumeFrom(requireComponents.core.store) {
updateTabCounter(it) updateTabCounter(it)
} }
homeViewModel.sessionToDelete?.also { homeViewModel.sessionToDelete?.also {
if (it == ALL_NORMAL_TABS || it == ALL_PRIVATE_TABS) { if (it == ALL_NORMAL_TABS || it == ALL_PRIVATE_TABS) {
removeAllTabsAndShowSnackbar(it) removeAllTabsAndShowSnackbar(it)
} else { } else {
removeTabAndShowSnackbar(it) removeTabAndShowSnackbar(it)
}
} }
}
homeViewModel.sessionToDelete = null homeViewModel.sessionToDelete = null
updateTabCounter(requireComponents.core.store.state) updateTabCounter(requireComponents.core.store.state)
if (bundleArgs.getBoolean(FOCUS_ON_ADDRESS_BAR)) { if (bundleArgs.getBoolean(FOCUS_ON_ADDRESS_BAR)) {
navigateToSearch() navigateToSearch()
} else if (bundleArgs.getLong(FOCUS_ON_COLLECTION, -1) >= 0) { } else if (bundleArgs.getLong(FOCUS_ON_COLLECTION, -1) >= 0) {
// No need to scroll to async'd loaded TopSites if we want to scroll to collections. // No need to scroll to async'd loaded TopSites if we want to scroll to collections.
homeViewModel.shouldScrollToTopSites = false homeViewModel.shouldScrollToTopSites = false
/* Triggered when the user has added a tab to a collection and has tapped /* Triggered when the user has added a tab to a collection and has tapped
* the View action on the [TabsTrayDialogFragment] snackbar.*/ * the View action on the [TabsTrayDialogFragment] snackbar.*/
scrollAndAnimateCollection(bundleArgs.getLong(FOCUS_ON_COLLECTION, -1)) scrollAndAnimateCollection(bundleArgs.getLong(FOCUS_ON_COLLECTION, -1))
}
} }
}
private fun observeSearchEngineChanges() { private fun observeSearchEngineChanges() {
consumeFlow(store) { flow -> consumeFlow(store) { flow ->

Loading…
Cancel
Save