Skip to content

Commit

Permalink
Merge pull request #1 from navi25/develop
Browse files Browse the repository at this point in the history
Modified Parent Recycler View to use RecycledViewPool for child Recyc…
  • Loading branch information
navi25 authored Sep 26, 2018
2 parents ddf8311 + 1d320f4 commit ca3dd0e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import io.navendra.nestedrecycler.R
import io.navendra.nestedrecycler.models.ChildModel
import kotlinx.android.synthetic.main.child_recycler.view.*

class ChildAdapter(private val children : List<ChildModel>) : RecyclerView.Adapter<ChildAdapter.ViewHolder>(){
class ChildAdapter(private val children : List<ChildModel>)
: RecyclerView.Adapter<ChildAdapter.ViewHolder>(){

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val v = LayoutInflater.from(parent.context).inflate(R.layout.child_recycler,parent,false)
val v = LayoutInflater.from(parent.context)
.inflate(R.layout.child_recycler,parent,false)
return ViewHolder(v)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import io.navendra.nestedrecycler.models.ParentModel
import kotlinx.android.synthetic.main.parent_recycler.view.*

class ParentAdapter(private val parents : List<ParentModel>) : RecyclerView.Adapter<ParentAdapter.ViewHolder>(){

private val viewPool = RecyclerView.RecycledViewPool()

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val v = LayoutInflater.from(parent.context).inflate(R.layout.parent_recycler,parent,false)
return ViewHolder(v)
Expand All @@ -27,6 +30,7 @@ class ParentAdapter(private val parents : List<ParentModel>) : RecyclerView.Adap
holder.recyclerView.apply {
layoutManager = LinearLayoutManager(holder.recyclerView.context, LinearLayout.HORIZONTAL, false)
adapter = ChildAdapter(parent.children)
recycledViewPool = viewPool
}
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Sep 07 00:03:47 MST 2018
#Wed Sep 26 01:33:33 MST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

0 comments on commit ca3dd0e

Please sign in to comment.