use of com.nostra13.universalimageloader.core.assist.ImageLoadingListener in project Timber by naman14.
the class QuickControlsFragment method updateNowplayingCard.
public void updateNowplayingCard() {
mTitle.setText(MusicPlayer.getTrackName());
mArtist.setText(MusicPlayer.getArtistName());
mTitleExpanded.setText(MusicPlayer.getTrackName());
mArtistExpanded.setText(MusicPlayer.getArtistName());
if (!duetoplaypause) {
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(MusicPlayer.getCurrentAlbumId()).toString(), mAlbumArt, new DisplayImageOptions.Builder().cacheInMemory(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).build(), new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
Bitmap failedBitmap = ImageLoader.getInstance().loadImageSync("drawable://" + R.drawable.ic_empty_music2);
if (getActivity() != null)
new setBlurredAlbumArt().execute(failedBitmap);
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (getActivity() != null)
new setBlurredAlbumArt().execute(loadedImage);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
}
});
}
duetoplaypause = false;
mProgress.setMax((int) MusicPlayer.duration());
mSeekBar.setMax((int) MusicPlayer.duration());
mProgress.postDelayed(mUpdateProgress, 10);
}
use of com.nostra13.universalimageloader.core.assist.ImageLoadingListener in project SimplifyReader by chentao0707.
the class CaptureActivity method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != RESULT_OK) {
return;
}
if (requestCode == IMAGE_PICKER_REQUEST_CODE) {
String imagePath = data.getStringExtra(CommonImagePickerDetailActivity.KEY_BUNDLE_RESULT_IMAGE_PATH);
if (!CommonUtils.isEmpty(imagePath)) {
ImageLoader.getInstance().loadImage("file://" + imagePath, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
String resultZxing = new DecodeUtils(DecodeUtils.DECODE_DATA_MODE_ALL).decodeWithZxing(loadedImage);
String resultZbar = new DecodeUtils(DecodeUtils.DECODE_DATA_MODE_ALL).decodeWithZbar(loadedImage);
if (!CommonUtils.isEmpty(resultZbar)) {
Bundle extras = new Bundle();
extras.putInt(DecodeThread.DECODE_MODE, DecodeUtils.DECODE_MODE_ZBAR);
handleDecode(resultZbar, extras);
} else if (!CommonUtils.isEmpty(resultZxing)) {
Bundle extras = new Bundle();
extras.putInt(DecodeThread.DECODE_MODE, DecodeUtils.DECODE_MODE_ZXING);
handleDecode(resultZxing, extras);
} else {
showToast(getResources().getString(R.string.tips_decode_null));
}
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
}
});
}
}
}
use of com.nostra13.universalimageloader.core.assist.ImageLoadingListener in project Wallpaper-Manager by Bencodes.
the class WallpaperFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
this.mNode = (NodeWallpaper) super.getArguments().getSerializable(BUNDLE_TAG);
final ActionBar ab = ((SherlockFragmentActivity) super.getActivity()).getSupportActionBar();
if (ab != null) {
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowHomeEnabled(false);
ab.setDisplayShowTitleEnabled(true);
final String title = super.getResources().getString(R.string.config_full_screen_wallpaper_title);
if (title == null || title.length() <= 0) {
ab.setTitle(mNode.name);
} else {
ab.setTitle(title);
}
}
this.mPending = (ProgressBar) super.getView().findViewById(R.id.pending);
this.mImageView = (PhotoView) mView.findViewById(R.id.wp_image);
ImageLoader.getInstance().displayImage(mNode.url, mImageView, new ImageLoadingListener() {
@Override
public void onLoadingStarted() {
mImageDrawableSet = false;
mImageView.setVisibility(View.GONE);
mPending.setVisibility(View.VISIBLE);
}
@Override
public void onLoadingFailed(FailReason failReason) {
mImageDrawableSet = false;
Toast.makeText(getActivity(), "Image Failed To Load!", Toast.LENGTH_SHORT).show();
}
@Override
public void onLoadingComplete(Bitmap bitmap) {
mImageDrawableSet = true;
mImageView.setVisibility(View.VISIBLE);
mImageView.setImageBitmap(bitmap);
mImageView.setZoomable(true);
mPending.setVisibility(View.GONE);
if (mApplyImageOnDisplay)
applyImage();
if (mSaveImageOnDisplay)
exportImage();
}
@Override
public void onLoadingCancelled() {
}
});
}
use of com.nostra13.universalimageloader.core.assist.ImageLoadingListener in project SimplifyReader by chentao0707.
the class MusicsFragment method refreshPageInfo.
@Override
public void refreshPageInfo(MusicsListEntity entity, int totalDuration) {
toggleShowLoading(false, null);
mPlayerDiscView.startPlay();
mPlayerCtrlBtn.setImageResource(R.drawable.btn_pause_selector);
if (null != entity) {
mTitle.setText(entity.getTitle());
StringBuilder sb = new StringBuilder();
sb.append("--\t");
sb.append(entity.getArtist());
sb.append("\t--");
mSonger.setText(sb.toString().trim());
}
if (totalDuration > 0) {
mPlayerSeekBar.setMax(totalDuration);
}
String imageUrl = entity.getPicture();
if (!CommonUtils.isEmpty(imageUrl)) {
mPlayerDiscView.loadAlbumCover(imageUrl);
ImageLoader.getInstance().loadImage(imageUrl, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
Bitmap bitmap = ImageBlurManager.doBlurJniArray(loadedImage, BLUR_RADIUS, false);
mBackgroundImage.setImageBitmap(bitmap);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
}
});
} else {
Bitmap bitmap = ImageBlurManager.doBlurJniArray(BitmapFactory.decodeResource(getResources(), R.drawable.player_bg), BLUR_RADIUS, false);
mBackgroundImage.setImageBitmap(bitmap);
}
String totalTime = CommonUtils.convertTime(totalDuration);
if (null != totalTime && !TextUtils.isEmpty(totalTime)) {
mTotalTime.setText(totalTime);
}
}
use of com.nostra13.universalimageloader.core.assist.ImageLoadingListener in project Android-Universal-Image-Loader by nostra13.
the class ImageLoader method loadImage.
/**
* Adds load image task to execution pool. Image will be returned with
* {@link ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)} callback}.
* <br />
* <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call
*
* @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png")
* @param targetImageSize Minimal size for {@link Bitmap} which will be returned in
* {@linkplain ImageLoadingListener#onLoadingComplete(String, android.view.View,
* android.graphics.Bitmap)} callback}. Downloaded image will be decoded
* and scaled to {@link Bitmap} of the size which is <b>equal or larger</b> (usually a bit
* larger) than incoming targetImageSize.
* @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image
* decoding and displaying. If <b>null</b> - default display image options
* {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions)
* from configuration} will be used.<br />
* @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires
* events on UI thread if this method is called on UI thread.
* @param progressListener {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
* Listener} for image loading progress. Listener fires events on UI thread if this method
* is called on UI thread. Caching on disk should be enabled in
* {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions options} to make
* this listener work.
* @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
*/
public void loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) {
checkConfiguration();
if (targetImageSize == null) {
targetImageSize = configuration.getMaxImageSize();
}
if (options == null) {
options = configuration.defaultDisplayImageOptions;
}
NonViewAware imageAware = new NonViewAware(uri, targetImageSize, ViewScaleType.CROP);
displayImage(uri, imageAware, options, listener, progressListener);
}
Aggregations