正在查看: Namma Yatri v3.3.7 应用的 NfcActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Namma Yatri v3.3.7 应用的 NfcActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package in.juspay.hypernfc;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.activity.J;
import androidx.activity.r;
import androidx.core.view.I;
import androidx.core.view.L0;
import androidx.core.view.b0;
import androidx.fragment.app.FragmentActivity;
import com.cardreader.card_reader_lib.CardTask;
import java.util.Timer;
import java.util.TimerTask;
import kotlin.jvm.internal.m;
import org.json.JSONObject;
public final class NfcActivity extends FragmentActivity {
private TimerTask task;
private final JSONObject data = new JSONObject();
private final CardTask cardTask = new CardTask();
private final Timer timerForWaitingInActivity = new Timer();
private final Timer timerToReadChangedMessage = new Timer();
public static final L0 onCreate$lambda$0(View v, L0 insets) {
m.i(v, "v");
m.i(insets, "insets");
androidx.core.graphics.d f = insets.f(L0.m.g() | L0.m.a());
m.h(f, "insets.getInsets(WindowI…pat.Type.displayCutout())");
v.setPadding(f.a, f.b, f.c, f.d);
return insets;
}
public static final void onCreate$lambda$1(NfcActivity this$0, View view) {
m.i(this$0, "this$0");
this$0.onBackPressed();
}
public static final void onCreate$lambda$2(NfcActivity this$0, ImageView imageView) {
m.i(this$0, "this$0");
((Wave) this$0.findViewById(R.id.rippleView)).startRippleAnimation(imageView.getTop() + (imageView.getHeight() / 2));
}
public static final void onNewIntent$lambda$3(NfcActivity this$0) {
m.i(this$0, "this$0");
this$0.findViewById(R.id.backgroundImage).setBackground(androidx.core.content.a.getDrawable(this$0.getApplicationContext(), R.drawable.image_border));
}
public final void timedOut(final JSONObject jSONObject) {
((TextView) findViewById(R.id.nfcStatus)).setText(R.string.no_card_detected);
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
Intent intent = new Intent();
intent.putExtra("result_data", jSONObject.toString());
this.setResult(0, intent);
this.finish();
}
};
this.task = timerTask;
this.timerToReadChangedMessage.schedule(timerTask, 1500L);
}
public void onBackPressed() {
setResult(0, new Intent());
finish();
}
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
r.b(this, (J) null, (J) null, 3, (Object) null);
Bundle extras = getIntent().getExtras();
int i = extras != null ? extras.getInt("waitingTime") : 7000;
setContentView(R.layout.activity_nfc);
b0.D0(findViewById(android.R.id.content), new I() {
public final L0 onApplyWindowInsets(View view, L0 l0) {
L0 onCreate$lambda$0;
onCreate$lambda$0 = NfcActivity.onCreate$lambda$0(view, l0);
return onCreate$lambda$0;
}
});
View findViewById = findViewById(R.id.backpressImage);
if (findViewById != null) {
findViewById.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NfcActivity.onCreate$lambda$1(NfcActivity.this, view);
}
});
}
final ImageView imageView = (ImageView) findViewById(R.id.backgroundImage);
imageView.post(new Runnable() {
@Override
public final void run() {
NfcActivity.onCreate$lambda$2(NfcActivity.this, imageView);
}
});
NfcActivity$onCreate$4 nfcActivity$onCreate$4 = new NfcActivity$onCreate$4(this);
this.task = nfcActivity$onCreate$4;
this.timerForWaitingInActivity.schedule(nfcActivity$onCreate$4, i);
}
protected void onDestroy() {
super.onDestroy();
try {
TimerTask timerTask = this.task;
if (timerTask != null) {
timerTask.cancel();
}
this.timerForWaitingInActivity.cancel();
this.timerToReadChangedMessage.cancel();
} catch (Exception unused) {
}
}
protected void onNewIntent(Intent intent) {
m.i(intent, "intent");
super/*androidx.activity.ComponentActivity*/.onNewIntent(intent);
try {
String cardDetails = this.cardTask.getCardDetails(intent);
this.data.put("error", (Object) null);
this.data.put("data", cardDetails);
if (cardDetails != null) {
((TextView) findViewById(R.id.nfcStatus)).setText(R.string.scan_successful);
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
JSONObject jSONObject;
Intent intent2 = new Intent();
jSONObject = NfcActivity.this.data;
intent2.putExtra("result_data", jSONObject.toString());
NfcActivity.this.setResult(-1, intent2);
NfcActivity.this.finish();
}
};
this.task = timerTask;
this.timerToReadChangedMessage.schedule(timerTask, 1500L);
} else {
runOnUiThread(new Runnable() {
@Override
public final void run() {
NfcActivity.onNewIntent$lambda$3(NfcActivity.this);
}
});
((TextView) findViewById(R.id.nfcStatus)).setText(R.string.scan_failed);
TimerTask timerTask2 = new TimerTask() {
@Override
public void run() {
Intent intent2 = new Intent();
intent2.putExtra("result_data", "{\"error\":\"Couldn't read your card ! Try again or type your card number\"}");
NfcActivity.this.setResult(0, intent2);
NfcActivity.this.finish();
}
};
this.task = timerTask2;
this.timerToReadChangedMessage.schedule(timerTask2, 1500L);
}
} catch (Exception unused) {
Intent intent2 = new Intent();
intent2.putExtra("result_data", "{\"error\":\"Couldn't recognize card ! Try again or type your card number\"}");
setResult(0, intent2);
finish();
}
}
protected void onPause() {
super.onPause();
if (this.cardTask.isNFCEnabled(this)) {
this.cardTask.onPauseClone(this);
}
}
protected void onResume() {
super.onResume();
if (this.cardTask.isNFCEnabled(this)) {
this.cardTask.onResumeClone(this);
}
}
}