Search in sources :

Example 1 with PersistentManager

use of com.benmu.framework.manager.impl.PersistentManager in project WeexErosFramework by bmfe.

the class DefaultImageAdapter method pickAvatar.

public void pickAvatar(final Context context, UploadImageBean bean, int requestCode) {
    if (!checkPermission(context))
        return;
    // 设置图片加载器
    imagePicker.setImageLoader(new GlideImageLoader());
    // 显示拍照按钮
    imagePicker.setShowCamera(true);
    // 是否是多张
    imagePicker.setMultiMode(false);
    // 允许裁剪
    imagePicker.setCrop(true);
    // 是否按矩形区域保存
    imagePicker.setSaveRectangle(true);
    // 裁剪框的形状
    imagePicker.setStyle(CropImageView.Style.RECTANGLE);
    // 裁剪框的宽度。单位像素(圆形自动取宽高最小值)
    imagePicker.setFocusWidth(Constant.ImageConstants.BIGGESTWIDTH);
    // 裁剪框的高度。单位像素(圆形自动取宽高最小值)
    imagePicker.setFocusHeight(Constant.ImageConstants.BIGGESTWIDTH);
    Intent intent = new Intent(context, ImageGridActivity.class);
    PersistentManager persistentManager = ManagerFactory.getManagerService(PersistentManager.class);
    persistentManager.setCacheData(Constant.ImageConstants.UPLOAD_IMAGE_BEAN, bean);
    ((Activity) context).startActivityForResult(intent, requestCode);
}
Also used : PersistentManager(com.benmu.framework.manager.impl.PersistentManager) ImageGridActivity(com.lzy.imagepicker.ui.ImageGridActivity) Activity(android.app.Activity) Intent(android.content.Intent)

Example 2 with PersistentManager

use of com.benmu.framework.manager.impl.PersistentManager in project WeexErosFramework by bmfe.

the class DefaultImageAdapter method openCamera.

public void openCamera(final Context context, UploadImageBean bean) {
    // 设置图片加载器
    imagePicker.setImageLoader(new GlideImageLoader());
    // 允许裁剪
    imagePicker.setCrop(true);
    // 是否按矩形区域保存
    imagePicker.setSaveRectangle(true);
    // 裁剪框的形状
    imagePicker.setStyle(CropImageView.Style.RECTANGLE);
    // 裁剪框的宽度。单位像素(圆形自动取宽高最小值)
    imagePicker.setFocusWidth(Constant.ImageConstants.BIGGESTWIDTH);
    // 裁剪框的高度。单位像素(圆形自动取宽高最小值)
    imagePicker.setFocusHeight(Constant.ImageConstants.BIGGESTWIDTH);
    PersistentManager persistentManager = ManagerFactory.getManagerService(PersistentManager.class);
    persistentManager.setCacheData(Constant.ImageConstants.UPLOAD_IMAGE_BEAN, bean);
    if (context instanceof Activity) {
        imagePicker.takePicture((Activity) context, 1001);
    }
}
Also used : PersistentManager(com.benmu.framework.manager.impl.PersistentManager) ImageGridActivity(com.lzy.imagepicker.ui.ImageGridActivity) Activity(android.app.Activity)

Example 3 with PersistentManager

use of com.benmu.framework.manager.impl.PersistentManager in project WeexErosFramework by bmfe.

the class DefaultImageAdapter method pickPhoto.

public void pickPhoto(final Context context, UploadImageBean bean, int requestCode) {
    if (!checkPermission(context))
        return;
    // 设置图片加载器
    imagePicker.setImageLoader(new GlideImageLoader());
    // 
    imagePicker.setShowCamera(true);
    // 允许裁剪(单选才有效)
    imagePicker.setCrop(false);
    // 是否是多张
    imagePicker.setMultiMode(true);
    // 选中数量限制
    imagePicker.setSelectLimit(bean.maxCount);
    Intent intent = new Intent(context, ImageGridActivity.class);
    PersistentManager persistentManager = ManagerFactory.getManagerService(PersistentManager.class);
    persistentManager.setCacheData(Constant.ImageConstants.UPLOAD_IMAGE_BEAN, bean);
    ((Activity) context).startActivityForResult(intent, requestCode);
}
Also used : PersistentManager(com.benmu.framework.manager.impl.PersistentManager) ImageGridActivity(com.lzy.imagepicker.ui.ImageGridActivity) Activity(android.app.Activity) Intent(android.content.Intent)

Aggregations

Activity (android.app.Activity)3 PersistentManager (com.benmu.framework.manager.impl.PersistentManager)3 ImageGridActivity (com.lzy.imagepicker.ui.ImageGridActivity)3 Intent (android.content.Intent)2