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 NewPipe by TeamNewPipe.
the class VideoItemDetailFragment method initThumbnailViews.
private void initThumbnailViews(final StreamInfo info) {
ImageView videoThumbnailView = (ImageView) activity.findViewById(R.id.detail_thumbnail_view);
ImageView uploaderThumb = (ImageView) activity.findViewById(R.id.detail_uploader_thumbnail_view);
if (info.thumbnail_url != null && !info.thumbnail_url.isEmpty()) {
imageLoader.displayImage(info.thumbnail_url, videoThumbnailView, displayImageOptions, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
ErrorActivity.reportError(getActivity(), failReason.getCause(), null, rootView, ErrorActivity.ErrorInfo.make(ErrorActivity.LOAD_IMAGE, NewPipe.getNameOfService(info.service_id), imageUri, R.string.could_not_load_thumbnails));
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
streamThumbnail = loadedImage;
if (streamThumbnail != null) {
// TODO: Change the thumbnail implementation
// When the thumbnail is not loaded yet, it not passes to the service in time
// so, I can notify the service through a broadcast, but the problem is
// when I click in another video, another thumbnail will be load, and will
// notify again, so I send the videoUrl and compare with the service's url
ActivityCommunicator.getCommunicator().backgroundPlayerThumbnail = streamThumbnail;
Intent intent = new Intent(PopupVideoPlayer.InternalListener.ACTION_UPDATE_THUMB);
intent.putExtra(PopupVideoPlayer.VIDEO_URL, info.webpage_url);
getContext().sendBroadcast(intent);
}
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
}
});
} else {
videoThumbnailView.setImageResource(R.drawable.dummy_thumbnail_dark);
}
if (info.uploader_thumbnail_url != null && !info.uploader_thumbnail_url.isEmpty()) {
imageLoader.displayImage(info.uploader_thumbnail_url, uploaderThumb, displayImageOptions, new ImageErrorLoadingListener(activity, rootView, info.service_id));
}
}
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 howabout-android by recomio.
the class ShowImageListAdapter method getView.
@Override
public View getView(int position, View convertView, final ViewGroup parent) {
final View showImageListItemView;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
showImageListItemView = inflater.inflate(R.layout.show_image_item, parent, false);
} else {
showImageListItemView = convertView;
}
final ImageView imageView = (ImageView) showImageListItemView.findViewById(R.id.image);
final ProgressBar progressBar = (ProgressBar) showImageListItemView.findViewById(R.id.load);
String imageUrl = imageList.get(position).getBasicUrl();
imageLoader.displayImage(imageUrl, imageView, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
progressBar.setVisibility(View.VISIBLE);
imageView.setVisibility(View.GONE);
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
// 스크린 width에 꽉 차게 view 리사이징.
float ratio = (float) parent.getWidth() / (float) loadedImage.getWidth();
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(parent.getWidth(), (int) ((float) loadedImage.getHeight() * ratio));
imageView.setLayoutParams(lp);
// margin.
lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lp.setMargins(1, 1, 1, 1);
imageView.setLayoutParams(lp);
imageView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
progressBar.setVisibility(View.GONE);
}
});
return showImageListItemView;
}
use of com.nostra13.universalimageloader.core.assist.ImageLoadingListener in project howabout-android by recomio.
the class MusicPlaylistActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
imageLoader = ImageLoader.getInstance();
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
setAdsContainer(R.id.adView);
HowaboutApplication application = (HowaboutApplication) getApplication();
playlistAdapter = application.getPlaylistAdapter();
if (MusicPlayerService.isLoading()) {
loadingProgressBar.setVisibility(View.VISIBLE);
playPauseToggleButton.setVisibility(View.GONE);
} else {
if (MusicPlayerService.isPlaying()) {
playPauseToggleButton.setImageDrawable(pauseIcon);
} else {
playPauseToggleButton.setImageDrawable(playIcon);
}
loadingProgressBar.setVisibility(View.GONE);
playPauseToggleButton.setVisibility(View.VISIBLE);
}
listView.setAdapter(playlistAdapter);
playlistAdapter.registerDataSetObserver(new DataSetObserver() {
@Override
public void onChanged() {
try {
Track track = playlistAdapter.getCurrentItem();
actionBar.setTitle(track.getTrackTitle());
actionBar.setSubtitle(track.getArtistName());
if (MusicPlayerService.isLoading()) {
loadingProgressBar.setVisibility(View.VISIBLE);
playPauseToggleButton.setVisibility(View.GONE);
} else {
if (MusicPlayerService.isPlaying()) {
playPauseToggleButton.setImageDrawable(pauseIcon);
} else {
playPauseToggleButton.setImageDrawable(playIcon);
}
loadingProgressBar.setVisibility(View.GONE);
playPauseToggleButton.setVisibility(View.VISIBLE);
}
imageLoader.displayImage(track.getThumbnailUrl(), songImageView, 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) {
}
});
String lyrics = playlistAdapter.getCurrentLyrics();
if (lyrics == null) {
lyricsScrollView.setVisibility(View.GONE);
lyricsTextView.setText("");
} else {
lyricsScrollView.setVisibility(View.VISIBLE);
lyricsTextView.setText(lyrics);
}
listView.invalidate();
} catch (Exception e) {
}
}
@Override
public void onInvalidated() {
}
});
playlistAdapter.notifyDataSetChanged();
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
playlistAdapter.play(position);
playlistAdapter.notifyDataSetChanged();
}
});
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
playlistAdapter.remove(position);
return true;
}
});
playPauseToggleButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
playlistAdapter.playPauseToggle();
if (MusicPlayerService.isPlaying()) {
playPauseToggleButton.setImageDrawable(pauseIcon);
} else {
playPauseToggleButton.setImageDrawable(playIcon);
}
}
});
prevButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
playlistAdapter.playPrev();
}
});
nextButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
playlistAdapter.playNext();
}
});
UpdateCurrentPositionTask updateCurrentPositionTask = new UpdateCurrentPositionTask();
updateCurrentPositionTimer.scheduleAtFixedRate(updateCurrentPositionTask, 0, 1000);
}
Aggregations