当前位置: 首页>>代码示例>>Java>>正文


Java ImageItem类代码示例

本文整理汇总了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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:UploadAdapter.java

示例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("--");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:RxFormUploadActivity.java

示例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("--");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:FormUploadActivity.java

示例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("--");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:UpActivity.java

示例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);
    }
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:17,代码来源:ImageGridActivity.java

示例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));
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:23,代码来源:ImagePreviewActivity.java

示例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));
        }
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:18,代码来源:ImagePreviewActivity.java

示例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));
    }
}
 
开发者ID:jeasonlzy,项目名称:ImagePicker,代码行数:21,代码来源:ImagePreviewActivity.java

示例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));
        }
    }
}
 
开发者ID:jeasonlzy,项目名称:ImagePicker,代码行数:18,代码来源:ImagePreviewActivity.java

示例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);
            }
        }
    }
}
 
开发者ID:jeasonlzy,项目名称:ImagePicker,代码行数:25,代码来源:WxDemoActivity.java

示例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("--");
        }
    }
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:24,代码来源:FormUploadActivity.java

示例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("没有数据");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:UploadListActivity.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:UploadAdapter.java

示例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);
        }
    }
}
 
开发者ID:CodingCodersCode,项目名称:EvolvingNetLib,代码行数:11,代码来源:MainActivity.java

示例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();
        }
    }
}
 
开发者ID:yiwent,项目名称:Mobike,代码行数:16,代码来源:BikeDamageReportActivity.java


注:本文中的com.lzy.imagepicker.bean.ImageItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。