酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

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


package com.kugou.babu.activity;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.g;
import com.kugou.babu.b.e;
import com.kugou.babu.d.j;
import com.kugou.babu.entity.VideoInfo;
import com.kugou.babu.entity.VideoUrl;
import com.kugou.babu.event.BabuVideoFirstPlayEvent;
import com.kugou.babu.event.BabuVideoFragmentEvent;
import com.kugou.babu.event.BabuVideoPlayerEvent;
import com.kugou.babu.event.BabuVideoSwitchPlayEvent;
import com.kugou.common.R;
import com.kugou.common.base.e;
import com.kugou.common.base.e.c;
import com.kugou.common.base.q;
import com.kugou.common.environment.a;
import com.kugou.common.filemanager.service.a.b;
import com.kugou.common.utils.ag;
import com.kugou.common.utils.ba;
import com.kugou.common.utils.br;
import com.kugou.common.utils.bv;
import com.kugou.common.utils.cj;
import com.kugou.ktv.android.common.activity.KtvBaseFragment;
import com.kugou.ktv.android.protocol.c.i;

@c(a = 0)
public class BabuVideoPlayerFragment extends KtvBaseFragment {

    private e f46347e;
    private VideoInfo f;
    private int g;
    private boolean i;
    private int j;

    public final String f46344b = "zzp";

    private final int f46345c = BabuVideoFragmentEvent.KTV_VIDEO_EVENT_FRAGMENT_RESUME;

    private final int f46346d = BabuVideoFragmentEvent.KTV_VIDEO_EVENT_FRAGMENT_PAUSE;
    private boolean h = false;
    private Handler k = new Handler(Looper.getMainLooper()) {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == 291) {
                BabuVideoPlayerFragment.this.f46347e.a();
            } else {
                if (i != 292) {
                    return;
                }
                BabuVideoPlayerFragment.this.f46347e.b();
            }
        }
    };

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        this.h = true;
        c();
        a(view);
    }

    private void c() {
        Bundle arguments = getArguments();
        if (arguments != null) {
            this.f = (VideoInfo) arguments.getParcelable("videoInfo");
            this.g = arguments.getInt("videoIndex");
        }
    }

    private void a(View view) {
        Log.d("zzp", "attachView " + this.g);
        this.f46347e.a(view);
        this.f46347e.a(this.f);
        g.a(this).a("http://coolshot.bssdl.kugou.com/b16c7052c05f7dd47d5a7781b48367d8.png").a((ImageView) view.findViewById(R.id.babu_homepage_attention_img));
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.i = true;
        this.j = 0;
        this.f46347e = new e(this);
        a(this.f46347e);
    }

    @Override
    public void b(Intent intent) {
        super.b(intent);
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        return layoutInflater.inflate(R.layout.babu_video_player_layout, (ViewGroup) null);
    }

    public void a() {
        Log.d("zzp", "startPlayVideo " + this.g + " getUserVisibleHint:" + getUserVisibleHint() + " mViewCreate:" + this.h);
        if (getUserVisibleHint() && this.h && b()) {
            VideoInfo videoInfo = this.f;
            videoInfo.video_url = "http://fs.mcoolshot.kugou.com/201805291432/ad2353b5125bb96a0e57831bc99f0823/G125/M09/0D/09/vQ0DAFrtXaCAGJFSACOvRH0L-wY587.mp4";
            this.f46347e.a(videoInfo.video_url);
            if (TextUtils.isEmpty(this.f.video_url)) {
                this.k.removeMessages(BabuVideoFragmentEvent.KTV_VIDEO_EVENT_FRAGMENT_RESUME);
                this.k.sendEmptyMessage(BabuVideoFragmentEvent.KTV_VIDEO_EVENT_FRAGMENT_RESUME);
                r();
                return;
            }
            p();
        }
    }

    public boolean a(String str) {
        return ag.v(b.b(ba.c(str), (String) null));
    }

    public void p() {
        boolean a2 = a(this.f.video_url);
        boolean d2 = cj.d(this.r);
        if (cj.c((Context) this.r) || a2) {
            this.f46347e.a(this.f.video_url);
            return;
        }
        if (!d2) {
            bv.b(this.r, getString(R.string.ktv_no_network));
            return;
        }
        Pair pair = new Pair("继续播放", "继续播放");
        if (!a.o()) {
            br.a(this.r, (e.a) null, (DialogInterface.OnDismissListener) null, (Pair<String, String>) pair, new q.a() {
                @Override
                public void onNegativeClick() {
                }

                @Override
                public void onOptionClick(int i) {
                    if (a.o()) {
                        BabuVideoPlayerFragment.this.f46347e.a(BabuVideoPlayerFragment.this.f.video_url);
                    }
                }
            });
        }
        if (br.U(this.r)) {
            br.a(this.r, (Pair<String, String>) pair, 3, new q.a() {
                @Override
                public void onNegativeClick() {
                }

                @Override
                public void onOptionClick(int i) {
                    if (i == 0) {
                        com.kugou.common.q.b.a().h(false);
                        BabuVideoPlayerFragment.this.f46347e.a(BabuVideoPlayerFragment.this.f.video_url);
                    }
                }
            });
        } else {
            this.f46347e.a(this.f.video_url);
        }
    }

    public void q() {
        this.k.removeMessages(BabuVideoFragmentEvent.KTV_VIDEO_EVENT_FRAGMENT_PAUSE);
        this.k.sendEmptyMessage(BabuVideoFragmentEvent.KTV_VIDEO_EVENT_FRAGMENT_PAUSE);
    }

    private void r() {
        new j(this.r).a(this.f.video_hash, this.f.video_id, new j.a() {
            @Override
            public void a(VideoUrl videoUrl) {
                BabuVideoPlayerFragment.this.q();
                if (videoUrl == null || TextUtils.isEmpty(videoUrl.getUrl())) {
                    bv.b(BabuVideoPlayerFragment.this.r, BabuVideoPlayerFragment.this.getString(R.string.babu_video_get_url_fail));
                    return;
                }
                BabuVideoPlayerFragment.this.f.video_url = videoUrl.getUrl();
                BabuVideoPlayerFragment.this.p();
            }

            @Override
            public void a(int i, String str, i iVar) {
                bv.b(BabuVideoPlayerFragment.this.r, BabuVideoPlayerFragment.this.getString(R.string.babu_video_get_url_fail));
                BabuVideoPlayerFragment.this.q();
            }
        });
    }

    @Override
    public void onResume() {
        super.onResume();
        Log.d("zzp", "onResume " + this.g);
        this.f46347e.h();
    }

    @Override
    public void onFragmentPause() {
        super.onFragmentPause();
        Log.d("zzp", "onFragmentPause " + this.g);
        this.f46347e.g();
    }

    @Override
    public void onFragmentResume() {
        super.onFragmentResume();
        Log.d("zzp", "onFragmentResume " + this.g);
        this.f46347e.h();
    }

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

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.d("zzp", "onDestroy " + this.g);
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        Log.d("zzp", "onAttach " + this.g);
    }

    @Override
    public void setUserVisibleHint(boolean z) {
        super.setUserVisibleHint(z);
        Log.d("zzp", "setUserVisibleHint:" + z + " " + this.g);
        com.kugou.babu.b.e eVar = this.f46347e;
        if (eVar != null) {
            eVar.a(z && b());
        }
        if (z) {
            a();
        }
    }

    public void onEventMainThread(BabuVideoFragmentEvent babuVideoFragmentEvent) {
        if (getUserVisibleHint() && isAlive()) {
            int i = babuVideoFragmentEvent.event;
            if (i == 291) {
                onFragmentResume();
            } else {
                if (i != 292) {
                    return;
                }
                onFragmentPause();
            }
        }
    }

    public void onEventMainThread(BabuVideoPlayerEvent babuVideoPlayerEvent) {
        if (getUserVisibleHint() && isAlive()) {
            switch (babuVideoPlayerEvent.event) {
                case 16:
                    u();
                    return;
                case 17:
                    s();
                    return;
                case 18:
                    t();
                    return;
                case 19:
                    Object[] objArr = babuVideoPlayerEvent.objs;
                    a(((Integer) objArr[0]).intValue(), ((Integer) objArr[1]).intValue());
                    return;
                default:
                    return;
            }
        }
    }

    private void s() {
        this.f46347e.e();
        q();
    }

    private void t() {
        if (this.i) {
            a();
        }
    }

    private void a(int i, int i2) {
        if (i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 11) {
            int i3 = this.j;
            if (i3 <= 5) {
                this.j = i3 + 1;
                a();
                return;
            }
            return;
        }
        if (i == 18 || i == 19) {
            com.kugou.g.a.a().a(false);
            a();
        }
    }

    private void u() {
        this.f46347e.m();
    }

    public void onEventMainThread(BabuVideoFirstPlayEvent babuVideoFirstPlayEvent) {
        if (getUserVisibleHint() && isAlive()) {
            a();
        }
    }

    public void onEventMainThread(BabuVideoSwitchPlayEvent babuVideoSwitchPlayEvent) {
        if (!getUserVisibleHint() || !isAlive() || !a(babuVideoSwitchPlayEvent.pageIndex)) {
            com.kugou.babu.b.e eVar = this.f46347e;
            if (eVar != null) {
                eVar.a(false);
                return;
            }
            return;
        }
        com.kugou.babu.b.e eVar2 = this.f46347e;
        if (eVar2 != null) {
            eVar2.a(true);
        }
        a();
    }

    public boolean b() {
        BabuVideoItemFragment babuVideoItemFragment = (BabuVideoItemFragment) getParentFragment();
        return babuVideoItemFragment != null && babuVideoItemFragment.a();
    }

    public boolean a(int i) {
        BabuVideoItemFragment babuVideoItemFragment = (BabuVideoItemFragment) getParentFragment();
        return babuVideoItemFragment != null && babuVideoItemFragment.a(i);
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i != 3 && i != 26) {
            return false;
        }
        this.f46347e.l();
        return false;
    }
}