导航菜单

页面标题

页面副标题

Mantra Counter v25.01 - NoAdsDialog.java 源代码

正在查看: Mantra Counter v25.01 应用的 NoAdsDialog.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.sweetedge.mantracounter.cashfree;

import android.content.Context;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager2.widget.ViewPager2;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.cashfree.pg.api.CFPaymentGatewayService;
import com.cashfree.pg.core.api.callback.CFCheckoutResponseCallback;
import com.cashfree.pg.core.api.exception.CFException;
import com.cashfree.pg.core.api.utils.CFErrorResponse;
import com.google.firebase.crashlytics.buildtools.reloc.org.apache.http.HttpHeaders;
import com.sweetedge.mantracounter.Authentication.UserWebService;
import com.sweetedge.mantracounter.R;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import save_data.Const;
import sweetedge.extra.PLog;
import sweetedge.popup.PToast;
import sweetedge.preference.PSharedPreference;

public class NoAdsDialog extends AppCompatActivity implements CFCheckoutResponseCallback {
    static RelativeLayout SuccessLayout = null;
    static TextView ValidTill = null;
    static CircleIndicator circleIndicator = null;
    public static boolean isPayClicked = false;
    static ViewPager2 viewPager;

    protected void onResume() {
        super.onResume();
        checkandFetchPaymentData(this);
    }

    public static void checkandFetchPaymentData(final Context context) {
        Volley.newRequestQueue(context).add(new StringRequest(1, Const.CheckandFetchPayData, new Response.Listener<String>() {
            public void onResponse(String str) {
                PLog.print("Check Response = " + str);
                if (str.contains("Success")) {
                    NoAdsDialog.viewPager.setVisibility(4);
                    NoAdsDialog.circleIndicator.setVisibility(4);
                    try {
                        JSONArray jSONArray = new JSONObject(str.substring(str.indexOf("{"))).getJSONArray("Prime");
                        for (int i = 0; i < jSONArray.length(); i++) {
                            String str2 = jSONArray.getJSONObject(i).getString("Plan_Name") + "Plan  ";
                            NoAdsDialog.ValidTill.setText(str2 + "Expiry\n" + jSONArray.getJSONObject(i).getString(HttpHeaders.TIMEOUT));
                            NoAdsDialog.SuccessLayout.setVisibility(0);
                        }
                        return;
                    } catch (JSONException e) {
                        throw new RuntimeException(e);
                    }
                }
                NoAdsDialog.viewPager.setVisibility(0);
                NoAdsDialog.circleIndicator.setVisibility(0);
                NoAdsDialog.SuccessLayout.setVisibility(8);
            }
        }, new Response.ErrorListener() {
            public void onErrorResponse(VolleyError volleyError) {
                PToast.showT(context, "The server is down, Can't check your data!");
            }
        }) {
            protected Map<String, String> getParams() {
                HashMap hashMap = new HashMap();
                hashMap.put("Gmail", PSharedPreference.getString(context, Const.GMAIL, "null"));
                return hashMap;
            }
        });
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_noads_chooser);
        SuccessLayout = (RelativeLayout) findViewById(R.id.successLayout);
        ValidTill = (TextView) findViewById(R.id.validTillDate);
        isPayClicked = false;
        circleIndicator = (CircleIndicator) findViewById(R.id.circle_in1);
        ViewPager2 findViewById = findViewById(R.id.viewpager2);
        viewPager = findViewById;
        UserWebService.getPaymentData(this, findViewById, circleIndicator);
        SuccessLayout.setVisibility(8);
        viewPager.setVisibility(0);
        circleIndicator.setVisibility(0);
        try {
            CFPaymentGatewayService.getInstance().setCheckoutCallback(this);
        } catch (CFException e) {
            e.printStackTrace();
        }
    }

    public void onPaymentVerify(String str) {
        PToast.showT(this, "Success with: " + str);
        PSharedPreference.setString(this, "O", str);
        MakePurchase.SetPaymentStatus(this, str, "Success");
    }

    public void onPaymentFailure(CFErrorResponse cFErrorResponse, String str) {
        PToast.showT(this, "Falied with: " + str);
        MakePurchase.SetPaymentStatus(this, str, "Failed by method");
    }
}