导航菜单

页面标题

页面副标题

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

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

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


package com.user.a4keygen.activity;

import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import com.google.gson.JsonObject;
import com.user.a4keygen.R;
import com.user.a4keygen.model.CommonResponseModel;
import com.user.a4keygen.network.ApiClient;
import com.user.a4keygen.network.ApiInterface;
import com.user.a4keygen.webutil.WebClientService;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class GetContactNumberActivity extends AppCompatActivity {
    String conNum;
    String userid;

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_get_contact_number);
        this.conNum = getPhoneNumber();
        this.userid = getIntent().getStringExtra("USERID");
        Toast.makeText((Context) this, (CharSequence) ("Your Id is :" + this.userid), 0).show();
        if (!WebClientService.isNull(this.conNum)) {
            if (!WebClientService.isNull(this.userid)) {
                sendConatctNumberToApi(this, manipulateNumber(this.conNum));
                return;
            } else {
                Toast.makeText((Context) this, (CharSequence) ("User id is Null" + this.userid), 0).show();
                return;
            }
        }
        Toast.makeText((Context) this, (CharSequence) "Failed To Get Contact Number", 0).show();
    }

    private String manipulateNumber(String str) {
        return str.length() > 10 ? str.substring(str.length() - 10) : str;
    }

    private String getPhoneNumber() {
        String line1Number;
        TelephonyManager telephonyManager = (TelephonyManager) getSystemService("phone");
        return (telephonyManager == null || !(ActivityCompat.checkSelfPermission(this, "android.permission.READ_PHONE_STATE") == 0 || ActivityCompat.checkSelfPermission(this, "android.permission.READ_PHONE_NUMBERS") == 0) || (line1Number = telephonyManager.getLine1Number()) == null || line1Number.isEmpty()) ? "" : line1Number;
    }

    private void sendConatctNumberToApi(final Context context, String str) {
        Toast.makeText(context, "Calling Api For " + this.conNum, 0).show();
        try {
            JsonObject jsonObject = new JsonObject();
            jsonObject.addProperty("userId", this.userid);
            jsonObject.addProperty("contactNo", str);
            ((ApiInterface) ApiClient.getInstance(this).getClient().create(ApiInterface.class)).saveNumber(jsonObject).enqueue(new Callback<CommonResponseModel>() {
                public void onResponse(Call<CommonResponseModel> call, Response<CommonResponseModel> response) {
                    if (response.isSuccessful()) {
                        if ("S".equals(((CommonResponseModel) response.body()).getStatus())) {
                            Toast.makeText(context, "Contact Num Fetched Successfully", 1).show();
                        } else {
                            Toast.makeText(context, "Fail", 1).show();
                        }
                    }
                }

                public void onFailure(Call<CommonResponseModel> call, Throwable th) {
                    Toast.makeText(context, "Fail", 1).show();
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
            Toast.makeText(context, "Fail", 1).show();
        }
    }
}