versionName is 2.31, 2.4, or 3.0. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.zxing.client.android"
- android:versionName="3.11 alpha 1"
- android:versionCode="43">
+ android:versionName="3.2 beta 1"
+ android:versionCode="44">
<!-- We require Cupcake (Android 1.5) or later, but are really targeting Donut. -->
<uses-sdk android:minSdkVersion="3"
android:targetSdkVersion="4"/>
<body>
<link rel="StyleSheet" href="style.css" type="text/css">
<h3><center>What's new in this version</center></h3>
-<p>New in version 3.11:</p>
+<p>New in version 3.2:</p>
<ul>
<li>Allowed devices without autofocus to see Barcode Scanner in the Market.</li>
- <li>Minor translation and bug fixes.</li>
-</ul>
-<p>New in version 3.1:</p>
-<ul>
- <li>Added a real-time visualization of the image processing as it's looking for barcodes.</li>
- <li>Made QR Code reading in shadows or other difficult lighting dramatically better.</li>
- <li>Added sharing of any installed app by generating a QR Code that links to Market.</li>
- <li>Many other minor improvements and bug fixes.</li>
+ <li>New Finnish, Dutch, and Czech translations.</li>
+ <li>Added a Google Shopper button when scanning products.</li>
+ <li>Fixed a possible crash on unsupported hardware.</li>
+ <li>Better layouts on QVGA devices like the HTC Tattoo.</li>
+ <li>Added the ability to email your scan history.</li>
+ <li>New high res icon and minor bug fixes.</li>
</ul>
</body>
</html>
<string name="button_done">Done</string>
<string name="button_email">Send email</string>
<string name="button_get_directions">Get directions</string>
+ <string name="button_google_shopper">Google Shopper</string>
<string name="button_mms">Send MMS</string>
<string name="button_ok">OK</string>
<string name="button_open_browser">Open browser</string>
<string name="button_product_search">Product Search</string>
- <string name="button_search_book_contents">Search book contents</string>
+ <string name="button_search_book_contents">Search contents</string>
<string name="button_read_book">Browse book</string>
<string name="button_share_app">Application</string>
<string name="button_share_bookmark">Bookmark</string>
<string name="msg_encode_barcode_failed">Could not generate the requested barcode.</string>
<string name="msg_encode_contents_failed">Could not encode a barcode from the data provided.</string>
<string name="msg_encode_in_progress">Generating a barcode\u2026</string>
+ <string name="msg_google_shopper_missing">Google Shopper is not installed</string>
+ <string name="msg_install_google_shopper">Google Shopper is a new Android app with prices, reviews, and more. Would you like to install it from Market?</string>
<string name="msg_intent_failed">Sorry, the requested application could not be launched. The barcode contents may be invalid.</string>
<string name="msg_loading_apps">Loading list of applications\u2026</string>
<string name="msg_not_our_results">You are leaving this application. The search results you will see are not related to this application.</string>
<string name="result_uri">Found URL</string>
<string name="history_title">History</string>
<string name="history_clear_text">Clear history</string>
- <string name="history_send">Send history</string>
+ <string name="history_send">Send history</string>
<string name="history_email_title">Barcode Scanner history</string>
<string name="sbc_name">Google Book Search</string>
<string name="share_name">Share via barcode</string>
<string name="title_about">Barcode Scanner v</string>
<string name="zxing_url">http://code.google.com/p/zxing</string>
-</resources>
\ No newline at end of file
+</resources>
package com.google.zxing.client.android.result;
+import com.google.zxing.client.android.PreferencesActivity;
+import com.google.zxing.client.android.R;
+import com.google.zxing.client.result.ISBNParsedResult;
+import com.google.zxing.client.result.ParsedResult;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
-import com.google.zxing.client.android.PreferencesActivity;
-import com.google.zxing.client.android.R;
-import com.google.zxing.client.result.ISBNParsedResult;
-import com.google.zxing.client.result.ParsedResult;
/**
* Handles books encoded by their ISBN values.
R.string.button_product_search,
R.string.button_book_search,
R.string.button_search_book_contents,
- R.string.button_custom_product_search,
+ R.string.button_google_shopper
};
- private final String customProductSearch;
+ private String customProductSearch;
public ISBNResultHandler(Activity activity, ParsedResult result) {
super(activity, result);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH, null);
+ if (customProductSearch != null && customProductSearch.length() == 0) {
+ customProductSearch = null;
+ }
}
@Override
public int getButtonCount() {
- return customProductSearch != null && customProductSearch.length() > 0 ? buttons.length : buttons
- .length - 1;
+ // Always show four buttons - Shopper and Custom Search are mutually exclusive.
+ return buttons.length;
}
@Override
public int getButtonText(int index) {
+ if (index == buttons.length - 1 && customProductSearch != null) {
+ return R.string.button_custom_product_search;
+ }
return buttons[index];
}
searchBookContents(isbnResult.getISBN());
break;
case 3:
- String url = customProductSearch.replace("%s", isbnResult.getISBN());
- openURL(url);
+ if (customProductSearch != null) {
+ String url = customProductSearch.replace("%s", isbnResult.getISBN());
+ openURL(url);
+ } else {
+ openGoogleShopper(isbnResult.getISBN());
+ }
break;
}
}
package com.google.zxing.client.android.result;
+import com.google.zxing.client.android.PreferencesActivity;
+import com.google.zxing.client.android.R;
+import com.google.zxing.client.result.ParsedResult;
+import com.google.zxing.client.result.ProductParsedResult;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
-import com.google.zxing.client.android.PreferencesActivity;
-import com.google.zxing.client.android.R;
-import com.google.zxing.client.result.ParsedResult;
-import com.google.zxing.client.result.ProductParsedResult;
/**
* Handles generic products which are not books.
private static final int[] buttons = {
R.string.button_product_search,
R.string.button_web_search,
+ R.string.button_google_shopper,
R.string.button_custom_product_search,
};
- private final String customProductSearch;
+ private String customProductSearch;
public ProductResultHandler(Activity activity, ParsedResult result) {
super(activity, result);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH, null);
+ if (customProductSearch != null && customProductSearch.length() == 0) {
+ customProductSearch = null;
+ }
}
@Override
webSearch(productResult.getNormalizedProductID());
break;
case 2:
+ openGoogleShopper(productResult.getNormalizedProductID());
+ break;
+ case 3:
String url = customProductSearch.replace("%s", productResult.getNormalizedProductID());
openURL(url);
break;
package com.google.zxing.client.android.result;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.ActivityNotFoundException;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.net.Uri;
-import android.preference.PreferenceManager;
-import android.provider.Contacts;
import com.google.zxing.client.android.Contents;
import com.google.zxing.client.android.Intents;
import com.google.zxing.client.android.LocaleManager;
import com.google.zxing.client.result.ParsedResult;
import com.google.zxing.client.result.ParsedResultType;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.SearchManager;
+import android.content.ActivityNotFoundException;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.preference.PreferenceManager;
+import android.provider.Contacts;
+
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd");
private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
+ private static final String GOOGLE_SHOPPER_PACKAGE = "com.google.android.apps.shopper";
+ private static final String GOOGLE_SHOPPER_ACTIVITY = GOOGLE_SHOPPER_PACKAGE +
+ ".results.SearchResultsActivity";
+ private static final String MARKET_URI_PREFIX = "market://search?q=pname:";
+ private static final String MARKET_REFERRER_SUFFIX =
+ "&referrer=utm_source%3Dbarcodescanner%26utm_medium%3Dapps%26utm_campaign%3Dscan";
+
public static final int MAX_BUTTON_COUNT = 4;
private final ParsedResult result;
private final Activity activity;
+ private final DialogInterface.OnClickListener shopperMarketListener =
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialogInterface, int which) {
+ launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(MARKET_URI_PREFIX +
+ GOOGLE_SHOPPER_PACKAGE + MARKET_REFERRER_SUFFIX)));
+ }
+ };
+
ResultHandler(Activity activity, ParsedResult result) {
this.result = result;
this.activity = activity;
launchIntent(intent);
}
+ final void openGoogleShopper(String query) {
+ try {
+ activity.getPackageManager().getPackageInfo(GOOGLE_SHOPPER_PACKAGE, 0);
+ // If we didn't throw, Shopper is installed, so launch it.
+ Intent intent = new Intent(Intent.ACTION_SEARCH);
+ intent.setClassName(GOOGLE_SHOPPER_PACKAGE, GOOGLE_SHOPPER_ACTIVITY);
+ intent.putExtra(SearchManager.QUERY, query);
+ activity.startActivity(intent);
+ } catch (PackageManager.NameNotFoundException e) {
+ // Otherwise offer to install it from Market.
+ AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ builder.setTitle(R.string.msg_google_shopper_missing);
+ builder.setMessage(R.string.msg_install_google_shopper);
+ builder.setIcon(R.drawable.shopper_icon);
+ builder.setPositiveButton(R.string.button_ok, shopperMarketListener);
+ builder.setNegativeButton(R.string.button_cancel, null);
+ builder.show();
+ }
+ }
+
void launchIntent(Intent intent) {
if (intent != null) {
try {
activity.startActivity(intent);
} catch (ActivityNotFoundException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- builder.setTitle(activity.getString(R.string.app_name));
- builder.setMessage(activity.getString(R.string.msg_intent_failed));
+ builder.setTitle(R.string.app_name);
+ builder.setMessage(R.string.msg_intent_failed);
builder.setPositiveButton(R.string.button_ok, null);
builder.show();
}