Search in sources :

Example 1 with MyAsyncTask

use of org.qii.weiciyuan.support.lib.MyAsyncTask in project weiciyuan by qii.

the class GalleryActivity method onDestroy.

@Override
protected void onDestroy() {
    super.onDestroy();
    for (String url : urls) {
        MyAsyncTask task = taskMap.get(url);
        if (task != null) {
            task.cancel(true);
        }
    }
    if (pager != null && unRecycledViews != null) {
        Utility.recycleViewGroupAndChildViews(pager, true);
        for (ViewGroup viewGroup : unRecycledViews) {
            Utility.recycleViewGroupAndChildViews(viewGroup, true);
        }
        System.gc();
    }
}
Also used : ViewGroup(android.view.ViewGroup) MyAsyncTask(org.qii.weiciyuan.support.lib.MyAsyncTask)

Example 2 with MyAsyncTask

use of org.qii.weiciyuan.support.lib.MyAsyncTask 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 3 with MyAsyncTask

use of org.qii.weiciyuan.support.lib.MyAsyncTask 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

MyAsyncTask (org.qii.weiciyuan.support.lib.MyAsyncTask)3 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 TextPaint (android.text.TextPaint)1 ViewGroup (android.view.ViewGroup)1 ImageView (android.widget.ImageView)1 TimeLineAvatarImageView (org.qii.weiciyuan.support.lib.TimeLineAvatarImageView)1