use of com.juns.wechat.chat.task.LoadVideoImageTask in project wechat by motianhuo.
the class MessageAdapter method showVideoThumbView.
/**
* 展示视频缩略图
*
* @param localThumb
* 本地缩略图路径
* @param iv
* @param thumbnailUrl
* 远程缩略图路径
* @param message
*/
private void showVideoThumbView(String localThumb, ImageView iv, String thumbnailUrl, final EMMessage message) {
// first check if the thumbnail image already loaded into cache
Bitmap bitmap = ImageCache.getInstance().get(localThumb);
if (bitmap != null) {
// thumbnail image is already loaded, reuse the drawable
iv.setImageBitmap(bitmap);
iv.setClickable(true);
iv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
VideoMessageBody videoBody = (VideoMessageBody) message.getBody();
// TODO 打开视频页面
System.err.println("video view is on click");
// Intent intent = new Intent(activity,
// ShowVideoActivity.class);
// intent.putExtra("localpath", videoBody.getLocalUrl());
// intent.putExtra("secret", videoBody.getSecret());
// intent.putExtra("remotepath", videoBody.getRemoteUrl());
// if (message != null
// && message.direct == EMMessage.Direct.RECEIVE
// && !message.isAcked
// && message.getChatType() != ChatType.GroupChat) {
// message.isAcked = true;
// try {
// EMChatManager.getInstance().ackMessageRead(
// message.getFrom(), message.getMsgId());
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// activity.startActivity(intent);
}
});
} else {
new LoadVideoImageTask().execute(localThumb, thumbnailUrl, iv, activity, message, this);
}
}
Aggregations