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_wrapper.clipToOutline = false
toolbar.setOnClickListener { it -> toolbar.setOnClickListener { it ->
val extras = FragmentNavigator.Extras.Builder().addSharedElement( val extras = FragmentNavigator.Extras.Builder().addSharedElement(
toolbar_wrapper, ViewCompat.getTransitionName(toolbar_wrapper)!! toolbar, ViewCompat.getTransitionName(toolbar)!!
).build() ).build()
Navigation.findNavController(it).navigate(R.id.action_homeFragment_to_browserFragment, null, null, extras) 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 <!-- 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 - 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/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<androidx.constraintlayout.widget.ConstraintLayout <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".browser.BrowserFragment"> tools:context="browser.BrowserFragment">
<FrameLayout <FrameLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="match_parent">
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/toolbar_wrapper"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<mozilla.components.concept.engine.EngineView <mozilla.components.concept.engine.EngineView
android:id="@+id/engineView" android:id="@+id/engineView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</FrameLayout>
<FrameLayout <mozilla.components.browser.awesomebar.BrowserAwesomeBar
android:id="@+id/toolbar_wrapper" android:id="@+id/awesomeBar"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:padding="4dp"
android:layout_marginTop="24dp" android:visibility="gone"
android:layout_marginRight="16dp" mozac:awesomeBarChipBackgroundColor="#444444"
android:background="@drawable/home_search_background" mozac:awesomeBarChipTextColor="#ffffff"
android:clipToPadding="false" mozac:awesomeBarDescriptionTextColor="#dddddd"
android:elevation="5dp" mozac:awesomeBarTitleTextColor="#ffffff" />
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" />
</FrameLayout> </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" app:layoutDescription="@xml/home_scene"
tools:context=".home.HomeFragment"> tools:context=".home.HomeFragment">
<ImageButton <ImageButton
android:id="@+id/menuButton" android:id="@+id/menuButton"
android:layout_width="@dimen/glyph_button_height" android:layout_width="@dimen/glyph_button_height"
@ -53,7 +52,6 @@
android:clipToPadding="false" android:clipToPadding="false"
android:elevation="5dp" android:elevation="5dp"
android:outlineProvider="paddedBounds" android:outlineProvider="paddedBounds"
android:transitionName="firstTransitionName"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/wordmark"> app:layout_constraintTop_toBottomOf="@id/wordmark">
@ -69,7 +67,8 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/search_hint" android:text="@string/search_hint"
android:textColor="@color/searchText" android:textColor="@color/searchText"
android:textSize="14sp" /> android:textSize="14sp"
android:transitionName="firstTransitionName" />
</FrameLayout> </FrameLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView