// Path: HOSMCollect/src/hosm/odk/collect/android/listeners/InstanceUploaderListener.java
// public interface InstanceUploaderListener {
//     void uploadingComplete(HashMap<String, String> result);
//     void progressUpdate(int progress, int total);
//     void authRequest(Uri url, HashMap<String, String> doneSoFar);
// }
// 
// Path: HOSMCollect/src/hosm/odk/collect/android/views/DynamicListPreference.java
// public class DynamicListPreference extends ListPreference {
// 
// 	// control whether dialog should show or not
// 	private boolean showDialog = false;
// 
// 	public DynamicListPreference(Context context, AttributeSet attrs) {
// 		super(context, attrs);
// 	}
// 
// 	public DynamicListPreference(Context context) {
// 		super(context);
// 	}
// 
// 	public DynamicListPreference(Context context, boolean show) {
// 		super(context);
// 		showDialog = show;
// 	}
// 
// 	// This is just to simulate that the user 'clicked' on the preference.
// 	public void show() {
// 		showDialog(null);
// 	}
// 	
// 	public boolean shouldShow() {
// 		return showDialog;
// 	}
// 
// 	@Override
// 	protected void showDialog(Bundle state) {
// 		if (showDialog) {
// 			super.showDialog(state);
// 		} else {
// 			// we don't want the dialog to show sometimes
// 			// like immediately after click, so we don't until we've generated
// 			// the
// 			// list choices
// 			return;
// 		}
// 	}
// 
// 	public void setShowDialog(boolean show) {
// 		showDialog = show;
// 	}
// 
// 	@Override
// 	public void onClick(DialogInterface dialog, int which) {
// 		super.onClick(dialog, which);
// 
// 		// causes list to refresh next time dialog is requested
// 		if (which == DialogInterface.BUTTON_NEGATIVE) {
// 			setShowDialog(false);
// 		}
// 	}
// 
// 	
// 	
// 
// }


import hosm.odk.collect.android.application.Collect;
import hosm.odk.collect.android.listeners.InstanceUploaderListener;
import hosm.odk.collect.android.tasks.GoogleMapsEngineTask;
import hosm.odk.collect.android.views.DynamicListPreference;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import hosm.odk.collect.android.R;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.GooglePlayServicesAvailabilityException;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
					.getEntry());
		}

		// get list of google accounts
		final Account[] accounts = AccountManager.get(getApplicationContext())
				.getAccountsByType("com.google");
		ArrayList<String> accountEntries = new ArrayList<String>();
		ArrayList<String> accountValues = new ArrayList<String>();

		for (int i = 0; i < accounts.length; i++) {
			accountEntries.add(accounts[i].name);
			accountValues.add(accounts[i].name);
		}
		accountEntries.add(getString(R.string.no_account));
		accountValues.add("");

		mSelectedGoogleAccountPreference.setEntries(accountEntries
				.toArray(new String[accountEntries.size()]));
		mSelectedGoogleAccountPreference.setEntryValues(accountValues
				.toArray(new String[accountValues.size()]));
		mSelectedGoogleAccountPreference
				.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
					@Override
					public boolean onPreferenceChange(Preference preference,
							Object newValue) {
						int index = ((ListPreference) preference)
								.findIndexOfValue(newValue.toString());
						String value = (String) ((ListPreference) preference)
								.getEntryValues()[index];
						((ListPreference) preference).setSummary(value);
// Path: HOSMCollect/src/hosm/odk/collect/android/listeners/InstanceUploaderListener.java
// public interface InstanceUploaderListener {
//     void uploadingComplete(HashMap<String, String> result);
//     void progressUpdate(int progress, int total);
//     void authRequest(Uri url, HashMap<String, String> doneSoFar);
// }
// 
// Path: HOSMCollect/src/hosm/odk/collect/android/views/DynamicListPreference.java
// public class DynamicListPreference extends ListPreference {
// 
// 	// control whether dialog should show or not
// 	private boolean showDialog = false;
// 
// 	public DynamicListPreference(Context context, AttributeSet attrs) {
// 		super(context, attrs);
// 	}
// 
// 	public DynamicListPreference(Context context) {
// 		super(context);
// 	}
// 
// 	public DynamicListPreference(Context context, boolean show) {
// 		super(context);
// 		showDialog = show;
// 	}
// 
// 	// This is just to simulate that the user 'clicked' on the preference.
// 	public void show() {
// 		showDialog(null);
// 	}
// 	
// 	public boolean shouldShow() {
// 		return showDialog;
// 	}
// 
// 	@Override
// 	protected void showDialog(Bundle state) {
// 		if (showDialog) {
// 			super.showDialog(state);
// 		} else {
// 			// we don't want the dialog to show sometimes
// 			// like immediately after click, so we don't until we've generated
// 			// the
// 			// list choices
// 			return;
// 		}
// 	}
// 
// 	public void setShowDialog(boolean show) {
// 		showDialog = show;
// 	}
// 
// 	@Override
// 	public void onClick(DialogInterface dialog, int which) {
// 		super.onClick(dialog, which);
// 
// 		// causes list to refresh next time dialog is requested
// 		if (which == DialogInterface.BUTTON_NEGATIVE) {
// 			setShowDialog(false);
// 		}
// 	}
// 
// 	
// 	
// 
// }


// Path: HOSMCollect/src/hosm/odk/collect/android/preferences/GMEPreferencesActivity.java
import hosm.odk.collect.android.application.Collect;
import hosm.odk.collect.android.listeners.InstanceUploaderListener;
import hosm.odk.collect.android.tasks.GoogleMapsEngineTask;
import hosm.odk.collect.android.views.DynamicListPreference;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import hosm.odk.collect.android.R;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.GooglePlayServicesAvailabilityException;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

					.getEntry());
		}

		// get list of google accounts
		final Account[] accounts = AccountManager.get(getApplicationContext())
				.getAccountsByType("com.google");
		ArrayList<String> accountEntries = new ArrayList<String>();
		ArrayList<String> accountValues = new ArrayList<String>();

		for (int i = 0; i < accounts.length; i++) {
			accountEntries.add(accounts[i].name);
			accountValues.add(accounts[i].name);
		}
		accountEntries.add(getString(R.string.no_account));
		accountValues.add("");

		mSelectedGoogleAccountPreference.setEntries(accountEntries
				.toArray(new String[accountEntries.size()]));
		mSelectedGoogleAccountPreference.setEntryValues(accountValues
				.toArray(new String[accountValues.size()]));
		mSelectedGoogleAccountPreference
				.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
					@Override
					public boolean onPreferenceChange(Preference preference,
							Object newValue) {
						int index = ((ListPreference) preference)
								.findIndexOfValue(newValue.toString());
						String value = (String) ((ListPreference) preference)
								.getEntryValues()[index];
						((ListPreference) preference).setSummary(value);
						return true;