use of com.nostra13.universalimageloader.core.assist.FailReason 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.FailReason 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.FailReason in project Android-Universal-Image-Loader by nostra13.
the class LoadAndDisplayImageTask method fireFailEvent.
private void fireFailEvent(final FailType failType, final Throwable failCause) {
if (syncLoading || isTaskInterrupted() || isTaskNotActual())
return;
Runnable r = new Runnable() {
@Override
public void run() {
if (options.shouldShowImageOnFail()) {
imageAware.setImageDrawable(options.getImageOnFail(configuration.resources));
}
listener.onLoadingFailed(uri, imageAware.getWrappedView(), new FailReason(failType, failCause));
}
};
runTask(r, false, handler, engine);
}
use of com.nostra13.universalimageloader.core.assist.FailReason in project howabout-android by recomio.
the class TrackListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final View trackListItemView;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
trackListItemView = inflater.inflate(R.layout.track_list_item, parent, false);
} else {
trackListItemView = convertView;
}
final ProgressBar progressBar = (ProgressBar) trackListItemView.findViewById(R.id.load);
final ImageView imageView = (ImageView) trackListItemView.findViewById(R.id.image);
final TextView trackTitle = (TextView) trackListItemView.findViewById(R.id.trackTitle);
final TextView artistName = (TextView) trackListItemView.findViewById(R.id.artistName);
final Track track = trackList.get(position);
trackTitle.setText(track.getTrackTitle());
artistName.setText(track.getArtistName());
String imageUrl = track.getThumbnailUrl();
imageLoader.displayImage(imageUrl, imageView, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
progressBar.setVisibility(View.VISIBLE);
imageView.setVisibility(View.INVISIBLE);
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
imageView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
progressBar.setVisibility(View.GONE);
}
});
final Button listenTrackButton = (Button) trackListItemView.findViewById(R.id.listenTrackButton);
final Button addTrackButton = (Button) trackListItemView.findViewById(R.id.addTrackButton);
// when click a 'listen' button.
listenTrackButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HowaboutApplication application = (HowaboutApplication) activity.getApplication();
application.getPlaylistAdapter().play(track);
}
});
// when click an 'add' button.
addTrackButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HowaboutApplication application = (HowaboutApplication) activity.getApplication();
application.getPlaylistAdapter().add(track);
}
});
return trackListItemView;
}
use of com.nostra13.universalimageloader.core.assist.FailReason in project howabout-android by recomio.
the class ImageListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final View imageListItemView;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
imageListItemView = inflater.inflate(R.layout.photo_list_item, parent, false);
} else {
imageListItemView = convertView;
}
final ImageView imageView = (ImageView) imageListItemView.findViewById(R.id.image);
final ProgressBar progressBar = (ProgressBar) imageListItemView.findViewById(R.id.load);
String imageUrl = imageList.get(position).getThumbmailUrl();
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) {
imageView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
progressBar.setVisibility(View.GONE);
}
});
// load more random images if needed.
if (position == getCount() - 1 && !isLoading) {
Log.i("ImageListAdapter", "need to load more images.");
isLoading = true;
((MainActivity) activity).getContentManager().execute(randomImagesRequest, new RandomImagesRequestListener());
}
return imageListItemView;
}
Aggregations