parent
c7b85d1272
commit
316569b899
|
@ -0,0 +1,42 @@
|
|||
/* 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.browser
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||
|
||||
/**
|
||||
* [CoordinatorLayout.Behavior] that will always position the [View] above the [BrowserToolbar] (including
|
||||
* when the browser toolbar is scrolling or performing a snap animation).
|
||||
*/
|
||||
@Suppress("unused") // Referenced from XML
|
||||
class BrowserToolbarDividerBehavior(
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
) : CoordinatorLayout.Behavior<View>(context, attrs) {
|
||||
override fun layoutDependsOn(parent: CoordinatorLayout, child: View, dependency: View): Boolean {
|
||||
if (dependency is BrowserToolbar) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.layoutDependsOn(parent, child, dependency)
|
||||
}
|
||||
|
||||
override fun onDependentViewChanged(parent: CoordinatorLayout, child: View, dependency: View): Boolean {
|
||||
return if (dependency is BrowserToolbar) {
|
||||
repositionView(child, dependency)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun repositionView(view: View, toolbar: BrowserToolbar) {
|
||||
view.translationY = (toolbar.translationY + toolbar.height * -1.0).toFloat()
|
||||
}
|
||||
}
|
|
@ -16,17 +16,25 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/nestedScrollQuickAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?foundation"
|
||||
android:clipToPadding="true"
|
||||
app:behavior_hideable="true"
|
||||
app:behavior_peekHeight="15dp"
|
||||
app:behavior_peekHeight="12dp"
|
||||
app:layout_behavior="org.mozilla.fenix.quickactionsheet.QuickActionSheetBehavior"/>
|
||||
|
||||
<View
|
||||
android:focusable="false"
|
||||
android:id="@+id/toolbarDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?neutral"
|
||||
app:layout_behavior="org.mozilla.fenix.browser.BrowserToolbarDividerBehavior" />
|
||||
|
||||
<mozilla.components.feature.findinpage.view.FindInPageBar
|
||||
android:id="@+id/findInPageView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -10,7 +10,14 @@
|
|||
android:background="?foundation"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:focusable="false"
|
||||
android:background="?attr/neutral"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<ImageButton
|
||||
android:paddingTop="7dp"
|
||||
android:id="@+id/quick_action_sheet_handle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="12dp"
|
||||
|
@ -20,6 +27,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:id="@+id/quick_action_buttons_layout"
|
||||
android:layout_margin="4dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
|
|
Loading…
Reference in New Issue