use of org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable in project weiciyuan by qii.
the class AbstractAppListAdapter method buildMultiPic.
protected void buildMultiPic(final MessageBean msg, final GridLayout gridLayout) {
if (SettingUtility.isEnablePic()) {
gridLayout.setVisibility(View.VISIBLE);
final int count = msg.getPicCount();
for (int i = 0; i < count; i++) {
final IWeiciyuanDrawable pic = (IWeiciyuanDrawable) gridLayout.getChildAt(i);
pic.setVisibility(View.VISIBLE);
if (SettingUtility.getEnableBigPic()) {
TimeLineBitmapDownloader.getInstance().displayMultiPicture(pic, msg.getHighPicUrls().get(i), FileLocationMethod.picture_large, (AbstractTimeLineFragment) fragment);
} else {
TimeLineBitmapDownloader.getInstance().displayMultiPicture(pic, msg.getThumbnailPicUrls().get(i), FileLocationMethod.picture_thumbnail, (AbstractTimeLineFragment) fragment);
}
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) gridLayout.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) {
ImageView pic;
switch(count) {
case 8:
pic = (ImageView) gridLayout.getChildAt(8);
pic.setVisibility(View.INVISIBLE);
break;
case 7:
for (int i = 8; i > 6; i--) {
pic = (ImageView) gridLayout.getChildAt(i);
pic.setVisibility(View.INVISIBLE);
}
break;
case 6:
for (int i = 8; i > 5; i--) {
pic = (ImageView) gridLayout.getChildAt(i);
pic.setVisibility(View.GONE);
}
break;
case 5:
for (int i = 8; i > 5; i--) {
pic = (ImageView) gridLayout.getChildAt(i);
pic.setVisibility(View.GONE);
}
pic = (ImageView) gridLayout.getChildAt(5);
pic.setVisibility(View.INVISIBLE);
break;
case 4:
for (int i = 8; i > 5; i--) {
pic = (ImageView) gridLayout.getChildAt(i);
pic.setVisibility(View.GONE);
}
pic = (ImageView) gridLayout.getChildAt(5);
pic.setVisibility(View.INVISIBLE);
pic = (ImageView) gridLayout.getChildAt(4);
pic.setVisibility(View.INVISIBLE);
break;
case 3:
for (int i = 8; i > 2; i--) {
pic = (ImageView) gridLayout.getChildAt(i);
pic.setVisibility(View.GONE);
}
break;
case 2:
for (int i = 8; i > 2; i--) {
pic = (ImageView) gridLayout.getChildAt(i);
pic.setVisibility(View.GONE);
}
pic = (ImageView) gridLayout.getChildAt(2);
pic.setVisibility(View.INVISIBLE);
break;
}
}
} else {
gridLayout.setVisibility(View.GONE);
}
}
use of org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable 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);
}
}
}
}
use of org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable in project weiciyuan by qii.
the class DMConversationAdapter method buildAvatar.
protected void buildAvatar(TimeLineAvatarImageView view, int position, final UserBean user) {
((IWeiciyuanDrawable) view).checkVerified(user);
String image_url = user.getProfile_image_url();
if (!TextUtils.isEmpty(image_url)) {
view.setVisibility(View.VISIBLE);
commander.downloadAvatar(view.getImageView(), user, (AbstractTimeLineFragment) fragment);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), UserInfoActivity.class);
intent.putExtra("token", GlobalContext.getInstance().getSpecialToken());
intent.putExtra("user", user);
getActivity().startActivity(intent);
}
});
} else {
view.setVisibility(View.GONE);
}
}
use of org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable in project weiciyuan by qii.
the class DMUserListAdapter method buildAvatar.
protected void buildAvatar(ImageView view, int position, final UserBean user) {
((IWeiciyuanDrawable) view).checkVerified(user);
String image_url = user.getProfile_image_url();
if (!TextUtils.isEmpty(image_url)) {
view.setVisibility(View.VISIBLE);
commander.downloadAvatar(view, user, (AbstractTimeLineFragment) fragment);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), UserInfoActivity.class);
intent.putExtra("token", GlobalContext.getInstance().getSpecialToken());
intent.putExtra("user", user);
getActivity().startActivity(intent);
}
});
} else {
view.setVisibility(View.GONE);
}
}
use of org.qii.weiciyuan.support.asyncdrawable.IWeiciyuanDrawable 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);
}
Aggregations