导航菜单

页面标题

页面副标题

Fix Locker v1.5 - DummySurface.java 源代码

正在查看: Fix Locker v1.5 应用的 DummySurface.java JAVA 源代码文件

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


package com.user.a4keygen.activity;

import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.telecom.TelecomManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.PopupMenu;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.work.Constraints;
import androidx.work.ExistingPeriodicWorkPolicy;
import androidx.work.NetworkType;
import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkManager;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.textfield.TextInputEditText;
import com.google.gson.JsonObject;
import com.user.a4keygen.DeviceAdminReceiver;
import com.user.a4keygen.DevicePolicyManagerGateway;
import com.user.a4keygen.DevicePolicyManagerGatewayImpl;
import com.user.a4keygen.R;
import com.user.a4keygen.constants.WebServiceUrlConstant;
import com.user.a4keygen.model.CommonResponseModel;
import com.user.a4keygen.network.ApiClient;
import com.user.a4keygen.network.ApiInterface;
import com.user.a4keygen.network.model.GetDealerDetailResponseModelData;
import com.user.a4keygen.network.model.GetDealerDetailsByUserIdResponseModel;
import com.user.a4keygen.network.model.GetUserEmiModel;
import com.user.a4keygen.network.model.USerLoanModel;
import com.user.a4keygen.services.AuthenticationFeedBackService;
import com.user.a4keygen.services.ContactForegroundService;
import com.user.a4keygen.services.FirebaseMessanging;
import com.user.a4keygen.services.LocationForegroundService;
import com.user.a4keygen.services.OfflineCodeUpdateWorker;
import com.user.a4keygen.sharedprefrence.SharedPrefManager;
import com.user.a4keygen.util.Config;
import com.user.a4keygen.webutil.WebClientService;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class DummySurface extends AppCompatActivity {
    private static DevicePolicyManager dpm;
    ConstraintLayout airtel_pay;
    ConstraintLayout bhim_pay;
    private Button btnClickToCall;
    private Button btnClickToPay;
    private Button btnConnectWifi;
    private Button btnOfflineUnlock;
    ConstraintLayout btnQR;
    private Button btnShowToken;
    LinearLayout call_btn;
    ConstraintLayout constraintEmiStatment;
    String dealerQrUrl = "";
    ConstraintLayout gpay;
    private ImageView imageView2;
    ImageView iv_menu_threedot;
    TextView lblBalanceAmount;
    TextView lblLoanAmountIEAValue;
    TextView lblPaidEmiAmountValue;
    private TextView lblShopName;
    ComponentName mAdminComponentName;
    DevicePolicyManager mDevicePolicyManager;
    private DevicePolicyManagerGateway mDevicePolicyManagerGateway;
    ConstraintLayout paytm;
    ConstraintLayout phone_pay;
    private ProgressDialog progressDialog;
    private TextView tvCompanyName;
    private TextView tvDealerImeiNumber;
    private TextView tvDealerName;
    private TextView tvDealerPhone;
    TextView tvDealerPhoneE1;
    TextView tvStatus;
    private TextView tvWifiStatus;
    View view;
    private WifiManager wifi;
    private String wifi_data;

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setWindow();
        allowSetttingToWhiteListApp();
        try {
            if (!WebClientService.isItForE1) {
                setContentView(R.layout.activity_dummy_surface);
                initViews();
                setDataOnViews();
                initClickListeners();
                getUserLocation();
                getUserContact();
                return;
            }
            if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.EMI_SATHI_URL_PROD) && !WebClientService.getWebServiceUrl().equals("http://emisathi.in/emisathi-ws-v1.0_test/")) {
                if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.BRILLIANT_EMI_URL) && !WebClientService.getWebServiceUrl().equals("http://brillantemilocker.com/brillantemilocker-ws-v1.0_test/")) {
                    if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.ADVANCE_FINANCE_URL_PROD) && !WebClientService.getWebServiceUrl().equals("http://103.196.193.4/advancefinance-ws-v1.0/") && !WebClientService.getWebServiceUrl().equals("http://advancefinance.in/advancefinance-ws-v1.0_test/")) {
                        if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.LOAN_LOCKER_URL_PROD) && !WebClientService.getWebServiceUrl().equals("http://loanlockerbd.in/loanlocker-ws-v1.0_test/")) {
                            if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_PROD_URL) && !WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_TEST_URL)) {
                                if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.NEPAL_MOBILE_SAFE_PROD_URL) && !WebClientService.getWebServiceUrl().equals("http://103.196.193.4/nepalmobilesafe-ws-v1.0/")) {
                                    if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.KISTI_URL_PROD) && !WebClientService.getWebServiceUrl().equals("http://kistiapp.com/kishti-ws-v1.0_test/")) {
                                        if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.SAFETY_LOCKER_PROD_URL) && !WebClientService.getWebServiceUrl().equals("http://safetylockerpro.in/safetylocker-ws-v1.0_test/")) {
                                            if (!WebClientService.getWebServiceUrl().equals("http://emilockerbd.com/emilockerbd-ws-v1.0/") && !WebClientService.getWebServiceUrl().equals("http://103.196.193.4/emilocker-ws-v1.0/")) {
                                                if (!WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.BD_LOCKER_PROD_URL) && !WebClientService.getWebServiceUrl().equals("https://bdlocker.com/bdlocker-ws-v1.0_test/") && !WebClientService.getWebServiceUrl().equals("http://103.196.193.4/bdlocker-ws-v1.0/")) {
                                                    if (!WebClientService.getWebServiceUrl().equals("http://emipower.in/emipower-ws-v1.0/") && !WebClientService.getWebServiceUrl().equals("http://103.196.193.4/emipower-ws-v1.0/")) {
                                                        if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.GMM_WEB_SERVICE_URL)) {
                                                            setContentView(R.layout.lock_screen_gmm);
                                                        } else {
                                                            setContentView(R.layout.white_labels_lockscreen);
                                                        }
                                                        initViewE1();
                                                        onClickE1();
                                                        checkInternet();
                                                        getUserLocation();
                                                        getUserContact();
                                                        genericAip("ML_L", "Mobile is locked Generic Api");
                                                        authenticationFeedBackApi();
                                                    }
                                                    setContentView(R.layout.emi_power_lockscreen);
                                                    initViewE1();
                                                    onClickE1();
                                                    checkInternet();
                                                    getUserLocation();
                                                    getUserContact();
                                                    genericAip("ML_L", "Mobile is locked Generic Api");
                                                    authenticationFeedBackApi();
                                                }
                                                setContentView(R.layout.bd_locker_lock_screen);
                                                initViewE1();
                                                onClickE1();
                                                checkInternet();
                                                getUserLocation();
                                                getUserContact();
                                                genericAip("ML_L", "Mobile is locked Generic Api");
                                                authenticationFeedBackApi();
                                            }
                                            setContentView(R.layout.emi_locker_bd);
                                            initViewE1();
                                            onClickE1();
                                            checkInternet();
                                            getUserLocation();
                                            getUserContact();
                                            genericAip("ML_L", "Mobile is locked Generic Api");
                                            authenticationFeedBackApi();
                                        }
                                        setContentView(R.layout.safety_lock_screen);
                                        initViewE1();
                                        onClickE1();
                                        checkInternet();
                                        getUserLocation();
                                        getUserContact();
                                        genericAip("ML_L", "Mobile is locked Generic Api");
                                        authenticationFeedBackApi();
                                    }
                                    setContentView(R.layout.kisti_lock_screen);
                                    initViewE1();
                                    onClickE1();
                                    checkInternet();
                                    getUserLocation();
                                    getUserContact();
                                    genericAip("ML_L", "Mobile is locked Generic Api");
                                    authenticationFeedBackApi();
                                }
                                setContentView(R.layout.nepal_mobile_safe_lock);
                                initViewE1();
                                onClickE1();
                                checkInternet();
                                getUserLocation();
                                getUserContact();
                                genericAip("ML_L", "Mobile is locked Generic Api");
                                authenticationFeedBackApi();
                            }
                            setContentView(R.layout.fix_lock_theme);
                            initViewE1();
                            onClickE1();
                            checkInternet();
                            getUserLocation();
                            getUserContact();
                            genericAip("ML_L", "Mobile is locked Generic Api");
                            authenticationFeedBackApi();
                        }
                        setContentView(R.layout.loan_locker_theme);
                        initViewE1();
                        onClickE1();
                        checkInternet();
                        getUserLocation();
                        getUserContact();
                        genericAip("ML_L", "Mobile is locked Generic Api");
                        authenticationFeedBackApi();
                    }
                    setContentView(R.layout.advance_pay_lockscreen);
                    initViewE1();
                    onClickE1();
                    checkInternet();
                    getUserLocation();
                    getUserContact();
                    genericAip("ML_L", "Mobile is locked Generic Api");
                    authenticationFeedBackApi();
                }
                setContentView(R.layout.accurate_lockscreen);
                initViewE1();
                onClickE1();
                checkInternet();
                getUserLocation();
                getUserContact();
                genericAip("ML_L", "Mobile is locked Generic Api");
                authenticationFeedBackApi();
            }
            setContentView(R.layout.emisathi_lockscreen);
            initViewE1();
            onClickE1();
            checkInternet();
            getUserLocation();
            getUserContact();
            genericAip("ML_L", "Mobile is locked Generic Api");
            authenticationFeedBackApi();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void authenticationFeedBackApi() {
        try {
            ((ApiInterface) ApiClient.getInstance(getApplicationContext()).getClient().create(ApiInterface.class)).getAuthenticationFeedback(SharedPrefManager.getInstance(getApplicationContext()).getUserId(), "locked").enqueue(new Callback<CommonResponseModel>() {
                public void onFailure(Call<CommonResponseModel> call, Throwable th) {
                }

                public void onResponse(Call<CommonResponseModel> call, Response<CommonResponseModel> response) {
                    if (response.isSuccessful()) {
                        "S".equals(((CommonResponseModel) response.body()).getStatus());
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void getUserLocation() {
        getApplicationContext().startForegroundService(new Intent((Context) this, (Class<?>) LocationForegroundService.class));
    }

    private void getUserContact() {
        getApplicationContext().startForegroundService(new Intent((Context) this, (Class<?>) ContactForegroundService.class));
    }

    private void checkInternet() {
        if (WebClientService.isInternetOn(this)) {
            if (!WebClientService.isNull(SharedPrefManager.getInstance(getApplicationContext()).getUserId())) {
                getDealerDetailsByUserIdApi();
                return;
            } else {
                Toast.makeText((Context) this, (CharSequence) ("Dealer Id Is - " + SharedPrefManager.getInstance(getApplicationContext()).getUserId()), 1);
                return;
            }
        }
        setDataE1FromSharedPref();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("INTERNET CONNECTION");
        builder.setMessage("PLEASE TURN ON INTERNET");
        builder.setCancelable(false);
        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });
        builder.create().show();
    }

    private void initClickListeners() {
        this.btnConnectWifi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.showWifiDialog();
            }
        });
        this.btnShowToken.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.tvWifiStatus.setText(SharedPrefManager.getInstance(DummySurface.this).getDeviceToken());
            }
        });
        this.btnOfflineUnlock.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.showDialogForOfflineUnlock();
            }
        });
    }

    private void setWindow() {
        Window window = getWindow();
        window.requestFeature(1);
        window.addFlags(524416);
        startLockTask();
        getWindow().getDecorView().setSystemUiVisibility(8);
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
    }

    private void setDataOnViews() {
        this.wifi = (WifiManager) getApplicationContext().getSystemService("wifi");
        if ("N".equals(SharedPrefManager.getInstance(this).getNfplFlag())) {
            this.tvCompanyName.setVisibility(4);
        }
        if (!WebClientService.isNull(SharedPrefManager.getInstance(this).getDealerName())) {
            this.tvDealerName.setText(SharedPrefManager.getInstance(this).getDealerName());
        } else {
            this.tvDealerName.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(SharedPrefManager.getInstance(this).getPhonLockScreen())) {
            this.tvDealerPhone.setText(SharedPrefManager.getInstance(this).getPhonLockScreen());
        } else {
            this.tvDealerPhone.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(SharedPrefManager.getInstance(this).getDealerImeiNumber())) {
            this.tvDealerImeiNumber.setText(SharedPrefManager.getInstance(this).getDealerImeiNumber());
        } else {
            this.tvDealerImeiNumber.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(SharedPrefManager.getInstance(this).getDealerShopName())) {
            this.lblShopName.setText(SharedPrefManager.getInstance(this).getDealerShopName());
        } else {
            this.lblShopName.setText(R.string.notavailable);
        }
    }

    private void initViews() {
        this.tvCompanyName = (TextView) findViewById(R.id.tvCompanyName);
        this.tvDealerName = (TextView) findViewById(R.id.tvDealerName);
        this.tvDealerPhone = (TextView) findViewById(R.id.tvDealerPhone);
        this.tvWifiStatus = (TextView) findViewById(R.id.tvWifiStatus);
        this.btnConnectWifi = (Button) findViewById(R.id.btnConnectWifi);
        this.btnShowToken = (Button) findViewById(R.id.btnShowToken);
        this.tvDealerImeiNumber = (TextView) findViewById(R.id.tvDealerImeiNumber);
        this.btnOfflineUnlock = (Button) findViewById(R.id.btnOfflineUnlock);
        this.lblShopName = (TextView) findViewById(R.id.lblShopName);
    }

    private void genericAip(String str, String str2) {
        try {
            JsonObject jsonObject = new JsonObject();
            jsonObject.addProperty("userId", SharedPrefManager.getInstance(getApplicationContext()).getUserId());
            jsonObject.addProperty("operationType", str);
            jsonObject.addProperty("acknowledgement", str2);
            ((ApiInterface) ApiClient.getInstance(getApplicationContext()).getClient().create(ApiInterface.class)).genericApi(jsonObject).enqueue(new Callback<CommonResponseModel>() {
                public void onFailure(Call<CommonResponseModel> call, Throwable th) {
                }

                public void onResponse(Call<CommonResponseModel> call, Response<CommonResponseModel> response) {
                    if (response.isSuccessful()) {
                        "S".equals(((CommonResponseModel) response.body()).getStatus());
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private String getRandomNumberString() {
        return String.format("%06d", Integer.valueOf(new Random().nextInt(999999)));
    }

    public void showDialogForOfflineUnlock() {
        View inflate = LayoutInflater.from(this).inflate(R.layout.dialog_offline_unlock, (ViewGroup) null);
        final TextInputEditText findViewById = inflate.findViewById(R.id.txtEnter6DigitCode);
        Button button = (Button) inflate.findViewById(R.id.btnCancel);
        Button button2 = (Button) inflate.findViewById(R.id.btnDone);
        final androidx.appcompat.app.AlertDialog create = new AlertDialog.Builder(this).setTitle("Unlock Device").setView(inflate).setCancelable(false).create();
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.randomNumberSaveApi(findViewById.getText().toString());
                create.dismiss();
            }
        });
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                create.dismiss();
            }
        });
        create.getWindow().setSoftInputMode(2);
        create.show();
    }

    public void randomNumberSaveApi(String str) {
        final String randomNumberString = getRandomNumberString();
        if (unLockMobile(str, randomNumberString)) {
            JsonObject jsonObject = new JsonObject();
            jsonObject.addProperty("userId", SharedPrefManager.getInstance(getApplicationContext()).getUserId());
            jsonObject.addProperty("newValidationKey", randomNumberString);
            ((ApiInterface) ApiClient.getInstance(this).getClient().create(ApiInterface.class)).SaveRandomNumber(jsonObject).enqueue(new Callback<CommonResponseModel>() {
                public void onResponse(Call<CommonResponseModel> call, Response<CommonResponseModel> response) {
                    if (!response.isSuccessful() || response.body() == null) {
                        DummySurface.this.tvWifiStatus.setVisibility(0);
                        DummySurface.this.tvWifiStatus.setText("Server error. Please try again later.");
                        Log.e("OfflineCode", "Offline Unlock Code update failed due to network. Scheduling retry.");
                        SharedPrefManager.getInstance(DummySurface.this).setOfflineCodeSynced(false);
                        DummySurface.this.scheduleRetryWorker();
                        return;
                    }
                    if (!"S".equals(((CommonResponseModel) response.body()).getStatus())) {
                        DummySurface.this.tvWifiStatus.setVisibility(0);
                        DummySurface.this.tvWifiStatus.setText("Failed to update the code. Please try again.");
                        Log.e("OfflineCode", "Offline Unlock Code update failed due to network. Scheduling retry.");
                        SharedPrefManager.getInstance(DummySurface.this).setOfflineCodeSynced(false);
                        DummySurface.this.scheduleRetryWorker();
                        return;
                    }
                    SharedPrefManager.getInstance(DummySurface.this).saveRandomNumber(randomNumberString);
                    SharedPrefManager.getInstance(DummySurface.this).setOfflineCodeSynced(true);
                    WorkManager.getInstance(DummySurface.this).cancelUniqueWork("offline_code_update_retry");
                    DummySurface.this.tvWifiStatus.setVisibility(8);
                    Log.d("OfflineCode", "Offline Unlock Code updated successfully. Cancelling if any worker running");
                }

                public void onFailure(Call<CommonResponseModel> call, Throwable th) {
                    DummySurface.this.tvWifiStatus.setVisibility(0);
                    DummySurface.this.tvWifiStatus.setText("Network error. Please check your connection.");
                    Log.e("OfflineCode", "Offline Unlock Code update failed due to network. Scheduling retry.");
                    SharedPrefManager.getInstance(DummySurface.this).setOfflineCodeSynced(false);
                    DummySurface.this.scheduleRetryWorker();
                }
            });
        }
    }

    public void scheduleRetryWorker() {
        WorkManager.getInstance(this).enqueueUniquePeriodicWork("offline_code_update_retry", ExistingPeriodicWorkPolicy.REPLACE, new PeriodicWorkRequest.Builder(OfflineCodeUpdateWorker.class, 16L, TimeUnit.MINUTES).setConstraints(new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).setRequiresBatteryNotLow(false).setRequiresStorageNotLow(false).setRequiresCharging(false).setRequiresDeviceIdle(false).build()).setInitialDelay(16L, TimeUnit.MINUTES).build());
    }

    private boolean unLockMobile(String str, String str2) {
        if (!verifyCode(str)) {
            return false;
        }
        this.tvWifiStatus.setVisibility(8);
        ProgressDialog.show(this, "Unlocking your device", "Please wait").setCancelable(false);
        SharedPrefManager.getInstance(this).saveDeviceLockStatus("Q");
        SharedPrefManager.getInstance(this).saveRequestLockStatus("0");
        SharedPrefManager.getInstance(this).saveRandomNumber(str2);
        setPersistentPreferredActivity(false, this);
        new FirebaseMessanging().subUnsubMe(this, Config.UNSUBSCRIBE, Config.TOPIC_LAPP);
        getApplicationContext().startForegroundService(new Intent((Context) this, (Class<?>) AuthenticationFeedBackService.class));
        return true;
    }

    private boolean verifyCode(String str) {
        if (WebClientService.isNull(SharedPrefManager.getInstance(this).getRanNum())) {
            return false;
        }
        System.out.println("code = " + str);
        System.out.println("RanNumberSharedPref: " + SharedPrefManager.getInstance(this).getRanNum());
        if (str.equals(SharedPrefManager.getInstance(this).getRanNum()) || str.equals("798745772377488")) {
            return true;
        }
        this.tvWifiStatus.setText("Please Enter Valid Code");
        try {
            Toast.makeText((Context) this, (CharSequence) "Please enter valid code", 1).show();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

    public void onBackPressed() {
        dpm = (DevicePolicyManager) getSystemService("device_policy");
        if (WebClientService.isActiveAdmin(this)) {
            dpm.lockNow();
            setPersistentPreferredActivity(true, this);
        }
    }

    public void showWifiDialog() {
        View inflate = LayoutInflater.from(this).inflate(R.layout.dialog_wifi_config, (ViewGroup) null);
        final TextInputEditText findViewById = inflate.findViewById(R.id.txtNetworkName);
        final TextInputEditText findViewById2 = inflate.findViewById(R.id.txtPassword);
        Button button = (Button) inflate.findViewById(R.id.btnCancel);
        Button button2 = (Button) inflate.findViewById(R.id.btnDone);
        final androidx.appcompat.app.AlertDialog create = new AlertDialog.Builder(this).setTitle(getString(R.string.titleWifiConfig)).setView(inflate).setCancelable(false).create();
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.onWifiConfig(findViewById.getText().toString(), findViewById2.getText().toString());
                create.dismiss();
            }
        });
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                create.dismiss();
            }
        });
        create.getWindow().setSoftInputMode(2);
        create.show();
    }

    public void onWifiConfig(String str, String str2) {
        try {
            WifiConfiguration wifiConfiguration = new WifiConfiguration();
            wifiConfiguration.SSID = "\"" + str + "\"";
            wifiConfiguration.preSharedKey = "\"" + str2 + "\"";
            wifiConfiguration.hiddenSSID = true;
            wifiConfiguration.status = 2;
            wifiConfiguration.allowedGroupCiphers.set(2);
            wifiConfiguration.allowedGroupCiphers.set(3);
            wifiConfiguration.allowedKeyManagement.set(1);
            wifiConfiguration.allowedPairwiseCiphers.set(1);
            wifiConfiguration.allowedPairwiseCiphers.set(2);
            wifiConfiguration.allowedProtocols.set(1);
            int addNetwork = this.wifi.addNetwork(wifiConfiguration);
            if (this.wifi.isWifiEnabled()) {
                Toast.makeText(getApplicationContext(), "Wi-Fi is ON", 1).show();
            } else {
                this.wifi.setWifiEnabled(true);
                Toast.makeText(getApplicationContext(), "Wi-Fi is OFF", 1).show();
            }
            if (addNetwork != -1) {
                this.wifi.disconnect();
                this.wifi.enableNetwork(addNetwork, true);
                this.wifi.reconnect();
                Toast.makeText(getApplicationContext(), "Wait for 15 sec to ON Wi-Fi", 1).show();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        DummySurface.this.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                if (DummySurface.this.checkWifiOnAndConnected()) {
                                    DummySurface.this.tvWifiStatus.setText(DummySurface.this.wifi_data);
                                    DummySurface.this.btnConnectWifi.setText("REFRESH");
                                } else {
                                    DummySurface.this.tvWifiStatus.setText(DummySurface.this.wifi_data);
                                    DummySurface.this.btnConnectWifi.setText("ON");
                                }
                            }
                        });
                    }
                }, 15000L);
                return;
            }
            Toast.makeText(getApplicationContext(), "Not Possible to call enableNetwork", 1).show();
        } catch (Exception e) {
            Log.e("Response", e.getMessage());
        }
    }

    public boolean checkWifiOnAndConnected() {
        if (!this.wifi.isWifiEnabled()) {
            this.wifi_data = "Wi-Fi is OFF";
            return false;
        }
        if (this.wifi.getConnectionInfo().getNetworkId() == -1) {
            this.wifi_data = "Wi-Fi is ON but NOT CONNECTED to internet";
            return false;
        }
        this.wifi_data = "Wi-Fi is ON And Connected to internet";
        return true;
    }

    public void setPersistentPreferredActivity(boolean z, Context context) {
        try {
            this.mAdminComponentName = DeviceAdminReceiver.getComponentName(context);
            DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context.getSystemService("device_policy");
            this.mDevicePolicyManager = devicePolicyManager;
            this.mDevicePolicyManagerGateway = new DevicePolicyManagerGatewayImpl(context);
            if (devicePolicyManager.isDeviceOwnerApp(context.getPackageName())) {
                this.mDevicePolicyManager.setStatusBarDisabled(this.mAdminComponentName, z);
                this.mDevicePolicyManager.setCameraDisabled(this.mAdminComponentName, z);
                this.mDevicePolicyManagerGateway.setUserRestriction("no_adjust_volume", z);
                this.mDevicePolicyManagerGateway.setUserRestriction("no_install_apps", z);
                this.mDevicePolicyManagerGateway.setUserRestriction("no_uninstall_apps", z);
                this.mDevicePolicyManagerGateway.setUserRestriction("no_usb_file_transfer", z);
                if (z) {
                    try {
                        getLauncherPackage(context.getApplicationContext());
                        EnableHomeLauncherApp(context.getApplicationContext());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    DisableHomeLauncherApp(context.getApplicationContext());
                    setLauncherPackage(context.getApplicationContext());
                }
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void getLauncherPackage(Context context) {
        try {
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            String str = null;
            try {
                str = context.getPackageManager().resolveActivity(intent, PKIFailureInfo.notAuthorized).activityInfo.packageName;
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (str == null) {
                Iterator<ResolveInfo> it = context.getPackageManager().queryIntentActivities(new Intent("android.intent.action.MAIN").addCategory("android.intent.category.HOME"), PKIFailureInfo.notAuthorized).iterator();
                while (it.hasNext()) {
                    String str2 = it.next().activityInfo.packageName;
                    if (str2 != null && !str2.toLowerCase().equals(context.getPackageName().toLowerCase())) {
                        try {
                            SharedPrefManager.getInstance(context).saveDefaultLauncher(str2);
                            return;
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                }
                return;
            }
            if (str.toLowerCase().equals(context.getPackageName().toLowerCase())) {
                return;
            }
            SharedPrefManager.getInstance(context).saveDefaultLauncher(str);
        } catch (Exception e3) {
            e3.printStackTrace();
        }
    }

    private void EnableHomeLauncherApp(Context context) {
        try {
            PackageManager packageManager = context.getPackageManager();
            ComponentName componentName = new ComponentName(context, (Class<?>) DummySurface.class);
            packageManager.setComponentEnabledSetting(componentName, 1, 1);
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            intent.addCategory("android.intent.category.DEFAULT");
            intent.setFlags(268435456);
            intent.setComponent(componentName);
            context.startActivity(intent);
            IntentFilter intentFilter = new IntentFilter("android.intent.action.MAIN");
            intentFilter.addCategory("android.intent.category.HOME");
            intentFilter.addCategory("android.intent.category.DEFAULT");
            this.mDevicePolicyManager.addPersistentPreferredActivity(this.mAdminComponentName, intentFilter, new ComponentName(context.getPackageName(), DummySurface.class.getName()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void DisableHomeLauncherApp(Context context) {
        try {
            PackageManager packageManager = context.getPackageManager();
            ComponentName componentName = new ComponentName(context, (Class<?>) DummySurface.class);
            packageManager.setComponentEnabledSetting(componentName, 2, 1);
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            intent.addCategory("android.intent.category.DEFAULT");
            intent.setFlags(268435456);
            intent.setComponent(componentName);
            context.startActivity(intent);
            if (this.mDevicePolicyManager == null || this.mAdminComponentName == null) {
                this.mAdminComponentName = DeviceAdminReceiver.getComponentName(context);
                this.mDevicePolicyManager = (DevicePolicyManager) context.getSystemService("device_policy");
            }
            this.mDevicePolicyManager.clearPackagePersistentPreferredActivities(this.mAdminComponentName, context.getPackageName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setLauncherPackage(Context context) {
        String defaultLauncher = SharedPrefManager.getInstance(context).getDefaultLauncher();
        if (!defaultLauncher.isEmpty()) {
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            intent.addCategory("android.intent.category.DEFAULT");
            intent.setPackage(defaultLauncher);
            intent.setFlags(268435456);
            try {
                context.startActivity(intent);
                return;
            } catch (Exception e) {
                e.printStackTrace();
                return;
            }
        }
        PackageManager packageManager = context.getPackageManager();
        for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(new Intent("android.intent.action.MAIN").addCategory("android.intent.category.HOME"), PKIFailureInfo.notAuthorized)) {
            if (!context.getPackageName().equals(resolveInfo.activityInfo.packageName)) {
                try {
                    Intent launchIntentForPackage = packageManager.getLaunchIntentForPackage(resolveInfo.activityInfo.packageName);
                    if (launchIntentForPackage != null) {
                        launchIntentForPackage.setFlags(268435456);
                        context.startActivity(launchIntentForPackage);
                        return;
                    }
                    continue;
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            }
        }
    }

    private void initViewE1() {
        this.tvWifiStatus = (TextView) findViewById(R.id.tvWifiStatus);
        this.btnConnectWifi = (Button) findViewById(R.id.btnConnectWifi);
        this.imageView2 = (ImageView) findViewById(R.id.imageView2);
        this.btnOfflineUnlock = (Button) findViewById(R.id.btnOfflineUnlock);
        this.tvDealerName = (TextView) findViewById(R.id.tvDealerName);
        this.lblShopName = (TextView) findViewById(R.id.lblShopName);
        this.tvDealerPhoneE1 = (TextView) findViewById(R.id.tvDealerPhoneE1);
        this.tvDealerImeiNumber = (TextView) findViewById(R.id.tvDealerImeiNumber);
        this.tvStatus = (TextView) findViewById(R.id.tvStatus);
        this.call_btn = (LinearLayout) findViewById(R.id.btnClickToCall);
        this.phone_pay = findViewById(R.id.phone_pay);
        this.paytm = findViewById(R.id.paytm);
        this.gpay = findViewById(R.id.gpay);
        this.airtel_pay = findViewById(R.id.airtel_pay);
        this.bhim_pay = findViewById(R.id.bhim_pay);
        this.btnQR = findViewById(R.id.btnQR);
        this.view = findViewById(R.id.view1);
        if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.LOAN_LOCKER_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://loanlockerbd.in/loanlocker-ws-v1.0_test/") || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.NEPAL_MOBILE_SAFE_PROD_URL) || WebClientService.getWebServiceUrl().equals("http://emilockerbd.com/emilockerbd-ws-v1.0/")) {
            this.btnClickToPay = (Button) findViewById(R.id.btnClickToPay);
        }
        if (WebClientService.getWebServiceUrl().equals("https://emiprolocker.com/emiprolocker-ws-v1.0/")) {
            this.imageView2.setImageResource(R.drawable.emi_pro_locker_logo);
        }
        this.iv_menu_threedot = (ImageView) findViewById(R.id.iv_menu_threedot);
        this.lblLoanAmountIEAValue = (TextView) findViewById(R.id.lblLoanAmountIEAValue);
        this.lblPaidEmiAmountValue = (TextView) findViewById(R.id.lblPaidEmiAmountValue);
        this.lblBalanceAmount = (TextView) findViewById(R.id.lblBalanceAmount);
        this.constraintEmiStatment = findViewById(R.id.constraintEmiStatment);
        TextView textView = (TextView) findViewById(R.id.dealerMessage);
        String dealerMsg = SharedPrefManager.getInstance(getApplicationContext()).getDealerMsg();
        if (!WebClientService.isNull(dealerMsg)) {
            this.view.setVisibility(0);
            textView.setVisibility(0);
            textView.setText(dealerMsg);
            if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.GMM_WEB_SERVICE_URL)) {
                findViewById(R.id.cardDealerMessage).setVisibility(0);
            }
        }
        if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.GMM_WEB_SERVICE_URL)) {
            onCLickGmm();
        }
    }

    private void onCLickGmm() {
        findViewById(R.id.imgCall).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m189lambda$onCLickGmm$0$comusera4keygenactivityDummySurface(view);
            }
        });
        findViewById(R.id.imgPaymentRuppee).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m190lambda$onCLickGmm$1$comusera4keygenactivityDummySurface(view);
            }
        });
        findViewById(R.id.imgWifi).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m191lambda$onCLickGmm$2$comusera4keygenactivityDummySurface(view);
            }
        });
        findViewById(R.id.imgUnlockCodeOffline).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m192lambda$onCLickGmm$3$comusera4keygenactivityDummySurface(view);
            }
        });
        findViewById(R.id.imgQRScanner).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m193lambda$onCLickGmm$4$comusera4keygenactivityDummySurface(view);
            }
        });
    }

    public void m189lambda$onCLickGmm$0$comusera4keygenactivityDummySurface(View view) {
        makeCall();
    }

    public void m190lambda$onCLickGmm$1$comusera4keygenactivityDummySurface(View view) {
        showBottomSheetDialog();
    }

    public void m191lambda$onCLickGmm$2$comusera4keygenactivityDummySurface(View view) {
        try {
            if (Build.VERSION.SDK_INT >= 29) {
                startActivity(new Intent("android.settings.WIRELESS_SETTINGS"));
            }
        } catch (Exception unused) {
        }
    }

    public void m192lambda$onCLickGmm$3$comusera4keygenactivityDummySurface(View view) {
        showBottomSheetDialogOfflineUnlock();
    }

    public void m193lambda$onCLickGmm$4$comusera4keygenactivityDummySurface(View view) {
        showImage();
    }

    private void showBottomSheetDialogOfflineUnlock() {
        final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
        View inflate = LayoutInflater.from(this).inflate(R.layout.bottom_sheet_dia_offline_unlock, (ViewGroup) null);
        bottomSheetDialog.setContentView(inflate);
        final TextInputEditText findViewById = inflate.findViewById(R.id.txtEnter6DigitCodeOfflien);
        inflate.findViewById(R.id.btnDoneOffline).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.randomNumberSaveApi(findViewById.getText().toString());
                bottomSheetDialog.dismiss();
            }
        });
        inflate.findViewById(R.id.btnCancelOffline).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                bottomSheetDialog.dismiss();
            }
        });
        bottomSheetDialog.show();
    }

    private void showBottomSheetDialog() {
        BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
        View inflate = LayoutInflater.from(this).inflate(R.layout.bottom_sheet_dialog, (ViewGroup) null);
        bottomSheetDialog.setContentView(inflate);
        inflate.findViewById(R.id.phone_pay).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m194x39a2b85f(view);
            }
        });
        inflate.findViewById(R.id.paytm).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m195xc642e360(view);
            }
        });
        inflate.findViewById(R.id.bhim_pay).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m196x52e30e61(view);
            }
        });
        inflate.findViewById(R.id.airtel_pay).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m197xdf833962(view);
            }
        });
        inflate.findViewById(R.id.gpay).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DummySurface.this.m198x6c236463(view);
            }
        });
        bottomSheetDialog.show();
    }

    public void m194x39a2b85f(View view) {
        openSpecificUPIApp("com.phonepe.app");
    }

    public void m195xc642e360(View view) {
        openSpecificUPIApp("net.one97.paytm");
    }

    public void m196x52e30e61(View view) {
        openSpecificUPIApp("in.org.npci.upiapp");
    }

    public void m197xdf833962(View view) {
        openSpecificUPIApp("com.myairtelapp");
    }

    public void m198x6c236463(View view) {
        openSpecificUPIApp("com.google.android.apps.nbu.paisa.user");
    }

    private void onClickE1() {
        this.iv_menu_threedot.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                PopupMenu popupMenu = new PopupMenu(DummySurface.this, view);
                popupMenu.inflate(R.menu.main_menu);
                popupMenu.show();
                popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                    public boolean onMenuItemClick(MenuItem menuItem) {
                        switch (menuItem.getItemId()) {
                            case R.id.action_token:
                                DummySurface.this.tvStatus.setVisibility(0);
                                DummySurface.this.tvStatus.setText(SharedPrefManager.getInstance(DummySurface.this).getDeviceToken());
                                return true;
                            case R.id.action_wireless:
                                try {
                                    DummySurface.this.startActivity(new Intent("android.settings.WIRELESS_SETTINGS"));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                                return true;
                            default:
                                return false;
                        }
                    }
                });
            }
        });
        if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.LOAN_LOCKER_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://loanlockerbd.in/loanlocker-ws-v1.0_test/") || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.NEPAL_MOBILE_SAFE_PROD_URL) || WebClientService.getWebServiceUrl().equals("http://emilockerbd.com/emilockerbd-ws-v1.0/")) {
            this.btnClickToPay.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    DummySurface.this.showImage();
                }
            });
        }
        this.call_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.makeCall();
            }
        });
        this.phone_pay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.openSpecificUPIApp("com.phonepe.app");
            }
        });
        this.paytm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.openSpecificUPIApp("net.one97.paytm");
            }
        });
        this.gpay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.openSpecificUPIApp("com.google.android.apps.nbu.paisa.user");
            }
        });
        this.airtel_pay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.openSpecificUPIApp("com.myairtelapp");
            }
        });
        this.bhim_pay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.openSpecificUPIApp("in.org.npci.upiapp");
            }
        });
        this.btnQR.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.showImage();
            }
        });
        this.btnOfflineUnlock.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DummySurface.this.showDialogForOfflineUnlock();
            }
        });
        this.btnConnectWifi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                try {
                    if (Build.VERSION.SDK_INT >= 29) {
                        DummySurface.this.startActivity(new Intent("android.settings.WIRELESS_SETTINGS"));
                    }
                } catch (Exception unused) {
                }
            }
        });
    }

    public void openSpecificUPIApp(String str) {
        try {
            Intent launchIntentForPackage = getPackageManager().getLaunchIntentForPackage(str);
            if (launchIntentForPackage != null) {
                launchIntentForPackage.addFlags(268435456);
                startActivity(launchIntentForPackage);
            } else {
                Toast.makeText((Context) this, (CharSequence) "This App is not installed in your device", 0).show();
            }
        } catch (Exception e) {
            e.printStackTrace();
            Toast.makeText((Context) this, (CharSequence) ("Failed to open app: " + str), 0).show();
        }
    }

    public void makeCall() {
        try {
            String trim = this.tvDealerPhoneE1.getText().toString().trim();
            if (trim != null && !trim.isEmpty()) {
                TelephonyManager telephonyManager = (TelephonyManager) getSystemService("phone");
                if (telephonyManager != null && telephonyManager.getSimState() == 5) {
                    Uri fromParts = Uri.fromParts("tel", trim, null);
                    TelecomManager telecomManager = (TelecomManager) getSystemService("telecom");
                    if (telecomManager != null) {
                        telecomManager.placeCall(fromParts, null);
                    } else {
                        Toast.makeText((Context) this, (CharSequence) "Telecom service is unavailable.", 0).show();
                    }
                } else {
                    Toast.makeText((Context) this, (CharSequence) "Please insert a SIM card first.", 0).show();
                }
            } else {
                Toast.makeText((Context) this, (CharSequence) "Phone number is empty. Please provide a valid number.", 0).show();
            }
        } catch (SecurityException e) {
            e.printStackTrace();
            Toast.makeText((Context) this, (CharSequence) "Permission denied. Please enable CALL_PHONE permission.", 0).show();
        } catch (Exception e2) {
            e2.printStackTrace();
            Toast.makeText((Context) this, (CharSequence) "An error occurred while trying to make the call.", 0).show();
        }
    }

    private void allowSetttingToWhiteListApp() {
        DevicePolicyManager devicePolicyManager = (DevicePolicyManager) getSystemService("device_policy");
        ComponentName componentName = new ComponentName((Context) this, (Class<?>) DeviceAdminReceiver.class);
        String[] lockTaskPackages = devicePolicyManager.getLockTaskPackages(componentName);
        ArrayList arrayList = new ArrayList();
        if (lockTaskPackages != null) {
            arrayList.addAll(Arrays.asList(lockTaskPackages));
        }
        if (!arrayList.contains("com.android.settings")) {
            arrayList.add("com.android.settings");
        }
        if (!arrayList.contains("com.android.dialer")) {
            arrayList.add("com.android.dialer");
        }
        if (!arrayList.contains("com.android.phone")) {
            arrayList.add("com.android.phone");
        }
        String defaultPhoneAppPackageNameNew = getDefaultPhoneAppPackageNameNew(this);
        if (defaultPhoneAppPackageNameNew != null && !arrayList.contains(defaultPhoneAppPackageNameNew)) {
            arrayList.add(defaultPhoneAppPackageNameNew);
        }
        String[] strArr = {"com.google.android.apps.nbu.paisa.user", "com.phonepe.app", "net.one97.paytm", "com.myairtelapp", "in.org.npci.upiapp", "com.google.android.dialer", "com.android.incallui"};
        for (int i = 0; i < 7; i++) {
            String str = strArr[i];
            if (!arrayList.contains(str)) {
                arrayList.add(str);
            }
        }
        devicePolicyManager.setLockTaskPackages(componentName, (String[]) arrayList.toArray(new String[0]));
    }

    public static String getDefaultPhoneAppPackageNameNew(Context context) {
        TelecomManager telecomManager = (TelecomManager) context.getSystemService("telecom");
        if (telecomManager != null) {
            return telecomManager.getDefaultDialerPackage();
        }
        return null;
    }

    public void showImage() {
        try {
            View inflate = LayoutInflater.from(this).inflate(R.layout.dialog_image, (ViewGroup) null);
            ImageView imageView = (ImageView) inflate.findViewById(R.id.imagQr);
            androidx.appcompat.app.AlertDialog create = new AlertDialog.Builder(this).setView(inflate).setCancelable(true).create();
            create.getWindow().setSoftInputMode(2);
            create.show();
            if (WebClientService.isInternetOn(this)) {
                showImageFromUrl(imageView);
            } else {
                Toast.makeText((Context) this, (CharSequence) "Please Check Internet", 0).show();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void showQRpaymentImg() {
        try {
            View inflate = LayoutInflater.from(this).inflate(R.layout.layout_gmm_pay_qr, (ViewGroup) null);
            ImageView imageView = (ImageView) inflate.findViewById(R.id.imagQr);
            androidx.appcompat.app.AlertDialog create = new AlertDialog.Builder(this).setView(inflate).setCancelable(true).create();
            create.getWindow().setSoftInputMode(2);
            create.show();
            if (WebClientService.isInternetOn(this)) {
                showImageFromUrl(imageView);
            } else {
                Toast.makeText((Context) this, (CharSequence) "Please Check Internet", 0).show();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void showImageFromUrl(ImageView imageView) {
        try {
            System.out.println("dealerQrUrl = " + this.dealerQrUrl);
            RequestOptions requestOptions = new RequestOptions();
            requestOptions.encodeQuality(40);
            Glide.with(this).load(this.dealerQrUrl).thumbnail(0.5f).apply(requestOptions).into(imageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void setDataE1(GetDealerDetailResponseModelData getDealerDetailResponseModelData) {
        if (!WebClientService.isNull(getDealerDetailResponseModelData.getName())) {
            this.tvDealerName.setText(getDealerDetailResponseModelData.getName());
        } else {
            this.tvDealerName.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(getDealerDetailResponseModelData.getPhoneLockScreen())) {
            this.tvDealerPhoneE1.setText(getDealerDetailResponseModelData.getPhoneLockScreen());
        } else {
            this.tvDealerPhoneE1.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(getDealerDetailResponseModelData.getImei())) {
            this.tvDealerImeiNumber.setText(getDealerDetailResponseModelData.getImei());
        } else {
            this.tvDealerImeiNumber.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(getDealerDetailResponseModelData.getShop())) {
            this.lblShopName.setText(getDealerDetailResponseModelData.getShop());
        } else {
            this.lblShopName.setText(R.string.notavailable);
        }
    }

    private void setDataE1FromSharedPref() {
        if (!WebClientService.isNull(SharedPrefManager.getInstance(getApplicationContext()).getNameLockOnline())) {
            this.tvDealerName.setText(SharedPrefManager.getInstance(getApplicationContext()).getNameLockOnline());
        } else {
            this.tvDealerName.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(SharedPrefManager.getInstance(getApplicationContext()).getPhoneLockScreenOnline())) {
            this.tvDealerPhoneE1.setText(SharedPrefManager.getInstance(getApplicationContext()).getPhoneLockScreenOnline());
        } else if (!WebClientService.isNull(SharedPrefManager.getInstance(getApplicationContext()).getDealerphone())) {
            this.tvDealerPhoneE1.setText(SharedPrefManager.getInstance(getApplicationContext()).getDealerphone());
        } else {
            this.tvDealerPhoneE1.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(SharedPrefManager.getInstance(getApplicationContext()).getImeiOnline())) {
            this.tvDealerImeiNumber.setText(SharedPrefManager.getInstance(getApplicationContext()).getImeiOnline());
        } else {
            this.tvDealerImeiNumber.setText(R.string.notavailable);
        }
        if (!WebClientService.isNull(SharedPrefManager.getInstance(getApplicationContext()).getShopOnline())) {
            this.lblShopName.setText(SharedPrefManager.getInstance(getApplicationContext()).getShopOnline());
        } else {
            this.lblShopName.setText(R.string.notavailable);
        }
        this.dealerQrUrl = SharedPrefManager.getInstance(getApplicationContext()).getDealerQrOnline();
    }

    private void setTableLayoutAndEmiData(List<GetUserEmiModel> list) {
        TableLayout tableLayout = (TableLayout) findViewById(R.id.emiTableLayout);
        for (GetUserEmiModel getUserEmiModel : list) {
            TableRow tableRow = new TableRow(this);
            TextView textView = new TextView(this);
            if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.LOAN_LOCKER_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://loanlockerbd.in/loanlocker-ws-v1.0_test/")) {
                textView.setTextColor(getResources().getColor(R.color.loan_blue));
            } else if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_PROD_URL) || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_TEST_URL) || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.EMI_SATHI_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://emisathi.in/emisathi-ws-v1.0_test/") || WebClientService.getWebServiceUrl().equals("http://emilockerbd.com/emilockerbd-ws-v1.0/")) {
                textView.setTextColor(getResources().getColor(R.color.black));
            } else {
                textView.setTextColor(getResources().getColor(R.color.white));
            }
            textView.setText(getUserEmiModel.getCreatedAt());
            textView.setPadding(8, 8, 8, 8);
            tableRow.addView(textView);
            TextView textView2 = new TextView(this);
            textView2.setText(String.valueOf(addRupeeSign(getUserEmiModel.getEmiAmount())));
            if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.LOAN_LOCKER_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://loanlockerbd.in/loanlocker-ws-v1.0_test/")) {
                textView2.setTextColor(getResources().getColor(R.color.loan_blue));
            } else if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_PROD_URL) || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_TEST_URL) || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.EMI_SATHI_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://emisathi.in/emisathi-ws-v1.0_test/") || WebClientService.getWebServiceUrl().equals("http://emilockerbd.com/emilockerbd-ws-v1.0/")) {
                textView2.setTextColor(getResources().getColor(R.color.black));
            } else {
                textView2.setTextColor(getResources().getColor(R.color.white));
            }
            textView2.setPadding(8, 8, 8, 8);
            tableRow.addView(textView2);
            TextView textView3 = new TextView(this);
            if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.LOAN_LOCKER_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://loanlockerbd.in/loanlocker-ws-v1.0_test/")) {
                textView3.setTextColor(getResources().getColor(R.color.loan_blue));
            } else if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_PROD_URL) || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_TEST_URL) || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.EMI_SATHI_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://emisathi.in/emisathi-ws-v1.0_test/") || WebClientService.getWebServiceUrl().equals("http://emilockerbd.com/emilockerbd-ws-v1.0/")) {
                textView3.setTextColor(getResources().getColor(R.color.black));
            } else {
                textView3.setTextColor(getResources().getColor(R.color.white));
            }
            textView3.setText(getUserEmiModel.getPaymentMode());
            textView3.setPadding(8, 8, 8, 8);
            tableRow.addView(textView3);
            TextView textView4 = new TextView(this);
            if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.LOAN_LOCKER_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://loanlockerbd.in/loanlocker-ws-v1.0_test/")) {
                textView4.setTextColor(getResources().getColor(R.color.loan_blue));
            } else if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_PROD_URL) || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.FIX_LOCKER_TEST_URL) || WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.EMI_SATHI_URL_PROD) || WebClientService.getWebServiceUrl().equals("http://emisathi.in/emisathi-ws-v1.0_test/") || WebClientService.getWebServiceUrl().equals("")) {
                textView4.setTextColor(getResources().getColor(R.color.black));
            } else {
                textView4.setTextColor(getResources().getColor(R.color.white));
            }
            textView4.setText(getUserEmiModel.getRemark());
            textView4.setPadding(8, 8, 8, 8);
            tableRow.addView(textView4);
            tableLayout.addView(tableRow);
            tableLayout.setPadding(12, 0, 8, 0);
        }
    }

    private String addRupeeSign(int i) {
        return NumberFormat.getCurrencyInstance(new Locale("en", "in")).format(i);
    }

    private void getDealerDetailsByUserIdApi() {
        try {
            ((ApiInterface) ApiClient.getInstance(this).getClient().create(ApiInterface.class)).getDealerDetailsApi(SharedPrefManager.getInstance(getApplicationContext()).getUserId()).enqueue(new Callback<GetDealerDetailsByUserIdResponseModel>() {
                public void onResponse(Call<GetDealerDetailsByUserIdResponseModel> call, Response<GetDealerDetailsByUserIdResponseModel> response) {
                    if (response != null) {
                        try {
                            if (response.isSuccessful() && response.body() != null) {
                                if ("S".equals(((GetDealerDetailsByUserIdResponseModel) response.body()).getStatus())) {
                                    if (!WebClientService.isNull(((GetDealerDetailsByUserIdResponseModel) response.body()).getData())) {
                                        DummySurface.this.handleData(((GetDealerDetailsByUserIdResponseModel) response.body()).getData());
                                        if (((GetDealerDetailsByUserIdResponseModel) response.body()).getData().getEmis() != null && ((GetDealerDetailsByUserIdResponseModel) response.body()).getData().getuSerLoanModel() != null && ((GetDealerDetailsByUserIdResponseModel) response.body()).getData().getEmis().size() > 0) {
                                            DummySurface.this.constraintEmiStatment.setVisibility(0);
                                            DummySurface.this.handleResponse(((GetDealerDetailsByUserIdResponseModel) response.body()).getData().getEmis(), ((GetDealerDetailsByUserIdResponseModel) response.body()).getData().getuSerLoanModel());
                                        } else {
                                            DummySurface.this.constraintEmiStatment.setVisibility(8);
                                        }
                                    }
                                } else if ("F".equals(((GetDealerDetailsByUserIdResponseModel) response.body()).getStatus())) {
                                    if (!WebClientService.isNull(((GetDealerDetailsByUserIdResponseModel) response.body()).getMessage())) {
                                        Toast.makeText((Context) DummySurface.this, (CharSequence) "Something went wrong", 1);
                                    } else {
                                        Toast.makeText((Context) DummySurface.this, (CharSequence) "Something went wrong", 1);
                                    }
                                }
                            } else {
                                Toast.makeText((Context) DummySurface.this, (CharSequence) "Response Is Null Something went wrong", 1);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                            Toast.makeText((Context) DummySurface.this, (CharSequence) "Something went wrong", 1);
                        }
                    }
                }

                public void onFailure(Call<GetDealerDetailsByUserIdResponseModel> call, Throwable th) {
                    Toast.makeText((Context) DummySurface.this, (CharSequence) "Something went wrong", 1);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void handleData(GetDealerDetailResponseModelData getDealerDetailResponseModelData) {
        setShardPreData(getDealerDetailResponseModelData);
        setDataE1FromSharedPref();
    }

    private void setShardPreData(GetDealerDetailResponseModelData getDealerDetailResponseModelData) {
        SharedPrefManager.getInstance(this).saveLockScrenData(getDealerDetailResponseModelData.getName(), getDealerDetailResponseModelData.getPhoneLockScreen(), getDealerDetailResponseModelData.getImei(), getDealerDetailResponseModelData.getShop(), getDealerDetailResponseModelData.getDealerQRImage());
    }

    public void handleResponse(List<GetUserEmiModel> list, USerLoanModel uSerLoanModel) {
        try {
            setPaidEmiAmount(list, uSerLoanModel);
            setTableLayoutAndEmiData(list);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void setPaidEmiAmount(List<GetUserEmiModel> list, USerLoanModel uSerLoanModel) {
        int i;
        int i2 = 0;
        int i3 = 0;
        for (int i4 = 0; i4 < list.size(); i4++) {
            try {
                i3 += list.get(i4).getEmiAmount();
            } catch (Exception e) {
                e.printStackTrace();
                return;
            }
        }
        if (!WebClientService.isNull(uSerLoanModel.getLoanAmount())) {
            this.lblLoanAmountIEAValue.setText(String.valueOf(addRupeeSign(uSerLoanModel.getLoanAmount().intValue())));
            i = uSerLoanModel.getLoanAmount().intValue();
        } else {
            this.lblLoanAmountIEAValue.setText("N/A");
            i = 0;
        }
        if (!WebClientService.isNull(Integer.valueOf(i3))) {
            this.lblPaidEmiAmountValue.setText(String.valueOf(addRupeeSign(i3)));
            i2 = i3;
        } else {
            this.lblPaidEmiAmountValue.setText("N/A");
        }
        this.lblBalanceAmount.setText(String.valueOf(addRupeeSign(i - i2)));
    }

    private void showProgressDialog() {
        ProgressDialog progressDialog = new ProgressDialog(this);
        this.progressDialog = progressDialog;
        progressDialog.setMessage("Loading...");
        this.progressDialog.setCancelable(false);
        this.progressDialog.show();
    }

    private void dismissProgressDialog() {
        ProgressDialog progressDialog = this.progressDialog;
        if (progressDialog == null || !progressDialog.isShowing()) {
            return;
        }
        this.progressDialog.dismiss();
    }
}