1
0
Fork 0

For #6795 - Auto shows toolbar when loading a new URL (#6955)

Co-authored-by: Severin <Baron-Severin@users.noreply.github.com>
master
Jeff Boek 2019-12-04 15:00:51 -08:00 committed by Severin Rudie
parent aa49ab1dfb
commit e8972bb47d
3 changed files with 23 additions and 1 deletions

View File

@ -376,6 +376,18 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
view = view
)
session.register(observer = object : Session.Observer {
override fun onLoadRequest(
session: Session,
url: String,
triggeredByRedirect: Boolean,
triggeredByWebContent: Boolean
): Boolean {
browserToolbarView.expand()
return false
}
}, owner = viewLifecycleOwner)
@Suppress("ConstantConditionIf")
if (FeatureFlags.pullToRefreshEnabled) {
val primaryTextColor =

View File

@ -17,6 +17,7 @@ import androidx.core.view.isVisible
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.browser_toolbar_popup_window.view.*
import kotlinx.android.synthetic.main.component_browser_top_toolbar.view.*
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
import mozilla.components.browser.session.Session
import mozilla.components.browser.toolbar.BrowserToolbar
@ -58,8 +59,10 @@ class BrowserToolbarView(
else -> R.layout.component_browser_top_toolbar
}
val view: BrowserToolbar = LayoutInflater.from(container.context)
private val layout = LayoutInflater.from(container.context)
.inflate(toolbarLayout, container, true)
val view: BrowserToolbar = layout
.findViewById(R.id.toolbar)
val toolbarIntegration: ToolbarIntegration
@ -216,6 +219,12 @@ class BrowserToolbarView(
// Intentionally leaving this as a stub for now since we don't actually want to update currently
}
fun expand() {
if (!settings.shouldUseBottomToolbar) {
layout.app_bar?.setExpanded(true)
}
}
companion object {
private const val TOOLBAR_ELEVATION = 16
}

View File

@ -3,6 +3,7 @@
- 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/. -->
<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<mozilla.components.browser.toolbar.BrowserToolbar