QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 VideoSameFullScreenPanel.java 源代码,内容仅作参考


package com.tencent.mtt.video.internal.player.ui;

import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.tencent.mtt.video.internal.engine.VideoManager;
import com.tencent.mtt.video.internal.player.H5VideoPlayer;
import com.tencent.mtt.video.internal.player.ui.base.VideoImageButton;
import com.tencent.mtt.video.internal.player.ui.base.VideoTextButton;
import com.tencent.mtt.video.internal.player.ui.panel.VideoMediaControllerStatusBtn;
import com.tencent.mtt.video.internal.resource.VideoResources;
import com.tencent.mtt.video.internal.utils.DeviceUtils;
import com.tencent.mtt.video.internal.utils.SafeBundleUtil;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.ArrayList;

public class VideoSameFullScreenPanel extends FrameLayout implements View.OnClickListener, View.OnTouchListener, IMenuContainer {

    public static final int f72898c = VideoResources.a("video_sdk_dp_69");
    private static final Integer o = -64759;

    Handler f72899a;

    H5VideoMediaController f72900b;

    private Context f72901d;
    private LinearLayout e;
    private H5VideoPlayer f;
    private int g;
    private LinearLayout h;
    private VideoTextButton i;
    private VideoImageButton j;
    private VideoTextButton k;
    private VideoImageButton l;
    private VideoImageButton m;
    private VideoMenuAnimationView n;
    private VideoTextButton p;

    public VideoSameFullScreenPanel(Context context, H5VideoMediaController h5VideoMediaController) {
        super(context);
        this.f72899a = null;
        this.f72900b = h5VideoMediaController;
        this.f72901d = context;
        this.f72899a = new Handler(Looper.getMainLooper()) {
            @Override
            public void handleMessage(Message message) {
                int i = message.what;
                if (i == 1) {
                    VideoSameFullScreenPanel.this.a();
                } else {
                    if (i != 2) {
                        return;
                    }
                    VideoSameFullScreenPanel.this.b(true);
                }
            }
        };
        j();
        g();
    }

    private void c(boolean z) {
        this.m.setVisibility((!l() || !m() || this.f72900b.j(1)) && !this.f72900b.isLiveStreaming() ? 0 : 8);
    }

    private void d(boolean z) {
        this.l.setVisibility(l() ? 8 : 0);
    }

    private void e(boolean z) {
        this.k.setVisibility((z || m()) ? 8 : 0);
    }

    private void f(boolean z) {
        this.i.setVisibility(z && this.f72900b.bc() > VideoManager.getInstance().getWidth() ? 8 : 0);
    }

    private void g() {
        i();
        h();
    }

    private void g(boolean z) {
        this.h.setVisibility(z ? 8 : 0);
    }

    private View getBlankView() {
        View view = new View(this.f72901d);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        view.setLayoutParams(layoutParams);
        view.setBackgroundColor(0);
        return view;
    }

    private void h() {
        this.h = new LinearLayout(this.f72901d);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, VideoResources.a("video_sdk_dp_69"));
        layoutParams.gravity = 80;
        this.h.setLayoutParams(layoutParams);
        this.h.setOrientation(0);
        this.h.setGravity(17);
        this.h.setBackgroundDrawable(VideoResources.e("video_sdk_same_bottom_bg"));
        addView(this.h);
        this.i = new VideoTextButton(this.f72901d);
        this.i.setId(65);
        this.i.setTextSize(0, VideoResources.a("video_sdk_dp_18"));
        this.i.setTextColor(Color.parseColor("#ffffffff"));
        this.i.setMinimumWidth(0);
        this.i.setSingleLine();
        this.i.setText(VideoResources.b("video_sdk_rotate"));
        int a2 = VideoResources.a("video_sdk_dp_2") + VideoResources.a("video_sdk_dp_50");
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(a2, a2);
        layoutParams2.gravity = 85;
        this.i.setLayoutParams(layoutParams2);
        this.i.setOnClickListener(this);
        this.i.setVisibility(8);
        this.h.addView(getBlankView());
        this.h.addView(this.i);
    }

    private void i() {
        this.e = new LinearLayout(this.f72901d);
        this.e.setLayoutParams(new FrameLayout.LayoutParams(-1, VideoResources.a("video_sdk_dp_69")));
        this.e.setOrientation(0);
        this.e.setBackgroundDrawable(VideoResources.e("video_sdk_same_top_bg"));
        addView(this.e);
        this.j = new VideoImageButton(this.f72901d);
        this.j.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        this.j.setBackgroundColor(0);
        this.j.setImageDrawable("video_sdk_back");
        this.j.setId(32);
        this.j.setOnClickListener(this);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(VideoResources.a("video_sdk_dp_32"), VideoResources.a("video_sdk_dp_40"));
        layoutParams.topMargin = VideoResources.a("video_sdk_dp_8");
        layoutParams.leftMargin = VideoResources.a("video_sdk_dp_8");
        layoutParams.gravity = 48;
        this.e.addView(this.j, layoutParams);
        this.e.addView(getBlankView());
        b();
        c();
        d();
        this.m = new VideoImageButton(this.f72901d);
        this.m.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        this.m.setBackgroundColor(0);
        this.m.setImageDrawable("video_sdk_menu_btn_fg");
        this.m.setId(35);
        this.m.setOnClickListener(this);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(VideoResources.a("video_sdk_dp_50"), VideoResources.a("video_sdk_dp_40"));
        layoutParams2.gravity = 53;
        layoutParams2.topMargin = VideoResources.a("video_sdk_dp_8");
        this.m.setVisibility(8);
        this.e.addView(this.m, layoutParams2);
    }

    private void j() {
        setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
        setBackgroundColor(0);
        setOnTouchListener(this);
    }

    private boolean k() {
        return !this.f72900b.j(1);
    }

    private boolean l() {
        return !this.f.ae();
    }

    private boolean m() {
        return this.f.isLiveStreaming() || !this.f.a((VideoMediaControllerStatusBtn) null);
    }

    private boolean n() {
        return !this.f72900b.isLiveStreaming();
    }

    private void setFocusEnable(boolean z) {
        if (!z) {
            setFocusable(false);
            setFocusableInTouchMode(false);
            clearFocus();
        } else {
            if (hasFocus()) {
                return;
            }
            setFocusable(true);
            setDescendantFocusability(262144);
            setFocusableInTouchMode(true);
            requestFocus();
        }
    }

    void a() {
        removeView(this.e);
    }

    public void a(int i) {
        if (this.f.ad()) {
            boolean z = this.f72900b.bb() < f72898c;
            g(z);
            f(this.f.bP());
            e(z);
            d(z);
            a(z);
            c(z);
        }
        if (this.f.getScreenMode() == 107) {
            setFocusEnable(true);
        } else {
            setFocusEnable(false);
        }
    }

    @Override
    public void a(View view) {
        if (view.getParent() == null) {
            addView(view);
        }
        setFocusEnable(false);
    }

    void a(boolean z) {
        this.p.setVisibility((z || k()) ? 8 : 0);
    }

    void b() {
        this.k = new VideoTextButton(this.f72901d);
        this.k.setBackgroundColor(0);
        this.k.setId(64);
        this.k.setText(VideoResources.b("video_sdk_cache"));
        this.k.setTextSize(0, VideoResources.a("video_sdk_dp_15"));
        this.k.setOnClickListener(this);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(VideoResources.a("video_sdk_dp_46"), VideoResources.a("video_sdk_dp_40"));
        layoutParams.gravity = 48;
        this.k.setVisibility(8);
        layoutParams.rightMargin = VideoResources.a("video_sdk_dp_8");
        layoutParams.topMargin = VideoResources.a("video_sdk_dp_8");
        this.e.addView(this.k, layoutParams);
    }

    public void b(int i) {
        a(this.f.bf());
    }

    @Override
    public void b(View view) {
        super.removeView(view);
        setFocusEnable(true);
    }

    public void b(boolean z) {
        VideoMenuAnimationView videoMenuAnimationView = this.n;
        if (videoMenuAnimationView != null && z) {
            videoMenuAnimationView.a(2);
        }
        removeView(this.n);
        this.m.a(0);
        this.n = null;
    }

    void c() {
        this.l = new VideoImageButton(this.f72901d);
        this.l.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        this.l.setImageDrawable("video_sdk_lite_wnd");
        this.l.setBackgroundColor(0);
        this.l.setId(1);
        this.l.setOnClickListener(this);
        int a2 = VideoResources.a("video_sdk_dp_32");
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(a2, a2);
        layoutParams.gravity = 48;
        layoutParams.topMargin = VideoResources.a("video_sdk_dp_12");
        this.e.addView(this.l, layoutParams);
        this.l.setVisibility(8);
    }

    void d() {
        this.p = new VideoTextButton(this.f72901d);
        this.p.setBackgroundColor(0);
        this.p.setId(62);
        this.p.setOnClickListener(this);
        this.p.setTextSize(0, VideoResources.a("video_sdk_dp_15"));
        this.p.setText(VideoResources.b("video_sdk_share"));
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(VideoResources.a("video_sdk_dp_46"), VideoResources.a("video_sdk_dp_40"));
        layoutParams.rightMargin = VideoResources.a("video_sdk_dp_8");
        layoutParams.topMargin = VideoResources.a("video_sdk_dp_8");
        layoutParams.gravity = 48;
        this.p.setVisibility(8);
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        if (keyEvent.getAction() == 0) {
            if (keyEvent.getKeyCode() == 4) {
                this.g = 4;
                return true;
            }
            this.g = -1;
        } else if (keyEvent.getAction() == 1) {
            if (this.g == 4) {
                this.f.doExitPlay(false);
            }
            return true;
        }
        return super.dispatchKeyEvent(keyEvent);
    }

    public void e() {
        this.n = f();
        addView(this.n);
        this.n.a(1);
        this.m.a(3);
        this.f72899a.removeMessages(2);
        this.f72899a.sendEmptyMessageDelayed(2, 3000L);
    }

    VideoMenuAnimationView f() {
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        if (!m()) {
            arrayList.add(VideoResources.b("video_sdk_cache"));
            arrayList2.add(64);
        }
        if (this.f72900b.j(1)) {
            arrayList.add(VideoResources.b("video_sdk_share"));
            arrayList2.add(o);
        }
        if (!n()) {
            arrayList.add(VideoResources.b("video_sdk_my_live_video"));
            arrayList2.add(66);
        }
        VideoMenuAnimationView videoMenuAnimationView = new VideoMenuAnimationView(this.f72901d, arrayList, arrayList2, this, getHeight());
        videoMenuAnimationView.setBackgroundDrawable(VideoResources.e("video_sdk_hint_bkg"));
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(VideoResources.a("video_sdk_dp_138") - VideoResources.a("video_sdk_dp_1"), videoMenuAnimationView.getTotalHeight());
        layoutParams.gravity = 53;
        layoutParams.topMargin = VideoResources.a("video_sdk_dp_48");
        layoutParams.rightMargin = VideoResources.a("video_sdk_dp_4");
        videoMenuAnimationView.setLayoutParams(layoutParams);
        return videoMenuAnimationView;
    }

    @Override
    public int getContainerHeight() {
        return getHeight();
    }

    @Override
    public void onClick(View view) {
        EventCollector.getInstance().onViewClickedBefore(view);
        if (view.getId() == o.intValue()) {
            b(true);
            this.f72900b.c(-1);
        } else {
            if (view.getId() != 62) {
                if (view.getId() != 32) {
                    if (view.getId() == 1) {
                        if (DeviceUtils.a(this.f72901d)) {
                            VideoManager.getInstance().getVideoHost().userBehaviorStatistics("AWSP007");
                        }
                        this.f72900b.av();
                    } else if (view.getId() == 66) {
                        if (this.f72900b.aX() != null) {
                            Bundle a2 = SafeBundleUtil.a();
                            a2.putString("url", "https://live.html5.qq.com/personal?from=cp&ch=003006");
                            a2.putBoolean("openWithNewWindow", true);
                            Object invokeMiscMethod = this.f72900b.aX().invokeMiscMethod("openUrl", a2);
                            if (!(invokeMiscMethod instanceof Boolean) || !((Boolean) invokeMiscMethod).booleanValue()) {
                                VideoManager.getInstance().getVideoHost().openUrl("https://live.html5.qq.com/personal?from=cp&ch=003006", true);
                            }
                        }
                    } else if (view.getId() == 35) {
                        VideoMenuAnimationView videoMenuAnimationView = this.n;
                        if (videoMenuAnimationView == null || !videoMenuAnimationView.isShown()) {
                            e();
                        }
                    }
                    b(false);
                } else if (!this.f.bB()) {
                    this.f.doExitPlay(false);
                }
                b(true);
            }
            b(true);
            this.f72900b.onClick(view);
        }
        EventCollector.getInstance().onViewClicked(view);
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        VideoMenuAnimationView videoMenuAnimationView = this.n;
        if (videoMenuAnimationView == null || !videoMenuAnimationView.isShown()) {
            return false;
        }
        b(true);
        return true;
    }

    public void setPlayer(H5VideoPlayer h5VideoPlayer) {
        this.f = h5VideoPlayer;
        if (this.j != null) {
            Object invokeMiscMethod = this.f.b().invokeMiscMethod("shouldRelaceSameLayerFullScreenBackIconWithCloseIcon", null);
            this.j.setImageDrawable(invokeMiscMethod instanceof Boolean ? ((Boolean) invokeMiscMethod).booleanValue() : false ? "video_sdk_close" : "video_sdk_back");
        }
    }
}