PurchaseFragment$2.smali

.class Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;
.super Ljava/lang/Object;
.source "PurchaseFragment.java"

# interfaces
.implements Lcom/android/volley/Response$Listener;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/yctpublication/mastes/purchase/PurchaseFragment;->getPackageList()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lcom/android/volley/Response$Listener<",
        "Lorg/json/JSONObject;",
        ">;"
    }
.end annotation


# instance fields
.field final synthetic this$0:Lcom/yctpublication/mastes/purchase/PurchaseFragment;


# direct methods
.method constructor <init>(Lcom/yctpublication/mastes/purchase/PurchaseFragment;)V
    .registers 2
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x8010
        }
        names = {
            "this$0"
        }
    .end annotation

    .line 133
    iput-object p1, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;->this$0:Lcom/yctpublication/mastes/purchase/PurchaseFragment;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public bridge synthetic onResponse(Ljava/lang/Object;)V
    .registers 2
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x1000
        }
        names = {
            "response"
        }
    .end annotation

    .line 133
    check-cast p1, Lorg/json/JSONObject;

    invoke-virtual {p0, p1}, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;->onResponse(Lorg/json/JSONObject;)V

    return-void
.end method

.method public onResponse(Lorg/json/JSONObject;)V
    .registers 7
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x0
        }
        names = {
            "response"
        }
    .end annotation

    const/4 v0, 0x0

    :try_start_1
    const-string v1, "status"

    .line 137
    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->getBoolean(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_56

    .line 139
    new-instance v1, Lorg/json/JSONArray;

    const-string v2, "data"

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

    move-result-object p1

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

    move p1, v0

    .line 140
    :goto_15
    invoke-virtual {v1}, Lorg/json/JSONArray;->length()I

    move-result v2

    if-ge p1, v2, :cond_56

    .line 141
    new-instance v2, Lcom/google/gson/Gson;

    invoke-direct {v2}, Lcom/google/gson/Gson;-><init>()V

    .line 142
    invoke-virtual {v1, p1}, Lorg/json/JSONArray;->getString(I)Ljava/lang/String;

    move-result-object v3

    const-class v4, Lcom/yctpublication/mastes/models/PackageModel;

    invoke-virtual {v2, v3, v4}, Lcom/google/gson/Gson;->fromJson(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/yctpublication/mastes/models/PackageModel;

    .line 143
    iget-object v3, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;->this$0:Lcom/yctpublication/mastes/purchase/PurchaseFragment;

    iget-object v3, v3, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->packageList:Ljava/util/ArrayList;

    invoke-virtual {v3, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 144
    iget-object v2, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;->this$0:Lcom/yctpublication/mastes/purchase/PurchaseFragment;

    iget-object v2, v2, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->recyclerView:Landroidx/recyclerview/widget/RecyclerView;

    iget-object v3, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;->this$0:Lcom/yctpublication/mastes/purchase/PurchaseFragment;

    iget-object v3, v3, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->adapter:Landroidx/recyclerview/widget/RecyclerView$Adapter;

    invoke-virtual {v2, v3}, Landroidx/recyclerview/widget/RecyclerView;->setAdapter(Landroidx/recyclerview/widget/RecyclerView$Adapter;)V
    :try_end_3e
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_3e} :catch_41

    add-int/lit8 p1, p1, 0x1

    goto :goto_15

    :catch_41
    move-exception p1

    .line 152
    invoke-virtual {p1}, Lorg/json/JSONException;->printStackTrace()V

    .line 153
    iget-object v1, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;->this$0:Lcom/yctpublication/mastes/purchase/PurchaseFragment;

    invoke-virtual {v1}, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {p1}, Lorg/json/JSONException;->getLocalizedMessage()Ljava/lang/String;

    move-result-object p1

    invoke-static {v1, p1, v0}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object p1

    invoke-virtual {p1}, Landroid/widget/Toast;->show()V

    .line 155
    :cond_56
    iget-object p1, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;->this$0:Lcom/yctpublication/mastes/purchase/PurchaseFragment;

    iget-object p1, p1, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->progressBar:Landroid/widget/ProgressBar;

    const/16 v0, 0x8

    invoke-virtual {p1, v0}, Landroid/widget/ProgressBar;->setVisibility(I)V

    return-void
.end method