From e2ee0347a3e3713b7351d501909d15762497ea3f Mon Sep 17 00:00:00 2001 From: lzx <573842281@qq.com> Date: Tue, 20 Sep 2016 11:57:29 +0800 Subject: [PATCH] fix bug --- .../LRecyclerview_library.iml | 36 ++++++++++++++----- .../recyclerview/LuRecyclerViewAdapter.java | 5 +++ app/app.iml | 18 +++++----- .../demo/ui/SwipeRefreshLayoutActivity.java | 16 +++++++++ build.gradle | 2 +- 5 files changed, 60 insertions(+), 17 deletions(-) diff --git a/LRecyclerview_library/LRecyclerview_library.iml b/LRecyclerview_library/LRecyclerview_library.iml index 19d5847..3921348 100644 --- a/LRecyclerview_library/LRecyclerview_library.iml +++ b/LRecyclerview_library/LRecyclerview_library.iml @@ -33,12 +33,14 @@ + + @@ -65,14 +67,6 @@ - - - - - - - - @@ -81,21 +75,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LuRecyclerViewAdapter.java b/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LuRecyclerViewAdapter.java index 6f46c26..a884bcc 100644 --- a/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LuRecyclerViewAdapter.java +++ b/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LuRecyclerViewAdapter.java @@ -342,4 +342,9 @@ public int getAdapterPosition(boolean isCallback, int position) { return -1; } + public void setOnItemClickListener(OnItemClickListener mOnItemClickListener) + { + this.mOnItemClickListener = mOnItemClickListener; + } + } diff --git a/app/app.iml b/app/app.iml index 7b3c9cf..d63d427 100644 --- a/app/app.iml +++ b/app/app.iml @@ -32,12 +32,14 @@ + + @@ -64,14 +66,6 @@ - - - - - - - - @@ -80,6 +74,14 @@ + + + + + + + + diff --git a/app/src/main/java/com/lzx/demo/ui/SwipeRefreshLayoutActivity.java b/app/src/main/java/com/lzx/demo/ui/SwipeRefreshLayoutActivity.java index 3daec51..2ca697d 100644 --- a/app/src/main/java/com/lzx/demo/ui/SwipeRefreshLayoutActivity.java +++ b/app/src/main/java/com/lzx/demo/ui/SwipeRefreshLayoutActivity.java @@ -16,6 +16,7 @@ import android.view.ViewGroup; import android.widget.TextView; +import com.github.jdsjlzx.interfaces.OnItemClickListener; import com.github.jdsjlzx.recyclerview.LuRecyclerView; import com.github.jdsjlzx.recyclerview.LuRecyclerViewAdapter; import com.github.jdsjlzx.util.LuRecyclerViewStateUtils; @@ -24,6 +25,7 @@ import com.lzx.demo.R; import com.lzx.demo.base.ListBaseAdapter; import com.lzx.demo.bean.ItemModel; +import com.lzx.demo.util.AppToast; import com.lzx.demo.util.AppUtil; import com.lzx.demo.util.NetworkUtils; import com.lzx.demo.weight.SampleHeader; @@ -98,6 +100,20 @@ public void onCreate(Bundle savedInstanceState) { LuRecyclerViewUtils.setHeaderView(mRecyclerView, new SampleHeader(this)); + mLRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() { + @Override + public void onItemClick(View view, int position) { + ItemModel item = mDataAdapter.getDataList().get(position); + AppToast.showShortText(SwipeRefreshLayoutActivity.this, item.title); + } + + @Override + public void onItemLongClick(View view, int position) { + ItemModel item = mDataAdapter.getDataList().get(position); + AppToast.showShortText(SwipeRefreshLayoutActivity.this, "onItemLongClick - " + item.title); + } + }); + mRecyclerView.setLScrollListener(new LuRecyclerView.LScrollListener() { @Override diff --git a/build.gradle b/build.gradle index 5bd29e6..30a316a 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } 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' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files