MsgViewHolderLingxiFirstQuestion.java 2.48 KB
Newer Older
1 2
package com.yidianling.im.session.viewholder;

霍志良 committed
3 4
import android.view.View;
import android.widget.FrameLayout;
5
import android.widget.ImageView;
霍志良 committed
6
import android.widget.LinearLayout;
7 8 9 10

import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp;
霍志良 committed
11
import com.yidianling.common.tools.LogUtil;
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
import com.yidianling.im.R;
import com.yidianling.im.session.extension.CustomAttachLingxiFirstQuestion;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.activity.WatchVideoActivity;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;

public class MsgViewHolderLingxiFirstQuestion extends MsgViewHolderBase {
    private ImageView imageView;
    private String jumpUrl;
    private String jumpVideo;
    private String imageUrl;

    public MsgViewHolderLingxiFirstQuestion(BaseMultiItemFetchLoadAdapter adapter) {
        super(adapter);
    }

    @Override
    protected int getContentResId() {
        return R.layout.im_nim_lingxi_first_question;
    }

    @Override
    protected void inflateContentView() {
        imageView=findViewById(R.id.first_question);
    }

    @Override
    protected void bindContentView() {
霍志良 committed
40
        avatarRight.setVisibility(View.INVISIBLE);
41 42 43 44 45 46
        jumpUrl=((CustomAttachLingxiFirstQuestion) message.getAttachment()).greetUrl;
        jumpVideo=((CustomAttachLingxiFirstQuestion) message.getAttachment()).greetVideo;
        imageUrl=((CustomAttachLingxiFirstQuestion) message.getAttachment()).greetImage;
        GlideApp.with(context)
                .load(imageUrl)
                .into(imageView);
霍志良 committed
47 48 49
        contentContainer.postDelayed(new Runnable() {
            @Override
            public void run() {
霍志良 committed
50 51
                FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( content_width.getWidth(),
                        (content_width.getWidth()/15)*13);
霍志良 committed
52
                imageView.setLayoutParams(params);
霍志良 committed
53 54
                imageView.postInvalidate();
//                imageView.requestLayout();
霍志良 committed
55 56 57
            }
        },200);

58 59 60 61 62
    }

    @Override
    protected void onItemClick() {
        super.onItemClick();
霍志良 committed
63
        if (jumpUrl!=null&&jumpUrl.length()>0){
64 65 66 67 68 69 70 71
            //跳转URL
            NewH5Activity.start(context,new H5Params(jumpUrl,null));
        }/* else if (jumpVideo!=null&&!jumpVideo.isEmpty()){
            //播放视频
            NewH5Activity.start(context,new H5Params(jumpVideo,null));
        }*/
    }
}