From 29d2ee828e2f90c32e5cc688209e574a2f5498d4 Mon Sep 17 00:00:00 2001 From: chenzj Date: Thu, 22 Sep 2016 21:07:45 +0800 Subject: [PATCH] =?UTF-8?q?1.fix=20-=20=E5=9C=A8adapter.notiChange?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E7=82=B9=E5=87=BB=E4=BC=9A=E8=BF=94?= =?UTF-8?q?=E5=9B=9Eposition=3D-1.=E5=AF=BC=E8=87=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=B6=8A=E7=95=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dreamliner/rvhelper/viewholder/BaseViewHolder.java | 10 ++++++++-- Sample/build.gradle | 4 ++-- build.gradle | 2 +- buildsystem/dependencies.gradle | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/RvHelperLib/src/main/java/com/dreamliner/rvhelper/viewholder/BaseViewHolder.java b/RvHelperLib/src/main/java/com/dreamliner/rvhelper/viewholder/BaseViewHolder.java index 3a88e9f..ed9387c 100644 --- a/RvHelperLib/src/main/java/com/dreamliner/rvhelper/viewholder/BaseViewHolder.java +++ b/RvHelperLib/src/main/java/com/dreamliner/rvhelper/viewholder/BaseViewHolder.java @@ -41,14 +41,20 @@ public BaseViewHolder(View itemView, ItemClickListener itemClickListener, ItemLo @Override public void onClick(View v) { if (null != mItemClickListener) { - mItemClickListener.onItemClick(v, getAdapterPosition()); + int position = getAdapterPosition(); + if (position != RecyclerView.NO_POSITION) { + mItemClickListener.onItemClick(v, getAdapterPosition()); + } } } @Override public boolean onLongClick(View v) { if (null != mItemLongListener) { - mItemLongListener.onLongClick(v, getAdapterPosition()); + int position = getAdapterPosition(); + if (position != RecyclerView.NO_POSITION) { + mItemLongListener.onLongClick(v, getAdapterPosition()); + } return true; } return false; diff --git a/Sample/build.gradle b/Sample/build.gradle index 20448dd..f313406 100644 --- a/Sample/build.gradle +++ b/Sample/build.gradle @@ -92,7 +92,7 @@ dependencies { compile libraries.loadingView - //compile project(':RvHelperLib') + compile project(':RvHelperLib') //user this in your project - compile 'com.github.chenzj-king:RvHelper:1.4.2' + //compile 'com.github.chenzj-king:RvHelper:1.4.2' } diff --git a/build.gradle b/build.gradle index b54361f..56622a3 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:2.1.3' + classpath 'com.android.tools.build:gradle:2.2.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' classpath libraries.apt } diff --git a/buildsystem/dependencies.gradle b/buildsystem/dependencies.gradle index 53a744c..6c439db 100644 --- a/buildsystem/dependencies.gradle +++ b/buildsystem/dependencies.gradle @@ -1,6 +1,6 @@ ext.versions = [ - code : 2, - name : '1.4.2', + code : 3, + name : '1.4.4', minSdk : 15, targetSdk : 23, @@ -9,7 +9,7 @@ ext.versions = [ // Library versions junit : '4.12', - supportLibs: '24.2.0', + supportLibs: '24.2.1', multidex : '1.0.1', ] ext.libraries = [