Search in sources :

Example 1 with IPictureWorker

use of org.qii.weiciyuan.support.asyncdrawable.IPictureWorker in project weiciyuan by qii.

the class AbstractAppListAdapter method interruptPicDownload.

protected void interruptPicDownload(GridLayout gridLayout) {
    for (int i = 0; i < gridLayout.getChildCount(); i++) {
        ImageView iv = (ImageView) gridLayout.getChildAt(i);
        if (iv != null) {
            Drawable drawable = iv.getDrawable();
            if (drawable instanceof PictureBitmapDrawable) {
                PictureBitmapDrawable downloadedDrawable = (PictureBitmapDrawable) drawable;
                IPictureWorker worker = downloadedDrawable.getBitmapDownloaderTask();
                if (worker != null) {
                    ((MyAsyncTask) worker).cancel(true);
                }
                iv.setImageDrawable(null);
            }
        }
    }
}
Also used : PictureBitmapDrawable(org.qii.weiciyuan.support.asyncdrawable.PictureBitmapDrawable) PictureBitmapDrawable(org.qii.weiciyuan.support.asyncdrawable.PictureBitmapDrawable) IWeiciyuanDrawable(org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable) Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) TimeLineAvatarImageView(org.qii.weiciyuan.support.lib.TimeLineAvatarImageView) IPictureWorker(org.qii.weiciyuan.support.asyncdrawable.IPictureWorker) MyAsyncTask(org.qii.weiciyuan.support.lib.MyAsyncTask) TextPaint(android.text.TextPaint)

Example 2 with IPictureWorker

use of org.qii.weiciyuan.support.asyncdrawable.IPictureWorker in project weiciyuan by qii.

the class AbstractAppListAdapter method interruptPicDownload.

protected void interruptPicDownload(IWeiciyuanDrawable view) {
    Drawable drawable = view.getImageView().getDrawable();
    if (drawable instanceof PictureBitmapDrawable) {
        PictureBitmapDrawable downloadedDrawable = (PictureBitmapDrawable) drawable;
        IPictureWorker worker = downloadedDrawable.getBitmapDownloaderTask();
        if (worker != null) {
            ((MyAsyncTask) worker).cancel(true);
        }
    }
    view.getImageView().setImageDrawable(null);
}
Also used : PictureBitmapDrawable(org.qii.weiciyuan.support.asyncdrawable.PictureBitmapDrawable) PictureBitmapDrawable(org.qii.weiciyuan.support.asyncdrawable.PictureBitmapDrawable) IWeiciyuanDrawable(org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable) Drawable(android.graphics.drawable.Drawable) IPictureWorker(org.qii.weiciyuan.support.asyncdrawable.IPictureWorker) MyAsyncTask(org.qii.weiciyuan.support.lib.MyAsyncTask)

Aggregations

Drawable (android.graphics.drawable.Drawable)2 IPictureWorker (org.qii.weiciyuan.support.asyncdrawable.IPictureWorker)2 IWeiciyuanDrawable (org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable)2 PictureBitmapDrawable (org.qii.weiciyuan.support.asyncdrawable.PictureBitmapDrawable)2 MyAsyncTask (org.qii.weiciyuan.support.lib.MyAsyncTask)2 TextPaint (android.text.TextPaint)1 ImageView (android.widget.ImageView)1 TimeLineAvatarImageView (org.qii.weiciyuan.support.lib.TimeLineAvatarImageView)1