From d8cba93d1b378b7168c6e489eb6c212b8c11c6ff Mon Sep 17 00:00:00 2001 From: mcarare <“mihai.carare.dev@gmail.com”> Date: Mon, 9 Mar 2020 16:22:38 +0200 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/8788 Use Flexbox instead of Grid manager for top sites --- app/build.gradle | 2 ++ .../home/sessioncontrol/viewholders/TopSiteViewHolder.kt | 5 ++--- app/src/main/res/layout/top_site_item.xml | 2 +- buildSrc/src/main/java/Dependencies.kt | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 217c7c5101..1f1926a23d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -504,6 +504,8 @@ dependencies { implementation Deps.androidx_work_ktx implementation Deps.google_material + implementation Deps.google_flexbox + implementation Deps.lottie implementation Deps.adjust diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TopSiteViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TopSiteViewHolder.kt index e3a979f8e9..324934b036 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TopSiteViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TopSiteViewHolder.kt @@ -5,8 +5,8 @@ package org.mozilla.fenix.home.sessioncontrol.viewholders import android.view.View -import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView +import com.google.android.flexbox.FlexboxLayoutManager import kotlinx.android.extensions.LayoutContainer import kotlinx.android.synthetic.main.component_top_sites.view.* import mozilla.components.feature.top.sites.TopSite @@ -24,7 +24,7 @@ class TopSiteViewHolder( init { view.top_sites_list.apply { adapter = topSitesAdapter - layoutManager = GridLayoutManager(view.context, NUM_COLUMNS) + layoutManager = FlexboxLayoutManager(view.context) isNestedScrollingEnabled = false } } @@ -35,6 +35,5 @@ class TopSiteViewHolder( companion object { const val LAYOUT_ID = R.layout.component_top_sites - const val NUM_COLUMNS = 5 } } diff --git a/app/src/main/res/layout/top_site_item.xml b/app/src/main/res/layout/top_site_item.xml index 1d95a4437a..7ac31d95d8 100644 --- a/app/src/main/res/layout/top_site_item.xml +++ b/app/src/main/res/layout/top_site_item.xml @@ -5,7 +5,7 @@