WebPlayerView$CoubVideoTask.smali

.class Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;
.super Landroid/os/AsyncTask;
.source "WebPlayerView.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lim/tpelyyftgw/ui/components/WebPlayerView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "CoubVideoTask"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask<",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        "Ljava/lang/String;",
        ">;"
    }
.end annotation


# instance fields
.field private canRetry:Z

.field private results:[Ljava/lang/String;

.field final synthetic this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

.field private videoId:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    return-void
.end method

.method public constructor <init>(Lim/tpelyyftgw/ui/components/WebPlayerView;Ljava/lang/String;)V
    .registers 3
    .param p2, "vid"    # Ljava/lang/String;

    .line 1079
    iput-object p1, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    .line 1076
    const/4 p1, 0x1

    iput-boolean p1, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->canRetry:Z

    .line 1077
    const/4 p1, 0x4

    new-array p1, p1, [Ljava/lang/String;

    iput-object p1, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    .line 1080
    iput-object p2, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->videoId:Ljava/lang/String;

    .line 1081
    return-void
.end method

.method private decodeUrl(Ljava/lang/String;)Ljava/lang/String;
    .registers 7
    .param p1, "input"    # Ljava/lang/String;

    .line 1084
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0, p1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 1085
    .local v0, "source":Ljava/lang/StringBuilder;
    const/4 v1, 0x0

    .local v1, "a":I
    :goto_6
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->length()I

    move-result v2

    if-ge v1, v2, :cond_22

    .line 1086
    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->charAt(I)C

    move-result v2

    .line 1087
    .local v2, "c":C
    invoke-static {v2}, Ljava/lang/Character;->toLowerCase(C)C

    move-result v3

    .line 1088
    .local v3, "lower":C
    if-ne v2, v3, :cond_1b

    invoke-static {v2}, Ljava/lang/Character;->toUpperCase(C)C

    move-result v4

    goto :goto_1c

    :cond_1b
    move v4, v3

    :goto_1c
    invoke-virtual {v0, v1, v4}, Ljava/lang/StringBuilder;->setCharAt(IC)V

    .line 1085
    .end local v2    # "c":C
    .end local v3    # "lower":C
    add-int/lit8 v1, v1, 0x1

    goto :goto_6

    .line 1091
    .end local v1    # "a":I
    :cond_22
    :try_start_22
    new-instance v1, Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    const/4 v3, 0x0

    invoke-static {v2, v3}, Landroid/util/Base64;->decode(Ljava/lang/String;I)[B

    move-result-object v2

    sget-object v3, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;

    invoke-direct {v1, v2, v3}, Ljava/lang/String;-><init>([BLjava/nio/charset/Charset;)V
    :try_end_32
    .catch Ljava/lang/Exception; {:try_start_22 .. :try_end_32} :catch_33

    return-object v1

    .line 1092
    :catch_33
    move-exception v1

    .line 1093
    .local v1, "ignore":Ljava/lang/Exception;
    const/4 v2, 0x0

    return-object v2
.end method


# virtual methods
.method protected bridge synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .registers 2

    .line 1073
    check-cast p1, [Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->doInBackground([Ljava/lang/Void;)Ljava/lang/String;

    move-result-object p1

    return-object p1
.end method

.method protected varargs doInBackground([Ljava/lang/Void;)Ljava/lang/String;
    .registers 11
    .param p1, "voids"    # [Ljava/lang/Void;

    .line 1098
    const-string v0, "other"

    iget-object v1, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    sget-object v2, Ljava/util/Locale;->US:Ljava/util/Locale;

    const/4 v3, 0x1

    new-array v4, v3, [Ljava/lang/Object;

    iget-object v5, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->videoId:Ljava/lang/String;

    const/4 v6, 0x0

    aput-object v5, v4, v6

    const-string v5, "https://coub.com/api/v2/coubs/%s.json"

    invoke-static {v2, v5, v4}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, p0, v2}, Lim/tpelyyftgw/ui/components/WebPlayerView;->downloadUrlContent(Landroid/os/AsyncTask;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 1099
    .local v1, "playerCode":Ljava/lang/String;
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->isCancelled()Z

    move-result v2

    const/4 v4, 0x0

    if-eqz v2, :cond_20

    .line 1100
    return-object v4

    .line 1103
    :cond_20
    :try_start_20
    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2, v1}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string v5, "file_versions"

    invoke-virtual {v2, v5}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v2

    const-string v5, "mobile"

    invoke-virtual {v2, v5}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v2

    .line 1104
    .local v2, "json":Lorg/json/JSONObject;
    const-string v5, "gifv"

    invoke-virtual {v2, v5}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-direct {p0, v5}, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->decodeUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    .line 1105
    .local v5, "video":Ljava/lang/String;
    const-string v7, "audio"

    invoke-virtual {v2, v7}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v7

    invoke-virtual {v7, v6}, Lorg/json/JSONArray;->getString(I)Ljava/lang/String;

    move-result-object v7

    .line 1106
    .local v7, "audio":Ljava/lang/String;
    if-eqz v5, :cond_5b

    if-eqz v7, :cond_5b

    .line 1107
    iget-object v8, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    aput-object v5, v8, v6

    .line 1108
    iget-object v8, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    aput-object v0, v8, v3

    .line 1109
    iget-object v3, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    const/4 v8, 0x2

    aput-object v7, v3, v8

    .line 1110
    iget-object v3, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    const/4 v8, 0x3

    aput-object v0, v3, v8
    :try_end_5b
    .catch Ljava/lang/Exception; {:try_start_20 .. :try_end_5b} :catch_5c

    .line 1114
    .end local v2    # "json":Lorg/json/JSONObject;
    .end local v5    # "video":Ljava/lang/String;
    .end local v7    # "audio":Ljava/lang/String;
    :cond_5b
    goto :goto_60

    .line 1112
    :catch_5c
    move-exception v0

    .line 1113
    .local v0, "e":Ljava/lang/Exception;
    invoke-static {v0}, Lim/tpelyyftgw/messenger/FileLog;->e(Ljava/lang/Throwable;)V

    .line 1115
    .end local v0    # "e":Ljava/lang/Exception;
    :goto_60
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->isCancelled()Z

    move-result v0

    if-eqz v0, :cond_67

    goto :goto_6b

    :cond_67
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    aget-object v4, v0, v6

    :goto_6b
    return-object v4
.end method

.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
    .registers 2

    .line 1073
    check-cast p1, Ljava/lang/String;

    invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->onPostExecute(Ljava/lang/String;)V

    return-void
.end method

.method protected onPostExecute(Ljava/lang/String;)V
    .registers 6
    .param p1, "result"    # Ljava/lang/String;

    .line 1120
    if-eqz p1, :cond_47

    .line 1121
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    const/4 v1, 0x1

    invoke-static {v0, v1}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1302(Lim/tpelyyftgw/ui/components/WebPlayerView;Z)Z

    .line 1122
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    invoke-static {v0, p1}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1402(Lim/tpelyyftgw/ui/components/WebPlayerView;Ljava/lang/String;)Ljava/lang/String;

    .line 1123
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    iget-object v2, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    aget-object v2, v2, v1

    invoke-static {v0, v2}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1502(Lim/tpelyyftgw/ui/components/WebPlayerView;Ljava/lang/String;)Ljava/lang/String;

    .line 1124
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    iget-object v2, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    const/4 v3, 0x2

    aget-object v2, v2, v3

    invoke-static {v0, v2}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$2402(Lim/tpelyyftgw/ui/components/WebPlayerView;Ljava/lang/String;)Ljava/lang/String;

    .line 1125
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    iget-object v2, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->results:[Ljava/lang/String;

    const/4 v3, 0x3

    aget-object v2, v2, v3

    invoke-static {v0, v2}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$2502(Lim/tpelyyftgw/ui/components/WebPlayerView;Ljava/lang/String;)Ljava/lang/String;

    .line 1126
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    invoke-static {v0}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1700(Lim/tpelyyftgw/ui/components/WebPlayerView;)Z

    move-result v0

    if-eqz v0, :cond_37

    .line 1127
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    invoke-static {v0}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1800(Lim/tpelyyftgw/ui/components/WebPlayerView;)V

    .line 1129
    :cond_37
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    const/4 v2, 0x0

    invoke-static {v0, v2, v1}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1900(Lim/tpelyyftgw/ui/components/WebPlayerView;ZZ)V

    .line 1130
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    invoke-static {v0}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$100(Lim/tpelyyftgw/ui/components/WebPlayerView;)Lim/tpelyyftgw/ui/components/WebPlayerView$ControlsView;

    move-result-object v0

    invoke-virtual {v0, v1, v1}, Lim/tpelyyftgw/ui/components/WebPlayerView$ControlsView;->show(ZZ)V

    goto :goto_52

    .line 1131
    :cond_47
    invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->isCancelled()Z

    move-result v0

    if-nez v0, :cond_52

    .line 1132
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$CoubVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;

    invoke-static {v0}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$2000(Lim/tpelyyftgw/ui/components/WebPlayerView;)V

    .line 1134
    :cond_52
    :goto_52
    return-void
.end method