Skip to content

Commit

Permalink
1.fix - 在adapter.notiChange的时候点击会返回position=-1.导致数据越界.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzj-king committed Sep 22, 2016
1 parent 22d5ec3 commit 29d2ee8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions buildsystem/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext.versions = [
code : 2,
name : '1.4.2',
code : 3,
name : '1.4.4',

minSdk : 15,
targetSdk : 23,
Expand All @@ -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 = [
Expand Down

0 comments on commit 29d2ee8

Please sign in to comment.