Only request default US results if local results are not found
git-svn-id: https://zxing.googlecode.com/svn/trunk@2924 59b500cc-1b3d-0410-9834-0bbf25fbcc57
diff --git a/android/src/com/google/zxing/client/android/result/supplement/AmazonInfoRetriever.java b/android/src/com/google/zxing/client/android/result/supplement/AmazonInfoRetriever.java
index 68dace2..d7a29bd 100644
--- a/android/src/com/google/zxing/client/android/result/supplement/AmazonInfoRetriever.java
+++ b/android/src/com/google/zxing/client/android/result/supplement/AmazonInfoRetriever.java
@@ -57,14 +57,14 @@
@Override
void retrieveSupplementalInfo() throws IOException {
- doRetrieveForCountry(country);
- if (!"US".equals(country)) {
+ boolean success = doRetrieveForCountry(country);
+ if (!success && !"US".equals(country)) {
// Also show US results to expand scope of results
doRetrieveForCountry("US");
}
}
- private void doRetrieveForCountry(String theCountry) throws IOException {
+ private boolean doRetrieveForCountry(String theCountry) throws IOException {
CharSequence contents =
HttpHelper.downloadViaHttp("https://bsplus.srowen.com/ss?c=" + theCountry + "&t=" + type + "&i=" + productID,
@@ -132,7 +132,7 @@
}
if (error || detailPageURL == null) {
- return;
+ return false;
}
Collection<String> newTexts = new ArrayList<String>();
@@ -145,6 +145,7 @@
}
append(productID, "Amazon " + theCountry, newTexts.toArray(new String[newTexts.size()]), detailPageURL);
+ return true;
}
private static void assertTextNext(XmlPullParser xpp) throws XmlPullParserException, IOException {