Search in sources :

Example 11 with ImageLoadingListener

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

Example 12 with ImageLoadingListener

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);
    }
}
Also used : Bitmap(android.graphics.Bitmap) 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) Track(io.recom.howabout.category.music.model.Track)

Example 13 with ImageLoadingListener

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) {
                }
            });
        }
    }
}
Also used : Bitmap(android.graphics.Bitmap) ImageLoadingListener(com.nostra13.universalimageloader.core.listener.ImageLoadingListener) Bundle(android.os.Bundle) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) DecodeUtils(com.github.obsessive.simplifyreader.ui.activity.qrcode.decode.DecodeUtils) SurfaceView(android.view.SurfaceView) ImageView(android.widget.ImageView) InjectView(butterknife.InjectView) View(android.view.View)

Example 14 with ImageLoadingListener

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() {
        }
    });
}
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 15 with ImageLoadingListener

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));
        }
    });
}
Also used : ImageViewAware(com.nostra13.universalimageloader.core.imageaware.ImageViewAware) ImageLoadingListener(com.nostra13.universalimageloader.core.listener.ImageLoadingListener) ImageLoadingProgressListener(com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) GridView(android.widget.GridView) ImageView(android.widget.ImageView) SpoilerRobotoTextView(me.ccrama.redditslide.SpoilerRobotoTextView) SubmissionsView(me.ccrama.redditslide.Fragments.SubmissionsView) ExoVideoView(me.ccrama.redditslide.Views.ExoVideoView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) Bitmap(android.graphics.Bitmap) SpoilerRobotoTextView(me.ccrama.redditslide.SpoilerRobotoTextView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) LinearLayout(android.widget.LinearLayout)

Aggregations

FailReason (com.nostra13.universalimageloader.core.assist.FailReason)30 Bitmap (android.graphics.Bitmap)29 View (android.view.View)29 ImageView (android.widget.ImageView)23 ImageLoadingListener (com.nostra13.universalimageloader.core.listener.ImageLoadingListener)22 TextView (android.widget.TextView)14 ProgressBar (android.widget.ProgressBar)8 File (java.io.File)8 Reddit (me.ccrama.redditslide.Reddit)8 LinearLayout (android.widget.LinearLayout)7 ImageLoadingListener (com.nostra13.universalimageloader.core.assist.ImageLoadingListener)7 ImageViewAware (com.nostra13.universalimageloader.core.imageaware.ImageViewAware)7 ImageLoadingProgressListener (com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener)7 Handler (android.os.Handler)5 OnClickListener (android.view.View.OnClickListener)5 IOException (java.io.IOException)5 SubmissionsView (me.ccrama.redditslide.Fragments.SubmissionsView)5 ExoVideoView (me.ccrama.redditslide.Views.ExoVideoView)5 SubsamplingScaleImageView (me.ccrama.redditslide.Views.SubsamplingScaleImageView)5 LayoutInflater (android.view.LayoutInflater)4