导航菜单

页面标题

页面副标题

哔哩哔哩 v1.6.6 - LivePlayerActivity.java 源代码

正在查看: 哔哩哔哩 v1.6.6 应用的 LivePlayerActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.bilibili.tv.ui.live.player;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import bl.abt;
import bl.adl;
import bl.agb;
import bl.lr;
import bl.wm;
import bl.wr;
import com.bilibili.tv.newplayer.video.LiveVideoPlayer;
import com.bilibili.tv.newplayer.widget.LivePlayerController;
import com.bilibili.tv.ui.base.BaseActivity;
import java.util.List;
import mybl.BiliFilter;
import mybl.BiliLiveContent;
import mybl.DanmakuClient;
import u.aly.j;

public class LivePlayerActivity extends BaseActivity implements View.OnClickListener, wr {
    private BiliLiveContent a;
    private String b;
    private String c;
    private int d;
    private agb e;
    private boolean f = false;
    private LiveVideoPlayer g;
    private LivePlayerController h;
    public static LivePlayerActivity _this = null;
    public static List<BiliLiveContent> lives = null;
    public static int live_index = -1;

    @Override
    public int g() {
        return 2131361822;
    }

    public static Intent a(Context context, BiliLiveContent biliLiveContent) {
        Intent intent = new Intent(context, (Class<?>) LivePlayerActivity.class);
        intent.putExtra("bili_live", biliLiveContent);
        intent.addFlags(604045312);
        return intent;
    }

    @Override
    public void f() {
        getWindow().addFlags(j.h);
        getWindow().setFlags(1024, 1024);
        adl.a(getWindow().getDecorView());
    }

    @Override
    public void a(Bundle bundle) {
        Intent intent = getIntent();
        if (intent != null) {
            this.a = (BiliLiveContent) intent.getParcelableExtra("bili_live");
            if (this.a.hasPlayUrl()) {
                this.a.getPlayUrl();
            }
            if (this.a != null) {
                this.b = this.a.mPlayUrl;
                this.c = this.a.mTitle;
                this.d = this.a.mRoomId;
            }
        }
        if (this.a == null || TextUtils.isEmpty(this.b)) {
            lr.b(this, "播放地址为空!!!");
            finish();
            return;
        }
        this.g = (LiveVideoPlayer) d(2131231071);
        this.g.a(this.b, this.c, Integer.valueOf(this.d));
        this.g.m();
        this.g.setOnClickListener(this);
        this.g.requestFocus();
        this.h = (LivePlayerController) d(2131230933);
        this.h.setFirstText(this.c);
        this.h.setSecondText(this.a.mUname + " · " + this.a.mArea + " · " + this.d);
        this.h.setUpAvatar(this.a.mFace);
        this.h.setControllerListener(this);
        this.h.setPlayer(this.g);
        this.h.setBiliLive(this.a);
        ((View) this.h.getParent()).setOnClickListener(this);
        this.g.danmakuClient = new DanmakuClient(this.d);
        _this = this;
    }

    @Override
    protected void attachBaseContext(Context context) {
        super.attachBaseContext(abt.a(context));
    }

    @Override
    public void onClick(View view) {
        boolean show = this.h.getShow();
        boolean e = wm.e();
        if (!show && e) {
            this.h.a(true);
        } else if (show) {
            this.h.a(false);
        }
    }

    @Override
    public boolean onKeyUp(int i, KeyEvent keyEvent) {
        boolean show = this.h.getShow();
        boolean e = wm.e();
        if (i != 4) {
            if (i != 82) {
            }
            if ((i == 82 || i == 66 || i == 23) && !show && e) {
                this.h.a(true);
            }
            if (i == 19 && !show) {
                if (live_index > 0) {
                    live_index--;
                    this.f = false;
                    refresh();
                } else {
                    lr.b(this, "已经到顶了");
                }
            }
            if (i == 20 && !show) {
                if (live_index < lives.size() - 1) {
                    live_index++;
                    this.f = false;
                    refresh();
                } else {
                    lr.b(this, "已经到底了");
                }
            }
            this.h.a(i, keyEvent);
        } else if (show) {
            this.h.a();
        } else {
            i();
            this.f = true;
        }
        return h();
    }

    private boolean h() {
        return this.e != null && this.e.isShowing();
    }

    public void refresh() {
        finish();
        startActivity(a(this, lives.get(live_index)));
    }

    private void i() {
        if (BiliFilter.fastquit_on) {
            this.f = false;
            finish();
            return;
        }
        if (this.e == null) {
            this.e = new agb.a(this).a(1).a("确定要退出播放吗?").a("继续播放", new agb.b() {
                @Override
                public void a(agb agbVar, View view) {
                    LivePlayerActivity.this.e.dismiss();
                    adl.a(LivePlayerActivity.this.getWindow().getDecorView());
                }
            }).b("确认退出", new agb.b() {
                @Override
                public void a(agb agbVar, View view) {
                    LivePlayerActivity.this.e.dismiss();
                    LivePlayerActivity.this.f = false;
                    LivePlayerActivity.this.finish();
                }
            }).a();
            this.e.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    if (!wm.e() && LivePlayerActivity.this.f) {
                        wm.g();
                        LivePlayerActivity.this.f = false;
                    }
                }
            });
        }
        if (this.e.isShowing()) {
            this.e.dismiss();
            return;
        }
        this.e.show();
        if (wm.e()) {
            wm.f();
            this.f = true;
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        this.g.f();
    }

    @Override
    public void onPause() {
        super.onPause();
        this.g.e();
    }

    @Override
    public void onDestroy() {
        if (this.g != null) {
            this.g.i();
        }
        this.e = null;
        super.onDestroy();
    }
}