九游游戏中心HD v4.6.8.1版本的 MD5 值为:78c397802cc5ffdcc7f5502ede90502e
以下内容为反编译后的 l.java 源代码,内容仅作参考
package cn.ninegame.gamemanager.video;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.MediaController;
import cn.ninegame.framework.NineGameClientApplication;
import cn.ninegame.gamemanager.video.a.a;
import cn.ninegame.gamemanager.video.parcel.ArticleVideoInfo;
import cn.ninegame.gamemanager.video.view.MediaControllerView;
import cn.ninegame.gamemanager.video.view.VideoStateView;
import cn.ninegame.gamemanagerhd.R;
import cn.ninegame.genericframework.ui.BaseActivity;
import cn.ninegame.library.network.net.request.aa;
import cn.ninegame.library.util.cc;
import com.UCMobile.Apollo.AutoVideoView;
import com.UCMobile.Apollo.SmartMediaPlayer;
import com.UCMobile.Apollo.VideoView;
import com.c.a.a;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
public final class l extends FrameLayout implements View.OnClickListener, k {
private int A;
public AutoVideoView f1659a;
public MediaController b;
public MediaControllerView c;
public a d;
public int e;
public int f;
public b g;
boolean h;
public String i;
public boolean j;
public ArticleVideoInfo k;
public a.b l;
public cn.ninegame.b.b.d m;
private VideoStateView n;
private int o;
private cn.ninegame.gamemanager.video.a.a p;
private Activity q;
private Timer r;
private boolean s;
private boolean t;
private final int u;
private final int v;
private com.c.a.d w;
private com.c.a.d x;
private com.c.a.d y;
private com.c.a.d z;
public static a.b k(l lVar) {
lVar.l = null;
return null;
}
public l(Context context) {
this(context, (byte) 0);
}
private l(Context context, byte b2) {
this(context, (char) 0);
}
private l(Context context, char c) {
super(context, null, 0);
this.d = new a(cn.ninegame.genericframework.basic.g.a().b().a());
this.p = new cn.ninegame.gamemanager.video.a.a();
this.s = false;
this.h = false;
this.u = 300;
this.v = 3500;
this.i = "";
this.j = true;
this.m = new u(this);
this.q = cn.ninegame.genericframework.basic.g.a().b().a();
LayoutInflater.from(getContext()).inflate(R.layout.video_activity, this);
this.c = (MediaControllerView) findViewById(R.id.media_controller_container);
this.c.findViewById(R.id.full_screen).setVisibility(0);
this.c.findViewById(R.id.resolution).setVisibility(8);
this.c.b = this;
this.n = (VideoStateView) findViewById(R.id.video_state_container);
this.n.f1674a = this;
this.p.d = getResources().getString(R.string.video_init_tips);
a(a.b.PAUSE);
if (cn.ninegame.b.f.j.e().d.f325a) {
n();
} else {
cn.ninegame.b.f.j.e().a(this.m);
}
this.c.setVisibility(8);
}
public final void a(a.b bVar) {
this.p.f1645a = bVar;
if (a.b.PLAY.equals(bVar)) {
if (this.s) {
this.p.b = a.EnumC0048a.PLAY_SEEK;
} else if (l()) {
this.p.b = a.EnumC0048a.PLAY_PAUSE;
} else {
this.p.b = null;
a((View) this.n, false, this.t);
}
}
if (a.b.LOADING.equals(bVar) || a.b.ERROR.equals(bVar) || a.b.NET_WORK_CHANGE.equals(bVar) || a.b.REPLAY.equals(bVar)) {
a((View) this.n, true, this.t);
}
this.n.a(this.p);
this.c.c = this.p;
}
public boolean l() {
return this.c.getVisibility() == 0;
}
private void a(View view, boolean z, boolean z2) {
com.c.a.m a2;
this.t = z;
if (z2) {
if (z) {
a2 = com.c.a.m.a(view, "alpha", 1.0f, 1.0f);
} else {
a2 = com.c.a.m.a(view, "alpha", 1.0f, 0.0f);
}
} else if (z) {
a2 = com.c.a.m.a(view, "alpha", 0.0f, 1.0f);
} else {
a2 = com.c.a.m.a(view, "alpha", 0.0f, 0.0f);
}
a2.b(300L);
a2.a();
}
public void m() {
this.d.removeMessages(8);
this.d.sendEmptyMessageDelayed(8, 3500L);
}
public void n() {
this.f1659a = new AutoVideoView(NineGameClientApplication.a());
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -2);
layoutParams.gravity = 17;
((FrameLayout) findViewById(R.id.play_frame)).addView(this.f1659a, 0, layoutParams);
this.b = new MediaController(getContext());
this.b.setVisibility(8);
this.b.setAnchorView(this.f1659a);
this.f1659a.setMediaController(this.b);
this.f1659a.setPlayerType(SmartMediaPlayer.PlayerType.R2_PLAYER);
m mVar = new m(this);
this.n.setOnTouchListener(mVar);
this.c.setOnTouchListener(mVar);
this.f1659a.setOnTouchListener(mVar);
this.c.d = new n(this);
this.A = getResources().getDimensionPixelOffset(R.dimen.video_activity_bar_height);
this.p.d = "";
a(a.b.LOADING);
this.f1659a.setVideoScalingMode(0);
this.f1659a.setOnCompletionListener(new o(this));
this.f1659a.setOnErrorListener(new p(this));
this.f1659a.setOnInfoListener(new q(this));
this.f1659a.setOnPreparedListener(new r(this));
}
public void o() {
if (this.r == null) {
this.r = new Timer();
this.g = new b(this.d);
this.r.schedule(this.g, 0L, 1000L);
}
}
public static class b extends TimerTask {
a f1661a;
public b(a aVar) {
this.f1661a = aVar;
}
@Override
public final void run() {
if (this.f1661a != null) {
this.f1661a.sendEmptyMessage(1);
}
}
}
public final void i() {
if (this.g != null) {
this.g.cancel();
this.g = null;
}
if (this.r != null) {
this.r.cancel();
this.r.purge();
this.r = null;
}
}
public final boolean j() {
return this.p.f1645a == a.b.PLAY;
}
private void p() {
if (this.k != null) {
a(this.k);
} else {
new aa(this.i, "normal").a(new s(this));
}
}
public void a(ArticleVideoInfo articleVideoInfo) {
if (articleVideoInfo != null && !this.q.isFinishing()) {
a(a.b.LOADING);
String str = articleVideoInfo.getVideoList()[0].fragments[0].url;
if (str == null || this.f1659a == null) {
return;
}
this.f1659a.stopPlayback();
HashMap hashMap = new HashMap();
String apolloUA = articleVideoInfo.getApolloUA();
String a2 = cn.ninegame.library.network.datadroid.d.b.a();
if (TextUtils.isEmpty(apolloUA)) {
apolloUA = "UCWEB/2.0 (####) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile";
}
String replace = apolloUA.replace("####", a2);
cn.ninegame.library.stat.b.b.a("Apollo UA:" + replace, new Object[0]);
hashMap.put("User-Agent", replace);
if (str.startsWith("http")) {
this.f1659a.setVideoURI(Uri.parse(str), hashMap);
} else {
this.f1659a.setVideoPath(str);
}
VideoView videoView = this.f1659a.getVideoView();
if (videoView != null) {
String apolloSetting = articleVideoInfo.getApolloSetting();
if (TextUtils.isEmpty(apolloSetting)) {
apolloSetting = "{\"rw.global.ap_seek_buf\":\"1000\", \"rw.instance.abc\":\"test\"}";
}
videoView.setApolloSettings(apolloSetting);
}
this.f1659a.start();
}
}
public void a(boolean z) {
this.w = a(this.w, 0, false);
this.x = a(this.x, 0, true);
this.y = a(this.y, this.A, false);
this.z = a(this.z, this.A, true);
if (!((this.w != null && this.w.d()) || (this.y != null && this.y.d()) || ((this.x != null && this.x.d()) || (this.z != null && this.z.d())))) {
if (z) {
if (!l()) {
if (this.p.f1645a == a.b.PLAY || this.p.f1645a == a.b.PAUSE) {
this.x.a();
this.t = true;
return;
}
this.w.a();
}
} else if (l()) {
if (this.p.f1645a == a.b.PLAY || this.p.f1645a == a.b.PAUSE) {
this.z.a();
this.t = false;
return;
}
this.y.a();
}
}
}
private com.c.a.d a(com.c.a.d dVar, int i, boolean z) {
if (dVar == null) {
dVar = new com.c.a.d();
dVar.a((Interpolator) new LinearInterpolator());
dVar.a(300L);
ArrayList arrayList = new ArrayList();
com.c.a.m a2 = com.c.a.m.a(this.c, "translationY", -i);
a2.a((a.InterfaceC0135a) new t(this, i));
arrayList.add(a2);
arrayList.add(com.c.a.m.a(this.c, "translationY", i));
if (z) {
if (i == 0) {
arrayList.add(com.c.a.m.a(this.n, "alpha", 0.0f, 1.0f));
} else {
arrayList.add(com.c.a.m.a(this.n, "alpha", 1.0f, 0.0f));
}
}
dVar.a((Collection<com.c.a.a>) arrayList);
}
return dVar;
}
public class a extends Handler {
private final WeakReference<Activity> b;
public a(Activity activity) {
this.b = new WeakReference<>(activity);
}
@Override
public final void handleMessage(Message message) {
if (this.b.get() == null) {
l.this.d.removeMessages(message.what);
} else if (l.this.f1659a != null) {
try {
switch (message.what) {
case 1:
l.this.e = l.this.f1659a.getCurrentPosition();
l.this.f = l.this.e;
l.this.c.a(l.this.e, l.this.f1659a.getBufferPercentage() + 1);
break;
case 8:
if (l.this.f1659a.isPlaying() && l.this.l()) {
l.this.a(false);
break;
}
break;
}
} catch (Exception e) {
cn.ninegame.library.stat.b.b.a(e);
}
}
}
}
public void q() {
this.h = true;
this.p.b = null;
a(a.b.REPLAY);
cn.ninegame.library.stat.a.j.b().a("videoending", "spbf_bfjs", "n");
}
@Override
public final void onClick(View view) {
}
@Override
public final void a() {
if (this.p.f1645a == a.b.REPLAY) {
c();
} else if (this.p.f1645a != a.b.ERROR) {
if (this.p.f1645a == a.b.NET_WORK_CHANGE) {
p();
} else if (this.f1659a != null) {
if (this.j) {
k();
this.j = false;
return;
}
if (a.b.COMPLETE.equals(this.p.f1645a)) {
this.f1659a.seekTo(this.e);
}
if (!a.b.PAUSE.equals(this.l)) {
this.f1659a.start();
a(a.b.PLAY);
} else {
b();
}
o();
m();
}
} else {
k();
}
}
@Override
public final void a(int i) {
if (this.f1659a != null) {
this.h = false;
this.f1659a.seekTo(i);
if (i >= this.o && !this.h) {
this.h = true;
q();
}
if (!this.h) {
if (this.p.f1645a != a.b.PLAY) {
this.e = i;
this.f = this.e;
if (a.b.REPLAY.equals(this.p.f1645a)) {
this.p.f1645a = a.b.COMPLETE;
}
a();
}
o();
}
}
}
@Override
public final void b() {
if (this.f1659a != null) {
a(a.b.PAUSE);
try {
this.f1659a.pause();
} catch (Exception e) {
cn.ninegame.library.stat.b.b.b(e);
}
a(true);
i();
}
}
@Override
public final void c() {
if (this.f1659a != null) {
this.f1659a.seekTo(0);
this.e = 0;
this.f = this.e;
a(a.b.PLAY);
this.f1659a.start();
}
}
@Override
public final void d() {
k();
}
@Override
public final void e() {
cn.ninegame.library.util.l.e(this.i);
}
@Override
public final void h() {
}
@Override
public final void a(String str) {
}
@Override
public final void f() {
}
@Override
public final void g() {
ArrayList<String> arrayList = new ArrayList<>();
ArrayList arrayList2 = new ArrayList();
arrayList.add(this.i);
Fragment a2 = ((BaseActivity) cn.ninegame.genericframework.basic.g.a().b().a()).a();
arrayList2.add(this.k);
Intent intent = new Intent(getContext(), VideoActivity.class);
intent.putStringArrayListExtra(VideoActivity.f1640a, arrayList);
intent.putExtra(VideoActivity.c, arrayList2);
intent.putExtra(VideoActivity.d, true);
intent.putExtra("currentProgress", this.f);
intent.putExtra("status", this.p.f1645a);
a2.startActivityForResult(intent, 123);
}
public final void k() {
cn.ninegame.library.network.a a2 = cn.ninegame.library.network.b.a(NineGameClientApplication.a());
if (a2 == cn.ninegame.library.network.a.WIFI) {
p();
} else if (a2.a()) {
if (this.f1659a != null && this.f1659a.isPlaying()) {
a(a.b.PAUSE);
this.f1659a.pause();
}
a(a.b.NET_WORK_CHANGE);
} else {
if (this.f1659a != null) {
this.f1659a.stopPlayback();
a(a.b.ERROR);
}
cc.b((int) R.string.network_fail);
}
}
public static boolean a(l lVar, SmartMediaPlayer smartMediaPlayer) {
if (lVar.q.isFinishing()) {
if (smartMediaPlayer != null) {
smartMediaPlayer.release();
}
return true;
}
return false;
}
}