本文整理汇总了Java中com.netease.nim.uikit.common.util.media.ImageUtil.getScaledImageFileWithMD5方法的典型用法代码示例。如果您正苦于以下问题:Java ImageUtil.getScaledImageFileWithMD5方法的具体用法?Java ImageUtil.getScaledImageFileWithMD5怎么用?Java ImageUtil.getScaledImageFileWithMD5使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.netease.nim.uikit.common.util.media.ImageUtil
的用法示例。
在下文中一共展示了ImageUtil.getScaledImageFileWithMD5方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleImagePath
import com.netease.nim.uikit.common.util.media.ImageUtil; //导入方法依赖的package包/类
/**
* 是否可以获取图片
*/
private boolean handleImagePath(Intent intent, Intent data) {
String photoPath = data.getStringExtra(Extras.EXTRA_FILE_PATH);
if (TextUtils.isEmpty(photoPath)) {
Toast.makeText(getActivity(), R.string.picker_image_error, Toast.LENGTH_LONG).show();
return false;
}
File imageFile = new File(photoPath);
intent.putExtra("OrigImageFilePath", photoPath);
File scaledImageFile = ImageUtil.getScaledImageFileWithMD5(imageFile, MIME_JPEG);
boolean local = data.getExtras().getBoolean(Extras.EXTRA_FROM_LOCAL, true);
if (!local) {
// 删除拍照生成的临时文件
AttachmentStore.delete(photoPath);
}
if (scaledImageFile == null) {
Toast.makeText(getActivity(), R.string.picker_image_error, Toast.LENGTH_LONG).show();
return false;
} else {
ImageUtil.makeThumbnail(getActivity(), scaledImageFile);
}
intent.putExtra("ImageFilePath", scaledImageFile.getAbsolutePath());
return true;
}
示例2: onGetLocalPictureResult
import com.netease.nim.uikit.common.util.media.ImageUtil; //导入方法依赖的package包/类
public void onGetLocalPictureResult(int requestCode, int resultCode, final Intent data) {
if (data == null) {
return;
}
final String photoPath = data.getStringExtra(Extras.EXTRA_FILE_PATH);
if (TextUtils.isEmpty(photoPath)) {
return;
}
imageFile = new File(photoPath);
String mimeType = FileUtil.getExtensionName(photoPath);
imageFile = ImageUtil.getScaledImageFileWithMD5(imageFile, mimeType);
if (imageFile == null) {
Toast.makeText(this, R.string.picker_image_error, Toast.LENGTH_LONG).show();
return;
} else {
ImageUtil.makeThumbnail(PreviewImageFromLocalActivity.this,
imageFile);
}
origImageList.add(photoPath);
selectImageList.add(imageFile.getAbsolutePath());
imageViewPagerAdapter.notifyDataSetChanged();
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
imageViewPager.setCurrentItem(selectImageList.size() - 1);
}
}, 100);
//有可用的图片
if(selectImageList.size() >= 1){
sendButton.setEnabled(true);
}
}
示例3: onGetLocalPictureResult
import com.netease.nim.uikit.common.util.media.ImageUtil; //导入方法依赖的package包/类
public void onGetLocalPictureResult(int requestCode, int resultCode, final Intent data) {
if (data == null) {
return;
}
final String photoPath = data.getStringExtra(Extras.EXTRA_FILE_PATH);
if (TextUtils.isEmpty(photoPath)) {
return;
}
imageFile = new File(photoPath);
String mimeType = FileUtil.getExtensionName(photoPath);
imageFile = ImageUtil.getScaledImageFileWithMD5(imageFile, mimeType);
if (imageFile == null) {
Toast.makeText(this, R.string.picker_image_error, Toast.LENGTH_LONG).show();
return;
} else {
ImageUtil.makeThumbnail(PreviewImageFromLocalActivity.this,
imageFile);
}
origImageList.add(photoPath);
selectImageList.add(imageFile.getAbsolutePath());
imageViewPagerAdapter.notifyDataSetChanged();
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
imageViewPager.setCurrentItem(selectImageList.size() - 1);
}
}, 100);
//有可用的图片
if (selectImageList.size() >= 1) {
sendButton.setEnabled(true);
}
}