Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
Issue #1664: Remove unnecessary updateFocusableViews param.
Browse files Browse the repository at this point in the history
The current focus is the default argument so it's unnecessary for us to
pass it in.

This simplifies the depependencies that ToolbarUiController has on the
NavOverlayFragment.
  • Loading branch information
mcomella committed Jan 30, 2019
1 parent 9f3821d commit ac3896a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ class NavigationOverlayFragment : Fragment() {
ToolbarUiController(
toolbarViewModel,
::exitFirefox,
{ currFocus },
::updateFocusableViews,
{ updateFocusableViews() },
onNavigationEvent
).onCreateView(view, viewLifecycleOwner, fragmentManager!!)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ private const val NAVIGATION_BUTTON_DISABLED_ALPHA = 0.3f
class ToolbarUiController(
private val toolbarViewModel: ToolbarViewModel,
private val exitFirefox: () -> Unit,
private val getCurrentFocus: () -> View?,
private val updateFocusableViews: (View?) -> Unit,
private val updateFocusableViews: () -> Unit,
private val onNavigationEvent: (NavigationEvent, String?, InlineAutocompleteEditText.AutocompleteResult?) -> Unit
) {

Expand Down Expand Up @@ -93,14 +92,13 @@ class ToolbarUiController(

toolbarViewModel.state.observe(viewLifecycleOwner, Observer {
if (it == null) return@Observer
val focusedView = getCurrentFocus()
updateOverlayButtonState(it.backEnabled, layout.navButtonBack)
updateOverlayButtonState(it.forwardEnabled, layout.navButtonForward)
updateOverlayButtonState(it.pinEnabled, layout.pinButton)
updateOverlayButtonState(it.refreshEnabled, layout.navButtonReload)
updateOverlayButtonState(it.desktopModeEnabled, layout.desktopModeButton)

updateFocusableViews(focusedView)
updateFocusableViews()

layout.pinButton.isChecked = it.pinChecked
layout.desktopModeButton.isChecked = it.desktopModeChecked
Expand Down

0 comments on commit ac3896a

Please sign in to comment.