// Path: src/com/eleybourn/bookcatalogue/SearchThread.java
// public static class BookSearchResults {
// 	public DataSource source;
// 	public Bundle data;
// 	public BookSearchResults(DataSource source, Bundle data) {
// 		this.source = source;
// 		this.data = data;
// 	}
// }
// 
// Path: src/com/eleybourn/bookcatalogue/SearchThread.java
// public enum DataSource {
// 	Amazon(0),
// 	Google(SearchManager.SEARCH_GOOGLE),
// 	OpenLibrary(0),
// 	LibraryThing(SearchManager.SEARCH_LIBRARY_THING),
// 	Goodreads(SearchManager.SEARCH_GOODREADS),
// 	BCDB(SearchManager.SEARCH_BC),
// 	Other(0),
// 	;
// 	private int mValue;
// 
// 	private DataSource(int value) {
// 		mValue = value;
// 	}
// 
// 	public int getValue() {
// 		return mValue;
// 	}
// }
// 
// Path: src/com/eleybourn/bookcatalogue/bcservices/BcService.java
// public enum Methods {
// 	Get,
// 	Post
// }


import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import android.net.Uri;
import android.os.Bundle;
import com.eleybourn.bookcatalogue.BuildConfig;
import com.eleybourn.bookcatalogue.SearchThread.BookSearchResults;
import com.eleybourn.bookcatalogue.SearchThread.DataSource;
import com.eleybourn.bookcatalogue.bcservices.BcService.Methods;
import com.eleybourn.bookcatalogue.utils.Logger;
import org.json.JSONArray;
	private void search(String url, boolean fetchThumbnail, ArrayList<BookSearchResults> resultList) {
		JSONObject apiResult;
		try {
			// Make sure we limit requests (no more than 1 request/second/client).
			BcService.waitUntilRequestAllowed();
			// Get the JSON result
			apiResult = BcService.makeServiceCall(url, Methods.Get, new HashMap<>());
		} catch (Exception e) {
			Logger.logError(e, "Service call failed");
			return;
		}

		if (apiResult == null) {
			Logger.logError(new RuntimeException("API result is null"));
			return;
		}

		try {
			// Check overall status
			apiResult = apiResult.getJSONObject(RESULTS);
			if (apiResult.optString(STATUS, "").equals(STATUS_OK)) {
				JSONArray results = apiResult.getJSONArray(DATA);
				// Process array of results
				for (int i = 0; i < results.length(); i++) {
					// Get one result
					JSONObject resultWrapper = results.getJSONObject(i);
					// If result status OK, process data
					if (resultWrapper.optString(STATUS, "").equals(STATUS_OK)) {
						boolean skip = false;
						String source = resultWrapper.getString(SOURCE);
// Path: src/com/eleybourn/bookcatalogue/SearchThread.java
// public static class BookSearchResults {
// 	public DataSource source;
// 	public Bundle data;
// 	public BookSearchResults(DataSource source, Bundle data) {
// 		this.source = source;
// 		this.data = data;
// 	}
// }
// 
// Path: src/com/eleybourn/bookcatalogue/SearchThread.java
// public enum DataSource {
// 	Amazon(0),
// 	Google(SearchManager.SEARCH_GOOGLE),
// 	OpenLibrary(0),
// 	LibraryThing(SearchManager.SEARCH_LIBRARY_THING),
// 	Goodreads(SearchManager.SEARCH_GOODREADS),
// 	BCDB(SearchManager.SEARCH_BC),
// 	Other(0),
// 	;
// 	private int mValue;
// 
// 	private DataSource(int value) {
// 		mValue = value;
// 	}
// 
// 	public int getValue() {
// 		return mValue;
// 	}
// }
// 
// Path: src/com/eleybourn/bookcatalogue/bcservices/BcService.java
// public enum Methods {
// 	Get,
// 	Post
// }


// Path: src/com/eleybourn/bookcatalogue/bcservices/BcSearchManager.java
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import android.net.Uri;
import android.os.Bundle;
import com.eleybourn.bookcatalogue.BuildConfig;
import com.eleybourn.bookcatalogue.SearchThread.BookSearchResults;
import com.eleybourn.bookcatalogue.SearchThread.DataSource;
import com.eleybourn.bookcatalogue.bcservices.BcService.Methods;
import com.eleybourn.bookcatalogue.utils.Logger;
import org.json.JSONArray;

	private void search(String url, boolean fetchThumbnail, ArrayList<BookSearchResults> resultList) {
		JSONObject apiResult;
		try {
			// Make sure we limit requests (no more than 1 request/second/client).
			BcService.waitUntilRequestAllowed();
			// Get the JSON result
			apiResult = BcService.makeServiceCall(url, Methods.Get, new HashMap<>());
		} catch (Exception e) {
			Logger.logError(e, "Service call failed");
			return;
		}

		if (apiResult == null) {
			Logger.logError(new RuntimeException("API result is null"));
			return;
		}

		try {
			// Check overall status
			apiResult = apiResult.getJSONObject(RESULTS);
			if (apiResult.optString(STATUS, "").equals(STATUS_OK)) {
				JSONArray results = apiResult.getJSONArray(DATA);
				// Process array of results
				for (int i = 0; i < results.length(); i++) {
					// Get one result
					JSONObject resultWrapper = results.getJSONObject(i);
					// If result status OK, process data
					if (resultWrapper.optString(STATUS, "").equals(STATUS_OK)) {
						boolean skip = false;
						String source = resultWrapper.getString(SOURCE);
						DataSource src;