Java Code Examples for com.yalantis.ucrop.UCrop#withOptions()

The following examples show how to use com.yalantis.ucrop.UCrop#withOptions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhotoActivity.java    From CrazyDaily with Apache License 2.0 6 votes vote down vote up
/**
 * 其它配置
 */
private UCrop advancedConfig(@NonNull UCrop uCrop) {
    UCrop.Options options = new UCrop.Options();
    switch (mCropCompressRadioGroup.getCheckedRadioButtonId()) {
        case R.id.photo_crop_compress_png:
            options.setCompressionFormat(Bitmap.CompressFormat.PNG);
            break;
        case R.id.photo_crop_compress_jpg:
        default:
            options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
            break;
    }
    options.setCompressionQuality(getCompressionQuality());
    options.setHideBottomControls(mCropUISetting.isChecked());
    options.setFreeStyleCropEnabled(mCropRatioFreestyle.isChecked());

    options.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    options.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    options.setActiveWidgetColor(ContextCompat.getColor(this, R.color.colorPrimary));
    options.setToolbarWidgetColor(ContextCompat.getColor(this, R.color.color_white));
    return uCrop.withOptions(options);
}
 
Example 2
Source File: MyTool.java    From PhotoOut with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: CropUtils.java    From CropUtils with Apache License 2.0 6 votes vote down vote up
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);
 }
 
Example 4
Source File: PicCrop.java    From PicCrop with Apache License 2.0 6 votes vote down vote up
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);
 }