package org.danielge.nfcskeleton;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentFilter;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.os.Bundle;
import android.util.Log;

import java.util.Arrays;

public abstract class NfcWriterActivity extends Activity {
    public static final String TAG = NfcWriterActivity.class.getSimpleName();

    private static final IntentFilter WRITE_FILTER = buildWriteFilter();

    private static IntentFilter buildWriteFilter() {
        IntentFilter filter = new IntentFilter();
        filter.addAction(NfcAdapter.ACTION_TAG_DISCOVERED);
        filter.addCategory(Intent.CATEGORY_DEFAULT);

        return filter;
    }

    private boolean writeMode = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onNewIntent(Intent intent) {
        String action = intent.getAction();

        if (writeMode && NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
            Log.i(TAG, "Discovered tag");

            Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
            onTagDiscovered(tag);
        }
    }

    protected abstract void onTagDiscovered (Tag tag);

    protected void enableWriteTagMode(IntentFilter[] additionalFilters, String[][] techlist) {
        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(this);
        Intent intent = new Intent(this, getClass());
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

        IntentFilter[] filters = Arrays.copyOf(additionalFilters, additionalFilters.length + 1);
        filters[additionalFilters.length - 1] = WRITE_FILTER;

        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
        adapter.enableForegroundDispatch(this, pendingIntent, additionalFilters, techlist);

        writeMode = true;
    }

    protected void disableWriteTagMode() {
        writeMode = false;
        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(this);
        adapter.disableForegroundDispatch(this);
    }

    protected final boolean inWriteMode() {
        return writeMode;
    }
}
@@ -1318,32 +1318,115 @@
 tag);%0A%0A    p
-rotected
+ublic void enableWriteTagMode() %7B%0A        enableWriteTagMode(null, null);%0A    %7D%0A%0A    public
  void enable
@@ -1695,16 +1695,110 @@
 Filter%5B%5D
+ filters;%0A        if (additionalFilters != null && additionalFilters.length %3E 0) %7B%0A           
  filters
@@ -1868,24 +1868,28 @@
 1);%0A        
+    
 filters%5Baddi
@@ -1929,16 +1929,102 @@
 _FILTER;
+%0A        %7D else %7B%0A            filters = new IntentFilter%5B%5D %7B WRITE_FILTER %7D;%0A        %7D
 %0A%0A      
@@ -2164,27 +2164,17 @@
 Intent, 
-additionalF
+f
 ilters, 
@@ -2219,32 +2219,29 @@
     %7D%0A%0A    p
-rotected
+ublic
  void disabl
@@ -2411,24 +2411,21 @@
 %7D%0A%0A    p
-rotected
+ublic
  final b

Change visibility of protected methods to public