本文整理汇总了Java中com.lzy.imagepicker.bean.ImageItem类的典型用法代码示例。如果您正苦于以下问题:Java ImageItem类的具体用法?Java ImageItem怎么用?Java ImageItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageItem类属于com.lzy.imagepicker.bean包,在下文中一共展示了ImageItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateData
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
public List<UploadTask<?>> updateData(List<ImageItem> images) {
this.type = -1;
this.images = images;
values = new ArrayList<>();
if (images != null) {
Random random = new Random();
for (int i = 0; i < images.size(); i++) {
ImageItem imageItem = images.get(i);
//这里是演示可以传递任何数据
PostRequest<String> postRequest = OkGo.<String>post(Urls.URL_FORM_UPLOAD)//
.headers("aaa", "111")//
.params("bbb", "222")//
.params("fileKey" + i, new File(imageItem.path))//
.converter(new StringConvert());
UploadTask<String> task = OkUpload.request(imageItem.path, postRequest)//
.priority(random.nextInt(100))//
.extra1(imageItem)//
.save();
values.add(task);
}
}
notifyDataSetChanged();
return values;
}
示例2: onActivityResult
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == 100) {
//noinspection unchecked
imageItems = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
if (imageItems != null && imageItems.size() > 0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < imageItems.size(); i++) {
if (i == imageItems.size() - 1) sb.append("图片").append(i + 1).append(" : ").append(imageItems.get(i).path);
else sb.append("图片").append(i + 1).append(" : ").append(imageItems.get(i).path).append("\n");
}
tvImages.setText(sb.toString());
} else {
tvImages.setText("--");
}
} else {
Toast.makeText(this, "没有选择图片", Toast.LENGTH_SHORT).show();
tvImages.setText("--");
}
}
}
示例3: onActivityResult
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == 100) {
imageItems = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
if (imageItems != null && imageItems.size() > 0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < imageItems.size(); i++) {
if (i == imageItems.size() - 1) sb.append("图片").append(i + 1).append(" : ").append(imageItems.get(i).path);
else sb.append("图片").append(i + 1).append(" : ").append(imageItems.get(i).path).append("\n");
}
tvImages.setText(sb.toString());
} else {
tvImages.setText("--");
}
} else {
Toast.makeText(this, "没有选择图片", Toast.LENGTH_SHORT).show();
tvImages.setText("--");
}
}
}
示例4: onActivityResult
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == 100) {
//noinspection unchecked
List<ImageItem> imageItems = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
if (imageItems != null && imageItems.size() > 0) {
imageItem = imageItems.get(0);
tvImages.setText(imageItem.path);
} else {
tvImages.setText("--");
}
} else {
Toast.makeText(this, "没有选择图片", Toast.LENGTH_SHORT).show();
tvImages.setText("--");
}
}
}
示例5: onImageSelected
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onImageSelected(int position, ImageItem item, boolean isAdd) {
if (imagePicker.getSelectImageCount() > 0) {
mBtnOk.setText(getString(R.string.select_complete,
imagePicker.getSelectImageCount() + "", imagePicker.getSelectLimit() + ""));
mBtnOk.setEnabled(true);
mBtnPre.setEnabled(true);
} else {
mBtnOk.setText(getString(R.string.complete));
mBtnOk.setEnabled(false);
mBtnPre.setEnabled(false);
}
mBtnPre.setText(getResources().getString(R.string.preview_count, imagePicker.getSelectImageCount() + ""));
// mImageGridAdapter.notifyDataSetChanged();
mImageGridAdapter.notifyItemChanged(position);
}
示例6: onImageSelected
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
/**
* 图片添加成功后,修改当前图片的选中数量
* 当调用 addSelectedImageItem 或 deleteSelectedImageItem 都会触发当前回调
*/
@Override
public void onImageSelected(int position, ImageItem item, boolean isAdd) {
if (imagePicker.getSelectImageCount() > 0) {
mBtnOk.setText(getString(R.string.select_complete, imagePicker.getSelectImageCount(), imagePicker.getSelectLimit()));
mBtnOk.setEnabled(true);
} else {
mBtnOk.setText(getString(R.string.complete));
mBtnOk.setEnabled(false);
}
if (mCbOrigin.isChecked()) {
long size = 0;
for (ImageItem imageItem : selectedImages)
size += imageItem.size;
String fileSize = Formatter.formatFileSize(this, size);
mCbOrigin.setText(getString(R.string.origin_size, fileSize));
}
}
示例7: onCheckedChanged
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int id = buttonView.getId();
if (id == R.id.cb_origin) {
if (isChecked) {
long size = 0;
for (ImageItem item : selectedImages)
size += item.size;
String fileSize = Formatter.formatFileSize(this, size);
isOrigin = true;
mCbOrigin.setText(getString(R.string.origin_size, fileSize));
} else {
isOrigin = false;
mCbOrigin.setText(getString(R.string.origin));
}
}
}
示例8: onImageSelected
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
/**
* 图片添加成功后,修改当前图片的选中数量
* 当调用 addSelectedImageItem 或 deleteSelectedImageItem 都会触发当前回调
*/
@Override
public void onImageSelected(int position, ImageItem item, boolean isAdd) {
if (imagePicker.getSelectImageCount() > 0) {
mBtnOk.setText(getString(R.string.ip_select_complete, imagePicker.getSelectImageCount(), imagePicker.getSelectLimit()));
} else {
mBtnOk.setText(getString(R.string.ip_complete));
}
if (mCbOrigin.isChecked()) {
long size = 0;
for (ImageItem imageItem : selectedImages)
size += imageItem.size;
String fileSize = Formatter.formatFileSize(this, size);
mCbOrigin.setText(getString(R.string.ip_origin_size, fileSize));
}
}
示例9: onCheckedChanged
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int id = buttonView.getId();
if (id == R.id.cb_origin) {
if (isChecked) {
long size = 0;
for (ImageItem item : selectedImages)
size += item.size;
String fileSize = Formatter.formatFileSize(this, size);
isOrigin = true;
mCbOrigin.setText(getString(R.string.ip_origin_size, fileSize));
} else {
isOrigin = false;
mCbOrigin.setText(getString(R.string.ip_origin));
}
}
}
示例10: onActivityResult
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
//添加图片返回
if (data != null && requestCode == REQUEST_CODE_SELECT) {
images = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
if (images != null) {
selImageList.addAll(images);
adapter.setImages(selImageList);
}
}
} else if (resultCode == ImagePicker.RESULT_CODE_BACK) {
//预览图片返回
if (data != null && requestCode == REQUEST_CODE_PREVIEW) {
images = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_IMAGE_ITEMS);
if (images != null) {
selImageList.clear();
selImageList.addAll(images);
adapter.setImages(selImageList);
}
}
}
}
示例11: onActivityResult
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == 100) {
imageItems = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
if (imageItems != null && imageItems.size() > 0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < imageItems.size(); i++) {
if (i == imageItems.size() - 1)
sb.append("图片").append(i + 1).append(" : ").append(imageItems.get(i).path);
else sb.append("图片").append(i + 1).append(" : ").append(imageItems.get(i).path).append("\n");
}
tvImages.setText(sb.toString());
} else {
tvImages.setText("--");
}
} else {
Toast.makeText(this, "没有选择图片", Toast.LENGTH_SHORT).show();
tvImages.setText("--");
}
}
}
示例12: onActivityResult
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == 100) {
//noinspection unchecked
List<ImageItem> images = (List<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
tasks = adapter.updateData(images);
} else {
showToast("没有数据");
}
}
}
示例13: bind
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
public void bind() {
Progress progress = task.progress;
ImageItem item = (ImageItem) progress.extra1;
Glide.with(context).load(item.path).error(R.mipmap.ic_launcher).into(icon);
name.setText(item.name);
priority.setText(String.format("优先级:%s", progress.priority));
}
示例14: onActivityResult
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == 100) {
List<ImageItem> images = (List<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
onStartUploadMethodTest(images);
}
}
}
示例15: uploadImage
import com.lzy.imagepicker.bean.ImageItem; //导入依赖的package包/类
private void uploadImage(int requestCode, int resultCode, Intent data) {
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == REQS_IMAGE_PICKER) {
ArrayList<ImageItem> images = null;
images = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
ImageItem imageItem = images.get(0);
Glide.with(BikeDamageReportActivity.this).load(imageItem.path).into(mIvPick);
// if (bmobFile == null)
bmobFile = new BmobFile(new File(imageItem.path));
bmobFile.setUrl(imageItem.path);
} else {
Toast.makeText(this, "没有数据", Toast.LENGTH_SHORT).show();
}
}
}