本文整理汇总了Java中com.soundcloud.android.crop.Crop.REQUEST_PICK属性的典型用法代码示例。如果您正苦于以下问题:Java Crop.REQUEST_PICK属性的具体用法?Java Crop.REQUEST_PICK怎么用?Java Crop.REQUEST_PICK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.soundcloud.android.crop.Crop
的用法示例。
在下文中一共展示了Crop.REQUEST_PICK属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
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);
}
});
}
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: 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");
}
}
示例8: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent result) {
if (requestCode == Crop.REQUEST_PICK && resultCode == RESULT_OK) {
beginCrop(result.getData());
} else if (requestCode == Crop.REQUEST_CROP) {
handleCrop(resultCode, result);
}
}
示例9: onActivityResult
@Override
public void onActivityResult(int reqCode, int resultCode, 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) {
Recipient recipient = RecipientFactory.getRecipientsFromString(this, contact, false).getPrimaryRecipient();
if (!selectedContacts.contains(recipient) &&
(existingContacts == null || !existingContacts.contains(recipient)) &&
recipient != null) {
addSelectedContact(recipient);
}
}
syncAdapterWithSelectedContacts();
break;
case Crop.REQUEST_PICK:
new Crop(data.getData()).output(outputFile).asSquare().start(this);
break;
case Crop.REQUEST_CROP:
new DecodeCropAndSetAsyncTask(Crop.getOutput(data)).execute();
}
}
示例10: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent result) {
if (requestCode == Crop.REQUEST_PICK) {
if(resultCode == RESULT_OK) {
beginCrop(result.getData());
} else {
finish();
}
} else if (requestCode == Crop.REQUEST_CROP) {
handleCrop(resultCode, result);
}
}
示例11: onActivityResult
@Override protected void onActivityResult(int requestCode, int resultCode, Intent result) {
if (requestCode == Crop.REQUEST_PICK && resultCode == RESULT_OK) {
beginCrop(result.getData());
} else if (requestCode == Crop.REQUEST_CROP) {
handleCrop(resultCode, result);
}
}
示例12: onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case Crop.REQUEST_PICK: {
if (resultCode == RESULT_OK) {
profileImage.setClickable(false);
profileImage.setVisibility(View.GONE);
profileImageProgress.setVisibility(View.VISIBLE);
Uri outputUri = Uri.fromFile(new File(getCacheDir(), "cropped"));
//new Crop(data.getData()).output(outputUri).asSquare().start(this);
Crop.of(data.getData(), outputUri).asSquare().start(this);
Log.d(TAG, "REQUEST_PICK returned");
profileImage.setImageURI(null);//necessary
profileImage.setImageURI(Crop.getOutput(data));
profileImage.setClickable(true);
profileImage.setVisibility(View.VISIBLE);
profileImageProgress.setVisibility(View.GONE);
}
break;
}
case Crop.REQUEST_CROP: {
if (resultCode == RESULT_OK) {
Log.d(TAG, "REQUEST_CROP returned");
profileImage.setImageURI(null);//necessary
profileImage.setImageURI(Crop.getOutput(data));
Uri filePath = Crop.getOutput(data);
try {
//Getting the Bitmap from Gallery
profileBitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
//setProfilePhoto();
uploadProfilePhoto();
//Setting the Bitmap to ImageView
//imageView.setImageBitmap(bitmap);
} catch (IOException e) {
e.printStackTrace();
}
} else if (resultCode == Crop.RESULT_ERROR) {
Toast.makeText(this, Crop.getError(data).getMessage(), Toast.LENGTH_SHORT).show();
}
break;
}
}
}
示例13: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(data != null){
switch (requestCode){
case REQUEST_SETTING:
if(data.getBooleanExtra("needRecreate",false)) { //设置后需要重启activity
mRefreshHandler.sendEmptyMessage(Constants.RECREATE_ACTIVITY);
} else if(data.getBooleanExtra("needRefreshAdapter",false)){ //清除缓存后刷新adapter
mRefreshHandler.sendEmptyMessage(Constants.UPDATE_ADAPTER);
} else if(data.getBooleanExtra("needRefreshLibrary",false)){ //刷新Library
List<Category> categories = (List<Category>) data.getSerializableExtra("Category");
if(categories != null && categories.size() > 0){
mViewPager.setOffscreenPageLimit(categories.size() - 1);
mPagerAdapter.setList(categories);
mPagerAdapter.notifyDataSetChanged();
}
}
break;
//图片选择
case Crop.REQUEST_CROP:
case Crop.REQUEST_PICK:
Intent intent = getIntent();
final CustomThumb thumbBean = intent.getParcelableExtra("thumb");
if(thumbBean == null)
break;
String errorTxt = getString(
thumbBean.getType() == Constants.ALBUM ? R.string.set_album_cover_error : thumbBean.getType() == Constants.ARTIST ? R.string.set_artist_cover_error : R.string.set_playlist_cover_error);
final int id = thumbBean.getId(); //专辑、艺术家、播放列表封面
if(resultCode != Activity.RESULT_OK) {
ToastUtil.show(this,errorTxt);
break;
}
if(requestCode == Crop.REQUEST_PICK){
//选择图片
File cacheDir = DiskCache.getDiskCacheDir(this,
"thumbnail/" + (thumbBean.getType() == Constants.ALBUM ? "album" : thumbBean.getType() == Constants.ARTIST ? "artist" : "playlist"));
if(!cacheDir.exists() && !cacheDir.mkdirs()){
ToastUtil.show(this,errorTxt);
return;
}
Uri destination = Uri.fromFile(new File(cacheDir, Util.hashKeyForDisk((id * 255 ) + "")));
Crop.of(data.getData(), destination).asSquare().start(this);
} else {
//图片裁剪
//裁剪后的图片路径
if(Crop.getOutput(data) == null)
return;
final String path = Crop.getOutput(data).getEncodedPath();
if(TextUtils.isEmpty(path) || id == -1){
ToastUtil.show(mContext,errorTxt);
return;
}
//清除fresco的缓存
new Thread(){
@Override
public void run() {
ImagePipeline imagePipeline = Fresco.getImagePipeline();
if(thumbBean.getType() != Constants.PLAYLIST){
if(new File(path).exists()){
Uri fileUri = Uri.parse("file://" + path);
imagePipeline.evictFromCache(fileUri);
} else {
Uri providerUri = ContentUris.withAppendedId(Uri.parse("content://media/external/audio/albumart"), id);
imagePipeline.evictFromCache(providerUri);
}
mRefreshHandler.sendEmptyMessage(Constants.UPDATE_ADAPTER);
}
}
}.start();
}
break;
}
}
}