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


Java UCrop.getOutput方法代码示例

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


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

示例1: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
        textView1.setText(R.string.identify_document);
        if (backTaked) {
            performOCRIFE(type, uri1, UCrop.getOutput(data));
            backTaked = false;
        } else {
            rectangleIfeFront.setVisibility(View.GONE);
            rectangleIfeBack.setVisibility(View.GONE);
            rectangleIneBack.setVisibility(View.GONE);
            uri1 = UCrop.getOutput(data);
            backTaked = true;
            if (type == Constants.IFEB || type == Constants.IFEC) {
                rectangleIfeBack.setVisibility(View.VISIBLE);
            } else if (type == Constants.IFED || type == Constants.IFEE) {
                rectangleIneBack.setVisibility(View.VISIBLE);
            }
        }
    } else {
        //final Throwable cropError = UCrop.getError(data);
    }
}
 
开发者ID:BrandonVargas,项目名称:AndroidOCRFforID,代码行数:24,代码来源:OcrIdActivity.java

示例2: dealCropResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void dealCropResult(@NonNull Intent result) {
        //得到结果的uri
        final Uri resultUri = UCrop.getOutput(result);
        if (resultUri != null) {
            ThreadPool.getInstance().execute(new Runnable() {
                @Override
                public void run() {
                    dealPicFromSelect(resultUri);
                }
            });
            //传送到结果界面预览
//            ResultActivity.startWithUri(MainActivity.this, resultUri);
        } else {
            Trace.show(mContext, "无法取回剪切过的图片");
        }
    }
 
开发者ID:hkq325800,项目名称:YellowNote,代码行数:17,代码来源:MainActivity.java

示例3: handleResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
/**
 * 注意,调用时data为null的判断
 *
 * @param context
 * @param cropHandler
 * @param requestCode
 * @param resultCode
 * @param data
 */
public static void handleResult(Activity context, CropHandler cropHandler, int requestCode, int resultCode, Intent data) {

    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == REQUEST_SELECT_PICTURE) {//第一次,选择图片后返回
            final Uri selectedUri = data.getData();
            if (selectedUri != null) {
                startCropActivity(context, data.getData());
            } else {
                Toast.makeText(context, "Cannot retrieve selected image", Toast.LENGTH_SHORT).show();
            }
        } else if (requestCode == UCrop.REQUEST_CROP) {//第二次返回,图片已经剪切好

            Uri finalUri = UCrop.getOutput(data);
            cropHandler.handleCropResult(finalUri,config.tag);

        } else if (requestCode == REQUEST_CAMERA) {//第一次,拍照后返回,因为设置了MediaStore.EXTRA_OUTPUT,所以data为null,数据直接就在uri中
            startCropActivity(context, uri);
        }
    }
    if (resultCode == UCrop.RESULT_ERROR) {
        cropHandler.handleCropError(data);
    }

}
 
开发者ID:glassLake,项目名称:CropUtils,代码行数:34,代码来源:CropUtils.java

示例4: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
/**
 * 注意,调用时data为null的判断
 *
 * @param context
 * @param cropHandler
 * @param requestCode
 * @param resultCode
 * @param data
 */
public static void onActivityResult( int requestCode, int resultCode, Intent data,Activity context, CropHandler cropHandler) {

    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == REQUEST_SELECT_PICTURE) {//第一次,选择图片后返回
            final Uri selectedUri = data.getData();
            if (selectedUri != null) {
                startCropActivity(context, data.getData());
            } else {
                Toast.makeText(context, "Cannot retrieve selected image", Toast.LENGTH_SHORT).show();
            }
        } else if (requestCode == UCrop.REQUEST_CROP) {//第二次返回,图片已经剪切好

            Uri finalUri = UCrop.getOutput(data);
            cropHandler.handleCropResult(finalUri,config.tag);

        } else if (requestCode == REQUEST_CAMERA) {//第一次,拍照后返回,因为设置了MediaStore.EXTRA_OUTPUT,所以data为null,数据直接就在uri中
            startCropActivity(context, uri);
        }
    }
    if (resultCode == UCrop.RESULT_ERROR) {
        cropHandler.handleCropError(data);
    }

}
 
开发者ID:hss01248,项目名称:PicCrop,代码行数:34,代码来源:PicCrop.java

示例5: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@SuppressWarnings("ResultOfMethodCallIgnored")
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
        if (mTempFile != null && mTempFile.exists()) {
            mTempFile.delete();
        }
        Uri outUri= UCrop.getOutput(data);
        if (outUri != null ) {
            if (mCallback != null) {
                mCallback.onCropperCallback(CropperResult.success, mSrcFile, mOutFile,outUri);
            }
        } else {
            if (mCallback != null) {
                mCallback.onCropperCallback(CropperResult.error_illegal_out_file, mSrcFile, null,null);
            }
        }
    }
}
 
开发者ID:zillachan,项目名称:LibZilla,代码行数:19,代码来源:ImageCropHelper.java

示例6: onCropFinish

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
public Uri onCropFinish(int resultCode, Intent data) {
    if (data == null) {
        return null;
    }
    Throwable throwable = UCrop.getError(data);
    if (throwable != null) {
        return null;
    }
    return UCrop.getOutput(data);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:BoxingUcrop.java

示例7: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    // 收到从Activity传递过来的回调,然后取出其中的值进行图片加载
    // 如果是我能够处理的类型
    if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
        // 通过UCrop得到对应的Uri
        final Uri resultUri = UCrop.getOutput(data);
        if (resultUri != null) {
            loadPortrait(resultUri);
        }
    } else if (resultCode == UCrop.RESULT_ERROR) {
        Application.showToast(R.string.data_rsp_error_unknown);
    }
}
 
开发者ID:FZZFVII,项目名称:pipe,代码行数:15,代码来源:UpdateInfoFragment.java

示例8: handleCropResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void handleCropResult(@NonNull Intent result) {
    final Uri resultUri = UCrop.getOutput(result);
    if (resultUri != null) {
        mCurrentPhotoStr = resultUri.getPath();
        mPhotoBitmap = BitmapFactory.decodeFile(resultUri.getPath());
        mCivPhoto.setImageBitmap(mPhotoBitmap);
    }


}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:11,代码来源:UpdateUserInfoActivity.java

示例9: handleCropResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void handleCropResult(@NonNull Intent result) {
    final Uri resultUri = UCrop.getOutput(result);
    if (resultUri != null) {
        mCurrentPhotoStr = resultUri.getPath();
        mPhotoBitmap = BitmapFactory.decodeFile(resultUri.getPath());
        mFamilyPhoto.setImageBitmap(mPhotoBitmap);
    }


}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:11,代码来源:EditFamilyActivity.java

示例10: handleCropResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void handleCropResult(@NonNull Intent result) {
    final Uri resultUri = UCrop.getOutput(result);
    if (resultUri != null) {
        mCallback.onPictureTakeDone(resultUri);
    } else {
        Toast.makeText(mActivity,
                R.string.toast_cannot_retrieve_cropped_image,
                Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:drakeet,项目名称:Lunei,代码行数:11,代码来源:TakePictureHelper.java

示例11: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) {

            List<Uri> mUris = Matisse.obtainResult(data);
            mStrings = Matisse.obtainPathResult(data);

//            try {
//                ExifInterface mExifInterface = new ExifInterface(mStrings.get(0));
//                Log.e(TAG, "onActivityResult: " + mExifInterface.getAttribute(ExifInterface.TAG_GPS_ALTITUDE));
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
            mMyAdapter.setData(mStrings);

            Tools.getPhotoInfo(mStrings.get(0));


//            Uri destinationUri = Uri.fromFile(new File(getCacheDir(), "test.jpg"));
//            UCrop.of(mUris.get(0), destinationUri)
//                    .withAspectRatio(16, 9)
//                    .withMaxResultSize(maxWidth, maxHeight)
//                    .start(this);
        }

        if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
            final Uri resultUri = UCrop.getOutput(data);
            Intent mIntent = new Intent(MatisseDemoActivity.this, PhotoProcessActivity.class);
            mIntent.putExtra("url", resultUri);
            startActivity(mIntent);
        } else if (resultCode == UCrop.RESULT_ERROR) {
            final Throwable cropError = UCrop.getError(data);
        }
    }
 
开发者ID:REBOOTERS,项目名称:AndroidAnimationExercise,代码行数:36,代码来源:MatisseDemoActivity.java

示例12: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
        final Uri resultUri = UCrop.getOutput(data);
        data.putExtra(HGallery.EXTRA_PATH, resultUri.getPath());
        setResult(RESULT_OK, data);
    } else if (resultCode == UCrop.RESULT_ERROR) {
        final Throwable cropError = UCrop.getError(data);
        Toast.makeText(GridImageActivity.this, cropError.getMessage(), Toast.LENGTH_SHORT).show();
    }
    finish();
}
 
开发者ID:hanks-zyh,项目名称:note,代码行数:13,代码来源:GridImageActivity.java

示例13: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
        chosenImageUri = UCrop.getOutput(data);
        simpleDraweeView.setImageURI(chosenImageUri);
        chosenImageUuid = new File(chosenImageUri.toString()).getName();
    } else if (resultCode == UCrop.RESULT_ERROR) {
        final Throwable cropError = UCrop.getError(data);
        Log.e("ImagePickerActivity", cropError.getMessage());
        Toast.makeText(getApplicationContext(), "Error cropping image", Toast.LENGTH_SHORT).show();
    }
    else if (requestCode == 200 && resultCode == Activity.RESULT_OK) {
        Uri imageUri = ImagePickerHelper.getPickImageResultUri(data, getApplicationContext());

        // For API >= 23 we need to check specifically that we have permissions to read external storage,
        // but we don't know if we need to for the URI so the simplest is to try open the stream and see if we get error.
        boolean requirePermissions = false;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
                checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED &&
                ImagePickerHelper.isUriRequiresPermissions(imageUri, getApplicationContext())) {

            // request permissions and handle the result in onRequestPermissionsResult()
            requirePermissions = true;
            mCropImageUri = imageUri;
            requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
        }

        if (!requirePermissions) {
            startUCrop(imageUri);
        }
    }
}
 
开发者ID:joeydeluca,项目名称:apparel,代码行数:33,代码来源:ImagePickerActivity.java

示例14: handleCropResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void handleCropResult(@NonNull Intent result) {
    headUri = UCrop.getOutput(result);
    if (headUri != null) {
        user_icon.setImageURI(headUri);
        isUpdateSuccess = 2;
        setButtonState(true);
    }
}
 
开发者ID:tengbinlive,项目名称:aibao_demo,代码行数:9,代码来源:UserFragment.java

示例15: onActivityResult

import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
        case CAMERA:
            if (resultCode == RESULT_OK) {
                    openCrop(imageUri, imageCroppedUri);
            } else {
                Toast.makeText(this, "未拍摄图片", Toast.LENGTH_SHORT).show();
            }
            break;
        case GALLARY:
            if (resultCode == RESULT_OK) {
                String filePath = null;
                if (Build.VERSION.SDK_INT >= 19) {
                    filePath = handleImageOnKitKat(data);
                } else {
                    filePath = handleImageBeforeKitKat(data);
                }
                //获取打开文件的URI
                if (Build.VERSION.SDK_INT >= 24) {
                    imageUri = FileProvider.getUriForFile(ModifyInfoActivity.this,
                            "com.jshaz.daigo.fileprovider", new File(filePath));
                    imageCroppedUri = FileProvider.getUriForFile(ModifyInfoActivity.this,
                            "com.jshaz.daigo.fileprovider", croppedImage);
                } else {
                    imageUri = Uri.fromFile(new File(filePath));
                    imageCroppedUri = Uri.fromFile(croppedImage);
                }
                openCrop(imageUri, imageCroppedUri);
            } else {
                Toast.makeText(this, "未选择图片", Toast.LENGTH_SHORT).show();
            }
            break;
        case UCrop.REQUEST_CROP:
            if (data != null) {
                final Uri resultUri = UCrop.getOutput(data);
                finalHeadBitmap = Utility.compressBitmap(
                        BitmapFactory.decodeFile(croppedImage.getAbsolutePath()));
                CBModifyHead.setImageBitmap(finalHeadBitmap);
            } else {
                Toast.makeText(this, "裁剪图片失败", Toast.LENGTH_SHORT).show();
            }

            break;
        case UCrop.RESULT_ERROR:
            Toast.makeText(this, "裁剪图片失败", Toast.LENGTH_SHORT).show();
            break;
        case RESET_PASSWORD:
            if (resultCode == RESULT_OK) {
                user.setPassword((String) data.getStringExtra("data"));
                user.writeToLocalDatabase();
            }
            break;
        case RESET_PHONE:
            if (resultCode == RESULT_OK) {
                user.setPhoneNum((String) data.getStringExtra("data"));
                user.writeToLocalDatabase();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        fillUserInfo();
                    }
                });
            }
            break;
        case VERIFICATION:

            break;
        default:
            break;
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
开发者ID:838030195,项目名称:DaiGo,代码行数:74,代码来源:ModifyInfoActivity.java


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