package com.ifpdos.factorytest;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.seewo.sdk.OsEventBus;
import com.seewo.sdk.event.OSEvent;
import com.seewo.sdk.eventbus.OnEventOfOS;
import com.seewo.sdk.eventbus.ThreadMode;
import java.nio.ByteBuffer;

/* JADX INFO: loaded from: classes.dex */
public class McuNfcTestActivity extends Activity implements View.OnClickListener {
    private static final String TAG = "NfcTestActivity";
    private static ByteBuffer buffer = ByteBuffer.allocate(8);
    String card_id;
    private Handler mHandler = new Handler();
    TextView message;
    Button nfc_fail;
    Button nfc_pass;

    @Override // android.app.Activity
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_nfc_test);
        this.nfc_pass = (Button) findViewById(R.id.nfc_pass);
        this.nfc_fail = (Button) findViewById(R.id.nfc_fail);
        this.message = (TextView) findViewById(R.id.message_tv);
        this.nfc_pass.setOnClickListener(this);
        this.nfc_fail.setOnClickListener(this);
    }

    @Override // android.app.Activity
    protected void onResume() {
        super.onResume();
        OsEventBus.getInstance().register(this);
    }

    @Override // android.view.View.OnClickListener
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.nfc_pass) {
            setResult(1);
            finish();
        } else if (id == R.id.nfc_fail) {
            setResult(2);
            finish();
        }
    }

    @Override // android.app.Activity
    protected void onDestroy() {
        super.onDestroy();
        OsEventBus.getInstance().unregister(this);
        this.mHandler.removeCallbacksAndMessages(null);
    }

    @OnEventOfOS(threadMode = ThreadMode.MAIN)
    public void onNfcChanged(OSEvent.NFCSendCardID nFCSendCardID) {
        if (nFCSendCardID.cardId.isEmpty()) {
            return;
        }
        Log.d(TAG, "onNfcChanged: " + nFCSendCardID.cardId);
        this.card_id = nFCSendCardID.cardId;
        this.message.setText(R.string.card_number);
        this.mHandler.postDelayed(new Runnable() { // from class: com.ifpdos.factorytest.McuNfcTestActivity$$ExternalSyntheticLambda0
            @Override // java.lang.Runnable
            public final void run() {
                this.f$0.lambda$onNfcChanged$0();
            }
        }, 300L);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ void lambda$onNfcChanged$0() {
        this.message.setText(getString(R.string.card_number) + this.card_id);
    }
}
