PurchaseFragment.smali

.class public Lcom/yctpublication/mastes/purchase/PurchaseFragment;
.super Landroidx/fragment/app/Fragment;
.source "PurchaseFragment.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/yctpublication/mastes/purchase/PurchaseFragment$PackageAdapter;
    }
.end annotation


# static fields
.field private static final TXN_REQUEST:I = 0x1


# instance fields
.field adapter:Landroidx/recyclerview/widget/RecyclerView$Adapter;

.field lastSelectedPosition:I

.field layoutManager:Landroidx/recyclerview/widget/RecyclerView$LayoutManager;

.field packageCategory:Lcom/yctpublication/mastes/models/PackageCategoryModel;

.field packageID:Ljava/lang/String;

.field packageList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList<",
            "Lcom/yctpublication/mastes/models/PackageModel;",
            ">;"
        }
    .end annotation
.end field

.field price:Ljava/lang/String;

.field progressBar:Landroid/widget/ProgressBar;

.field recyclerView:Landroidx/recyclerview/widget/RecyclerView;


# direct methods
.method public constructor <init>(Lcom/yctpublication/mastes/models/PackageCategoryModel;)V
    .registers 2
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x0
        }
        names = {
            "packageCategory"
        }
    .end annotation

    .line 61
    invoke-direct {p0}, Landroidx/fragment/app/Fragment;-><init>()V

    .line 62
    iput-object p1, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->packageCategory:Lcom/yctpublication/mastes/models/PackageCategoryModel;

    const/4 p1, -0x1

    .line 63
    iput p1, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->lastSelectedPosition:I

    return-void
.end method

.method static synthetic access$100(Lcom/yctpublication/mastes/purchase/PurchaseFragment;)V
    .registers 1

    .line 44
    invoke-direct {p0}, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->checkout()V

    return-void
.end method

.method private checkout()V
    .registers 4

    .line 111
    new-instance v0, Landroid/content/Intent;

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

    move-result-object v1

    const-class v2, Lcom/yctpublication/mastes/purchase/CheckoutActivity;

    invoke-direct {v0, v1, v2}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 112
    iget-object v1, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->price:Ljava/lang/String;

    const-string v2, "price"

    invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 113
    iget-object v1, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->packageID:Ljava/lang/String;

    const-string v2, "package_id"

    invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v1, "test_id"

    const-string v2, "0"

    .line 114
    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const/4 v1, 0x1

    .line 115
    invoke-virtual {p0, v0, v1}, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->startActivityForResult(Landroid/content/Intent;I)V

    return-void
.end method

.method private getPackageList()V
    .registers 11

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

    move-result-object v0

    invoke-static {v0}, Lcom/yctpublication/mastes/common/LibraryFunctions;->isNetworkConnected(Landroid/content/Context;)Z

    move-result v0

    const/4 v1, 0x0

    if-eqz v0, :cond_44

    .line 123
    iget-object v0, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->progressBar:Landroid/widget/ProgressBar;

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

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

    move-result-object v0

    invoke-static {v0}, Lcom/android/volley/toolbox/Volley;->newRequestQueue(Landroid/content/Context;)Lcom/android/volley/RequestQueue;

    move-result-object v0

    .line 128
    new-instance v1, Ljava/util/HashMap;

    invoke-direct {v1}, Ljava/util/HashMap;-><init>()V

    .line 129
    iget-object v2, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->packageCategory:Lcom/yctpublication/mastes/models/PackageCategoryModel;

    invoke-virtual {v2}, Lcom/yctpublication/mastes/models/PackageCategoryModel;->getId()Ljava/lang/String;

    move-result-object v2

    const-string v3, "pkg_cat_id"

    invoke-interface {v1, v3, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 130
    new-instance v7, Lorg/json/JSONObject;

    invoke-direct {v7, v1}, Lorg/json/JSONObject;-><init>(Ljava/util/Map;)V

    .line 132
    new-instance v1, Lcom/android/volley/toolbox/JsonObjectRequest;

    const/4 v5, 0x1

    new-instance v8, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;

    invoke-direct {v8, p0}, Lcom/yctpublication/mastes/purchase/PurchaseFragment$2;-><init>(Lcom/yctpublication/mastes/purchase/PurchaseFragment;)V

    new-instance v9, Lcom/yctpublication/mastes/purchase/PurchaseFragment$3;

    invoke-direct {v9, p0}, Lcom/yctpublication/mastes/purchase/PurchaseFragment$3;-><init>(Lcom/yctpublication/mastes/purchase/PurchaseFragment;)V

    const-string v6, "https://yctpublication.com/api/get-packages.php"

    move-object v4, v1

    invoke-direct/range {v4 .. v9}, Lcom/android/volley/toolbox/JsonObjectRequest;-><init>(ILjava/lang/String;Lorg/json/JSONObject;Lcom/android/volley/Response$Listener;Lcom/android/volley/Response$ErrorListener;)V

    .line 165
    invoke-virtual {v0, v1}, Lcom/android/volley/RequestQueue;->add(Lcom/android/volley/Request;)Lcom/android/volley/Request;

    return-void

    .line 168
    :cond_44
    invoke-virtual {p0}, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->getContext()Landroid/content/Context;

    move-result-object v0

    const v2, 0x7f12007b

    invoke-virtual {p0, v2}, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->getString(I)Ljava/lang/String;

    move-result-object v2

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

    move-result-object v0

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

    return-void
.end method


# virtual methods
.method public onActivityResult(IILandroid/content/Intent;)V
    .registers 4
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x0,
            0x0,
            0x0
        }
        names = {
            "requestCode",
            "resultCode",
            "data"
        }
    .end annotation

    .line 233
    invoke-super {p0, p1, p2, p3}, Landroidx/fragment/app/Fragment;->onActivityResult(IILandroid/content/Intent;)V

    return-void
.end method

.method public onCreateView(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Landroid/os/Bundle;)Landroid/view/View;
    .registers 5
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x0,
            0x0,
            0x0
        }
        names = {
            "inflater",
            "container",
            "savedInstanceState"
        }
    .end annotation

    const p3, 0x7f0c007b

    const/4 v0, 0x0

    .line 71
    invoke-virtual {p1, p3, p2, v0}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object p1

    return-object p1
.end method

.method public onViewCreated(Landroid/view/View;Landroid/os/Bundle;)V
    .registers 4
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x0,
            0x0
        }
        names = {
            "view",
            "savedInstanceState"
        }
    .end annotation

    const p2, 0x7f090267

    .line 77
    invoke-virtual {p1, p2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p2

    check-cast p2, Landroid/widget/TextView;

    .line 78
    iget-object v0, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->packageCategory:Lcom/yctpublication/mastes/models/PackageCategoryModel;

    invoke-virtual {v0}, Lcom/yctpublication/mastes/models/PackageCategoryModel;->getHeading()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    const p2, 0x7f090266

    .line 80
    invoke-virtual {p1, p2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p2

    check-cast p2, Landroid/widget/TextView;

    .line 81
    iget-object v0, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->packageCategory:Lcom/yctpublication/mastes/models/PackageCategoryModel;

    invoke-virtual {v0}, Lcom/yctpublication/mastes/models/PackageCategoryModel;->getDescription()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    const p2, 0x7f0902b1

    .line 84
    invoke-virtual {p1, p2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p2

    check-cast p2, Landroidx/recyclerview/widget/RecyclerView;

    iput-object p2, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->recyclerView:Landroidx/recyclerview/widget/RecyclerView;

    .line 85
    new-instance p2, Landroidx/recyclerview/widget/LinearLayoutManager;

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

    move-result-object v0

    invoke-direct {p2, v0}, Landroidx/recyclerview/widget/LinearLayoutManager;-><init>(Landroid/content/Context;)V

    iput-object p2, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->layoutManager:Landroidx/recyclerview/widget/RecyclerView$LayoutManager;

    .line 86
    iget-object v0, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->recyclerView:Landroidx/recyclerview/widget/RecyclerView;

    invoke-virtual {v0, p2}, Landroidx/recyclerview/widget/RecyclerView;->setLayoutManager(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)V

    .line 87
    new-instance p2, Lcom/yctpublication/mastes/purchase/PurchaseFragment$PackageAdapter;

    const/4 v0, 0x0

    invoke-direct {p2, p0, v0}, Lcom/yctpublication/mastes/purchase/PurchaseFragment$PackageAdapter;-><init>(Lcom/yctpublication/mastes/purchase/PurchaseFragment;Lcom/yctpublication/mastes/purchase/PurchaseFragment$1;)V

    iput-object p2, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->adapter:Landroidx/recyclerview/widget/RecyclerView$Adapter;

    const p2, 0x7f09027d

    .line 89
    invoke-virtual {p1, p2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p2

    check-cast p2, Landroid/widget/ProgressBar;

    iput-object p2, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->progressBar:Landroid/widget/ProgressBar;

    .line 92
    new-instance p2, Ljava/util/ArrayList;

    invoke-direct {p2}, Ljava/util/ArrayList;-><init>()V

    iput-object p2, p0, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->packageList:Ljava/util/ArrayList;

    .line 93
    invoke-direct {p0}, Lcom/yctpublication/mastes/purchase/PurchaseFragment;->getPackageList()V

    const p2, 0x7f09008b

    .line 96
    invoke-virtual {p1, p2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/Button;

    .line 97
    new-instance p2, Lcom/yctpublication/mastes/purchase/PurchaseFragment$1;

    invoke-direct {p2, p0}, Lcom/yctpublication/mastes/purchase/PurchaseFragment$1;-><init>(Lcom/yctpublication/mastes/purchase/PurchaseFragment;)V

    invoke-virtual {p1, p2}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    return-void
.end method