/**
  * Check if NFC adapter is enabled. If not, show the user a dialog and let him choose between
  * "Goto NFC Setting", "Use Editor Only" and "Exit App". Also enable NFC foreground dispatch
  * system.
  *
  * @see Common#enableNfcForegroundDispatch(Activity)
  */
 private void checkNfc() {
   // Check if the NFC hardware is enabled.
   if (Common.getNfcAdapter() != null && !Common.getNfcAdapter().isEnabled()) {
     // NFC is disabled. Show dialog.
     mEnableNfc.show();
     // Disable read/write tag options.
     mReadTag.setEnabled(false);
     mWriteTag.setEnabled(false);
     return;
   } else {
     // NFC is enabled. Hide dialog and enable NFC
     // foreground dispatch.
     if (mOldIntent != getIntent()) {
       int typeCheck = Common.treatAsNewTag(getIntent(), this);
       if (typeCheck == -1 || typeCheck == -2) {
         // Device or tag does not support Mifare Classic.
         // Run the only thing that is possible: The tag info tool.
         Intent i = new Intent(this, TagInfoToolActivity.class);
         startActivity(i);
       }
       mOldIntent = getIntent();
     }
     Common.enableNfcForegroundDispatch(this);
     mEnableNfc.hide();
     mReadTag.setEnabled(true);
     mWriteTag.setEnabled(true);
   }
 }
 /**
  * Handle new Intent as a new tag Intent and if the tag/device does not support Mifare Classic,
  * then run {@link TagInfoToolActivity}.
  *
  * @see Common#treatAsNewTag(Intent, android.content.Context)
  * @see TagInfoToolActivity
  */
 @Override
 public void onNewIntent(Intent intent) {
   int typeCheck = Common.treatAsNewTag(intent, this);
   if (typeCheck == -1 || typeCheck == -2) {
     // Device or tag does not support Mifare Classic.
     // Run the only thing that is possible: The tag info tool.
     Intent i = new Intent(this, TagInfoToolActivity.class);
     startActivity(i);
   }
 }