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


Java CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE属性代码示例

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


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

示例1: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if(requestCode == GALLERY_REQUEST_CODE && resultCode == RESULT_OK){

        Uri imageUri = data.getData();
        CropImage.activity(imageUri)
                .setGuidelines(CropImageView.Guidelines.ON)
                .setAspectRatio(1,1)
                .start(this);
    }
    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {

            mImageUri = result.getUri();
            mProfilePicture.setImageURI(mImageUri);

        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Toast.makeText(CreateProfileActivity.this, "Failed to get profile picture, Try Again.", Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:24,代码来源:CreateProfileActivity.java

示例2: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if(requestCode == GALLERY_REQUEST_CODE && resultCode == RESULT_OK){
        Uri ImageUri = data.getData();
        CropImage.activity(ImageUri)
                .setGuidelines(CropImageView.Guidelines.ON)
                .setAspectRatio(1,1)
                .start(this);
    }
    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {
            imageUri = result.getUri();
            getProfilePicture.setImageURI(imageUri);

        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Toast.makeText(ViewEditProfileActivity.this, "Failed to get profile picture, please try again.", Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:22,代码来源:ViewEditProfileActivity.java

示例3: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {

        case CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE:
            CropImage.ActivityResult result = CropImage.getActivityResult(data);
            if (resultCode == RESULT_OK) {
                Uri resultUri = result.getUri();
                File file = FunctionHelper.createFileFromUri(this, resultUri);
                if (file == null) return;
                if (view_ShowMenu == img_avatar) {
                    changeImage(img_avatar, file.getAbsolutePath());
                } else if (view_ShowMenu == img_background) {
                    changeImage(img_background, file.getAbsolutePath());
                }
                view_ShowMenu = null;

            } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
                @SuppressWarnings("ThrowableNotThrown") Exception error = result.getError();
                Log.d(TAG, error.toString());
            }
            break;
    }
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:25,代码来源:DetailTeacherActivity.java

示例4: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
        case GALLERY_CODE:
            if (data != null) {
                Uri uri = data.getData();
                cropImage(uri);
            }
            break;
        case CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE:
            CropImage.ActivityResult result = CropImage.getActivityResult(data);
            if (resultCode == RESULT_OK) {
                Uri picUri = result.getUri();
                saveBImage(picUri);
                demoIv.setImageURI(picUri);
                //demoIv.setBackgroundColor(Color.TRANSPARENT);
            } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
                Exception error = result.getError();
            }
            break;
    }
}
 
开发者ID:shivam301296,项目名称:2048-TimeKiller,代码行数:23,代码来源:Setting.java

示例5: handleCropImageResult

protected void handleCropImageResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {
            if (ValidationUtil.checkImageMinSize(result.getCropRect())) {
                imageUri = result.getUri();
                loadImageToImageView();
            } else {
                showSnackBar(R.string.error_smaller_image);
            }
        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            LogUtil.logError(TAG, "crop image error", result.getError());
            showSnackBar(R.string.error_fail_crop_image);
        }
    }
}
 
开发者ID:rozdoum,项目名称:social-app-android,代码行数:16,代码来源:PickImageActivity.java

示例6: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

  // handle result of CropImageActivity
  if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
    CropImage.ActivityResult result = CropImage.getActivityResult(data);
    if (resultCode == RESULT_OK) {
      ((ImageView) findViewById(R.id.quick_start_cropped_image)).setImageURI(result.getUri());
      Toast.makeText(
              this, "Cropping successful, Sample: " + result.getSampleSize(), Toast.LENGTH_LONG)
          .show();
    } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
      Toast.makeText(this, "Cropping failed: " + result.getError(), Toast.LENGTH_LONG).show();
    }
  }
}
 
开发者ID:ArthurHub,项目名称:Android-Image-Cropper,代码行数:16,代码来源:MainActivity.java

示例7: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    // handle result of CropImageActivity
    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {
            ((ImageView) findViewById(R.id.quick_start_cropped_image)).setImageURI(result.getUri());
            Toast.makeText(this, "Cropping successful, Sample: " + result.getSampleSize(), Toast.LENGTH_LONG).show();
        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Toast.makeText(this, "Cropping failed: " + result.getError(), Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:chuch0805,项目名称:Android-Demo_ImageCroper,代码行数:14,代码来源:MainActivity.java

示例8: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // handle result of pick image chooser
    if (requestCode == CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE) {
        if (resultCode == Activity.RESULT_OK) {
            Uri imageUri = CropImage.getPickImageResultUri(this, data);

            if (CropImage.isReadExternalStoragePermissionsRequired(this, imageUri)) {
                cropImageUri = imageUri;
                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, CropImage.PICK_IMAGE_PERMISSIONS_REQUEST_CODE);
            } else {
                startCropImageActivity(imageUri);
            }
        } else {
            Snackbar.make(findViewById(android.R.id.content), getString(R.string.addVehicle_picture_add_fail, ""), Snackbar.LENGTH_SHORT).show();
        }
    } else if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {
            vehiclePicturePath = result.getUri().getPath();
            Picasso.with(getApplicationContext()).load(new File(vehiclePicturePath)).into(imgCarPhoto);
            imgCarPhoto.setAlpha(REMOVE_PHOTO_ALPHA_CHANNEL);
            imgCarPhotoRemove.setVisibility(View.VISIBLE);
            Snackbar.make(findViewById(android.R.id.content), getString(R.string.addVehicle_picture_add_success), Snackbar.LENGTH_SHORT).show();
        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Exception error = result.getError();
            Snackbar.make(findViewById(android.R.id.content), getString(R.string.addVehicle_picture_add_fail, error), Snackbar.LENGTH_SHORT).show();

        }
    }
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:31,代码来源:VehicleAbstractActivity.java

示例9: onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {
            Uri resultUri = result.getUri();
            Event_image.setImageURI(resultUri);
        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Exception error = result.getError();
            Log.d("someerror",error.toString());
        }
    }
}
 
开发者ID:picopalette,项目名称:event-me,代码行数:13,代码来源:EventCreationActivity.java

示例10: onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == Constants.RESULT_PROFILE_IMAGE_SELECTED) { // image selected. Crop the image
        if (resultCode == RESULT_OK && data != null && data.getData() != null) {
            startImageCrop(data.getData());
        } else if (resultCode != RESULT_CANCELED) {
            Toast.makeText(getActivity(), getString(R.string.image_selection_error), Toast.LENGTH_SHORT).show();
        }
    } else if (requestCode == Constants.RESULT_PROFILE_IMAGE_TAKEN) { // image taken. Crop the image
        if (resultCode == RESULT_OK) {
            Uri uri = FileProvider.getUriForFile(getActivity(), getString(R.string.file_provider),
                    mPresenter.getTempImageFileForOwner());
            getActivity().revokeUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

            startImageCrop(uri);
        } else if (resultCode != RESULT_CANCELED) {
            Toast.makeText(getActivity(), getString(R.string.image_taking_error), Toast.LENGTH_SHORT).show();
        }
    } else if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { // image cropped
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {
            Bitmap bitmap = ImageHelper.decodeSampledBitmapFromUri(getActivity().getContentResolver(),
                    result.getUri(), Constants.PROFILE_IMAGE_WIDTH, Constants.PROFILE_IMAGE_HEIGHT);
            mPresenter.newProfileImageSelected(bitmap);
        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Diagnostic.logError(Diagnostic.DiagnosticFlag.Other, "Image failed to be cropped");
            Toast.makeText(getActivity(), getString(R.string.image_selection_error), Toast.LENGTH_SHORT).show();
        }
    } else if (requestCode == Constants.RESULT_PROFILE_UPDATE && resultCode == Activity.RESULT_OK) { // bio updated
        if (getView() != null) {
            ((TextView) getView().findViewById(R.id.profile_bio)).setText(data.getStringExtra("bio"));
            Toast.makeText(getActivity(), getString(R.string.updated), Toast.LENGTH_SHORT).show();
        }
    }
}
 
开发者ID:Q115,项目名称:Goalie_Android,代码行数:37,代码来源:ProfileFragment.java

示例11: onResult

@Override
public void onResult(Activity activity, int requestCode, int resultCode, Intent data) {
   	if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
   		CropImage.ActivityResult result = CropImage.getActivityResult(data);
   		
   		if (resultCode == Activity.RESULT_OK) {
   			String imagePath = "file://" + result.getUri().getEncodedPath();
   			sendResult(true, "", imagePath);
               
   		} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
   			Exception error = result.getError();
   			sendResult(false, error.getMessage(), "");
     	    }
       }
}
 
开发者ID:prashantsaini1,项目名称:android-titanium-imagecropper,代码行数:15,代码来源:ImagecropModule.java

示例12: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
        case AVATAR_PICK_RESULT: {
            if (resultCode == RESULT_OK && data != null) {
                CropImage.activity(data.getData())
                        .setInitialCropWindowPaddingRatio(0)
                        .setAspectRatio(AVATAR_WIDTH, AVATAR_HEIGHT)
                        .start(this);
            } else {
                endMediaPicking();
            }
            break;
        }
        case HEADER_PICK_RESULT: {
            if (resultCode == RESULT_OK && data != null) {
                CropImage.activity(data.getData())
                        .setInitialCropWindowPaddingRatio(0)
                        .setAspectRatio(HEADER_WIDTH, HEADER_HEIGHT)
                        .start(this);
            } else {
                endMediaPicking();
            }
            break;
        }
        case CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE: {
            CropImage.ActivityResult result = CropImage.getActivityResult(data);
            if (resultCode == RESULT_OK) {
                beginResize(result.getUri());
            } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
                onResizeFailure();
            }
            break;
        }
    }
}
 
开发者ID:Vavassor,项目名称:Tusky,代码行数:37,代码来源:EditProfileActivity.java

示例13: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(intent);
        if (resultCode == RESULT_OK) {
            if (intent == null) {
                return;
            }
            if (imageChangeUri != null) {
                imageChangeUri = result.getUri();
                applozicGroupProfileIcon.setImageDrawable(null); // <--- added to force redraw of ImageView
                applozicGroupProfileIcon.setImageURI(imageChangeUri);
            } else {
                imageChangeUri = result.getUri();
                String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
                String imageFileName = "JPEG_" + timeStamp + "_" + ".jpeg";
                applozicGroupProfileIcon.setImageDrawable(null); // <--- added to force redraw of ImageView
                applozicGroupProfileIcon.setImageURI(imageChangeUri);
                profilePhotoFile = FileClientService.getFilePath(imageFileName, this, "image/jpeg");
                fileClientService.writeFile(imageChangeUri, profilePhotoFile);
            }
        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Utils.printLog(this,ChannelNameActivity.class.getName(),this.getString(R.string.applozic_Cropping_failed)+result.getError());
        }
    }
    if (resultCode == Activity.RESULT_OK) {
        handleOnActivityResult(requestCode, intent);
    }
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:30,代码来源:ChannelNameActivity.java

示例14: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    try {
        if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
            CropImage.ActivityResult result = CropImage.getActivityResult(intent);
            if (resultCode == RESULT_OK) {
                if (intent == null) {
                    return;
                }
                if (imageChangeUri != null) {
                    imageChangeUri = result.getUri();
                    circleImageView.setImageDrawable(null); // <--- added to force redraw of ImageView
                    circleImageView.setImageURI(imageChangeUri);
                    new ProfilePictureUpload(true, profilePhotoFile, imageChangeUri, ChannelCreateActivity.this).execute((Void[]) null);
                } else {
                    imageChangeUri = result.getUri();
                    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
                    String imageFileName = "JPEG_" + timeStamp + "_" + ".jpeg";
                    circleImageView.setImageDrawable(null); // <--- added to force redraw of ImageView
                    circleImageView.setImageURI(imageChangeUri);
                    profilePhotoFile = FileClientService.getFilePath(imageFileName, this, "image/jpeg");
                    new ProfilePictureUpload(true, profilePhotoFile, imageChangeUri, ChannelCreateActivity.this).execute((Void[]) null);
                }
            } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
                Toast.makeText(this, this.getString(R.string.applozic_Cropping_failed) + result.getError(), Toast.LENGTH_LONG).show();
            }
        }
        if (resultCode == Activity.RESULT_OK) {
            handleOnActivityResult(requestCode, intent);
        }
    } catch (Exception e) {
        Utils.printLog(this, TAG, "exception in profile image");
    }
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:35,代码来源:ChannelCreateActivity.java

示例15: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == GALLERY_REQUEST && resultCode == RESULT_OK) {
        Uri imageUri = data.getData();

        CropImage.activity(imageUri)
                .setGuidelines(CropImageView.Guidelines.ON)
                .setCropShape(CropImageView.CropShape.OVAL)
                .setAspectRatio(1, 1)
                .start(this);
    }

    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {

            mImageUri = result.getUri();
            editProfilepic.setImageURI(mImageUri);

        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Exception error = result.getError();
            Log.e(TAG + "crop_error", error.toString());
        }
    }

}
 
开发者ID:clementf2b,项目名称:FaceT,代码行数:28,代码来源:ProfileEditActivity.java


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