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);
}
}
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);
}
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);
}
}
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);
}
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);
}
Aggregations