// Path: app/src/main/java/com/murrayc/galaxyzoo/app/provider/Item.java
// public final class Item {
//     public static final String AUTHORITY =
//             "com.murrayc.galaxyzoo.app";
// 
//     /**
//      * The The content:// style URI for the list of all Items,
//      * or part of the URI for a single Item.
//      */
//     public static final Uri ITEMS_URI = Uri.parse("content://" +
//             AUTHORITY + "/" + ItemsContentProvider.URI_PART_ITEM);
// 
//     /**
//      * The URI for the list of all files,
//      * or part of the URI for a single file.
//      * Clients don't need to build a /file/ URI -
//      * they will get a /file/ URI from the Item.Columns.FILE_URI_COLUMN column
//      * in the result from a ITEMS_URI query.
//      */
//     public static final Uri FILE_URI = Uri.parse("content://" +
//             AUTHORITY + "/" + ItemsContentProvider.URI_PART_FILE);
//     public static final String ITEM_URI_PART = ItemsContentProvider.URI_PART_ITEM;
// 
//     public static final class Columns implements BaseColumns {
//         //The ID is BaseColumns._ID;
//         public static final String DONE = "done"; //Integer boolean (1 or 0)
//         public static final String UPLOADED = "uploaded"; //Integer boolean (1 or 0)
//         public static final String SUBJECT_ID = "subjectId";
//         public static final String ZOONIVERSE_ID = "zooniverseId";
//         public static final String GROUP_ID = "groupId";
//         public static final String LOCATION_STANDARD_URI_REMOTE = "locationStandardUriRemote";
//         public static final String LOCATION_STANDARD_URI = "locationStandardUri";
//         public static final String LOCATION_STANDARD_DOWNLOADED = "locationStandardDownloaded"; //Integer boolean (1 or 0)
//         public static final String LOCATION_THUMBNAIL_URI_REMOTE = "locationThumbnailUriRemote";
//         public static final String LOCATION_THUMBNAIL_URI = "locationThumbnailUri";
//         public static final String LOCATION_THUMBNAIL_DOWNLOADED = "locationThumbnailDownloaded"; //Integer boolean (1 or 0)
//         public static final String LOCATION_INVERTED_URI_REMOTE = "locationInvertedUriRemote";
//         public static final String LOCATION_INVERTED_URI = "locationInvertedUri";
//         public static final String LOCATION_INVERTED_DOWNLOADED = "locationInvertedDownloaded"; //Integer boolean (1 or 0)
//         public static final String FAVORITE = "favorite"; //Integer boolean (1 or 0)
//         public static final String DATETIME_DONE = "dateTimeDone"; //An ISO8601 string ("YYYY-MM-DD HH:MM:SS.SSS").
// 
//     }
// }


import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerFuture;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.util.JsonReader;
import com.murrayc.galaxyzoo.app.provider.Item;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.ref.WeakReference;
import java.util.Map;
     *
     * Don't call this from the main thread - use an AsyncTask, for instance.
     * @param context
     */
    private static void addAnonymousAccount(final Context context) {
        final AccountManager accountManager = AccountManager.get(context);
        final Account account = new Account(ACCOUNT_NAME_ANONYMOUS, LoginUtils.ACCOUNT_TYPE);
        //Note that this requires the AUTHENTICATE_ACCOUNTS permission on
        //SDK <=22:
        accountManager.addAccountExplicitly(account, null, null);

        //In case it has not been called yet.
        //This has no effect the second time.
        Utils.initDefaultPrefs(context);

        //Give the new account the existing (probably default) preferences,
        //so the SyncAdapter can use them.
        //See SettingsFragment.onSharedPreferenceChanged().
        copyPrefsToAccount(context, accountManager, account);

        //Tell the SyncAdapter to sync whenever the network is reconnected:
        setAutomaticAccountSync(context, account);
    }

    static void setAutomaticAccountSync(final Context context, final Account account) {
        final ContentResolver resolver = context.getContentResolver();
        if (resolver == null) {
            return;
        }

// Path: app/src/main/java/com/murrayc/galaxyzoo/app/provider/Item.java
// public final class Item {
//     public static final String AUTHORITY =
//             "com.murrayc.galaxyzoo.app";
// 
//     /**
//      * The The content:// style URI for the list of all Items,
//      * or part of the URI for a single Item.
//      */
//     public static final Uri ITEMS_URI = Uri.parse("content://" +
//             AUTHORITY + "/" + ItemsContentProvider.URI_PART_ITEM);
// 
//     /**
//      * The URI for the list of all files,
//      * or part of the URI for a single file.
//      * Clients don't need to build a /file/ URI -
//      * they will get a /file/ URI from the Item.Columns.FILE_URI_COLUMN column
//      * in the result from a ITEMS_URI query.
//      */
//     public static final Uri FILE_URI = Uri.parse("content://" +
//             AUTHORITY + "/" + ItemsContentProvider.URI_PART_FILE);
//     public static final String ITEM_URI_PART = ItemsContentProvider.URI_PART_ITEM;
// 
//     public static final class Columns implements BaseColumns {
//         //The ID is BaseColumns._ID;
//         public static final String DONE = "done"; //Integer boolean (1 or 0)
//         public static final String UPLOADED = "uploaded"; //Integer boolean (1 or 0)
//         public static final String SUBJECT_ID = "subjectId";
//         public static final String ZOONIVERSE_ID = "zooniverseId";
//         public static final String GROUP_ID = "groupId";
//         public static final String LOCATION_STANDARD_URI_REMOTE = "locationStandardUriRemote";
//         public static final String LOCATION_STANDARD_URI = "locationStandardUri";
//         public static final String LOCATION_STANDARD_DOWNLOADED = "locationStandardDownloaded"; //Integer boolean (1 or 0)
//         public static final String LOCATION_THUMBNAIL_URI_REMOTE = "locationThumbnailUriRemote";
//         public static final String LOCATION_THUMBNAIL_URI = "locationThumbnailUri";
//         public static final String LOCATION_THUMBNAIL_DOWNLOADED = "locationThumbnailDownloaded"; //Integer boolean (1 or 0)
//         public static final String LOCATION_INVERTED_URI_REMOTE = "locationInvertedUriRemote";
//         public static final String LOCATION_INVERTED_URI = "locationInvertedUri";
//         public static final String LOCATION_INVERTED_DOWNLOADED = "locationInvertedDownloaded"; //Integer boolean (1 or 0)
//         public static final String FAVORITE = "favorite"; //Integer boolean (1 or 0)
//         public static final String DATETIME_DONE = "dateTimeDone"; //An ISO8601 string ("YYYY-MM-DD HH:MM:SS.SSS").
// 
//     }
// }


// Path: app/src/main/java/com/murrayc/galaxyzoo/app/LoginUtils.java
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerFuture;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.util.JsonReader;
import com.murrayc.galaxyzoo.app.provider.Item;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.ref.WeakReference;
import java.util.Map;

     *
     * Don't call this from the main thread - use an AsyncTask, for instance.
     * @param context
     */
    private static void addAnonymousAccount(final Context context) {
        final AccountManager accountManager = AccountManager.get(context);
        final Account account = new Account(ACCOUNT_NAME_ANONYMOUS, LoginUtils.ACCOUNT_TYPE);
        //Note that this requires the AUTHENTICATE_ACCOUNTS permission on
        //SDK <=22:
        accountManager.addAccountExplicitly(account, null, null);

        //In case it has not been called yet.
        //This has no effect the second time.
        Utils.initDefaultPrefs(context);

        //Give the new account the existing (probably default) preferences,
        //so the SyncAdapter can use them.
        //See SettingsFragment.onSharedPreferenceChanged().
        copyPrefsToAccount(context, accountManager, account);

        //Tell the SyncAdapter to sync whenever the network is reconnected:
        setAutomaticAccountSync(context, account);
    }

    static void setAutomaticAccountSync(final Context context, final Account account) {
        final ContentResolver resolver = context.getContentResolver();
        if (resolver == null) {
            return;
        }

        ContentResolver.setSyncAutomatically(account, Item.AUTHORITY, true);