// Path: src/org/pixmob/freemobile/netstat/Constants.java
// public static final String TAG = "FreeMobileNetstat";
// 
// Path: src/org/pixmob/freemobile/netstat/content/NetstatContract.java
// public static class Events implements BaseColumns, EventsColumns {
//     /**
//      * The content:// style URI for this table.
//      */
//     public static final Uri CONTENT_URI = new Uri.Builder()
//             .scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY)
//             .appendPath("events").build();
//     /**
//      * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
//      * entry.
//      */
//     public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event";
//     /**
//      * The MIME type of {@link #CONTENT_TYPE} providing a directory of
//      * entries.
//      */
//     public static final String CONTENT_TYPE = "vnd.android.cursor.dir/event";
// }
// 
// Path: src/org/pixmob/freemobile/netstat/util/IOUtils.java
// public final class IOUtils {
//     private IOUtils() {
//     }
//     
//     /**
//      * Quietly close a stream. This method accepts <code>null</code> values.
//      * @param stream stream to close
//      */
//     public static void close(Closeable stream) {
//         if (stream != null) {
//             try {
//                 stream.close();
//             } catch (IOException ignore) {
//             }
//         }
//     }
// }


import static org.pixmob.freemobile.netstat.Constants.TAG;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import org.pixmob.freemobile.netstat.R;
import org.pixmob.freemobile.netstat.content.NetstatContract.Events;
import org.pixmob.freemobile.netstat.util.IOUtils;
import android.content.Context;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Environment;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.widget.Toast;
            return false;
        }
        return true;
    }
    
    @Override
    protected void onProgressUpdate(Integer... values) {
        final ExportDialogFragment f = (ExportDialogFragment) fragmentManager
                .findFragmentByTag(DIALOG_TAG);
        if (f != null) {
            final int current = values[0];
            final int total = values[1];
            f.update(current, total);
        }
    }
    
    @Override
    protected void onPreExecute() {
        if (!Environment.getExternalStorageState().equals(
            Environment.MEDIA_MOUNTED)) {
            Log.w(TAG, "External storage is not available");
            Toast.makeText(context,
                context.getString(R.string.external_storage_not_available),
                Toast.LENGTH_SHORT).show();
            aborted = true;
        } else {
            new ExportDialogFragment().show(fragmentManager, DIALOG_TAG);
        }
    }
    
// Path: src/org/pixmob/freemobile/netstat/Constants.java
// public static final String TAG = "FreeMobileNetstat";
// 
// Path: src/org/pixmob/freemobile/netstat/content/NetstatContract.java
// public static class Events implements BaseColumns, EventsColumns {
//     /**
//      * The content:// style URI for this table.
//      */
//     public static final Uri CONTENT_URI = new Uri.Builder()
//             .scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY)
//             .appendPath("events").build();
//     /**
//      * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
//      * entry.
//      */
//     public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event";
//     /**
//      * The MIME type of {@link #CONTENT_TYPE} providing a directory of
//      * entries.
//      */
//     public static final String CONTENT_TYPE = "vnd.android.cursor.dir/event";
// }
// 
// Path: src/org/pixmob/freemobile/netstat/util/IOUtils.java
// public final class IOUtils {
//     private IOUtils() {
//     }
//     
//     /**
//      * Quietly close a stream. This method accepts <code>null</code> values.
//      * @param stream stream to close
//      */
//     public static void close(Closeable stream) {
//         if (stream != null) {
//             try {
//                 stream.close();
//             } catch (IOException ignore) {
//             }
//         }
//     }
// }


// Path: src/org/pixmob/freemobile/netstat/ui/ExportTask.java
import static org.pixmob.freemobile.netstat.Constants.TAG;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import org.pixmob.freemobile.netstat.R;
import org.pixmob.freemobile.netstat.content.NetstatContract.Events;
import org.pixmob.freemobile.netstat.util.IOUtils;
import android.content.Context;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Environment;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.widget.Toast;

            return false;
        }
        return true;
    }
    
    @Override
    protected void onProgressUpdate(Integer... values) {
        final ExportDialogFragment f = (ExportDialogFragment) fragmentManager
                .findFragmentByTag(DIALOG_TAG);
        if (f != null) {
            final int current = values[0];
            final int total = values[1];
            f.update(current, total);
        }
    }
    
    @Override
    protected void onPreExecute() {
        if (!Environment.getExternalStorageState().equals(
            Environment.MEDIA_MOUNTED)) {
            Log.w(TAG, "External storage is not available");
            Toast.makeText(context,
                context.getString(R.string.external_storage_not_available),
                Toast.LENGTH_SHORT).show();
            aborted = true;
        } else {
            new ExportDialogFragment().show(fragmentManager, DIALOG_TAG);
        }
    }
    
    @Override