本文整理汇总了Java中com.soundcloud.android.crop.Crop.REQUEST_CROP属性的典型用法代码示例。如果您正苦于以下问题:Java Crop.REQUEST_CROP属性的具体用法?Java Crop.REQUEST_CROP怎么用?Java Crop.REQUEST_CROP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.soundcloud.android.crop.Crop
的用法示例。
在下文中一共展示了Crop.REQUEST_CROP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Crop.REQUEST_PICK) {
photoImageView.setClickable(true);
if (resultCode == Activity.RESULT_OK) {
// 选择图片后
beginCrop(data.getData());
}
} else if (requestCode == Crop.REQUEST_CROP) {
// 图片编辑完后
handleCrop(resultCode, data);
}
}
示例2: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
/* Changed by Sharath Pandeshwar on 05/03/2014 */
//Changed to CreateEditWallPostFragment
if (requestCode == Crop.REQUEST_PICK) {
((CreateEditWallPostFragment) getSupportFragmentManager().findFragmentByTag(AppConstants.FragmentTags.POST_ON_WALL)).onActivityResult(requestCode, resultCode, data);
Logger.d(TAG, "REQUEST PICK");
} else if (requestCode == Crop.REQUEST_CROP) {
((CreateEditWallPostFragment) getSupportFragmentManager().findFragmentByTag(AppConstants.FragmentTags.POST_ON_WALL)).onActivityResult(requestCode, resultCode, data);
Logger.d(TAG, "REQUEST CROP");
}
/* End of modification by Sharath Pandeshwar on 05/03/2014 */
}
示例3: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_GALLERY && resultCode == Activity.RESULT_OK) {
tempAvatarPath = Files.getInternalTempFile("avatar", "jpg");
Crop.of(data.getData(), Uri.fromFile(new File(tempAvatarPath)))
.asSquare()
.start(this);
return;
} else if (requestCode == REQUEST_PHOTO && resultCode == Activity.RESULT_OK) {
tempAvatarPath = Files.getInternalTempFile("avatar", "jpg");
Crop.of(Uri.fromFile(new File(externalFile)), Uri.fromFile(new File(tempAvatarPath)))
.asSquare()
.start(this);
return;
} else if (requestCode == Crop.REQUEST_CROP && resultCode == Activity.RESULT_OK) {
setResult(RESULT_OK, new Intent()
.putExtra(Intents.EXTRA_RESULT, Intents.RESULT_IMAGE)
.putExtra(Intents.EXTRA_IMAGE, tempAvatarPath));
finish();
return;
}
setResult(RESULT_CANCELED);
finish();
}
示例4: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_GALLERY && resultCode == Activity.RESULT_OK) {
avatarPath = Files.getInternalTempFile("avatar", "jpg");
Crop.of(data.getData(), Uri.fromFile(new File(avatarPath)))
.asSquare()
.start(this);
} else if (requestCode == REQUEST_PHOTO && resultCode == Activity.RESULT_OK) {
avatarPath = Files.getInternalTempFile("avatar", "jpg");
Crop.of(Uri.fromFile(new File(externalFile)), Uri.fromFile(new File(avatarPath)))
.asSquare()
.start(this);
} else if (requestCode == Crop.REQUEST_CROP && resultCode == Activity.RESULT_OK) {
if (avatarPath == null) {
return;
}
if (peer.getPeerType() == PeerType.PRIVATE) {
if (peer.getPeerId() == myUid()) {
messenger().changeMyAvatar(avatarPath);
}
} else if (peer.getPeerType() == PeerType.GROUP) {
messenger().changeGroupAvatar(peer.getPeerId(), avatarPath);
}
}
}
示例5: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_GALLERY && resultCode == Activity.RESULT_OK) {
avatarPath = AppContext.getInternalTempFile("avatar", "jpg");
Crop.of(data.getData(), Uri.fromFile(new File(avatarPath)))
.asSquare()
.start(this);
} else if (requestCode == REQUEST_PHOTO && resultCode == Activity.RESULT_OK) {
avatarPath = AppContext.getInternalTempFile("avatar", "jpg");
Crop.of(Uri.fromFile(new File(externalFile)), Uri.fromFile(new File(avatarPath)))
.asSquare()
.start(this);
} else if (requestCode == Crop.REQUEST_CROP && resultCode == Activity.RESULT_OK) {
if (peer.getPeerType() == PeerType.PRIVATE) {
if (peer.getPeerId() == myUid()) {
messenger().changeMyAvatar(avatarPath);
}
} else if (peer.getPeerType() == PeerType.GROUP) {
messenger().changeGroupAvatar(peer.getPeerId(), avatarPath);
}
}
}
示例6: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_GALLERY && resultCode == Activity.RESULT_OK) {
tempAvatarPath = AppContext.getInternalTempFile("avatar", "jpg");
Crop.of(data.getData(), Uri.fromFile(new File(tempAvatarPath)))
.asSquare()
.start(this);
return;
} else if (requestCode == REQUEST_PHOTO && resultCode == Activity.RESULT_OK) {
tempAvatarPath = AppContext.getInternalTempFile("avatar", "jpg");
Crop.of(Uri.fromFile(new File(externalFile)), Uri.fromFile(new File(tempAvatarPath)))
.asSquare()
.start(this);
return;
} else if (requestCode == Crop.REQUEST_CROP && resultCode == Activity.RESULT_OK) {
setResult(RESULT_OK, new Intent()
.putExtra(Intents.EXTRA_RESULT, Intents.RESULT_IMAGE)
.putExtra(Intents.EXTRA_IMAGE, tempAvatarPath));
finish();
return;
}
setResult(RESULT_CANCELED);
finish();
}
示例7: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Crop.REQUEST_CROP && resultCode == Activity.RESULT_OK) {
Rect rect = Crop.getRect(data);
Boundary b = new Boundary(rect.left, rect.top, rect.width(), rect.height());
requestBounds(b);
}
else if (resultCode == Crop.RESULT_REFRESH)
{
takePhoto();
}
else {
mListener.onSetupServerAborted();
}
}
示例8: onActivityResult
@Override
public void onActivityResult(int reqCode, int resultCode, final Intent data) {
super.onActivityResult(reqCode, resultCode, data);
Uri outputFile = Uri.fromFile(new File(getCacheDir(), "cropped"));
if (data == null || resultCode != Activity.RESULT_OK)
return;
switch (reqCode) {
case PICK_CONTACT:
List<String> selected = data.getStringArrayListExtra("contacts");
for (String contact : selected) {
final Recipient recipient = RecipientFactory.getRecipientsFromString(this, contact, false).getPrimaryRecipient();
if (recipient != null) addSelectedContacts(recipient);
}
break;
case Crop.REQUEST_PICK:
new Crop(data.getData()).output(outputFile).asSquare().start(this);
break;
case Crop.REQUEST_CROP:
Glide.with(this).load(Crop.getOutput(data)).asBitmap()
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.centerCrop().override(AVATAR_SIZE, AVATAR_SIZE)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
setAvatar(Crop.getOutput(data), resource);
}
});
}
}
示例9: processPickedPhoto
private void processPickedPhoto(int resultCode, Intent data){
switch (resultCode)
{
case Activity.RESULT_OK:
Uri uri = data.getData();
mFileName = DaoCore.generateEntity();
// If enabled we will save the image to the app
// directory in gallery else we will save it in the cache dir.
File dir;
if (BDefines.Options.SaveImagesToDir)
dir = Utils.ImageSaver.getAlbumStorageDir(activity.get(), Utils.ImageSaver.IMAGE_DIR_NAME);
else
dir = this.activity.get().getCacheDir();
if (dir == null)
{
uiHelper.dismissProgressCard();
uiHelper.showAlertToast(R.string.unable_to_fetch_image);
return;
}
Uri outputUri = Uri.fromFile(new File(dir, mFileName + ".jpeg"));
crop = new Cropper(uri);
Intent cropIntent = crop.getAdjustIntent(this.activity.get(), outputUri);
int request = Crop.REQUEST_CROP + PHOTO_PICKER_ID;
activity.get().startActivityForResult(cropIntent, request);
return;
case Activity.RESULT_CANCELED:
uiHelper.dismissProgressCard();
}
}
示例10: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
/* super.onActivityResult(requestCode, resultCode, data);
if (requestCode == GET_FROM_GALLERY && resultCode == Activity.RESULT_OK) {
selectedImage = data.getData();
String[] filePathColumn ={MediaStore.Images.Media.DATA};
Cursor cursor=getContentResolver().query(selectedImage,filePathColumn,null,null,null);
cursor.moveToFirst();
int columnIndex =cursor.getColumnIndex(filePathColumn[0]);
String picturePath =cursor.getString(columnIndex);
cursor.close();
user_img.setImageBitmap(BitmapFactory.decodeFile(picturePath));
}*/
if (requestCode == Crop.REQUEST_PICK && resultCode == RESULT_OK) {
beginCrop(data.getData());
} else if (requestCode == Crop.REQUEST_CROP) {
handleCrop(resultCode, data);
}
}
示例11: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent result) {
super.onActivityResult(requestCode, resultCode, result);
if (resultCode != Activity.RESULT_OK)
return;
if (requestCode == CAMERA_REQUEST_CODE) {
beginCrop(Uri.fromFile(new File(IMAGNAME)));
} else if (requestCode == Crop.REQUEST_PICK) {
beginCrop(result.getData());
} else if (requestCode == Crop.REQUEST_CROP) {
handleCrop(result);
}
}
示例12: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Crop.REQUEST_PICK) {
photoImageView.setClickable(true);
if (resultCode == Activity.RESULT_OK){
// 选择图片后
beginCrop(data.getData());
}
} else if (requestCode == Crop.REQUEST_CROP) {
// 图片编辑完后
handleCrop(resultCode, data);
}
}
示例13: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
switch (requestCode) {
case REQUEST_CHOOSE_FILE:
Uri source = data.getData();
String original = FileUtils.getPath(this, source);
if (original != null) {
source = Uri.parse("file://"+original);
}
Uri destination = Uri.fromFile(new File(getCacheDir(), "croppedAvatar"));
final int size = getPixel(192);
Crop.of(source, destination).asSquare().withMaxSize(size, size).start(this);
break;
case Crop.REQUEST_CROP:
this.avatarUri = Uri.fromFile(new File(getCacheDir(), "croppedAvatar"));
loadImageIntoPreview(this.avatarUri);
break;
}
}
}
示例14: onActivityResult
@Override
protected void onActivityResult(final int requestCode, final int resultCode,
final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if ((requestCode == GooglePlusManager.CONNECTION_UPDATE_ERROR)
&& (resultCode == RESULT_OK)) {
mGooglePlusManager.onActivityResult();
} else if (requestCode == Crop.REQUEST_CROP) {
((EditProfileFragment) getSupportFragmentManager().findFragmentByTag(AppConstants.FragmentTags.EDIT_PROFILE)).onActivityResult
(requestCode, resultCode,
data);
Logger.d(TAG, "REQUEST CROP");
}
else if (requestCode == Crop.REQUEST_PICK) {
((EditProfileFragment) getSupportFragmentManager().findFragmentByTag(AppConstants.FragmentTags.EDIT_PROFILE)).onActivityResult
(requestCode, resultCode,
data);
Logger.d(TAG, "REQUEST PICK");
}
}
示例15: handleResult
public void handleResult(int requestCode, int resultCode, Intent data) {
if (DEBUG) Timber.v("onActivityResult");
if (!hasActivity()) return;
/* Pick photo logic*/
if (requestCode == PHOTO_PICKER_ID)
{
processPickedPhoto(resultCode, data);
}
else if (requestCode == Crop.REQUEST_CROP + PHOTO_PICKER_ID) {
processCroppedPhoto(resultCode, data);
}
/* Pick location logic*/
else if (requestCode == PICK_LOCATION)
{
processPickedLocation(resultCode, data);
}
/* Capture image logic*/
else if (requestCode == CAPTURE_IMAGE)
{
if (resultCode == Activity.RESULT_OK) {
sendImageMessage(selectedFilePath);
}
}
}