2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-09 19:10:42 +00:00

Closes #134 - Collapse/show the toolbar based on browser scrolling

This commit is contained in:
Emily Kager 2019-01-22 16:12:20 -08:00 committed by Jeff Boek
parent b59183fed0
commit 19572d474a
3 changed files with 38 additions and 46 deletions

View File

@ -44,7 +44,7 @@ class HomeFragment : Fragment() {
toolbar_wrapper.clipToOutline = false
toolbar.setOnClickListener { it ->
val extras = FragmentNavigator.Extras.Builder().addSharedElement(
toolbar_wrapper, ViewCompat.getTransitionName(toolbar_wrapper)!!
toolbar, ViewCompat.getTransitionName(toolbar)!!
).build()
Navigation.findNavController(it).navigate(R.id.action_homeFragment_to_browserFragment, null, null, extras)
}

View File

@ -2,52 +2,45 @@
<!-- 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/. -->
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".browser.BrowserFragment">
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:mozac="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="browser.BrowserFragment">
<FrameLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/toolbar_wrapper"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
android:layout_width="match_parent"
android:layout_height="match_parent">
<mozilla.components.concept.engine.EngineView
android:id="@+id/engineView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
android:id="@+id/engineView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/toolbar_wrapper"
android:layout_width="0dp"
<mozilla.components.browser.awesomebar.BrowserAwesomeBar
android:id="@+id/awesomeBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="24dp"
android:layout_marginRight="16dp"
android:background="@drawable/home_search_background"
android:clipToPadding="false"
android:elevation="5dp"
android:outlineProvider="paddedBounds"
android:transitionName="firstTransitionName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<mozilla.components.browser.toolbar.BrowserToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="8dp"
android:background="@android:color/white"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true" />
android:padding="4dp"
android:visibility="gone"
mozac:awesomeBarChipBackgroundColor="#444444"
mozac:awesomeBarChipTextColor="#ffffff"
mozac:awesomeBarDescriptionTextColor="#dddddd"
mozac:awesomeBarTitleTextColor="#ffffff" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<mozilla.components.browser.toolbar.BrowserToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:background="@android:color/white"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:transitionName="firstTransitionName"
app:layout_behavior="mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior"
app:layout_scrollFlags="scroll|enterAlways|snap|exitUntilCollapsed" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -12,7 +12,6 @@
app:layoutDescription="@xml/home_scene"
tools:context=".home.HomeFragment">
<ImageButton
android:id="@+id/menuButton"
android:layout_width="@dimen/glyph_button_height"
@ -53,7 +52,6 @@
android:clipToPadding="false"
android:elevation="5dp"
android:outlineProvider="paddedBounds"
android:transitionName="firstTransitionName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/wordmark">
@ -69,7 +67,8 @@
android:gravity="center_vertical"
android:text="@string/search_hint"
android:textColor="@color/searchText"
android:textSize="14sp" />
android:textSize="14sp"
android:transitionName="firstTransitionName" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView