Java 类com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener 实例源码

项目:android-opensource-library-56    文件:ImageAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.image_item, null);
    }
    Photo photo = getItem(position);
    ImageView imageView = (ImageView) convertView.findViewById(R.id.image);
    imageView.setTag(photo.getMediumUrl());
    imageView.setImageBitmap(null);
    ImageLoader.getInstance().cancelDisplayTask(imageView);

    ImageLoader.getInstance().displayImage(photo.getMediumUrl(), imageView, new SimpleImageLoadingListener() {
        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            if (view.getTag().equals(imageUri)) {
                ((ImageView) view).setImageBitmap(loadedImage);
            }
        }
    });

    return convertView;
}
项目:q-municate-android    文件:MainActivity.java   
private void loadLogoActionBar(String logoUrl) {
    ImageLoader.getInstance().loadImage(logoUrl, ImageLoaderUtils.UIL_USER_AVATAR_DISPLAY_OPTIONS,
            new SimpleImageLoadingListener() {

                @Override
                public void onLoadingComplete(String imageUri, View view, Bitmap loadedBitmap) {
                    setActionBarIcon(MediaUtils.getRoundIconDrawable(MainActivity.this, loadedBitmap));
                }
            });
}
项目:q-municate-android    文件:BaseDialogActivity.java   
protected void loadActionBarLogo(String logoUrl) {
    ImageLoader.getInstance().loadImage(logoUrl, ImageLoaderUtils.UIL_USER_AVATAR_DISPLAY_OPTIONS,
            new SimpleImageLoadingListener() {

                @Override
                public void onLoadingComplete(String imageUri, View view, Bitmap loadedBitmap) {
                    setActionBarIcon(
                            MediaUtils.getRoundIconDrawable(BaseDialogActivity.this, loadedBitmap));
                }
            });
}
项目:juahya    文件:IFlateViewInFlaterAdapter.java   
public void finishIFlate(final View layout){
        layout.setPadding(
                paddingLeft==NONE_INT?0:paddingLeft, 
                paddingTop==NONE_INT?0:paddingTop, 
                paddingRight==NONE_INT?0:paddingRight, 
                paddingBottom==NONE_INT?0:paddingBottom);
//      if(NONE_INT!=gravity)layout.setGravity(gravity);
        if(NONE_INT!=backgroundColor)layout.setBackgroundColor(backgroundColor);
        if(NONE_INT!=background)layout.setBackgroundResource(background);
        if(NONE_INT!=id)layout.setId(id);
        if(null!=imageuri){
            imageLoader.loadImage(imageuri, options, new SimpleImageLoadingListener(){

                @Override
                public void onLoadingComplete(String imageUri, View view,
                        Bitmap loadedImage, String filePath) {
                    try{
                        Debug.dLog("loadImage:"+filePath);
//                      layout.setBackground(new BitmapDrawable(loadedImage));
                        layout.setBackgroundDrawable(new BitmapDrawable(loadedImage));
                        layout.postInvalidate();
                    }catch(Exception e){
                        Debug.dLog(e);
                    }
                    super.onLoadingComplete(imageUri, view, loadedImage, filePath);
                }

            });
        }
        onFinishIFlate(layout);
    }
项目:v2ex-daily-android    文件:AsyncImageGetter.java   
@Override
public Drawable getDrawable(String source) {
    final URLDrawable urlDrawable = new URLDrawable();
    ImageLoader.getInstance().loadImage(source, new SimpleImageLoadingListener() {
        @Override
        public void onLoadingComplete(String s, View view, Bitmap bitmap) {
            if (bitmap != null) {
                int width;
                int height;
                if (bitmap.getWidth() > mMaxWidth) {
                    width = mMaxWidth;
                    height = mMaxWidth * bitmap.getHeight() / bitmap.getWidth();
                } else {
                    width = bitmap.getWidth();
                    height = bitmap.getHeight();
                }
                Drawable drawable = new BitmapDrawable(mContext.getResources(), bitmap);
                drawable.setBounds(0, 0, width, height);
                urlDrawable.setBounds(0, 0, width, height);
                urlDrawable.mDrawable = drawable;
                //reset text to invalidate.
                mContainer.setText(mContainer.getText());
            }
        }
    });
    return urlDrawable;
}
项目:discogsscrobbler    文件:ReleaseDetailFragment.java   
private void setRelease() {
    ((TextView) mRootView.findViewById(R.id.detail_title)).setText(mRelease.title);
    ((TextView) mRootView.findViewById(R.id.detail_artist)).setText(mRelease.artist);
    ((TextView) mRootView.findViewById(R.id.detail_label)).setText(mRelease.label);
    ((TextView) mRootView.findViewById(R.id.detail_format)).setText(mRelease.format_extended);
    ((TextView) mRootView.findViewById(R.id.detail_country)).setText(mRelease.country);
    ((TextView) mRootView.findViewById(R.id.detail_released)).setText(mRelease.released_formatted);
    ((TextView) mRootView.findViewById(R.id.detail_genre)).setText(mRelease.genres);
    ((TextView) mRootView.findViewById(R.id.detail_style)).setText(mRelease.styles);
    ((TextView) mRootView.findViewById(R.id.detail_notes)).setText(mRelease.notes);
    ((TextView) mRootView.findViewById(R.id.detail_marketplace)).setText("http://www.discogs.com/marketplace?release_id="+mRelease.releaseid);
    if(mRelease.master_id!=0) {
        ((TextView) mRootView.findViewById(R.id.detail_marketplace_master)).setText("http://www.discogs.com/marketplace?master_id=" + mRelease.master_id);
    } else {
        mRootView.findViewById(R.id.detail_marketplace_master).setVisibility(View.GONE);
    }
    //decide to load big or small image
    if(!mRelease.hasExtendedInfo) {
        //we don't got extended info on this release yet, only display thumbnail
        ImageView thumb = (ImageView) mRootView.findViewById(R.id.detail_thumb);
        thumb.setVisibility(ImageView.VISIBLE);
        mImageLoader.displayImage(mRelease.thumb,thumb);
    } else {
        ImageView image = (ImageView) mRootView.findViewById(R.id.detail_image);

        if(mRelease.images().size()>0) {
            Image img = mRelease.images().get(0);
            mImageLoader.displayImage(img.uri, image, new SimpleImageLoadingListener() {
                @Override
                public void onLoadingComplete(Bitmap loadedImage) {
                    super.onLoadingComplete(loadedImage);
                    //make the small thumbnail invisible
                    mRootView.findViewById(R.id.detail_thumb).setVisibility(ImageView.INVISIBLE);
                }
            });
        }
    }
}
项目:zen4android    文件:ZenGalleryActivity.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    if (convertView == null) {
        convertView = mInflater
                .inflate(R.layout.zen_gallery_item, null);
    }

    ImageView GallerySelector = (ImageView) convertView
            .findViewById(R.id.zen_gallery_selector);
    final ImageView imageView = (ImageView) convertView
            .findViewById(R.id.zen_gallery_item);

    imageLoader.displayImage("file://" + imageUrls.get(position),
            imageView, options, new SimpleImageLoadingListener() {
                @Override
                public void onLoadingComplete(Bitmap loadedImage) {
                    Animation anim = AnimationUtils
                            .loadAnimation(ZenGalleryActivity.this,
                                    R.anim.zen_fade_in);
                    imageView.setAnimation(anim);
                    anim.start();
                }
            });

    int selector = (mSparseBooleanArray.get(position) ? R.drawable.checkbox_selected : R.drawable.checkbox_normal);
    GallerySelector.setTag(position);
    GallerySelector.setImageResource(selector);

    return convertView;
}
项目:Allow    文件:GcmHelper.java   
public void sendNotification(final Message msg) {
    if (TextUtils.isEmpty(msg.photo)){
        doSendNotification(msg, null);

    } else {
        ImageLoader.getInstance().loadImage(msg.photo, new SimpleImageLoadingListener() {
            @Override
            public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                doSendNotification(msg, loadedImage);
            }
        });
    }
}
项目:Studddinv2_android    文件:GalleryAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    final ViewHolder holder;
    if (convertView == null) {

        convertView = infalter.inflate(R.layout.gallery_item, null);
        holder = new ViewHolder();
        holder.imgQueue = (ImageView) convertView
                .findViewById(R.id.imgQueue);

        holder.imgQueueMultiSelected = (ImageView) convertView
                .findViewById(R.id.imgQueueMultiSelected);

        if (isActionMultiplePick) {
            holder.imgQueueMultiSelected.setVisibility(View.VISIBLE);
        } else {
            holder.imgQueueMultiSelected.setVisibility(View.GONE);
        }

        convertView.setTag(holder);

    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    holder.imgQueue.setTag(position);

    try {

        imageLoader.displayImage("file://" + data.get(position).sdcardPath,
                holder.imgQueue, new SimpleImageLoadingListener() {
                    @Override
                    public void onLoadingStarted(String imageUri, View view) {
                        holder.imgQueue
                                .setImageResource(R.drawable.no_media);
                        super.onLoadingStarted(imageUri, view);
                    }
                });

        if (isActionMultiplePick) {

            holder.imgQueueMultiSelected
                    .setSelected(data.get(position).isSeleted);

        }

    } catch (Exception e) {
        e.printStackTrace();
    }

    return convertView;
}
项目:MultipleImagePicker    文件:CustomGalleryAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    final ViewHolder holder;
    if (convertView == null) {

        convertView = infalter.inflate(R.layout.gallery_item, null);
        holder = new ViewHolder();
        holder.imgQueue = (ImageView) convertView
                .findViewById(R.id.imgQueue);

        holder.imgQueueMultiSelected = (ImageView) convertView
                .findViewById(R.id.imgQueueMultiSelected);

        if (isActionMultiplePick) {
            holder.imgQueueMultiSelected.setVisibility(View.VISIBLE);
        } else {
            holder.imgQueueMultiSelected.setVisibility(View.GONE);
        }

        convertView.setTag(holder);

    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    holder.imgQueue.setTag(position);

    try {

        imageLoader.displayImage("file://" + data.get(position).sdcardPath,
                holder.imgQueue, new SimpleImageLoadingListener() {
                    @Override
                    public void onLoadingStarted(String imageUri, View view) {
                        holder.imgQueue
                                .setImageResource(R.drawable.no_media);
                        super.onLoadingStarted(imageUri, view);
                    }
                });

        if (isActionMultiplePick) {

            holder.imgQueueMultiSelected
                    .setSelected(data.get(position).isSeleted);

        }

    } catch (Exception e) {
        e.printStackTrace();
    }

    return convertView;
}
项目:Fotoflick-android    文件:FotoFlickActivity.java   
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ParseAnalytics.trackAppOpened(getIntent());
        setContentView(R.layout.main);

        mLastHour = new Date();
        mLastHour.setHours(mLastHour.getHours() - 2);

        // Instantiate a QueryFactory to define the ParseQuery to be used for fetching items in this
        // Adapter.
        ParseQueryAdapter.QueryFactory<ParseObject> factory =
            new ParseQueryAdapter.QueryFactory<ParseObject>() {
              public ParseQuery<ParseObject> create() {
                ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Image");
//                query.whereGreaterThan("createdAt", mLastHour);
                query.orderByDescending("createdAt");
                return query;
              }
            };
        mAdapter = new ParseQueryAdapter<ParseObject>(this, factory) {
            @Override
            public View getItemView(ParseObject object, View v, ViewGroup parent) {
                if (v == null) {
                    v = View.inflate(FotoFlickActivity.this, R.layout.photo, null);
                }

                super.getItemView(object, v, parent);

                final ImageView imgView = (ImageView)v;
                ImageLoader.getInstance()
                    .loadImage(object.getString("imageURLString")
                            , mTargetSize
                            , new SimpleImageLoadingListener() {
                                @Override
                                public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                                    imgView.setImageBitmap(loadedImage);
                                }
                            });
                imgView.setOnClickListener(mListener);
                return v;
            }
        };

        // Perhaps set a callback to be fired upon successful loading of a new set of ParseObjects.
        mAdapter.addOnQueryLoadListener(new OnQueryLoadListener<ParseObject>() {
            @Override
            public void onLoading() {
                mProgressBar.setVisibility(View.VISIBLE);
            }

            @Override
            public void onLoaded(List<ParseObject> objects, Exception e) {
                mProgressBar.setVisibility(View.GONE);
                android.util.Log.d("Foto", "onLoaded");
                if (objects != null) {
                    android.util.Log.d("Foto", "parsing objects: " + objects.size());
                }
            }
        });

        mGridView = (GridView) findViewById(R.id.photo_grid);
        mProgressBar = (ProgressBar) findViewById(R.id.progress);

        mGridView.setAdapter(mAdapter);
    }