AgentWebViewUtils.smali
.class public Lcom/sandboxol/center/utils/AgentWebViewUtils;
.super Ljava/lang/Object;
.source "AgentWebViewUtils.java"
# static fields
.field private static final JS_HIDE_YOUTUBE_MORE_VIDEO:Ljava/lang/String; = "javascript:document.onclick= function(){document.querySelector(\'.ytp-pause-overlay\').style.visibility=\'hidden\'}"
.field private static final JS_HIDE_YOUTUBE_TITLE:Ljava/lang/String; = "javascript:(function() { document.querySelector(\'.ytp-chrome-top\').style.display=\'none\'; })();"
.field public static agentWeb:Lcom/just/agentweb/AgentWeb;
# direct methods
.method public constructor <init>()V
.registers 1
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static getLoopVideo(Ljava/lang/String;)Ljava/lang/String;
.registers 3
.line 1
invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_7
goto :goto_2c
:cond_7
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v1, "?autoplay=1&loop=1&playlist="
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v1, "/"
invoke-virtual {p0, v1}, Ljava/lang/String;->lastIndexOf(Ljava/lang/String;)I
move-result v1
add-int/lit8 v1, v1, 0x1
invoke-virtual {p0, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;
move-result-object p0
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p0, "&muted=1"
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
:goto_2c
return-object p0
.end method
.method public static initAgentWebView(Landroid/app/Activity;Landroid/view/ViewGroup;Ljava/lang/String;)Lcom/just/agentweb/AgentWeb;
.registers 6
.line 1
invoke-static {p0}, Lcom/just/agentweb/AgentWeb;->with(Landroid/app/Activity;)Lcom/just/agentweb/AgentWeb$AgentBuilder;
move-result-object v0
new-instance v1, Landroid/widget/LinearLayout$LayoutParams;
const/4 v2, -0x1
invoke-direct {v1, v2, v2}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V
.line 2
invoke-virtual {v0, p1, v1}, Lcom/just/agentweb/AgentWeb$AgentBuilder;->setAgentWebParent(Landroid/view/ViewGroup;Landroid/view/ViewGroup$LayoutParams;)Lcom/just/agentweb/AgentWeb$IndicatorBuilder;
move-result-object p1
.line 3
invoke-virtual {p1}, Lcom/just/agentweb/AgentWeb$IndicatorBuilder;->useDefaultIndicator()Lcom/just/agentweb/AgentWeb$CommonBuilder;
move-result-object p1
new-instance v0, Lcom/sandboxol/center/utils/AgentWebViewUtils$2;
invoke-direct {v0, p0}, Lcom/sandboxol/center/utils/AgentWebViewUtils$2;-><init>(Landroid/app/Activity;)V
.line 4
invoke-virtual {p1, v0}, Lcom/just/agentweb/AgentWeb$CommonBuilder;->setWebChromeClient(Lcom/just/agentweb/WebChromeClient;)Lcom/just/agentweb/AgentWeb$CommonBuilder;
move-result-object p0
new-instance p1, Lcom/sandboxol/center/utils/AgentWebViewUtils$1;
invoke-direct {p1}, Lcom/sandboxol/center/utils/AgentWebViewUtils$1;-><init>()V
.line 5
invoke-virtual {p0, p1}, Lcom/just/agentweb/AgentWeb$CommonBuilder;->setWebViewClient(Lcom/just/agentweb/WebViewClient;)Lcom/just/agentweb/AgentWeb$CommonBuilder;
move-result-object p0
.line 6
invoke-virtual {p0}, Lcom/just/agentweb/AgentWeb$CommonBuilder;->createAgentWeb()Lcom/just/agentweb/AgentWeb$PreAgentWeb;
move-result-object p0
.line 7
invoke-virtual {p0}, Lcom/just/agentweb/AgentWeb$PreAgentWeb;->ready()Lcom/just/agentweb/AgentWeb$PreAgentWeb;
move-result-object p0
.line 8
invoke-static {p2}, Lcom/sandboxol/center/utils/AgentWebViewUtils;->getLoopVideo(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
invoke-virtual {p0, p1}, Lcom/just/agentweb/AgentWeb$PreAgentWeb;->go(Ljava/lang/String;)Lcom/just/agentweb/AgentWeb;
move-result-object p0
sput-object p0, Lcom/sandboxol/center/utils/AgentWebViewUtils;->agentWeb:Lcom/just/agentweb/AgentWeb;
.line 9
sget-object p0, Lcom/sandboxol/center/utils/AgentWebViewUtils;->agentWeb:Lcom/just/agentweb/AgentWeb;
invoke-virtual {p0}, Lcom/just/agentweb/AgentWeb;->getAgentWebSettings()Lcom/just/agentweb/IAgentWebSettings;
move-result-object p0
invoke-interface {p0}, Lcom/just/agentweb/IAgentWebSettings;->getWebSettings()Landroid/webkit/WebSettings;
move-result-object p0
.line 10
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
const/4 p2, 0x0
const/16 v0, 0x11
if-lt p1, v0, :cond_4a
.line 11
invoke-virtual {p0, p2}, Landroid/webkit/WebSettings;->setMediaPlaybackRequiresUserGesture(Z)V
.line 12
:cond_4a
invoke-virtual {p0, p2}, Landroid/webkit/WebSettings;->setBuiltInZoomControls(Z)V
.line 13
invoke-virtual {p0, p2}, Landroid/webkit/WebSettings;->setSupportZoom(Z)V
.line 14
invoke-virtual {p0, p2}, Landroid/webkit/WebSettings;->setDisplayZoomControls(Z)V
.line 15
sget-object p0, Lcom/sandboxol/center/utils/AgentWebViewUtils;->agentWeb:Lcom/just/agentweb/AgentWeb;
invoke-virtual {p0}, Lcom/just/agentweb/AgentWeb;->getWebCreator()Lcom/just/agentweb/WebCreator;
move-result-object p0
invoke-interface {p0}, Lcom/just/agentweb/WebCreator;->getWebView()Landroid/webkit/WebView;
move-result-object p0
const/high16 p1, -0x1000000
invoke-virtual {p0, p1}, Landroid/webkit/WebView;->setBackgroundColor(I)V
.line 16
sget-object p0, Lcom/sandboxol/center/utils/AgentWebViewUtils;->agentWeb:Lcom/just/agentweb/AgentWeb;
return-object p0
.end method