正在查看: Clash Legends v0.0.1 应用的 PaymentDetailsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 PaymentDetailsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.instamojo.android.activities;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.FragmentTransaction;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.instamojo.android.Instamojo;
import com.instamojo.android.R;
import com.instamojo.android.fragments.BaseFragment;
import com.instamojo.android.fragments.PaymentOptionsFragment;
import com.instamojo.android.helpers.Constants;
import com.instamojo.android.helpers.Logger;
import com.instamojo.android.models.GatewayOrder;
import com.instamojo.android.network.ServiceGenerator;
import java.io.IOException;
import kotlin.jvm.internal.IntCompanionObject;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class PaymentDetailsActivity extends BaseActivity {
private static final String a = PaymentDetailsActivity.class.getSimpleName();
private GatewayOrder b;
private boolean c;
private SearchView.OnQueryTextListener d;
private String e;
static void a(PaymentDetailsActivity paymentDetailsActivity) {
Logger.d(a, "Found order Object. Starting PaymentOptionsFragment");
paymentDetailsActivity.loadFragment(new PaymentOptionsFragment(), false);
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow();
window.clearFlags(67108864);
window.addFlags(IntCompanionObject.MIN_VALUE);
window.setStatusBarColor(getResources().getColor(R.color.primary_color));
setContentView(R.layout.activity_payment_details_instamojo);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
updateActionBar();
String str = a;
Logger.d(str, "Inflated XML");
String stringExtra = getIntent().getStringExtra(Constants.ORDER_ID);
if (stringExtra == null) {
Logger.e(str, "Object not found. Sending back - Payment Cancelled");
a(2, null, null);
}
ServiceGenerator.getImojoService().getPaymentOptions(stringExtra).enqueue(new Callback<GatewayOrder>() {
public final void onResponse(Call<GatewayOrder> call, Response<GatewayOrder> response) {
if (response.isSuccessful()) {
PaymentDetailsActivity.this.b = (GatewayOrder) response.body();
PaymentDetailsActivity.a(PaymentDetailsActivity.this);
} else {
if (response.errorBody() != null) {
try {
Logger.d(PaymentDetailsActivity.a, "Error response from server while fetching order details.");
Logger.e(PaymentDetailsActivity.a, "Error: " + response.errorBody().string());
} catch (IOException e) {
e.printStackTrace();
}
}
PaymentDetailsActivity.this.a(3, null, "Error fetching order details");
}
}
public final void onFailure(Call<GatewayOrder> call, Throwable th) {
PaymentDetailsActivity.this.a(3, null, "Failed to fetch order details");
}
});
registerReceiver(Instamojo.getInstance(), new IntentFilter(Instamojo.ACTION_INTENT_FILTER));
}
public boolean onCreateOptionsMenu(Menu menu) {
if (this.c) {
getMenuInflater().inflate(R.menu.menu_payment_options, menu);
SearchManager searchManager = (SearchManager) getSystemService(FirebaseAnalytics.Event.SEARCH);
SearchView actionView = menu.findItem(R.id.search).getActionView();
actionView.setQueryHint(this.e);
actionView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
actionView.setSubmitButtonEnabled(true);
SearchView.OnQueryTextListener onQueryTextListener = this.d;
if (onQueryTextListener != null) {
actionView.setOnQueryTextListener(onQueryTextListener);
}
}
Logger.d(a, "Inflated Options Menu");
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == 16908332) {
onBackPressed();
}
return super.onOptionsItemSelected(item);
}
public void startPaymentActivity(Bundle bundle) {
Logger.d(a, "Starting PaymentActivity with given Bundle");
Intent intent = new Intent((Context) this, (Class<?>) PaymentActivity.class);
intent.putExtras(getIntent());
intent.putExtra(Constants.PAYMENT_BUNDLE, bundle);
startActivityForResult(intent, 9);
}
public void onBackPressed() {
if (getSupportFragmentManager().getBackStackEntryCount() != 0) {
getSupportFragmentManager().popBackStackImmediate();
} else {
a(2, null, null);
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
int i;
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 9) {
Logger.d(a, "Returning back result to caller");
switch (resultCode) {
case -1:
i = 1;
break;
case 0:
i = 2;
break;
default:
i = 3;
break;
}
a(i, data.getExtras(), null);
}
}
public GatewayOrder getOrder() {
return this.b;
}
public void loadFragment(BaseFragment fragment, boolean addToBackStack) {
String str = a;
Logger.d(str, "Loading Fragment - " + fragment.getClass().getSimpleName());
FragmentTransaction beginTransaction = getSupportFragmentManager().beginTransaction();
beginTransaction.setTransition(4097);
beginTransaction.replace(R.id.container, fragment);
if (addToBackStack) {
beginTransaction.addToBackStack(fragment.getFragmentName());
}
beginTransaction.commit();
Logger.d(str, "Loaded Fragment - " + fragment.getClass().getSimpleName());
}
public void showSearchOption(String hintText, SearchView.OnQueryTextListener queryTextListener) {
this.c = true;
this.d = queryTextListener;
this.e = hintText;
invalidateOptionsMenu();
}
public void hideSearchOption() {
this.c = false;
invalidateOptionsMenu();
}
public void a(int i, Bundle bundle, String str) {
Intent intent = new Intent();
if (bundle != null) {
intent.putExtras(bundle);
}
intent.putExtra(Constants.KEY_CODE, i);
if (str != null && !str.isEmpty()) {
intent.putExtra("message", str);
}
intent.setAction(Instamojo.ACTION_INTENT_FILTER);
intent.addFlags(32);
sendBroadcast(intent);
finish();
}
protected void onDestroy() {
unregisterReceiver(Instamojo.getInstance());
super.onDestroy();
}
}