diff --git a/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionUIView.kt b/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionUIView.kt index 7a7d26a33..88e8084a9 100644 --- a/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionUIView.kt +++ b/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionUIView.kt @@ -14,6 +14,7 @@ import io.reactivex.Observable import io.reactivex.Observer import io.reactivex.functions.Consumer import kotlinx.android.synthetic.main.fragment_browser.* +import kotlinx.android.synthetic.main.layout_quick_action_sheet.* import kotlinx.android.synthetic.main.layout_quick_action_sheet.view.* import org.mozilla.fenix.R import org.mozilla.fenix.components.metrics.Event @@ -45,7 +46,8 @@ class QuickActionUIView( } } - override fun onSlide(p0: View, p1: Float) { + override fun onSlide(bottomSheet: View, slideOffset: Float) { + animateOverlay(slideOffset) } }) @@ -69,6 +71,13 @@ class QuickActionUIView( } } + /** + * Changes alpha of overlay based on new offset of this sheet within [-1,1] range. + */ + private fun animateOverlay(offset: Float) { + overlay.alpha = (1 - offset) + } + private fun updateImportantForAccessibility(state: Int) { view.findViewById(R.id.quick_action_buttons_layout).importantForAccessibility = if (state == BottomSheetBehavior.STATE_COLLAPSED || state == BottomSheetBehavior.STATE_HIDDEN) diff --git a/app/src/main/res/layout/layout_quick_action_sheet.xml b/app/src/main/res/layout/layout_quick_action_sheet.xml index 283135e72..1abfb0a2f 100644 --- a/app/src/main/res/layout/layout_quick_action_sheet.xml +++ b/app/src/main/res/layout/layout_quick_action_sheet.xml @@ -2,90 +2,101 @@ - - - - - + android:layout_height="wrap_content"> + android:background="?foundation" + android:orientation="vertical"> -