Search in sources :

Example 1 with MsgDetailReadWorker

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

the class BrowserWeiboMsgFragment method displayPictures.

private void displayPictures(final MessageBean msg, final GridLayout layout, WeiboDetailImageView view, boolean refreshPic) {
    if (!msg.isMultiPics()) {
        view.setVisibility(View.VISIBLE);
        if (Utility.isTaskStopped(picTask) && refreshPic) {
            picTask = new MsgDetailReadWorker(view, msg);
            picTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
        } else {
            picTask.setView(view);
        }
    } else {
        layout.setVisibility(View.VISIBLE);
        final int count = msg.getPicCount();
        for (int i = 0; i < count; i++) {
            final IWeiciyuanDrawable pic = (IWeiciyuanDrawable) layout.getChildAt(i);
            pic.setVisibility(View.VISIBLE);
            if (SettingUtility.getEnableBigPic()) {
                TimeLineBitmapDownloader.getInstance().displayMultiPicture(pic, msg.getHighPicUrls().get(i), FileLocationMethod.picture_large);
            } else {
                TimeLineBitmapDownloader.getInstance().displayMultiPicture(pic, msg.getMiddlePicUrls().get(i), FileLocationMethod.picture_bmiddle);
            }
            final int finalI = i;
            pic.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    ArrayList<AnimationRect> animationRectArrayList = new ArrayList<AnimationRect>();
                    for (int i = 0; i < count; i++) {
                        final IWeiciyuanDrawable pic = (IWeiciyuanDrawable) layout.getChildAt(i);
                        ImageView imageView = (ImageView) pic;
                        if (imageView.getVisibility() == View.VISIBLE) {
                            AnimationRect rect = AnimationRect.buildFromImageView(imageView);
                            animationRectArrayList.add(rect);
                        }
                    }
                    Intent intent = GalleryAnimationActivity.newIntent(msg, animationRectArrayList, finalI);
                    getActivity().startActivity(intent);
                }
            });
        }
        if (count < 9) {
            for (int i = count; i < 9; i++) {
                ImageView pic = (ImageView) layout.getChildAt(i);
                pic.setVisibility(View.GONE);
            }
        }
    }
}
Also used : AnimationRect(org.qii.weiciyuan.support.lib.AnimationRect) ArrayList(java.util.ArrayList) Intent(android.content.Intent) ImageView(android.widget.ImageView) WeiboDetailImageView(org.qii.weiciyuan.support.lib.WeiboDetailImageView) ProfileTopAvatarImageView(org.qii.weiciyuan.support.lib.ProfileTopAvatarImageView) MsgDetailReadWorker(org.qii.weiciyuan.support.asyncdrawable.MsgDetailReadWorker) ImageView(android.widget.ImageView) WeiboDetailImageView(org.qii.weiciyuan.support.lib.WeiboDetailImageView) View(android.view.View) AdapterView(android.widget.AdapterView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) ProfileTopAvatarImageView(org.qii.weiciyuan.support.lib.ProfileTopAvatarImageView) IWeiciyuanDrawable(org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 ArrayList (java.util.ArrayList)1 IWeiciyuanDrawable (org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable)1 MsgDetailReadWorker (org.qii.weiciyuan.support.asyncdrawable.MsgDetailReadWorker)1 AnimationRect (org.qii.weiciyuan.support.lib.AnimationRect)1 ProfileTopAvatarImageView (org.qii.weiciyuan.support.lib.ProfileTopAvatarImageView)1 WeiboDetailImageView (org.qii.weiciyuan.support.lib.WeiboDetailImageView)1 PullToRefreshListView (org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView)1