[fenix] Fixes https://github.com/mozilla-mobile/fenix/issues/654 - Update refresh/stop toolbar buttons (https://github.com/mozilla-mobile/fenix/pull/2702)
(Also back and forward)pull/600/head
parent
237c06cfc1
commit
cea10f040e
@ -0,0 +1,31 @@
|
||||
/* 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.components.toolbar
|
||||
|
||||
import mozilla.components.browser.session.SelectionAwareSessionObserver
|
||||
import mozilla.components.browser.session.Session
|
||||
import mozilla.components.browser.session.SessionManager
|
||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||
|
||||
class MenuPresenter(
|
||||
private val menuToolbar: BrowserToolbar,
|
||||
sessionManager: SessionManager,
|
||||
private val sessionId: String? = null
|
||||
) : SelectionAwareSessionObserver(sessionManager) {
|
||||
|
||||
fun start() {
|
||||
observeIdOrSelected(sessionId)
|
||||
}
|
||||
|
||||
/** Redraw the refresh/stop button */
|
||||
override fun onLoadingStateChanged(session: Session, loading: Boolean) {
|
||||
menuToolbar.invalidateActions()
|
||||
}
|
||||
|
||||
/** Redraw the back and forward buttons */
|
||||
override fun onNavigationStateChanged(session: Session, canGoBack: Boolean, canGoForward: Boolean) {
|
||||
menuToolbar.invalidateActions()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue