Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
classichu committed Mar 30, 2017
1 parent bbb1ed1 commit 4620ea9
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.classichu.photoselector.imagespicker.ImagePickBean;
import com.classichu.photoselector.listener.OnNotFastClickListener;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
Expand All @@ -26,7 +27,12 @@ protected void onCreate(Bundle savedInstanceState) {
findViewById(R.id.dsadas).setOnClickListener(new OnNotFastClickListener() {
@Override
protected void onNotFastClick(View v) {
ClassicPhotoUploaderDataHelper.setDataAndToPhotoSelector(MainActivity.this, "", 5);

ImagePickBean imagePickBean=new ImagePickBean();
imagePickBean.setImagePathOrUrl("https://p0.ssl.qhimg.com/t01fbefb649670ca78d.jpg");
List<ImagePickBean> list=new ArrayList<>();
list.add(imagePickBean);
ClassicPhotoUploaderDataHelper.setDataAndToPhotoSelector(MainActivity.this, list, 5);
// startActivity(new Intent(MainActivity.this, ClassicPhotoSelectorActivity.class));
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,35 @@
*/

public class PhotoSelectorDataWrapper implements Serializable{
private String resultid;//选株点击详情id
private String key;
private int maxCount;
//调查项id
private List<ImagePickBean> imagePickBeanList;

public void setResultid(String resultid) {
this.resultid = resultid;
}

public void setKey(String key) {
this.key = key;
}

public void setMaxCount(int maxCount) {
this.maxCount = maxCount;
}

public void setImagePickBeanList(List<ImagePickBean> imagePickBeanList) {
this.imagePickBeanList = imagePickBeanList;
}

public void setItemid(String itemid) {
this.itemid = itemid;
}
private String imagePickKey;//

public List<ImagePickBean> getImagePickBeanList() {
return imagePickBeanList;
}


public PhotoSelectorDataWrapper() {
public void setImagePickBeanList(List<ImagePickBean> imagePickBeanList) {
this.imagePickBeanList = imagePickBeanList;
}

public String getResultid() {
return resultid;
private List<ImagePickBean> imagePickBeanList;
public String getImagePickKey() {
return imagePickKey;
}

public String getKey() {
return key;
public void setImagePickKey(String imagePickKey) {
this.imagePickKey = imagePickKey;
}

public int getMaxCount() {
return maxCount;
public int getMaxPickCount() {
return maxPickCount;
}

public String getItemid() {
return itemid;
public void setMaxPickCount(int maxPickCount) {
this.maxPickCount = maxPickCount;
}

private String itemid;//详情 code

private int maxPickCount;
//


}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class ClassicPhotoSelectorActivity extends AppCompatActivity {
private ImagePickRecyclerView iprv;
private int mMaxImagePickCount = 3;
private String mImagePickKey;
private String mImagePickKey="";

private static final int REQUEST_CODE_SELECT_PHOTO = 44544;
private PhotoSelectorDataWrapper mPhotoSelectorDataWrapper;
Expand All @@ -38,9 +38,11 @@ protected void onCreate(Bundle savedInstanceState) {
}
if (bundle != null) {
mIsToolbarTitleCenter = bundle.getBoolean("isTitleCenter");
mMaxImagePickCount = bundle.getInt("maxImagePickCount");
mImagePickKey = bundle.getString("imagePickKey");
mPhotoSelectorDataWrapper = (PhotoSelectorDataWrapper) bundle.getSerializable("photoSelectorDataWrapper");
mPhotoSelectorDataWrapper = (PhotoSelectorDataWrapper)
bundle.getSerializable("photoSelectorDataWrapper");
if (mPhotoSelectorDataWrapper!=null){
mMaxImagePickCount =mPhotoSelectorDataWrapper.getMaxPickCount();
mImagePickKey =mPhotoSelectorDataWrapper.getImagePickKey();}
}

initToolbar();
Expand All @@ -59,6 +61,11 @@ protected void onNotFastClick(View v) {

iprv = (ImagePickRecyclerView) findViewById(R.id.id_iprv);
iprv.setMaxImagePickCount(mMaxImagePickCount);
//
if (mPhotoSelectorDataWrapper!=null&&mPhotoSelectorDataWrapper.getImagePickBeanList() != null
&& mPhotoSelectorDataWrapper.getImagePickBeanList().size() > 0) {
iprv.addDataList(mPhotoSelectorDataWrapper.getImagePickBeanList());
}
iprv.setOnAddClickListener(new ImagePickRecyclerView.OnAddClickListener() {
@Override
public void onAddClick(View view, int maxPickImageCount, int hasImageCount) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@
public class ClassicPhotoUploaderDataHelper {
public static final int REQUEST_CODE_PHOTO_SELECTOR = 2329;

public static void setDataAndToPhotoSelector(FragmentActivity fragmentActivity, String imagePickKey,
public static void setDataAndToPhotoSelector(FragmentActivity fragmentActivity,List<ImagePickBean> imagePickBeanList,
int maxImagePickCount) {
setDataAndToPhotoSelector(fragmentActivity, imagePickKey, maxImagePickCount, true);
setDataAndToPhotoSelector(fragmentActivity,imagePickBeanList, maxImagePickCount, true);
}

public static void setDataAndToPhotoSelector(FragmentActivity fragmentActivity, String imagePickKey,
public static void setDataAndToPhotoSelector(FragmentActivity fragmentActivity,
List<ImagePickBean> imagePickBeanList,
int maxImagePickCount, boolean isTitleCenter) {
WeakReference<FragmentActivity> fragmentActivityWeakReference = new WeakReference<>(fragmentActivity);
Intent intent = new Intent(fragmentActivityWeakReference.get(), ClassicPhotoSelectorActivity.class);
Bundle bundle = new Bundle();
bundle.putString("imagePickKey", imagePickKey);
bundle.putInt("maxImagePickCount", maxImagePickCount);
bundle.putBoolean("isTitleCenter", isTitleCenter);
PhotoSelectorDataWrapper wrapper=new PhotoSelectorDataWrapper();
wrapper.setMaxPickCount(maxImagePickCount);
wrapper.setImagePickBeanList(imagePickBeanList);
wrapper.setImagePickKey("");
bundle.putSerializable("photoSelectorDataWrapper", wrapper);
intent.putExtras(bundle);
fragmentActivityWeakReference.get().startActivityForResult(intent, REQUEST_CODE_PHOTO_SELECTOR);
}
Expand All @@ -40,8 +44,9 @@ public static void callAtOnActivityResult(int requestCode, int resultCode, Inten
PhotoSelectorBackData photoSelectorBackData) {
PhotoSelectorDataWrapper photoSelectorDataWrapper;
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_PHOTO_SELECTOR) {
photoSelectorDataWrapper = (PhotoSelectorDataWrapper) data.getSerializableExtra("photoSelectorDataWrapper");
if (photoSelectorBackData != null && photoSelectorBackData != null) {
photoSelectorDataWrapper = (PhotoSelectorDataWrapper)
data.getSerializableExtra("photoSelectorDataWrapper");
if (photoSelectorBackData != null) {
photoSelectorBackData.backData(photoSelectorDataWrapper.getImagePickBeanList());
}

Expand Down

0 comments on commit 4620ea9

Please sign in to comment.