APKPure.apk(点击下载) / CmsTopicVideoViewHolder.java


package com.apkpure.aegon.cms.viewholder;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.apkpure.aegon.R;
import com.apkpure.aegon.cms.activity.PictureBrowseActivity;
import com.apkpure.aegon.widgets.textview.ExpressionTextView;
import com.apkpure.aegon.widgets.textview.RoundTextView;
import com.apkpure.proto.nano.OpenConfigProtos;
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView;
import com.tencent.trpcprotocol.projecta.common.youtube_video_info.nano.VideoInfo;
import com.tencent.trpcprotocol.projecta.common.youtube_video_info.nano.VideoTopicInfo;
import e.g.a.f.f;
import e.g.a.h0.b.h;
import e.g.a.h0.b.q.c;
import e.g.a.i.n0.l1;
import e.g.a.i.n0.m1;
import e.g.a.i.n0.n1;
import e.g.a.i.n0.r0;
import e.g.a.i.n0.s0;
import e.g.a.i.n0.t0;
import e.g.a.i0.a1;
import e.g.a.i0.n0;
import e.g.a.i0.p1;
import e.s.a.c.a.q;
import e.s.a.c.b.j;
import e.w.e.a.b.l.b;
import i.b0.a.a.g;
import i.o.c.l;
import java.util.HashMap;
import java.util.Objects;

public class CmsTopicVideoViewHolder extends CmsYoutubeViewHolder {
    public static boolean P = true;
    public View B;
    public FrameLayout C;
    public ImageView D;
    public RoundTextView E;
    public LinearLayout F;
    public ExpressionTextView G;
    public TextView H;
    public TextView I;
    public YouTubePlayerView J;
    public View K;
    public VideoInfo L;
    public View M;
    public boolean N = false;
    public ImageView O;

    public class a implements View.OnClickListener {
        public final /* synthetic */ VideoInfo b;

        public a(VideoInfo videoInfo) {
            this.b = videoInfo;
        }

        public void onClick(View view) {
            CmsTopicVideoViewHolder cmsTopicVideoViewHolder = CmsTopicVideoViewHolder.this;
            Context context = cmsTopicVideoViewHolder.c;
            VideoTopicInfo[] videoTopicInfoArr = this.b.topics;
            int i2 = videoTopicInfoArr[0].topicId;
            String str = videoTopicInfoArr[0].topicName;
            boolean z = CmsTopicVideoViewHolder.P;
            Objects.requireNonNull(cmsTopicVideoViewHolder);
            OpenConfigProtos.OpenConfig openConfig = new OpenConfigProtos.OpenConfig();
            openConfig.url = "https://tapi.pureapk.woa.com/v3/topic_video?topic_id=" + i2;
            openConfig.type = "CMS";
            openConfig.title = str;
            openConfig.eventInfoV2 = e.d.a.a.a.i0("eventId", "topic_video");
            n0.J(context, openConfig);
            b.C0315b.f12266a.s(view);
        }
    }

    public CmsTopicVideoViewHolder(l lVar, Context context, View view) {
        super(lVar, context, view);
        this.c = context;
        this.d = lVar;
        this.B = view.findViewById(R.id.arg_RES_2131298922);
        this.C = (FrameLayout) view.findViewById(R.id.arg_RES_2131298974);
        this.D = (ImageView) view.findViewById(R.id.arg_RES_2131296662);
        this.E = (RoundTextView) view.findViewById(R.id.arg_RES_2131298911);
        this.F = (LinearLayout) view.findViewById(R.id.arg_RES_2131296450);
        this.G = (ExpressionTextView) view.findViewById(R.id.arg_RES_2131296934);
        this.H = (TextView) view.findViewById(R.id.arg_RES_2131296935);
        this.I = (TextView) view.findViewById(R.id.arg_RES_2131296933);
        this.K = view.findViewById(R.id.arg_RES_2131297558);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    @Override // com.apkpure.aegon.cms.viewholder.CmsYoutubeViewHolder
    private void k() {
        if (this.O != null) {
            g j2 = p1.j(this.d, P ? R.drawable.arg_RES_2131231807 : R.drawable.arg_RES_2131231810);
            if (j2 != null) {
                p1.z(j2, this.O, -1);
            }
        }
    }

    public static void n(CmsTopicVideoViewHolder cmsTopicVideoViewHolder) {
        Object tag = cmsTopicVideoViewHolder.J.getTag();
        if (tag instanceof q) {
            q qVar = (q) tag;
            if (!cmsTopicVideoViewHolder.N) {
                View inflate = View.inflate(cmsTopicVideoViewHolder.d, R.layout.arg_RES_2131493622, null);
                ImageView imageView = (ImageView) inflate.findViewById(R.id.arg_RES_2131298495);
                cmsTopicVideoViewHolder.O = imageView;
                imageView.setOnClickListener(new s0(cmsTopicVideoViewHolder, qVar));
                cmsTopicVideoViewHolder.N = true;
                j playerUiController = cmsTopicVideoViewHolder.J.getPlayerUiController();
                if (playerUiController != null) {
                    playerUiController.q(inflate);
                }
                playerUiController.h(new n1(cmsTopicVideoViewHolder, qVar));
            }
            cmsTopicVideoViewHolder.k();
        }
    }

    @Override // com.apkpure.aegon.cms.viewholder.CmsYoutubeViewHolder
    public void h() {
        YouTubePlayerView youTubePlayerView = this.J;
        if (youTubePlayerView != null && this.f1601a) {
            Object tag = youTubePlayerView.getTag();
            if (tag instanceof q) {
                YouTubePlayerView youTubePlayerView2 = this.J;
                VideoInfo videoInfo = this.L;
                c.a(youTubePlayerView2, "auto_pause", videoInfo.videoId, Integer.valueOf(videoInfo.durationSeconds), this.L.isOperationConfig);
                ((q) tag).b();
            }
            if (this.f1601a) {
                this.f1601a = false;
                this.J.setVisibility(8);
            }
        }
    }

    @Override // com.apkpure.aegon.cms.viewholder.CmsYoutubeViewHolder
    public void i() {
        if (this.D != null && !this.f1601a) {
            this.f1601a = true;
            if (!(f.b().c() instanceof PictureBrowseActivity)) {
                this.J.setStartSecond(0);
                YouTubePlayerView youTubePlayerView = this.J;
                VideoInfo videoInfo = this.L;
                c.c(youTubePlayerView, "auto_start", videoInfo.videoId, Integer.valueOf(videoInfo.durationSeconds), Boolean.valueOf(this.L.isOperationConfig));
                YouTubePlayerView youTubePlayerView2 = this.J;
                VideoInfo videoInfo2 = this.L;
                youTubePlayerView2.setVisibility(0);
                youTubePlayerView2.j(new t0(this, videoInfo2, youTubePlayerView2));
                youTubePlayerView2.h(new m1(this));
            }
        }
    }

    public final void o() {
        if (this.J == null) {
            YouTubePlayerView youTubePlayerView = new YouTubePlayerView(this.c);
            this.J = youTubePlayerView;
            youTubePlayerView.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
            this.J.setVisibility(8);
            if (this.J.getPlayerUiController() != null) {
                this.J.getPlayerUiController().d(false);
            }
            if (this.J.getPlayerUiController() != null) {
                this.J.getPlayerUiController().d(true);
                this.J.getPlayerUiController().l(false);
            }
            this.C.addView(this.J);
        }
    }

    public void p(q qVar, View view) {
        if (P) {
            qVar.k();
        } else {
            qVar.o();
        }
        P = !P;
        k();
        b.C0315b.f12266a.s(view);
    }

    public void q(VideoInfo videoInfo, View view, long j2, int i2) {
        this.M = view;
        this.L = videoInfo;
        this.K.setLayoutParams(new LinearLayout.LayoutParams(-1, p1.a(this.c, 12.0f)));
        this.K.setBackgroundColor(p1.i(this.d, R.attr.arg_RES_2130970040));
        o();
        if (getAdapterPosition() == 0) {
            this.B.setVisibility(0);
        } else {
            this.B.setVisibility(8);
        }
        int b = (a1.b(this.c) * 9) / 16;
        this.D.getLayoutParams().height = b;
        this.C.getLayoutParams().height = b;
        this.C.setTag(this);
        this.J.getLayoutParams().height = b;
        this.E.setText(videoInfo.duration);
        if (!TextUtils.isEmpty(videoInfo.icon)) {
            Context context = this.c;
            e.d.a.a.a.u0(context, 2, context, videoInfo.icon, this.D);
        }
        this.D.setOnClickListener(new r0(this, videoInfo));
        this.F.setVisibility(0);
        if (!TextUtils.isEmpty(videoInfo.videoName)) {
            this.G.setVisibility(0);
            this.G.setHtmlText(videoInfo.videoName);
        }
        this.I.setText(videoInfo.subTitle);
        VideoTopicInfo[] videoTopicInfoArr = videoInfo.topics;
        if (videoTopicInfoArr.length <= 0 || videoTopicInfoArr[0] == null || TextUtils.isEmpty(videoTopicInfoArr[0].topicName)) {
            this.H.setVisibility(8);
        } else {
            TextView textView = this.H;
            StringBuilder Z = e.d.a.a.a.Z("# ");
            Z.append(videoInfo.topics[0].topicName);
            textView.setText(Z.toString());
            this.H.setOnClickListener(new a(videoInfo));
            HashMap hashMap = new HashMap();
            e.d.a.a.a.r0(videoInfo.topics[0].topicId, hashMap, "tag_id", "small_position", "1");
            h.s(this.H, "tag", hashMap, false);
        }
        if (j2 == 2150) {
            this.H.setVisibility(8);
        }
        this.J.setDtListener(new l1(this));
        HashMap hashMap2 = new HashMap();
        hashMap2.put("position", Integer.valueOf(i2 + 1));
        hashMap2.put("model_type", 1006);
        hashMap2.put("module_name", "video_card");
        h.s(view, "card", hashMap2, false);
        View c = this.J.getPlayerUiController().c();
        VideoInfo videoInfo2 = this.L;
        o.s.c.j.e(videoInfo2, "videoInfo");
        new Handler(Looper.getMainLooper()).post(new e.g.a.h0.b.q.a(c, videoInfo2));
        h.s(this.J.getPlayerUiController().j(), "full_screen_button", hashMap2, false);
    }
}