Search in sources :

Example 1 with UploadResultBean

use of com.benmu.framework.model.UploadResultBean in project WeexErosFramework by bmfe.

the class AbstractWeexActivity method cameraResult.

/**
 * 照片拍摄完成读取结果
 */
private void cameraResult() {
    ImagePicker.galleryAddPic(this, this.imagePicker.getTakeImageFile());
    String path = this.imagePicker.getTakeImageFile().getAbsolutePath();
    int degree = BitmapUtil.getBitmapDegree(path);
    if (degree != 0) {
        Bitmap bitmap = BitmapUtil.rotateBitmapByDegree(path, degree);
        if (bitmap != null) {
            File file = new File(path);
            try {
                FileOutputStream bos = new FileOutputStream(file);
                bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
                bos.flush();
                bos.close();
            } catch (IOException var9) {
                var9.printStackTrace();
            }
        }
    }
    UploadResultBean uploadResultBean = new UploadResultBean();
    uploadResultBean.resCode = 0;
    uploadResultBean.msg = "拍照成功";
    List<String> dataList = new ArrayList<>();
    dataList.add(path);
    uploadResultBean.setData(dataList);
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(uploadResultBean);
}
Also used : Bitmap(android.graphics.Bitmap) FileOutputStream(java.io.FileOutputStream) ArrayList(java.util.ArrayList) UploadResultBean(com.benmu.framework.model.UploadResultBean) IOException(java.io.IOException) File(java.io.File)

Example 2 with UploadResultBean

use of com.benmu.framework.model.UploadResultBean in project WeexErosFramework by bmfe.

the class AbstractWeexActivity method pickReturn.

/**
 * 选择图片结果返回。
 */
private void pickReturn(ArrayList<ImageItem> items) {
    UploadResultBean bean = new UploadResultBean();
    List<String> data = new ArrayList<>();
    for (ImageItem path : items) {
        data.add(path.path);
    }
    bean.data = data;
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(bean);
}
Also used : ArrayList(java.util.ArrayList) UploadResultBean(com.benmu.framework.model.UploadResultBean) ImageItem(com.lzy.imagepicker.bean.ImageItem)

Example 3 with UploadResultBean

use of com.benmu.framework.model.UploadResultBean in project WeexErosFramework by bmfe.

the class AxiosManager method resultBean.

/**
 * 组合返回给前端的Js 数据
 */
public UploadResultBean resultBean(int code, String message, ArrayList<String> arrayList) {
    UploadResultBean uploadResultBean = new UploadResultBean();
    uploadResultBean.resCode = code;
    uploadResultBean.msg = message;
    uploadResultBean.setData(arrayList);
    return uploadResultBean;
}
Also used : UploadResultBean(com.benmu.framework.model.UploadResultBean)

Aggregations

UploadResultBean (com.benmu.framework.model.UploadResultBean)3 ArrayList (java.util.ArrayList)2 Bitmap (android.graphics.Bitmap)1 ImageItem (com.lzy.imagepicker.bean.ImageItem)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1