Commit f61219e9 authored by Matthew Finkel's avatar Matthew Finkel
Browse files

fixup! Bug 40028: Implement new home screen

parent 2e5d5aed
Loading
Loading
Loading
Loading
+33 −8
Original line number Diff line number Diff line
@@ -379,14 +379,31 @@ class HomeFragment : Fragment() {
            view?.sessionControlRecyclerView?.apply {
                (layoutParams as ViewGroup.MarginLayoutParams).setMargins(0, 0, 0, 60)
            }
            view?.homeAppBar?.apply {
            view?.toolbarLayout?.apply {
                visibility = View.VISIBLE

                children.forEach {
                    (it.layoutParams as AppBarLayout.LayoutParams).scrollFlags = if (onboarding.userHasBeenOnboarded()) {
                        AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL
                // If the Layout rendering pass was completed, then we have a |height| value,
                // if it wasn't completed then we have 0.
                if (height == 0) {
                    // Set the bottom margin after the toolbar height is defined during Layout
                    doOnLayout {
                        val toolbarLayoutHeight = view.toolbarLayout.height
                        view.sessionControlRecyclerView?.apply {
                            (layoutParams as ViewGroup.MarginLayoutParams).setMargins(
                                0,
                                0,
                                0,
                                toolbarLayoutHeight - SESSION_CONTROL_VIEW_PADDING
                            )
                        }
                    }
                } else {
                        AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
                    view.sessionControlRecyclerView?.apply {
                        (layoutParams as ViewGroup.MarginLayoutParams).setMargins(
                            0,
                            0,
                            0,
                            height - SESSION_CONTROL_VIEW_PADDING
                        )
                    }
                }
            }
@@ -398,8 +415,16 @@ class HomeFragment : Fragment() {
                    View.GONE
                }
            }
            view?.toolbarLayout?.apply {
            view?.homeAppBar?.apply {
                visibility = View.VISIBLE

                children.forEach {
                    (it.layoutParams as AppBarLayout.LayoutParams).scrollFlags = if (onboarding.userHasBeenOnboarded()) {
                        AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL
                    } else {
                        AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
                    }
                }
            }
        }
    }