|
|
@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.mozilla.fenix.components.toolbar
|
|
|
|
package org.mozilla.fenix.components.toolbar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.view.View
|
|
|
|
import mozilla.components.browser.session.SelectionAwareSessionObserver
|
|
|
|
import mozilla.components.browser.session.SelectionAwareSessionObserver
|
|
|
|
import mozilla.components.browser.session.Session
|
|
|
|
import mozilla.components.browser.session.Session
|
|
|
|
import mozilla.components.browser.session.SessionManager
|
|
|
|
import mozilla.components.browser.session.SessionManager
|
|
|
@ -14,10 +15,11 @@ class MenuPresenter(
|
|
|
|
private val menuToolbar: BrowserToolbar,
|
|
|
|
private val menuToolbar: BrowserToolbar,
|
|
|
|
sessionManager: SessionManager,
|
|
|
|
sessionManager: SessionManager,
|
|
|
|
private val sessionId: String? = null
|
|
|
|
private val sessionId: String? = null
|
|
|
|
) : SelectionAwareSessionObserver(sessionManager) {
|
|
|
|
) : SelectionAwareSessionObserver(sessionManager), View.OnAttachStateChangeListener {
|
|
|
|
|
|
|
|
|
|
|
|
fun start() {
|
|
|
|
fun start() {
|
|
|
|
observeIdOrSelected(sessionId)
|
|
|
|
observeIdOrSelected(sessionId)
|
|
|
|
|
|
|
|
menuToolbar.addOnAttachStateChangeListener(this)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Redraw the refresh/stop button */
|
|
|
|
/** Redraw the refresh/stop button */
|
|
|
@ -38,4 +40,12 @@ class MenuPresenter(
|
|
|
|
fun invalidateActions() {
|
|
|
|
fun invalidateActions() {
|
|
|
|
menuToolbar.invalidateActions()
|
|
|
|
menuToolbar.invalidateActions()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onViewDetachedFromWindow(v: View?) {
|
|
|
|
|
|
|
|
menuToolbar.onStop()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onViewAttachedToWindow(v: View?) {
|
|
|
|
|
|
|
|
// no-op
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|