1
0
Fork 0

Fixes #654 - Update refresh/stop toolbar buttons (#2702)

(Also back and forward)
master
Tiger Oakes 2019-05-23 13:46:23 -04:00 committed by Jeff Boek
parent bf28462c47
commit 9b69f9f5db
4 changed files with 36 additions and 0 deletions

View File

@ -56,5 +56,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- #1599 - Fixed a crash creating a bookmark for a custom tab
- #1414 - Fixed site permissions settings getting reset in Android 6.
- #1994 - Made app state persist better when rotating the screen
- #654 - Updated Refresh button to turn into Stop button while menu is open.
- [AC #2725](https://github.com/mozilla-mobile/android-components/issues/2725) Updated tracking protectionPolicy to [recommend](https://github.com/mozilla-mobile/android-components/blob/master/components/concept/engine/src/main/java/mozilla/components/concept/engine/EngineSession.kt#L156)
### Removed

View File

@ -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()
}
}

View File

@ -77,12 +77,15 @@ class ToolbarIntegration(
ToolbarFeature.UrlRenderConfiguration(PublicSuffixList(context),
DefaultThemeManager.resolveAttribute(R.attr.primaryText, context), renderStyle = renderStyle)
)
private var menuPresenter = MenuPresenter(toolbar, context.components.core.sessionManager, sessionId)
override fun start() {
menuPresenter.start()
toolbarPresenter.start()
}
override fun stop() {
menuPresenter.stop()
toolbarPresenter.stop()
}
}

View File

@ -36,6 +36,7 @@ private object Versions {
// be kept in sync with the version used by android-components above.
const val mozilla_appservices = "0.28.1"
const val autodispose = "1.1.0"
const val adjust = "4.11.4"
const val installreferrer = "1.0"