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


Java UCrop.start方法代码示例

本文整理汇总了Java中com.yalantis.ucrop.UCrop.start方法的典型用法代码示例。如果您正苦于以下问题:Java UCrop.start方法的具体用法?Java UCrop.start怎么用?Java UCrop.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.yalantis.ucrop.UCrop的用法示例。


在下文中一共展示了UCrop.start方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
public static void startCropActivity(Activity context, Uri sourceUri,BasePhotoBuilder builder) {
    CropConfig config = buildCropConfig(builder);
    Uri mDestinationUri = buildUri(builder,false);
    UCrop uCrop = UCrop.of(sourceUri, mDestinationUri);

    uCrop.withAspectRatio(config.aspectRatioX,config.aspectRatioY);
    uCrop.withMaxResultSize(config.maxWidth,config.maxHeight);

    UCrop.Options options = new UCrop.Options();
    options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
    options.setAllowedGestures(UCropActivity.SCALE,UCropActivity.NONE,UCropActivity.NONE);
    options.setCompressionQuality(config.quality);
    // options.setOvalDimmedLayer(config.isOval);
    options.setCircleDimmedLayer(config.isOval);
    options.setShowCropGrid(config.showGridLine);
    options.setHideBottomControls(config.hideBottomControls);
    options.setShowCropFrame(config.showOutLine);
    options.setToolbarColor(config.toolbarColor);
    options.setStatusBarColor(config.statusBarColor);

    uCrop.withOptions(options);

    uCrop.start(context);
}
 
开发者ID:hss01248,项目名称:PhotoOut,代码行数:25,代码来源:MyTool.java

示例2: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private static void startCropActivity(Activity context, Uri sourceUri) {
     Uri mDestinationUri = buildUri();
     UCrop uCrop = UCrop.of(sourceUri, mDestinationUri);

     uCrop.withAspectRatio(config.aspectRatioX,config.aspectRatioY);
     uCrop.withMaxResultSize(config.maxWidth,config.maxHeight);

     UCrop.Options options = new UCrop.Options();
     options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
     options.setAllowedGestures(UCropActivity.SCALE,UCropActivity.NONE,UCropActivity.NONE);
     options.setCompressionQuality(config.quality);
     options.setOvalDimmedLayer(config.isOval);
     options.setShowCropGrid(config.showGridLine);
     options.setHideBottomControls(config.hideBottomControls);
     options.setShowCropFrame(config.showOutLine);
options.setToolbarColor(config.toolbarColor);
     options.setStatusBarColor(config.statusBarColor);

     uCrop.withOptions(options);

     uCrop.start(context);
 }
 
开发者ID:glassLake,项目名称:CropUtils,代码行数:23,代码来源:CropUtils.java

示例3: startCropping

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
/**
 * Start the cropping activity via Yalantis UCrop
 * @param sourceUri Source URI to crop
 * @param destinationUri Destination URI
 */
public void startCropping(Uri sourceUri, Uri destinationUri){
    //Build options
    options = optionsAndFlags.cropOptions;
    if(options == null) {
        options = CameraMediaUtilities.buildUCropOptions();
    }

    try {
        UCrop cropping = UCrop.of(sourceUri, destinationUri);
        //cropping.withMaxResultSize(maxWidth, maxHeight);
        if(options != null){
            cropping.withOptions(options);
        }
        cropping.start(activity, TAG_CROP_PHOTO);
    } catch (Exception e){
        e.printStackTrace();
        listener.onTaskComplete("An error occurred while processing your photo", TAG_CROP_ERROR);
    }
}
 
开发者ID:PGMacDesign,项目名称:PGMacTips,代码行数:25,代码来源:CameraMediaUtilities.java

示例4: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private static void startCropActivity(Activity context, Uri sourceUri) {
     Uri mDestinationUri = buildUri();
     UCrop uCrop = UCrop.of(sourceUri, mDestinationUri);

     uCrop.withAspectRatio(config.aspectRatioX,config.aspectRatioY);
     uCrop.withMaxResultSize(config.maxWidth,config.maxHeight);

     UCrop.Options options = new UCrop.Options();
     options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
     options.setAllowedGestures(UCropActivity.SCALE,UCropActivity.NONE,UCropActivity.NONE);
     options.setCompressionQuality(config.quality);
    // options.setOvalDimmedLayer(config.isOval);
     options.setCircleDimmedLayer(config.isOval);
     options.setShowCropGrid(config.showGridLine);
     options.setHideBottomControls(config.hideBottomControls);
     options.setShowCropFrame(config.showOutLine);
options.setToolbarColor(config.toolbarColor);
     options.setStatusBarColor(config.statusBarColor);

     uCrop.withOptions(options);

     uCrop.start(context);
 }
 
开发者ID:hss01248,项目名称:PicCrop,代码行数:24,代码来源:PicCrop.java

示例5: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (resultCode) {
            case Activity.RESULT_CANCELED:
                listener.onCropCancel();
                break;
            case UCrop.RESULT_ERROR:
                if (data != null) {
                    Throwable cropError = UCrop.getError(data);
                    if (cropError != null) {
                        listener.onCropError(cropError.getMessage());
                    } else {
                        listener.onCropError("裁剪出现未知错误");
                    }
                } else {
                    listener.onCropError("获取相册图片出现错误");
                }
                break;

            case Activity.RESULT_OK:
                switch (requestCode) {
                    case TYPE_CAMERA:
                        notifyImageToCamera(listener.getSimpleActivity(), imagePath);
                        UCrop of = UCrop.of(imagePath, Uri.fromFile(getDiskCacheDir()));
//                        of.withAspectRatio(8,5);
                        UCrop.Options options = new UCrop.Options();
                        options.setAspectRatioOptions(0, new AspectRatio("8:5", 8, 5));
                        of.withOptions(options);
                        of.start(listener.getSimpleActivity());
                        break;
                    case UCrop.REQUEST_CROP:
                        listener.onCropSuccess(UCrop.getOutput(data));
                        break;
                }
                break;
        }
    }
 
开发者ID:Loofer,项目名称:Watermark,代码行数:37,代码来源:SimpleRxGalleryFinal.java

示例6: startUCrop

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
public static String startUCrop(Activity activity, String sourceFilePath,
                                int requestCode, float aspectRatioX, float aspectRatioY) {
    Uri sourceUri = Uri.fromFile(new File(sourceFilePath));
    File outDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
    if (!outDir.exists()) {
        outDir.mkdirs();
    }
    File outFile = new File(outDir, System.currentTimeMillis() + ".jpg");
    //裁剪后图片的绝对路径
    String cameraScalePath = outFile.getAbsolutePath();
    Uri destinationUri = Uri.fromFile(outFile);
    //初始化,第一个参数:需要裁剪的图片;第二个参数:裁剪后图片
    UCrop uCrop = UCrop.of(sourceUri, destinationUri);
    //初始化UCrop配置
    UCrop.Options options = new UCrop.Options();
    //设置裁剪图片可操作的手势
    options.setAllowedGestures(UCropActivity.SCALE, UCropActivity.ROTATE, UCropActivity.ALL);
    //是否隐藏底部容器,默认显示
    options.setHideBottomControls(true);
    //设置toolbar颜色
    options.setToolbarColor(ActivityCompat.getColor(activity, R.color.colorPrimary));
    //设置状态栏颜色
    options.setStatusBarColor(ActivityCompat.getColor(activity, R.color.colorPrimary));
    //是否能调整裁剪框
    options.setFreeStyleCropEnabled(true);
    //UCrop配置
    uCrop.withOptions(options);
    //设置裁剪图片的宽高比,比如16:9
    uCrop.withAspectRatio(aspectRatioX, aspectRatioY);
    //uCrop.useSourceImageAspectRatio();
    //跳转裁剪页面
    uCrop.start(activity, requestCode);
    return cameraScalePath;
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:35,代码来源:ReleaseOrderActivity.java

示例7: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
/**
 * @param activity
 * @param uri      //     * @param compressionSet mRadioGroupCompressionSettings.getCheckedRadioButtonId()
 *                 //     * @param aspectChecked  mRadioGroupAspectRatio.getCheckedRadioButtonId()
 */
public static void startCropActivity(Activity activity, @NonNull Uri uri) {
    String destinationFileName = SAMPLE_CROPPED_IMAGE_NAME;
    if (PNGorJPEG)
        destinationFileName += ".png";
    else
        destinationFileName += ".jpg";

    UCrop uCrop = UCrop.of(uri, Uri.fromFile(new File(cacheDir, destinationFileName)));

    uCrop = basisConfig(uCrop, 1, 1);
    uCrop = advancedConfig(uCrop);

    uCrop.start(activity);
}
 
开发者ID:hkq325800,项目名称:YellowNote,代码行数:20,代码来源:CropUtil.java

示例8: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void startCropActivity(@NonNull Uri uri) {
    UCrop uCrop = UCrop.of(uri, mDestinationUri);

    uCrop = basisConfig(uCrop);
    uCrop = advancedConfig(uCrop);

    if (mFragment == null) {
        uCrop.start(mActivity);
    } else {
        uCrop.start(mActivity, mFragment);
    }
}
 
开发者ID:drakeet,项目名称:Lunei,代码行数:13,代码来源:TakePictureHelper.java

示例9: startUCrop

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void startUCrop(Uri selectedImageUri) {
    UCrop uCrop = UCrop.of(selectedImageUri, Uri.fromFile(
            getImageFile(UUID.randomUUID().toString())
    )).withMaxResultSize(1000, 1000);

    // TODO: make this abstract
    if (this instanceof EditItemActivity) {
        uCrop.withAspectRatio(9, 16);
    }
    else if (this instanceof EditEventActivity) {
        uCrop.withAspectRatio(4, 3);
    }

    uCrop.start(this);
}
 
开发者ID:joeydeluca,项目名称:apparel,代码行数:16,代码来源:ImagePickerActivity.java

示例10: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void startCropActivity(@NonNull Uri uri) {

        UCrop uCrop = UCrop.of(uri, Uri.fromFile(tempOutputFile));

        uCrop = advancedConfig(uCrop);
        uCrop.start(ChangeProfileActivity.this);
    }
 
开发者ID:sciage,项目名称:FinalProject,代码行数:8,代码来源:ChangeProfileActivity.java

示例11: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void startCropActivity(@NonNull Uri uri) {

        UCrop uCrop = UCrop.of(uri, Uri.fromFile(tempOutputFile));

        uCrop = advancedConfig(uCrop);
        uCrop.start(MessageActivity.this);
    }
 
开发者ID:sciage,项目名称:FinalProject,代码行数:8,代码来源:MessageActivity.java

示例12: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void startCropActivity(@NonNull Uri uri) {

        UCrop uCrop = UCrop.of(uri, Uri.fromFile(tempOutputFile));

        uCrop = advancedConfig(uCrop);
        uCrop.start(CreateGroupDescActivity.this);
    }
 
开发者ID:sciage,项目名称:FinalProject,代码行数:8,代码来源:CreateGroupDescActivity.java

示例13: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void startCropActivity(@NonNull Uri uri) {
    Date d = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String s = sdf.format(d);

    String destinationFileName = s + ".jpg";

    UCrop uCrop = UCrop.of(uri, Uri.fromFile(new File(getCacheDir(), destinationFileName)));

    uCrop = uCrop.useSourceImageAspectRatio();

    uCrop.start(UpdateUserInfoActivity.this);
}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:14,代码来源:UpdateUserInfoActivity.java

示例14: startCropActivity

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void startCropActivity(@NonNull Uri uri) {
    Date d = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String s = sdf.format(d);

    String destinationFileName = s + ".jpg";

    UCrop uCrop = UCrop.of(uri, Uri.fromFile(new File(getCacheDir(), destinationFileName)));

    uCrop = uCrop.useSourceImageAspectRatio();

    uCrop.start(EditFamilyActivity.this);
}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:14,代码来源:EditFamilyActivity.java


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