Search in sources :

Example 11 with FailReason

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() {
        }
    });
}
Also used : Bitmap(android.graphics.Bitmap) ImageLoadingListener(com.nostra13.universalimageloader.core.assist.ImageLoadingListener) SherlockFragmentActivity(com.actionbarsherlock.app.SherlockFragmentActivity) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ActionBar(com.actionbarsherlock.app.ActionBar)

Example 12 with FailReason

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);
    }
}
Also used : Bitmap(android.graphics.Bitmap) ImageLoadingListener(com.nostra13.universalimageloader.core.listener.ImageLoadingListener) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ImageView(android.widget.ImageView) PlayerDiscView(com.github.obsessive.simplifyreader.widgets.PlayerDiscView) InjectView(butterknife.InjectView) View(android.view.View) TextView(android.widget.TextView) MusicsView(com.github.obsessive.simplifyreader.view.MusicsView)

Example 13 with FailReason

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);
}
Also used : FailReason(com.nostra13.universalimageloader.core.assist.FailReason)

Example 14 with FailReason

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;
}
Also used : ImageLoadingListener(com.nostra13.universalimageloader.core.assist.ImageLoadingListener) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) HowaboutApplication(io.recom.howabout.HowaboutApplication) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Bitmap(android.graphics.Bitmap) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ProgressBar(android.widget.ProgressBar) Track(io.recom.howabout.category.music.model.Track)

Example 15 with FailReason

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;
}
Also used : Bitmap(android.graphics.Bitmap) ImageLoadingListener(com.nostra13.universalimageloader.core.assist.ImageLoadingListener) LayoutInflater(android.view.LayoutInflater) ImageView(android.widget.ImageView) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ImageView(android.widget.ImageView) View(android.view.View) ProgressBar(android.widget.ProgressBar)

Aggregations

FailReason (com.nostra13.universalimageloader.core.assist.FailReason)19 Bitmap (android.graphics.Bitmap)18 View (android.view.View)17 ImageView (android.widget.ImageView)17 TextView (android.widget.TextView)12 ImageLoadingListener (com.nostra13.universalimageloader.core.assist.ImageLoadingListener)7 RecyclerView (android.support.v7.widget.RecyclerView)6 ImageLoadingListener (com.nostra13.universalimageloader.core.listener.ImageLoadingListener)6 Palette (android.support.v7.graphics.Palette)4 LayoutInflater (android.view.LayoutInflater)4 SimpleImageLoadingListener (com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener)4 Track (io.recom.howabout.category.music.model.Track)4 ProgressBar (android.widget.ProgressBar)3 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)3 HowaboutApplication (io.recom.howabout.HowaboutApplication)3 OnClickListener (android.view.View.OnClickListener)2 InjectView (butterknife.InjectView)2 ActionBar (com.actionbarsherlock.app.ActionBar)2 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)2 MaterialDrawableBuilder (net.steamcrafted.materialiconlib.MaterialDrawableBuilder)2