Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #8788 Use Flexbox instead of Grid manager for top sites
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare authored and ekager committed Mar 9, 2020
1 parent a581486 commit 320fc4e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ dependencies {
implementation Deps.androidx_work_ktx
implementation Deps.google_material

implementation Deps.google_flexbox

implementation Deps.lottie

implementation Deps.adjust
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
Expand All @@ -35,6 +35,5 @@ class TopSiteViewHolder(

companion object {
const val LAYOUT_ID = R.layout.component_top_sites
const val NUM_COLUMNS = 5
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/top_site_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/top_site_item"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:padding="4dp"
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ object Versions {
const val androidx_transition = "1.3.0"
const val androidx_work = "2.2.0"
const val google_material = "1.1.0"
const val google_flexbox = "2.0.1"

const val mozilla_android_components = "36.0.0-SNAPSHOT"

Expand Down Expand Up @@ -174,6 +175,7 @@ object Deps {
const val androidx_work_ktx = "androidx.work:work-runtime-ktx:${Versions.androidx_work}"
const val androidx_work_testing = "androidx.work:work-testing:${Versions.androidx_work}"
const val google_material = "com.google.android.material:material:${Versions.google_material}"
const val google_flexbox = "com.google.android:flexbox:${Versions.google_flexbox}"

const val adjust = "com.adjust.sdk:adjust-android:${Versions.adjust}"
const val installreferrer = "com.android.installreferrer:installreferrer:${Versions.installreferrer}"
Expand Down

0 comments on commit 320fc4e

Please sign in to comment.