左晓为主开发手持机充值管理机
zuoxiao
2024-09-11 5b9a5a629f8c31a8c05a918dcefc557b46651dfe
qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/activity/BaseNfcActivity.java
@@ -1,15 +1,8 @@
package com.dayu.qihealonelibrary.activity;
/**
 * Created by zuo on 2018/12/2.
 */
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.os.Handler;
import com.dayu.baselibrary.utils.TipUtil;
@@ -17,7 +10,7 @@
/**
 * Author:Created by Ricky on 2017/8/25.
 * Author:Createdby zuo on 2018/12/2.
 * Email:584182977@qq.com
 * Description:
 * 子类在onNewIntent方法中进行NFC标签相关操作。
@@ -25,14 +18,13 @@
 * 在onNewIntent方法中执行intent传递过来的Tag数据
 * 将NFC标签卡靠近手机后部(NFC标签卡可网上自行购买)
 */
public class BaseNfcActivity extends QHAloneBaseActivity  {
public class BaseNfcActivity extends BaseActivity {
    protected NfcAdapter mNfcAdapter;
    private PendingIntent mPendingIntent;
    volatile UserCard userCard;
    Handler handler;
    /**
     * onCreat->onStart->onResume->onPause->onStop->onDestroy
@@ -68,7 +60,6 @@
    public void onResume() {
        super.onResume();
        if (!ifNFCUse(this)) {
            this.finish();
        }
        //设置处理优于所有其他NFC的处理
        if (mNfcAdapter != null)
@@ -97,7 +88,12 @@
     */
    protected Boolean ifNFCUse(Activity context) {
        if (mNfcAdapter == null) {
            TipUtil.show(context, "设备不支持NFC!");
            TipUtil.show(context, "设备不支持NFC!", new TipUtil.TipListener() {
                @Override
                public void onCancle() {
                    BaseNfcActivity.this.finish();
                }
            });
            return false;
        }
        if (mNfcAdapter != null && !mNfcAdapter.isEnabled()) {