Skip to content

Commit

Permalink
V1.2.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
smuyyh committed Jun 14, 2018
1 parent 9fb3966 commit 87f9ba2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
### 添加依赖
```
// 不包含v7和recyclerview的依赖,需自行在项目中引入
compile 'com.yuyh.easyadapter:library:1.1.5'
compile 'com.yuyh.easyadapter:library:1.2.0'
```

### 用法

#### step1

```java
package com.yuyh.easyadapter;

Expand Down Expand Up @@ -38,6 +41,40 @@ public class ListViewAdapter extends EasyLVAdapter<Bean> {
}
}
```

#### step2

```java
// 若需要调用adapter.setImageUrl,可以在Application配置全局统一回调,也可Adapter单独重写getImageLoader方法
AdapterImageLoader.init(new AdapterImageLoader.ImageLoader() {
@Override
public void loadImage(Context context, String url, ImageView view) {
Glide.with(context)
.load(url)
.into(view);
}
});
```

#### step3
```java

// 若adapter需要单独定制ImageLoader,比如placeHolder,则重写该方法,以替换全局初始化的ImageLoader
@Override
public AdapterImageLoader.ImageLoader getImageLoader() {
return new AdapterImageLoader.ImageLoader() {
@Override
public void loadImage(Context context, String url, ImageView view) {
Glide.with(context)
.load(url)
.override(10, 10)
.into(view);
}
};
}

```

AbsListView的Adapter,继承EasyLVAdapter,重写convert方法,完成数据与事件的绑定,并且可以指定多种样式的item布局,通过重写getLayoutIndex方法,来指定position位置的item引用的布局。

EasyLVHolder中封装了很多通用的方法,比如setText/setImageDrawable/setOnClickListener等等。也可直接通过getConvertView取出item布局,或者通过getView(int id)取出某个控件,进行相应操作。
Expand Down
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
version = "1.1.5" // 版本号
version = "1.2.0" // 版本号

android {
compileSdkVersion 27
Expand All @@ -11,8 +11,8 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 7
versionName "1.1.5"
versionCode 8
versionName "1.2.0"
}
buildTypes {
release {
Expand Down

0 comments on commit 87f9ba2

Please sign in to comment.