导航菜单

页面标题

页面副标题

MedEd v5.3.6 - NfcActivity.java 源代码

正在查看: MedEd v5.3.6 应用的 NfcActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package in.juspay.hypernfc;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.fragment.app.e;
import com.cardreader.card_reader_lib.CardTask;
import defpackage.RunnableC0692a70;
import defpackage.RunnableC2132on2;
import in.juspay.hyper.constants.LogLevel;
import in.juspay.hypernfc.NfcActivity;
import java.util.Timer;
import java.util.TimerTask;
import org.json.JSONObject;

public class NfcActivity extends e {
    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 class AnonymousClass1 extends TimerTask {
        public AnonymousClass1() {
        }

        public void lambda$run$0() {
            View findViewById = NfcActivity.this.findViewById(R.id.backgroundImage);
            Context applicationContext = NfcActivity.this.getApplicationContext();
            int i = R.drawable.image_border;
            Object obj = dT.a;
            findViewById.setBackground(a.b(applicationContext, i));
        }

        @Override
        public void run() {
            try {
                NfcActivity.this.data.put(LogLevel.ERROR, "Request timed out!");
                NfcActivity.this.data.put("data", (Object) null);
                NfcActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        NfcActivity.AnonymousClass1.this.lambda$run$0();
                    }
                });
                NfcActivity nfcActivity = NfcActivity.this;
                nfcActivity.timedOut(nfcActivity.data);
            } catch (Exception unused) {
                Intent intent = new Intent();
                intent.putExtra("result_data", "{\"error\":\"Couldn't read the card! Try again or type your card number\"}");
                NfcActivity.this.setResult(0, intent);
                NfcActivity.this.finish();
            }
        }
    }

    public void lambda$onCreate$0(ImageView imageView) {
        ((Wave) findViewById(R.id.rippleView)).startRippleAnimation((imageView.getHeight() / 2) + imageView.getTop());
    }

    public void lambda$onNewIntent$1() {
        View findViewById = findViewById(R.id.backgroundImage);
        Context applicationContext = getApplicationContext();
        int i = R.drawable.image_border;
        Object obj = dT.a;
        findViewById.setBackground(a.b(applicationContext, i));
    }

    public 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());
                NfcActivity.this.setResult(0, intent);
                NfcActivity.this.finish();
            }
        };
        this.task = timerTask;
        this.timerToReadChangedMessage.schedule(timerTask, 1500L);
    }

    public void onBackPressed() {
        setResult(0, new Intent());
        finish();
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        Bundle extras = getIntent().getExtras();
        int i = extras != null ? extras.getInt("waitingTime") : 7000;
        setContentView(R.layout.activity_nfc);
        ImageView imageView = (ImageView) findViewById(R.id.backgroundImage);
        imageView.post(new RunnableC0692a70(this, 6, imageView));
        AnonymousClass1 anonymousClass1 = new AnonymousClass1();
        this.task = anonymousClass1;
        this.timerForWaitingInActivity.schedule(anonymousClass1, i);
    }

    public void onDestroy() {
        super.onDestroy();
        try {
            TimerTask timerTask = this.task;
            if (timerTask != null) {
                timerTask.cancel();
            }
            this.timerForWaitingInActivity.cancel();
            this.timerToReadChangedMessage.cancel();
        } catch (Exception unused) {
        }
    }

    public void onNewIntent(Intent intent) {
        super/*OL*/.onNewIntent(intent);
        try {
            String cardDetails = this.cardTask.getCardDetails(intent);
            this.data.put(LogLevel.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() {
                        Intent intent2 = new Intent();
                        intent2.putExtra("result_data", NfcActivity.this.data.toString());
                        NfcActivity.this.setResult(-1, intent2);
                        NfcActivity.this.finish();
                    }
                };
                this.task = timerTask;
                this.timerToReadChangedMessage.schedule(timerTask, 1500L);
            } else {
                runOnUiThread(new RunnableC2132on2(this, 6));
                ((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();
        }
    }

    public void onPause() {
        super.onPause();
        if (this.cardTask.isNFCEnabled(this)) {
            this.cardTask.onPauseClone(this);
        }
    }

    public void onResume() {
        super.onResume();
        if (this.cardTask.isNFCEnabled(this)) {
            this.cardTask.onResumeClone(this);
        }
    }
}