Stick Squad 3 v1.2.5.9版本的 MD5 值为:375cf7f77a7075270cd68d1397368279
以下内容为反编译后的 i.java 源代码,内容仅作参考
package io.presage.utils.a;
import android.R;
import android.content.Context;
import android.media.AudioManager;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import io.presage.activities.PresageActivity;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
public final class i extends a implements AudioManager.OnAudioFocusChangeListener, YouTubePlayer.OnInitializedListener, YouTubePlayer.PlayerStateChangeListener {
private YouTubePlayerView b;
private FrameLayout f475c;
private FrameLayout.LayoutParams d;
private FrameLayout.LayoutParams e;
private WebView f;
private YouTubePlayer g;
private AudioManager h;
private boolean i;
private boolean j;
private m k;
private String l;
private String m;
private int n;
public static int f(i iVar) {
iVar.n = -1;
return -1;
}
public i(g gVar, PresageActivity presageActivity, d dVar, io.presage.b.e eVar) {
super(gVar, presageActivity, dVar, eVar);
this.g = null;
this.n = -1;
if (eVar.e() != null) {
Boolean bool = (Boolean) eVar.e().b("muted");
if (bool != null) {
this.i = bool.booleanValue();
} else {
this.i = false;
}
Boolean bool2 = (Boolean) eVar.e().b("auto_start");
if (bool2 != null) {
this.j = bool2.booleanValue();
} else {
this.j = true;
}
String str = (String) eVar.e().b("show_type");
if (str != null) {
if (str.equals("AUTO")) {
this.k = m.AUTO;
} else if (str.equals("MANUAL")) {
this.k = m.MANUAL;
} else {
this.k = m.DIRECT;
}
} else {
this.k = m.DIRECT;
}
this.m = eVar.d().b("youtube_id");
this.l = (String) eVar.e().b("webview_url");
}
}
@Override
public final void h() {
this.h = (AudioManager) d().getSystemService(Context.AUDIO_SERVICE);
this.f475c = new FrameLayout(d());
this.f475c.setBackgroundColor(0);
this.d = new FrameLayout.LayoutParams(-1, -1);
this.d.setMargins(0, 0, 0, 0);
this.f = new WebView(d());
CookieSyncManager.createInstance(d());
CookieManager.getInstance().removeAllCookie();
this.f.setBackgroundColor(0);
this.f.clearHistory();
this.f.clearCache(true);
this.f.clearAnimation();
this.f.resumeTimers();
this.f.getSettings().setJavaScriptEnabled(true);
WebView webView = this.f;
d();
webView.addJavascriptInterface(new s(this, c()), "Presage");
this.f.setWebChromeClient(new l(this));
this.f.setWebViewClient(new WebViewClient());
this.f.setVerticalScrollBarEnabled(false);
this.f.setHorizontalScrollBarEnabled(false);
this.f475c.addView(this.f);
c().a("loaded");
this.f.addJavascriptInterface(new n(this), "PresageVideo");
this.f.loadData("", "text/html", null);
this.f.setBackgroundResource(R.color.transparent);
this.f.setTag("webview");
this.f.loadUrl(this.l);
try {
this.b = new YouTubePlayerView(d());
this.b.initialize("AIzaSyDrGX2EVGpPrxbVzANo1Ws_t7FtdyGWphM", this);
this.b.setOnTouchListener(new j(this));
this.e = new FrameLayout.LayoutParams(-1, -1);
this.e.leftMargin = 0;
this.e.topMargin = 0;
this.e.gravity = 51;
Map map = (Map) c().e().b("zone");
if (map != null) {
a(map);
}
if (this.k != m.DIRECT) {
this.n = this.e.bottomMargin;
this.e.bottomMargin = 99999;
}
this.b.setLayoutParams(this.e);
this.f475c.addView(this.b, this.e);
} catch (Exception e) {
e().a(e.getMessage());
}
}
public void a(Map map) {
Map map2 = (Map) map.get("size");
if (map2 != null) {
Double d = (Double) map2.get("width");
if (d != null && d.doubleValue() > 0.0d) {
this.e.width = io.presage.utils.j.a((int) Math.round(d.doubleValue()));
}
Double d2 = (Double) map2.get("height");
if (d2 != null && d2.doubleValue() > 0.0d) {
this.e.height = io.presage.utils.j.a((int) Math.round(d2.doubleValue()));
}
}
Map map3 = (Map) map.get("margins");
if (map3 != null) {
Double d3 = (Double) map3.get("left");
if (d3 != null && d3.doubleValue() > 0.0d) {
this.e.leftMargin = io.presage.utils.j.a((int) Math.round(d3.doubleValue()));
}
Double d4 = (Double) map3.get("top");
if (d4 != null && d4.doubleValue() > 0.0d) {
this.e.topMargin = io.presage.utils.j.a((int) Math.round(d4.doubleValue()));
}
Double d5 = (Double) map3.get("right");
if (d5 != null && d5.doubleValue() > 0.0d) {
this.e.rightMargin = io.presage.utils.j.a((int) Math.round(d5.doubleValue()));
}
Double d6 = (Double) map3.get("bottom");
if (d6 != null && d6.doubleValue() > 0.0d) {
this.e.bottomMargin = io.presage.utils.j.a((int) Math.round(d6.doubleValue()));
}
}
ArrayList arrayList = (ArrayList) map.get("gravity");
if (arrayList != null) {
this.e.gravity = 0;
Iterator it = arrayList.iterator();
while (it.hasNext()) {
String str = (String) it.next();
if (str.equals("top")) {
this.e.gravity |= 48;
} else if (str.equals("left")) {
this.e.gravity |= 3;
} else if (str.equals("bottom")) {
this.e.gravity |= 80;
} else if (str.equals("right")) {
this.e.gravity |= 5;
} else if (str.equals("center")) {
this.e.gravity |= 17;
} else if (str.equals("center_horizontal")) {
this.e.gravity |= 1;
} else if (str.equals("center_vertical")) {
this.e.gravity |= 16;
}
}
}
}
@Override
public final void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
StringBuilder sb = new StringBuilder();
switch (k.a[youTubeInitializationResult.ordinal()]) {
case 1:
sb.append("CLIENT_LIBRARY_UPDATE_REQUIRED");
break;
case 2:
sb.append("DEVELOPER_KEY_INVALID");
break;
case 3:
sb.append("ERROR_CONNECTING_TO_SERVICE");
break;
case 4:
sb.append("INTERNAL_ERROR");
break;
case 5:
sb.append("INVALID_APPLICATION_SIGNATURE");
break;
case 6:
sb.append("NETWORK_ERROR");
break;
case 7:
sb.append("SERVICE_DISABLED");
break;
case 8:
sb.append("SERVICE_INVALID");
break;
case 9:
sb.append("SERVICE_MISSING");
break;
case 10:
sb.append("SERVICE_VERSION_UPDATE_REQUIRED");
break;
case 11:
sb.append("SUCCESS");
break;
case 12:
sb.append("UNKNOWN_ERROR");
break;
default:
sb.append("SHOULD NOT HAPPEND");
break;
}
e().a(sb.toString());
}
@Override
public final void b() {
super.b();
k();
if (this.f != null) {
this.f.loadUrl("about:blank");
this.f.destroy();
this.f = null;
}
}
@Override
public final void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean z) {
e().b();
this.g = youTubePlayer;
this.g.setManageAudioFocus(false);
if (this.h.requestAudioFocus(this, 3, 1) == 1) {
this.h.setStreamMute(3, this.i);
} else {
this.g.setManageAudioFocus(true);
}
this.g.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS);
this.g.setPlayerStateChangeListener(this);
this.g.cueVideo(this.m);
}
@Override
public final void onAudioFocusChange(int i) {
}
@Override
public final void onVideoStarted() {
}
@Override
public final void onVideoEnded() {
if (this.f != null) {
this.f.loadUrl("javascript:VideoCallback.completed();");
}
}
@Override
public final void onLoading() {
}
@Override
public final void onLoaded(String str) {
if (this.f != null) {
this.f.loadUrl("javascript:VideoCallback.prepared();");
if (this.k == m.AUTO) {
b(true);
}
if (this.j) {
this.g.play();
}
}
}
@Override
public final void onError(YouTubePlayer.ErrorReason errorReason) {
c().b("youtube", "ERROR PLAYING");
if (this.f != null) {
this.f.loadUrl("javascript:VideoCallback.error();");
}
}
@Override
public final void onAdStarted() {
}
@Override
public final void i() {
if (this.g != null) {
this.b.setOnTouchListener(null);
this.g.release();
this.g = null;
}
}
@Override
public final void j() {
if (this.i) {
this.i = !this.i;
this.h.setStreamMute(3, this.i);
}
this.h.abandonAudioFocus(this);
}
@Override
public final FrameLayout f() {
return this.f475c;
}
@Override
public final FrameLayout.LayoutParams g() {
return this.d;
}
public final void b(boolean z) {
if (z) {
this.e.bottomMargin = this.n;
this.b.setLayoutParams(this.e);
this.n = -1;
return;
}
this.n = this.e.bottomMargin;
this.e.bottomMargin = 99999;
this.b.setLayoutParams(this.e);
}
public final void k() {
if (this.b != null) {
ViewGroup viewGroup = (ViewGroup) this.b.getParent();
i();
if (viewGroup != null) {
viewGroup.removeView(this.b);
this.b = null;
}
}
}
}