OnLoadImage Vollständiges Laden
private void onLoadImage(final String imagePath) {
ImageSize targetSize = new ImageSize(imageView.getWidth(), imageView.getHeight()); // result Bitmap will be fit to this size
//ImageLoader imageLoader = ImageLoader.getInstance(); // Get singleto
com.nostra13.universalimageloader.core.ImageLoader imageLoader = com.nostra13.universalimageloader.core.ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(getContext()));
imageLoader.loadImage(imagePath, targetSize, new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(final String imageUri, View view) {
super.onLoadingStarted(imageUri, view);
progress2.setVisibility(View.VISIBLE);
new Handler().post(new Runnable() {
public void run() {
progress2.setColorSchemeResources(android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
// Picasso.with(getContext()).load(imagePath).into(imageView);
// Picasso.with(getContext()).load(imagePath) .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE).into(imageView);
Glide.with(getContext())
.load(imagePath)
.asBitmap()
.into(imageView);
}
});
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (view == null) {
progress2.setVisibility(View.INVISIBLE);
}
// else {
Log.e("onLoadImage", "onLoadingComplete");
// progress2.setVisibility(View.INVISIBLE);
// }
// setLoagingCompileImage();
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
super.onLoadingFailed(imageUri, view, failReason);
if (view == null) {
progress2.setVisibility(View.INVISIBLE);
}
Log.e("onLoadingFailed", imageUri);
Log.e("onLoadingFailed", failReason.toString());
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
super.onLoadingCancelled(imageUri, view);
if (view == null) {
progress2.setVisibility(View.INVISIBLE);
}
Log.e("onLoadImage", "onLoadingCancelled");
}
});
}