Skip to content

Commit

Permalink
更新readme,和注释
Browse files Browse the repository at this point in the history
  • Loading branch information
yaozs committed Apr 17, 2017
1 parent 96d0184 commit f621ebe
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 12 deletions.
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,71 @@
# ImageShowPicker
单纯的上传图片展示控件

![image](https://github.com/yaozs/YzsLib/blob/master/app/src/main/res/mipmap-xxxhdpi/icon.png)

## 欢迎大家Star,使用

 YzsLib开源交流群:331973212

朋友是否一次又一次的写着放朋友圈的选择发布框架就是这个
![image](https://github.com/yaozs/ImageShowPicker/blob/master/pic/weixin_pic.jpg)
现在支持的框架来了
![image](https://github.com/yaozs/ImageShowPicker/blob/master/pic/imageshowpickerview.gif)
## Attributes属性(ImageShowPicker布局文件中调用)
|Attributes|forma|describe
|---|---|---|
|pic_size| dimension|单张图片大小(宽高一样)
|max_num| integer|最大数量
|add_label| reference|添加图片
|del_label| reference|删除图片
|is_show_del| boolean|是否显示删除按钮
|is_show_anim| boolean|是否展示动画
|one_line_show_num| integer|单行显示数量

使用方法
```java
ImageShowPickerView pickerView = (ImageShowPickerView)findViewById(R.id.it_picker_view);
final List<ImageBean> list = getItem(position);
pickerView.setImageLoaderInterface(new Loader());
pickerView.setNewData(list);
//展示有动画和无动画
if (position % 2 == 1) {
pickerView.setShowAnim(true);
} else {
pickerView.setShowAnim(false);
}
pickerView.setPickerListener(new ImageShowPickerListener() {
@Override
public void addOnClickListener(int remainNum) {
Toast.makeText(context, "remainNum" + remainNum, Toast.LENGTH_SHORT).show();
//在listview或recyclerview才会使用这个list.add(),其他情况都不用
list.add(new ImageBean("http://pic78.huitu.com/res/20160604/1029007_20160604114552332126_1.jpg"));
pickerView.addData(new ImageBean("http://pic78.huitu.com/res/20160604/1029007_20160604114552332126_1.jpg"));
}

@Override
public void picOnClickListener(List<ImageShowPickerBean> list, int position, int remainNum) {
Toast.makeText(context, list.size() + "========" + position + "remainNum" + remainNum, Toast.LENGTH_SHORT).show();
}

@Override
public void delOnClickListener(int position, int remainNum) {
list.remove(position);
Toast.makeText(context, "delOnClickListenerremainNum" + remainNum, Toast.LENGTH_SHORT).show();
}
});
pickerView.show();


//获取所有数据
pickerView.getDataList();
```


## 本人的其他项目
[YzsLib——超好用的开发框架](https://github.com/yaozs/YzsLib)
[YzsBaseActivity——简化到一定境界的BaseActivity](https://github.com/yaozs/YzsBaseActivity)




Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
/**
* Author 姚智胜
* Version V1.0版本
* Description:
* Description: picker点击事件监听
* Date: 2017/4/15
*/

public interface ImageShowPickerListener {

void addOnClickListener(int remainNum);

void picOnClickListener(List<ImageShowPickerBean> list, int position,int remainNum);
void picOnClickListener(List<ImageShowPickerBean> list, int position, int remainNum);

void delOnClickListener(int position,int remainNum);
void delOnClickListener(int position, int remainNum);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.yzs.imageshowpickerview;

import android.view.View;

/**
* Author 姚智胜
* Version V1.0版本
* Description:
* Description: view内部使用的点击监听
* Date: 2017/4/15
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.FrameLayout;

import java.util.ArrayList;
Expand Down Expand Up @@ -157,7 +156,6 @@ public ImageShowPickerView(@NonNull Context context, @Nullable AttributeSet attr

private void init(Context context, AttributeSet attrs) {
list = new ArrayList<>();
Log.e("init", "==" + list.size());
viewTypedArray(context, attrs);
recyclerView = new RecyclerView(context);
addView(recyclerView);
Expand Down Expand Up @@ -189,7 +187,6 @@ public void show() {
adapter.setShowDel(isShowDel);
adapter.setShowAnim(isShowAnim);
recyclerView.setAdapter(adapter);
Log.e("show", "==" + list.size());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Author 姚智胜
* Version V1.0版本
* Description:
* Description: 处理recyclerview在adapter内调用notifyItemChanged崩溃的解决方法
* Date: 2017/4/15
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Author: 姚智胜
* Version: V1.0版本
* Description:
* Description: dp转换工具类
* Date: 2017/4/17
*/

Expand Down
2 changes: 1 addition & 1 deletion imageshowpickerview/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<attr name="is_show_del" format="boolean" />
<!-- 是否展示动画-->
<attr name="is_show_anim" format="boolean" />
<!-- 是否显示删除按钮-->
<!-- 单行显示数量-->
<attr name="one_line_show_num" format="integer" />

</declare-styleable>
Expand Down

0 comments on commit f621ebe

Please sign in to comment.