File tree Expand file tree Collapse file tree 7 files changed +22
-6
lines changed
app/src/main/java/com/example/datasourceadapter/screens
src/main/java/com/novemio/datasourceadapter/adapter Expand file tree Collapse file tree 7 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,13 @@ import com.novemio.datasourceadapter.item.RecyclerItem
99 */
1010class TestDataSource (map : Map <String , ItemRenderer <out RecyclerItem >>) : RecyclerDataSource(map) {
1111
12- }
12+
13+
14+ override var clickListener: ((RecyclerItem ) -> Unit )? = :: onItemClick
15+
16+ private fun onItemClick (item : RecyclerItem ) {
17+
18+
19+
20+
21+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ buildscript {
1111
1212 }
1313 dependencies {
14- classpath ' com.android.tools.build:gradle:3.3 .2'
14+ classpath ' com.android.tools.build:gradle:3.4 .2'
1515 classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
1616 classpath " android.arch.navigation:navigation-safe-args-gradle-plugin:$navigationVersion "
1717
Original file line number Diff line number Diff line change 11apply plugin : ' com.android.library'
22apply plugin : ' kotlin-android'
33
4- ext. libVersionName = " 0.3.2 "
4+ ext. libVersionName = " 0.3.3 "
55android {
66 compileSdkVersion 28
77
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package com.novemio.datasourceadapter.adapter
22
33import android.view.ViewGroup
44import androidx.recyclerview.widget.RecyclerView
5+ import com.novemio.datasourceadapter.item.RecyclerItem
56
67/* *
78 * Created by novemio on 4/11/19.
@@ -12,6 +13,7 @@ class RecyclerAdapter(
1213) : RecyclerView.Adapter<RecyclerViewHolder>() {
1314
1415
16+
1517 init {
1618 recyclerDataSource.attachAdapter(this )
1719 setHasStableIds(true )
@@ -23,6 +25,9 @@ class RecyclerAdapter(
2325
2426 override fun onBindViewHolder (holder : RecyclerViewHolder , position : Int ) {
2527 holder.bind(recyclerDataSource.getItem(position))
28+ holder.itemView.setOnClickListener {
29+ recyclerDataSource.clickListener?.invoke(recyclerDataSource.getItem(position))
30+ }
2631 }
2732
2833 override fun getItemCount (): Int {
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ open class RecyclerDataSource(
1616 protected val renderers : Map <String , ItemRenderer <out RecyclerItem >>
1717) {
1818
19+
20+ open var clickListener: ((RecyclerItem ) -> Unit )? = null
1921 protected var recyclerReference: WeakReference <RecyclerAdapter >? = null
2022
2123 protected val viewTypeToRenderKeyMap = HashMap <Int , String >()
Original file line number Diff line number Diff line change 66# http://www.gradle.org/docs/current/userguide/build_environment.html
77# Specifies the JVM arguments used for the daemon process.
88# The setting is particularly useful for tweaking memory settings.
9- org.gradle.jvmargs =-Xmx1536m
9+ org.gradle.jvmargs ="-Xmx2048m
1010# When configured, Gradle will run in incubating parallel mode.
1111# This option should only be used with decoupled projects. More details, visit
1212# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Original file line number Diff line number Diff line change 1- # Fri Apr 12 16:51:26 CEST 2019
1+ # Mon Jul 29 08:02:06 CEST 2019
22distributionBase =GRADLE_USER_HOME
33distributionPath =wrapper/dists
44zipStoreBase =GRADLE_USER_HOME
55zipStorePath =wrapper/dists
6- distributionUrl =https\://services.gradle.org/distributions/gradle-4.10 .1-all.zip
6+ distributionUrl =https\://services.gradle.org/distributions/gradle-5.4 .1-all.zip
You can’t perform that action at this time.
0 commit comments