return early if cannot init adapter
[YkNeoCR.git] / src / org / average / nfcauthcr / NfcCRdispatch.java
index 25198beff5fdf39e9b1819d673d8822bbe688cc7..3216ef642a3b1dc126ec316a95036c9a3fee66e3 100644 (file)
@@ -1,4 +1,4 @@
-package org.average.nfcauthcr;
+package org.average.ykneocr;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -14,8 +14,8 @@ import android.nfc.tech.IsoDep;
 import android.util.Log;
 import android.widget.Toast;
 
-import org.average.nfcauthcr.YkNeo;
-import org.average.nfcauthcr.CRException;
+import org.average.ykneocr.YkNeo;
+import org.average.ykneocr.CRException;
 
 public class NfcCRdispatch {
 
@@ -55,7 +55,7 @@ public class NfcCRdispatch {
                return null;
        }
 
-       public void onResume(ArrayList<String> challenge) {
+       public boolean onResume(ArrayList<String> challenge) {
                this.challenge = challenge;
                Intent intent = activity.getIntent();
                intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
@@ -68,16 +68,17 @@ public class NfcCRdispatch {
                if (adapter == null) {
                        Toast.makeText(activity, R.string.no_nfc,
                                                Toast.LENGTH_LONG).show();
-                       return;
+                       return false;
                }
                if (!adapter.isEnabled()) {
                        Toast.makeText(activity, R.string.nfc_disabled,
                                                Toast.LENGTH_LONG).show();
-                       return;
+                       return false;
                }
                adapter.enableForegroundDispatch(activity, tagIntent,
                                        new IntentFilter[] {iso},
                                        new String[][] {techs});
+               return true;
        }
 
        public void onPause() {