use of com.nostra13.universalimageloader.core.listener.ImageLoadingListener in project howabout-android by recomio.
the class MusicPlaylistAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final View playlistItemView;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
playlistItemView = inflater.inflate(R.layout.music_playlist_item, parent, false);
} else {
playlistItemView = convertView;
}
final ImageView imageView = (ImageView) playlistItemView.findViewById(R.id.image);
final TextView trackTitle = (TextView) playlistItemView.findViewById(R.id.trackTitle);
final TextView artistName = (TextView) playlistItemView.findViewById(R.id.artistName);
final ImageView isCurrentItem = (ImageView) playlistItemView.findViewById(R.id.isCurrentItem);
if (position == currentPosition) {
isCurrentItem.setVisibility(View.VISIBLE);
} else {
isCurrentItem.setVisibility(View.GONE);
}
final Track track = trackList.get(position);
trackTitle.setText(track.getTrackTitle());
artistName.setText(track.getArtistName());
String thumbnailUrl = track.getThumbnailUrl();
imageLoader.displayImage(thumbnailUrl, imageView, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
// imageView.setVisibility(View.INVISIBLE);
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
imageView.setVisibility(View.VISIBLE);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
}
});
return playlistItemView;
}
use of com.nostra13.universalimageloader.core.listener.ImageLoadingListener in project howabout-android by recomio.
the class MusicBottomBarFragment method updateTrack.
protected void updateTrack() {
HowaboutApplication application = (HowaboutApplication) getActivity().getApplication();
Track track = application.getPlaylistAdapter().getCurrentItem();
if (track != null) {
trackTitle.setText(track.getTrackTitle());
artistName.setText(track.getArtistName());
imageLoader.displayImage(track.getThumbnailUrl(), imageView, 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) {
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
}
});
rootView.setVisibility(View.VISIBLE);
} else {
rootView.setVisibility(View.GONE);
}
if (MusicPlayerService.isLoading()) {
isLoading.setVisibility(View.VISIBLE);
isPlaying.setVisibility(View.GONE);
} else {
if (MusicPlayerService.isPlaying()) {
isPlaying.setImageDrawable(pauseIcon);
} else {
isPlaying.setImageDrawable(playIcon);
}
isLoading.setVisibility(View.GONE);
isPlaying.setVisibility(View.VISIBLE);
}
}
use of com.nostra13.universalimageloader.core.listener.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.listener.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.listener.ImageLoadingListener in project Slide by ccrama.
the class TumblrPager method loadImage.
private static void loadImage(final View rootView, Fragment f, String url) {
final SubsamplingScaleImageView image = rootView.findViewById(R.id.image);
image.setMinimumDpi(70);
image.setMinimumTileDpi(240);
ImageView fakeImage = new ImageView(f.getActivity());
final TextView size = rootView.findViewById(R.id.size);
fakeImage.setLayoutParams(new LinearLayout.LayoutParams(image.getWidth(), image.getHeight()));
fakeImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
((Reddit) f.getActivity().getApplication()).getImageLoader().displayImage(url, new ImageViewAware(fakeImage), new DisplayImageOptions.Builder().resetViewBeforeLoading(true).cacheOnDisk(true).imageScaleType(ImageScaleType.NONE).cacheInMemory(false).build(), new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
size.setVisibility(View.VISIBLE);
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
Log.v("Slide", "LOADING FAILED");
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
size.setVisibility(View.GONE);
image.setImage(ImageSource.bitmap(loadedImage));
(rootView.findViewById(R.id.progress)).setVisibility(View.GONE);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
Log.v("Slide", "LOADING CANCELLED");
}
}, new ImageLoadingProgressListener() {
@Override
public void onProgressUpdate(String imageUri, View view, int current, int total) {
size.setText(FileUtil.readableFileSize(total));
((ProgressBar) rootView.findViewById(R.id.progress)).setProgress(Math.round(100.0f * current / total));
}
});
}
Aggregations