Search in sources :

Example 1 with UploadImageBean

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

the class EventCamera method uploadImage.

public void uploadImage(String json, Context context, JSCallback jsCallback) {
    if (!PermissionUtils.checkPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
        return;
    }
    mUploadAvatar = jsCallback;
    mUploadContext = context;
    UploadImageBean bean = ManagerFactory.getManagerService(ParseManager.class).parseObject(json, UploadImageBean.class);
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().register(this);
    ImageManager imageManager = ManagerFactory.getManagerService(ImageManager.class);
    if (bean.allowCrop && bean.maxCount == 1) {
        // 上传头像
        imageManager.pickAvatar(context, bean, Constant.ImageConstants.IMAGE_PICKER);
    } else if (bean.maxCount > 0) {
        imageManager.pickPhoto(context, bean, Constant.ImageConstants.IMAGE_PICKER);
    }
}
Also used : UploadImageBean(com.benmu.framework.model.UploadImageBean) ParseManager(com.benmu.framework.manager.impl.ParseManager) ImageManager(com.benmu.framework.manager.impl.ImageManager)

Example 2 with UploadImageBean

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

the class EventCamera method openCamera.

public void openCamera(String json, Context context, JSCallback jsCallback) {
    if (!PermissionUtils.checkPermission(context, Manifest.permission.CAMERA)) {
        return;
    }
    mUploadAvatar = jsCallback;
    mUploadContext = context;
    UploadImageBean bean = ManagerFactory.getManagerService(ParseManager.class).parseObject(json, UploadImageBean.class);
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().register(this);
    ImageManager imageManager = ManagerFactory.getManagerService(ImageManager.class);
    imageManager.openCamera(context, bean);
}
Also used : UploadImageBean(com.benmu.framework.model.UploadImageBean) ParseManager(com.benmu.framework.manager.impl.ParseManager) ImageManager(com.benmu.framework.manager.impl.ImageManager)

Example 3 with UploadImageBean

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

the class EventImage method pick.

public void pick(String json, Context context, JSCallback jsCallback) {
    // Manifest.permission.READ_EXTERNAL_STORAGE 权限申请
    if (!PermissionUtils.checkPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) {
        return;
    }
    mPickCallback = jsCallback;
    UploadImageBean bean = ManagerFactory.getManagerService(ParseManager.class).parseObject(json, UploadImageBean.class);
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().register(this);
    ImageManager imageManager = ManagerFactory.getManagerService(ImageManager.class);
    if (bean.allowCrop && bean.maxCount == 1) {
        // 上传头像
        imageManager.pickAvatar(context, bean, Constant.ImageConstants.IMAGE_NOT_UPLOADER_PICKER);
    } else if (bean.maxCount > 0) {
        imageManager.pickPhoto(context, bean, Constant.ImageConstants.IMAGE_NOT_UPLOADER_PICKER);
    }
}
Also used : UploadImageBean(com.benmu.framework.model.UploadImageBean) ParseManager(com.benmu.framework.manager.impl.ParseManager) ImageManager(com.benmu.framework.manager.impl.ImageManager)

Example 4 with UploadImageBean

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

the class EventFetch method uploadImage.

public void uploadImage(String json, Context context, JSCallback jsCallback) {
    mUploadAvatar = jsCallback;
    mUploadContext = context;
    UploadImageBean bean = ManagerFactory.getManagerService(ParseManager.class).parseObject(json, UploadImageBean.class);
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().register(this);
    ImageManager imageManager = ManagerFactory.getManagerService(ImageManager.class);
    ArrayList<ImageItem> items = new ArrayList<>();
    if (bean.images == null || bean.images.size() == 0) {
        Toast.makeText(context, "没传递上传的图片~", Toast.LENGTH_SHORT).show();
        return;
    }
    for (String path : bean.images) {
        ImageItem item = new ImageItem();
        item.path = path;
        items.add(item);
    }
    imageManager.UpMultipleImageData(context, items, bean);
}
Also used : UploadImageBean(com.benmu.framework.model.UploadImageBean) ArrayList(java.util.ArrayList) ImageItem(com.lzy.imagepicker.bean.ImageItem) ParseManager(com.benmu.framework.manager.impl.ParseManager) ImageManager(com.benmu.framework.manager.impl.ImageManager)

Example 5 with UploadImageBean

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

the class AbstractWeexActivity method UpMultipleImageData.

/**
 * 上传图片
 */
private void UpMultipleImageData(ArrayList<ImageItem> items) {
    ImageManager imageManager = ManagerFactory.getManagerService(ImageManager.class);
    UploadImageBean bean = ManagerFactory.getManagerService(PersistentManager.class).getCacheData(Constant.ImageConstants.UPLOAD_IMAGE_BEAN, UploadImageBean.class);
    imageManager.UpMultipleImageData(this, items, bean);
}
Also used : UploadImageBean(com.benmu.framework.model.UploadImageBean) PersistentManager(com.benmu.framework.manager.impl.PersistentManager) ImageManager(com.benmu.framework.manager.impl.ImageManager)

Aggregations

ImageManager (com.benmu.framework.manager.impl.ImageManager)5 UploadImageBean (com.benmu.framework.model.UploadImageBean)5 ParseManager (com.benmu.framework.manager.impl.ParseManager)4 PersistentManager (com.benmu.framework.manager.impl.PersistentManager)1 ImageItem (com.lzy.imagepicker.bean.ImageItem)1 ArrayList (java.util.ArrayList)1