正在查看: Clash Legends v0.0.1 应用的 FpOtpVerificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 FpOtpVerificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clash.legends.ui.activities;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.NetworkResponse;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.clash.legends.ui.activities.FpOtpVerificationActivity;
import com.clash.legends.utils.LoadingDialog;
import com.clash.legends.utils.LocaleHelper;
import com.mukesh.OnOtpCompletionListener;
import com.mukesh.OtpView;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class FpOtpVerificationActivity extends AppCompatActivity {
Context context;
LoadingDialog loadingDialog;
RequestQueue mQueue;
OtpView otpView;
TextView otpnote;
TextView otpnote2;
TextView resend;
Resources resources;
TextView verificationtitle;
String ep = "";
String memberid = "";
String apiotp = "";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(2131558445);
Context locale = LocaleHelper.setLocale(this);
this.context = locale;
this.resources = locale.getResources();
countdown();
this.loadingDialog = new LoadingDialog(this);
Intent intent = getIntent();
this.ep = intent.getStringExtra("EP");
this.memberid = intent.getStringExtra("MID");
this.apiotp = intent.getStringExtra("OTP");
this.verificationtitle = (TextView) findViewById(2131363734);
this.otpnote = (TextView) findViewById(2131362967);
TextView textView = (TextView) findViewById(2131362966);
this.otpnote2 = textView;
textView.setText(this.resources.getString(2131886662));
this.otpnote.setText(this.resources.getString(2131886661));
this.verificationtitle.setText(this.resources.getString(2131887061));
this.otpView = findViewById(2131362961);
TextView textView2 = (TextView) findViewById(2131363161);
this.resend = textView2;
textView2.setClickable(false);
this.resend.setEnabled(false);
this.resend.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FpOtpVerificationActivity.this.m36xbb61b8f1(view);
}
});
this.otpView.setShowSoftInputOnFocus(true);
this.otpView.setOtpCompletionListener(new OnOtpCompletionListener() {
public final void onOtpCompleted(String str) {
FpOtpVerificationActivity.this.m37xcc1785b2(str);
}
});
}
void m36xbb61b8f1(View v) {
this.resend.setClickable(false);
this.resend.setEnabled(false);
sendotp(this.ep);
}
void m37xcc1785b2(String otp) {
if (TextUtils.equals(otp, this.apiotp)) {
createnewpass(this.memberid);
} else {
Toast.makeText(getApplicationContext(), this.resources.getString(2131887096), 0).show();
this.otpView.setText("");
}
}
public void countdown() {
new CountDownTimer(60000L, 1000L) {
@Override
public void onTick(long millisUntilFinished) {
FpOtpVerificationActivity.this.resend.setText(String.valueOf(millisUntilFinished / 1000));
}
@Override
public void onFinish() {
FpOtpVerificationActivity.this.resend.setText(FpOtpVerificationActivity.this.resources.getString(2131886954));
FpOtpVerificationActivity.this.resend.setClickable(true);
FpOtpVerificationActivity.this.resend.setEnabled(true);
}
}.start();
}
public void sendotp(String ep) {
RequestQueue newRequestQueue = Volley.newRequestQueue(getApplicationContext());
this.mQueue = newRequestQueue;
newRequestQueue.getCache().clear();
String url = this.resources.getString(2131886167) + "sendOTP";
HashMap<String, String> params = new HashMap<>();
params.put("email_mobile", ep);
JsonObjectRequest request = new JsonObjectRequest(url, new JSONObject(params), new Response.Listener() {
public final void onResponse(Object obj) {
FpOtpVerificationActivity.this.m38xbf4a841((JSONObject) obj);
}
}, new Response.ErrorListener() {
public final void onErrorResponse(VolleyError volleyError) {
FpOtpVerificationActivity.this.m39x1caa7502(volleyError);
}
}) {
protected Map<String, String> getParams() throws AuthFailureError {
return super.getParams();
}
public Map<String, String> getHeaders() {
Map<String, String> headers = new HashMap<>();
headers.put("x-localization", LocaleHelper.getPersist(FpOtpVerificationActivity.this.context));
return headers;
}
};
request.setShouldCache(false);
request.setRetryPolicy(new DefaultRetryPolicy(30000, 1, 0.0f));
this.mQueue.add(request);
}
void m38xbf4a841(JSONObject response) {
this.loadingDialog.dismiss();
try {
Toast.makeText(getApplicationContext(), response.getString("message"), 0).show();
if (TextUtils.equals(response.getString("status"), "true")) {
this.apiotp = response.getString("otp");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
void m39x1caa7502(VolleyError error) {
this.loadingDialog.dismiss();
NetworkResponse response = error.networkResponse;
if (response != null && response.data != null) {
String errorString = new String(response.data);
try {
JSONObject obj = new JSONObject(errorString);
String message = obj.getString("message");
Toast.makeText(getApplicationContext(), message, 0).show();
} catch (JSONException e) {
}
}
}
public void createnewpass(String memberid) {
final Dialog builder = new Dialog(this);
builder.setCancelable(false);
builder.setContentView(2131558595);
EditText pass = (EditText) builder.findViewById(2131363166);
EditText cpass = (EditText) builder.findViewById(2131363165);
Button submit = (Button) builder.findViewById(2131363169);
Button cancel = (Button) builder.findViewById(2131363164);
submit.setOnClickListener(new AnonymousClass3(pass, cpass, builder, memberid));
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FpOtpVerificationActivity.this.m35xd1a23b15(builder, view);
}
});
builder.show();
}
class AnonymousClass3 implements View.OnClickListener {
final Dialog val$builder;
final EditText val$cpass;
final String val$memberid;
final EditText val$pass;
AnonymousClass3(EditText editText, EditText editText2, Dialog dialog, String str) {
this.val$pass = editText;
this.val$cpass = editText2;
this.val$builder = dialog;
this.val$memberid = str;
}
@Override
public void onClick(View view) {
if (TextUtils.isEmpty(this.val$pass.getText().toString().trim())) {
this.val$pass.setError(FpOtpVerificationActivity.this.resources.getString(2131886435));
return;
}
if (TextUtils.isEmpty(this.val$cpass.getText().toString().trim())) {
this.val$cpass.setError(FpOtpVerificationActivity.this.resources.getString(2131886964));
return;
}
if (!TextUtils.equals(this.val$pass.getText().toString().trim(), this.val$cpass.getText().toString().trim())) {
this.val$cpass.setError(FpOtpVerificationActivity.this.resources.getString(2131886666));
return;
}
FpOtpVerificationActivity.this.loadingDialog.show();
this.val$builder.dismiss();
FpOtpVerificationActivity fpOtpVerificationActivity = FpOtpVerificationActivity.this;
fpOtpVerificationActivity.mQueue = Volley.newRequestQueue(fpOtpVerificationActivity.getApplicationContext());
FpOtpVerificationActivity.this.mQueue.getCache().clear();
String url = FpOtpVerificationActivity.this.resources.getString(2131886167) + "forgotpassword";
HashMap<String, String> params = new HashMap<>();
params.put("member_id", this.val$memberid);
params.put("submit", "forgotpass");
params.put("password", this.val$pass.getText().toString().trim());
params.put("cpassword", this.val$cpass.getText().toString().trim());
JsonObjectRequest request = new JsonObjectRequest(url, new JSONObject(params), new Response.Listener() {
public final void onResponse(Object obj) {
FpOtpVerificationActivity.AnonymousClass3.this.m40x9658d154((JSONObject) obj);
}
}, new Response.ErrorListener() {
public final void onErrorResponse(VolleyError volleyError) {
FpOtpVerificationActivity.AnonymousClass3.this.m41x50ce71d5(volleyError);
}
}) {
protected Map<String, String> getParams() throws AuthFailureError {
return super.getParams();
}
public Map<String, String> getHeaders() {
Map<String, String> headers = new HashMap<>();
headers.put("x-localization", LocaleHelper.getPersist(FpOtpVerificationActivity.this.context));
return headers;
}
};
request.setShouldCache(false);
request.setRetryPolicy(new DefaultRetryPolicy(30000, 1, 0.0f));
FpOtpVerificationActivity.this.mQueue.add(request);
}
void m40x9658d154(JSONObject response) {
FpOtpVerificationActivity.this.loadingDialog.dismiss();
try {
Toast.makeText(FpOtpVerificationActivity.this.getApplicationContext(), response.getString("message"), 0).show();
if (TextUtils.equals(response.getString("status"), "true")) {
Intent intent = new Intent((Context) FpOtpVerificationActivity.this, (Class<?>) MainActivity.class);
FpOtpVerificationActivity.this.startActivity(intent);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
void m41x50ce71d5(VolleyError error) {
FpOtpVerificationActivity.this.loadingDialog.dismiss();
NetworkResponse response = error.networkResponse;
if (response != null && response.data != null) {
String errorString = new String(response.data);
try {
JSONObject obj = new JSONObject(errorString);
String message = obj.getString("message");
Toast.makeText(FpOtpVerificationActivity.this.getApplicationContext(), message, 0).show();
} catch (JSONException e) {
}
}
}
}
void m35xd1a23b15(Dialog builder, View view) {
builder.dismiss();
startActivity(new Intent((Context) this, (Class<?>) MainActivity.class));
}
}