正在查看: Chaupal v3.2 应用的 NfcActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Chaupal v3.2 应用的 NfcActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package in.juspay.hypernfc;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.fragment.app.h;
import com.cardreader.card_reader_lib.CardTask;
import java.util.Timer;
import java.util.TimerTask;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
public final class NfcActivity extends h {
private TimerTask task;
@NotNull
private final JSONObject data = new JSONObject();
@NotNull
private final CardTask cardTask = new CardTask();
@NotNull
private final Timer timerForWaitingInActivity = new Timer();
@NotNull
private final Timer timerToReadChangedMessage = new Timer();
public static final void onCreate$lambda$0(NfcActivity this$0, ImageView imageView) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
((Wave) this$0.findViewById(R.id.rippleView)).startRippleAnimation(imageView.getTop() + (imageView.getHeight() / 2));
}
public static final void onNewIntent$lambda$1(NfcActivity this$0) {
Intrinsics.checkNotNullParameter(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);
Bundle extras = getIntent().getExtras();
int i = extras != null ? extras.getInt("waitingTime") : 7000;
setContentView(R.layout.activity_nfc);
final ImageView imageView = (ImageView) findViewById(R.id.backgroundImage);
imageView.post(new Runnable() {
@Override
public final void run() {
NfcActivity.onCreate$lambda$0(NfcActivity.this, imageView);
}
});
NfcActivity$onCreate$2 nfcActivity$onCreate$2 = new NfcActivity$onCreate$2(this);
this.task = nfcActivity$onCreate$2;
this.timerForWaitingInActivity.schedule(nfcActivity$onCreate$2, 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(@NotNull Intent intent) {
Intrinsics.checkNotNullParameter(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$1(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);
}
}
}