正在查看: Clash Legends v0.0.1 应用的 WithdrawMoneyActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 WithdrawMoneyActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clash.legends.ui.activities;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.Editable;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
import android.text.style.ImageSpan;
import android.util.Log;
import android.util.Patterns;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
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.models.CurrentUser;
import com.clash.legends.utils.CustomTypefaceSpan;
import com.clash.legends.utils.LoadingDialog;
import com.clash.legends.utils.LocaleHelper;
import com.clash.legends.utils.UserLocalStore;
import com.google.android.material.textfield.TextInputLayout;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class WithdrawMoneyActivity extends AppCompatActivity {
String amount;
JSONArray array;
ImageView back;
Context context;
LoadingDialog loadingDialog;
RequestQueue mQueue;
TextView onlywithdarwwinmoneytitle;
EditText paytm_number;
RadioButton rdbtn;
Resources resources;
TextInputLayout til;
TextView withdrawNote;
RadioGroup withdrawOption;
TextView withdrawTitle;
EditText withdraw_amount;
TextView withdrawmoneytitle;
TextView withdrawtotitle;
int amountInt = 0;
String withdrawMethod = "";
String selectedField = "";
String point = "";
int pointInt = 0;
String selectedCurrencySymbol = "";
String minWithdraw = "";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(2131558493);
Context locale = LocaleHelper.setLocale(this);
this.context = locale;
this.resources = locale.getResources();
ImageView imageView = (ImageView) findViewById(2131361995);
this.back = imageView;
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WithdrawMoneyActivity.this.m228xf2273f0b(view);
}
});
this.withdrawmoneytitle = (TextView) findViewById(2131363813);
this.withdrawtotitle = (TextView) findViewById(2131363815);
this.onlywithdarwwinmoneytitle = (TextView) findViewById(2131362903);
this.withdrawmoneytitle.setText(this.resources.getString(2131887086));
this.withdrawtotitle.setText(this.resources.getString(2131887088));
this.onlywithdarwwinmoneytitle.setText(this.resources.getString(2131887100));
this.til = findViewById(2131362873);
LoadingDialog loadingDialog = new LoadingDialog(this);
this.loadingDialog = loadingDialog;
loadingDialog.show();
this.paytm_number = (EditText) findViewById(2131363000);
this.withdraw_amount = (EditText) findViewById(2131363808);
final Button withdraw_btn = (Button) findViewById(2131363809);
this.withdrawTitle = (TextView) findViewById(2131363814);
this.withdrawOption = (RadioGroup) findViewById(2131363811);
this.withdrawNote = (TextView) findViewById(2131363810);
RequestQueue newRequestQueue = Volley.newRequestQueue(this);
this.mQueue = newRequestQueue;
newRequestQueue.getCache().clear();
final UserLocalStore userLocalStore = new UserLocalStore(getApplicationContext());
String url = this.resources.getString(2131886167) + "withdraw_method";
JsonObjectRequest request = new JsonObjectRequest(url, null, new Response.Listener() {
public final void onResponse(Object obj) {
WithdrawMoneyActivity.this.m229x1b7b944c((JSONObject) obj);
}
}, new Response.ErrorListener() {
public final void onErrorResponse(VolleyError volleyError) {
Log.e("**VolleyError", "error" + volleyError.getMessage());
}
}) {
public Map<String, String> getHeaders() {
Map<String, String> headers = new HashMap<>();
CurrentUser user = userLocalStore.getLoggedInUser();
String token = "Bearer " + user.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
headers.put("x-localization", LocaleHelper.getPersist(WithdrawMoneyActivity.this.context));
return headers;
}
};
request.setShouldCache(false);
this.mQueue.add(request);
this.withdrawOption.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(RadioGroup radioGroup, int i) {
WithdrawMoneyActivity.this.m230x6e243ece(radioGroup, i);
}
});
withdraw_btn.setEnabled(false);
withdraw_btn.setBackgroundColor(getResources().getColor(2131100328));
this.paytm_number.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (TextUtils.equals(WithdrawMoneyActivity.this.selectedField, "mobile no")) {
if (charSequence.length() < 7 || charSequence.length() > 15) {
withdraw_btn.setEnabled(false);
withdraw_btn.setBackgroundColor(WithdrawMoneyActivity.this.getResources().getColor(2131100328));
return;
} else {
if (!TextUtils.isEmpty(WithdrawMoneyActivity.this.withdraw_amount.getText().toString())) {
withdraw_btn.setEnabled(true);
withdraw_btn.setBackgroundColor(WithdrawMoneyActivity.this.getResources().getColor(2131100329));
return;
}
return;
}
}
withdraw_btn.setEnabled(true);
withdraw_btn.setBackgroundColor(WithdrawMoneyActivity.this.getResources().getColor(2131100329));
}
@Override
public void afterTextChanged(Editable editable) {
}
});
this.withdraw_amount.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (charSequence.length() > 0) {
if (!TextUtils.isEmpty(WithdrawMoneyActivity.this.paytm_number.getText().toString())) {
withdraw_btn.setEnabled(true);
}
withdraw_btn.setBackgroundColor(WithdrawMoneyActivity.this.getResources().getColor(2131100329));
WithdrawMoneyActivity.this.withdrawNote.setText(TextUtils.concat(WithdrawMoneyActivity.this.resources.getString(2131887103), " ", WithdrawMoneyActivity.this.selectedCurrencySymbol, String.format("%.2f", Double.valueOf(Double.parseDouble(String.valueOf(charSequence)) / WithdrawMoneyActivity.this.pointInt))));
if (TextUtils.equals(WithdrawMoneyActivity.this.selectedCurrencySymbol, "₹")) {
Typeface font = Typeface.DEFAULT;
SpannableStringBuilder SS = new SpannableStringBuilder(WithdrawMoneyActivity.this.resources.getString(2131886107));
SS.setSpan(new CustomTypefaceSpan("", font), 0, 1, 34);
WithdrawMoneyActivity.this.withdrawNote.setText(TextUtils.concat(Html.fromHtml(WithdrawMoneyActivity.this.getString(2131887103)), " ", SS, Html.fromHtml(String.format("%.2f", Double.valueOf(Double.parseDouble(String.valueOf(charSequence)) / WithdrawMoneyActivity.this.pointInt)))));
WithdrawMoneyActivity.this.withdrawNote.setClickable(true);
WithdrawMoneyActivity.this.withdrawNote.setMovementMethod(LinkMovementMethod.getInstance());
return;
}
return;
}
WithdrawMoneyActivity.this.withdrawNote.setText("");
withdraw_btn.setEnabled(false);
withdraw_btn.setBackgroundColor(WithdrawMoneyActivity.this.getResources().getColor(2131100328));
}
@Override
public void afterTextChanged(Editable editable) {
}
});
withdraw_btn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WithdrawMoneyActivity.this.m232x3cc9e913(withdraw_btn, view);
}
});
}
void m228xf2273f0b(View view) {
Intent intent = new Intent(getApplicationContext(), (Class<?>) MyWalletActivity.class);
intent.putExtra("N", "2");
startActivity(intent);
}
void m229x1b7b944c(JSONObject response) {
Log.d("withdraw", response.toString());
this.loadingDialog.dismiss();
try {
JSONArray arr = response.getJSONArray("withdraw_method");
this.minWithdraw = response.getString("min_withdrawal");
this.array = arr;
if (!TextUtils.equals(response.getString("withdraw_method"), "[]")) {
JSON_PARSE_DATA_AFTER_WEBCALL(arr);
} else {
Toast.makeText((Context) this, (CharSequence) this.resources.getString(2131887085), 0).show();
startActivity(new Intent(getApplicationContext(), (Class<?>) MyWalletActivity.class));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
void m230x6e243ece(RadioGroup group, int checkedId) {
RadioButton radioButton = (RadioButton) findViewById(checkedId);
this.rdbtn = radioButton;
try {
this.withdrawMethod = radioButton.getText().toString();
for (int i = 0; i < this.array.length(); i++) {
try {
JSONObject json = this.array.getJSONObject(i);
if (TextUtils.equals(json.getString("withdraw_method"), this.withdrawMethod)) {
this.paytm_number.setText("");
this.selectedCurrencySymbol = json.getString("currency_symbol");
String string = json.getString("withdraw_method_currency_point");
this.point = string;
this.pointInt = Integer.parseInt(string);
if (this.withdraw_amount.getText().toString().trim().length() > 0) {
this.withdrawNote.setText(TextUtils.concat(this.resources.getString(2131887103), " ", this.selectedCurrencySymbol, String.format("%.2f", Double.valueOf(Double.parseDouble(this.withdraw_amount.getText().toString().trim()) / this.pointInt))));
if (TextUtils.equals(this.selectedCurrencySymbol, "₹")) {
Typeface font = Typeface.DEFAULT;
SpannableStringBuilder SS = new SpannableStringBuilder(this.resources.getString(2131886107));
SS.setSpan(new CustomTypefaceSpan("", font), 0, 1, 34);
this.withdrawNote.setText(TextUtils.concat(Html.fromHtml(getString(2131887103)), " ", SS, Html.fromHtml(String.format("%.2f", Double.valueOf(Double.parseDouble(this.withdraw_amount.getText().toString().trim()) / this.pointInt)))));
this.withdrawNote.setClickable(true);
this.withdrawNote.setMovementMethod(LinkMovementMethod.getInstance());
}
} else {
this.withdrawNote.setText("");
}
this.selectedField = json.getString("withdraw_method_field");
if (TextUtils.equals(json.getString("withdraw_method_field"), "mobile no")) {
this.til.setHint(this.resources.getString(2131886567));
this.paytm_number.setInputType(3);
} else if (TextUtils.equals(json.getString("withdraw_method_field"), "email")) {
this.til.setHint(this.resources.getString(2131886425));
this.paytm_number.setInputType(32);
} else if (TextUtils.equals(json.getString("withdraw_method_field"), "UPI ID")) {
this.til.setHint(this.resources.getString(2131887058));
this.paytm_number.setInputType(1);
} else if (TextUtils.equals(json.getString("withdraw_method_field"), "Wallet Address")) {
this.til.setHint(this.resources.getString(2131887089));
this.paytm_number.setInputType(1);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
} catch (NullPointerException e2) {
e2.printStackTrace();
}
this.withdrawTitle.setText(this.resources.getString(2131887088) + " " + this.withdrawMethod);
}
void m232x3cc9e913(Button withdraw_btn, View view) {
String paytmnumber = this.paytm_number.getText().toString().trim();
String trim = this.withdraw_amount.getText().toString().trim();
this.amount = trim;
try {
this.amountInt = Integer.parseInt(trim);
} catch (NumberFormatException e) {
e.printStackTrace();
}
if (TextUtils.equals(this.selectedField, "mobile no")) {
if (TextUtils.equals(paytmnumber, "")) {
Toast.makeText(getApplicationContext(), this.resources.getString(2131886901), 0).show();
return;
}
} else if (TextUtils.equals(this.selectedField, "email")) {
if (TextUtils.equals(paytmnumber, "")) {
Toast.makeText(getApplicationContext(), this.resources.getString(2131886898), 0).show();
return;
} else if (!Patterns.EMAIL_ADDRESS.matcher(paytmnumber).matches()) {
Toast.makeText(getApplicationContext(), this.resources.getString(2131887094), 0).show();
return;
}
} else if (TextUtils.equals(this.selectedField, "Wallet Address")) {
if (TextUtils.equals(paytmnumber, "")) {
Toast.makeText(getApplicationContext(), this.resources.getString(2131886906), 0).show();
return;
} else if (!TextUtils.equals(String.valueOf(paytmnumber.length()), "34")) {
Toast.makeText(getApplicationContext(), this.resources.getString(2131886905), 0).show();
return;
}
} else if (TextUtils.equals(this.selectedField, "UPI ID") && TextUtils.equals(paytmnumber, "")) {
Toast.makeText(getApplicationContext(), this.resources.getString(2131886904), 0).show();
return;
}
int minWithdrawInt = Integer.parseInt(this.minWithdraw);
if (this.amountInt < minWithdrawInt) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(2131886441));
SpannableStringBuilder builderp = new SpannableStringBuilder();
builderp.append((CharSequence) Html.fromHtml(getString(2131886434) + " ")).append(" ", new ImageSpan(getApplicationContext(), 2131231392, 1), 0).append((CharSequence) " ").append((CharSequence) (((Object) Html.fromHtml(this.minWithdraw)) + "."));
builder.setMessage(builderp);
builder.setPositiveButton(getString(2131886650), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
WithdrawMoneyActivity.lambda$onCreate$4(dialogInterface, i);
}
});
builder.show();
builder.create();
return;
}
this.loadingDialog.show();
RequestQueue newRequestQueue = Volley.newRequestQueue(this);
this.mQueue = newRequestQueue;
newRequestQueue.getCache().clear();
final UserLocalStore userLocalStore1 = new UserLocalStore(getApplicationContext());
CurrentUser user = userLocalStore1.getLoggedInUser();
String url1 = this.resources.getString(2131886167) + "withdraw";
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("submit", "withdraw");
hashMap.put("amount", this.withdraw_amount.getText().toString().trim());
hashMap.put("pyatmnumber", this.paytm_number.getText().toString().trim());
hashMap.put("withdraw_method", this.withdrawMethod);
hashMap.put("member_id", user.getMemberid());
JsonObjectRequest request1 = new JsonObjectRequest(url1, new JSONObject(hashMap), new Response.Listener() {
public final void onResponse(Object obj) {
WithdrawMoneyActivity.this.m231xea213e91((JSONObject) obj);
}
}, new Response.ErrorListener() {
public final void onErrorResponse(VolleyError volleyError) {
Log.e("**VolleyError", "error" + volleyError.getMessage());
}
}) {
public Map<String, String> getHeaders() {
Map headers = new HashMap();
CurrentUser user2 = userLocalStore1.getLoggedInUser();
String token = "Bearer " + user2.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
headers.put("x-localization", LocaleHelper.getPersist(WithdrawMoneyActivity.this.context));
return headers;
}
};
request1.setShouldCache(false);
this.mQueue.add(request1);
this.paytm_number.setText("");
this.withdraw_amount.setText("");
withdraw_btn.setEnabled(false);
}
static void lambda$onCreate$4(DialogInterface dialogInterface, int i) {
}
void m231xea213e91(JSONObject response) {
Log.d("withdr", response.toString());
this.loadingDialog.dismiss();
try {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
if (TextUtils.equals(response.getString("status"), "true")) {
builder.setTitle(this.resources.getString(2131887020));
} else {
builder.setTitle(this.resources.getString(2131886441));
}
builder.setMessage(response.getString("message"));
builder.setPositiveButton(this.resources.getString(2131886650), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
WithdrawMoneyActivity.lambda$onCreate$5(dialogInterface, i);
}
});
builder.show();
builder.create();
} catch (JSONException e) {
e.printStackTrace();
}
}
static void lambda$onCreate$5(DialogInterface dialogInterface, int i) {
}
public void JSON_PARSE_DATA_AFTER_WEBCALL(JSONArray array) {
this.withdrawOption.setOrientation(1);
for (int i = 0; i < array.length(); i++) {
try {
JSONObject json = array.getJSONObject(i);
RadioButton radioButton = new RadioButton(this);
this.rdbtn = radioButton;
radioButton.setId(i);
this.rdbtn.setText(json.getString("withdraw_method"));
if (i == 0) {
this.selectedCurrencySymbol = json.getString("currency_symbol");
String string = json.getString("withdraw_method_currency_point");
this.point = string;
this.pointInt = Integer.parseInt(string);
this.rdbtn.setChecked(true);
this.withdrawMethod = this.rdbtn.getText().toString();
this.withdrawTitle.setText(this.resources.getString(2131887088) + " " + this.withdrawMethod);
this.selectedField = json.getString("withdraw_method_field");
if (TextUtils.equals(json.getString("withdraw_method_field"), "mobile no")) {
this.til.setHint(this.resources.getString(2131886567));
this.paytm_number.setInputType(3);
} else if (TextUtils.equals(json.getString("withdraw_method_field"), "email")) {
this.til.setHint(this.resources.getString(2131886425));
this.paytm_number.setInputType(32);
} else if (TextUtils.equals(json.getString("withdraw_method_field"), "UPI ID")) {
this.til.setHint(this.resources.getString(2131887058));
this.paytm_number.setInputType(1);
} else if (TextUtils.equals(json.getString("withdraw_method_field"), "Wallet Address")) {
this.til.setHint(this.resources.getString(2131887089));
this.paytm_number.setInputType(1);
}
}
this.withdrawOption.addView(this.rdbtn);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}