Search in sources :

Example 1 with LoadVideoImageTask

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);
    }
}
Also used : Bitmap(android.graphics.Bitmap) OnClickListener(android.view.View.OnClickListener) LoadVideoImageTask(com.juns.wechat.chat.task.LoadVideoImageTask) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) VideoMessageBody(com.easemob.chat.VideoMessageBody)

Aggregations

Bitmap (android.graphics.Bitmap)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 VideoMessageBody (com.easemob.chat.VideoMessageBody)1 LoadVideoImageTask (com.juns.wechat.chat.task.LoadVideoImageTask)1