导航菜单

页面标题

页面副标题

OLX India v19.42.007 - NFCActivity.java 源代码

正在查看: OLX India v19.42.007 应用的 NFCActivity.java JAVA 源代码文件

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


package com.payu.nfc.view;

import android.graphics.drawable.Drawable;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.nfc.tech.IsoDep;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import androidx.appcompat.widget.AppCompatImageView;
import com.payu.nfc.e;
import com.payu.nfc.f;
import com.payu.nfc.g;
import com.payu.nfc.i;
import com.payu.nfc.j;
import com.payu.nfc.model.h;
import com.payu.nfc.parser.a;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import kotlin.Metadata;

@Metadata
public final class NFCActivity extends androidx.appcompat.app.d implements NfcAdapter.ReaderCallback {
    public NfcAdapter Q;

    public static final class a extends androidx.vectordrawable.graphics.drawable.b {
        public final boolean a;
        public final androidx.vectordrawable.graphics.drawable.c b;

        public a(boolean z, androidx.vectordrawable.graphics.drawable.c cVar) {
            this.a = z;
            this.b = cVar;
        }

        public void onAnimationEnd(Drawable drawable) {
            if (this.a) {
                this.b.start();
            }
        }
    }

    public static final void i2(NFCActivity nFCActivity) {
        i.b = null;
        nFCActivity.finish();
    }

    public static final void j2(NFCActivity nFCActivity, com.payu.nfc.model.a aVar) {
        nFCActivity.h2(com.payu.nfc.d.payu_nfc_success, false, com.payu.nfc.d.payu_nfc_reading_success_icon, g.payu_read_success_text);
        com.payu.nfc.interfaces.a aVar2 = i.b;
        if (aVar2 == null) {
            return;
        }
        aVar2.onNFCReadSuccess(aVar);
    }

    public static final void m2(NFCActivity nFCActivity) {
        String string = nFCActivity.getString(g.payu_read_error_text);
        nFCActivity.h2(com.payu.nfc.d.payu_nfc_error, false, com.payu.nfc.d.payu_nfc_reading_error_icon, g.payu_read_error_text);
        com.payu.nfc.interfaces.a aVar = i.b;
        if (aVar == null) {
            return;
        }
        aVar.onNFCReadFailure(0, string);
    }

    public static final void n2(NFCActivity nFCActivity) {
        nFCActivity.k2();
        nFCActivity.a();
    }

    public final void a() {
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public final void run() {
                NFCActivity.i2(NFCActivity.this);
            }
        }, 2000L);
    }

    public final void h2(int i, boolean z, int i2, int i3) {
        AppCompatImageView findViewById = findViewById(e.card_read_image);
        findViewById(e.text_card).setText(getString(i3));
        findViewById(e.card_overlap_image).setImageResource(i2);
        androidx.vectordrawable.graphics.drawable.c a2 = androidx.vectordrawable.graphics.drawable.c.a(this, i);
        findViewById.setImageDrawable(a2);
        if (a2 != null) {
            a2.c(new a(z, a2));
        }
        if (a2 == null) {
            return;
        }
        a2.start();
    }

    public final void k2() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                NFCActivity.m2(NFCActivity.this);
            }
        });
    }

    public void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.r*/.onCreate(bundle);
        this.Q = NfcAdapter.getDefaultAdapter(this);
        setContentView(f.activity_nfc);
        h2(com.payu.nfc.d.payu_nfc_reading_started, true, com.payu.nfc.d.payu_nfc_reading_icon, g.payu_read);
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public final void run() {
                NFCActivity.n2(NFCActivity.this);
            }
        }, 25000L);
    }

    public void onResume() {
        super/*androidx.fragment.app.r*/.onResume();
        NfcAdapter nfcAdapter = this.Q;
        if (nfcAdapter != null) {
            Log.d("mNfcAdapter is: ", String.valueOf(nfcAdapter));
            Bundle bundle = new Bundle();
            bundle.putInt("presence", 250);
            this.Q.enableReaderMode(this, this, 287, bundle);
        }
    }

    @Override
    public void onTagDiscovered(Tag tag) {
        final com.payu.nfc.model.a aVar;
        com.payu.nfc.model.g gVar;
        try {
            IsoDep isoDep = IsoDep.get(tag);
            isoDep.connect();
            j jVar = new j();
            jVar.a = isoDep;
            org.slf4j.a aVar2 = com.payu.nfc.parser.a.f;
            a.C0083a c0083a = new a.C0083a();
            c0083a.a = true;
            c0083a.c = true;
            c0083a.b = true;
            c0083a.e = false;
            c0083a.d = true;
            com.payu.nfc.model.f d = new com.payu.nfc.parser.a(jVar, new com.payu.nfc.iso7816emv.impl.a(), c0083a).d();
            String a2 = d.a();
            h hVar = d.d;
            Date date = hVar != null ? hVar.c : null;
            if (date == null && (gVar = d.e) != null) {
                date = gVar.c;
            }
            String format = new SimpleDateFormat("MMyyyy", Locale.getDefault()).format(date);
            aVar = new com.payu.nfc.model.a(a2, format.substring(0, 2), format.substring(2, 6));
        } catch (Exception e) {
            Log.d("NFC READING FAILED", e.toString());
            k2();
        }
        if (aVar.a().length() <= 0 && aVar.b().length() <= 0 && aVar.c().length() <= 0) {
            k2();
            a();
        }
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                NFCActivity.j2(NFCActivity.this, aVar);
            }
        });
        a();
    }
}