Final Barcode Scanner 3.4 changes:
authordswitkin@google.com <dswitkin@google.com@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 20 Jul 2010 22:43:38 +0000 (22:43 +0000)
committerdswitkin@google.com <dswitkin@google.com@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 20 Jul 2010 22:43:38 +0000 (22:43 +0000)
- Cleaned up the sharing UI
- Removed a piece of black artwork
- Fixed the Froyo bug with the Help screen appearing blank
- Made external URLs in Help launch in the Browser
- Updated some help text

git-svn-id: http://zxing.googlecode.com/svn/trunk@1491 59b500cc-1b3d-0410-9834-0bbf25fbcc57

12 files changed:
android/AndroidManifest.xml
android/assets/html/index.html
android/assets/html/sharing.html
android/assets/html/style.css
android/assets/html/whatsnew.html
android/res/drawable/launcher_icon_large.png [deleted file]
android/res/layout-land/share.xml
android/res/layout-ldpi/capture.xml
android/res/layout/capture.xml
android/res/layout/share.xml
android/src/com/google/zxing/client/android/CaptureActivity.java
android/src/com/google/zxing/client/android/HelpActivity.java

index e7049ce..e746bb0 100755 (executable)
@@ -20,8 +20,8 @@ version to be published. The next versionCode will be 7, regardless of whether t
 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.4 beta 3"
-          android:versionCode="57"
+          android:versionName="3.4"
+          android:versionCode="58"
           android:installLocation="auto">
   <!-- We require Cupcake (Android 1.5) or later, but are really targeting Donut. -->
   <uses-sdk android:minSdkVersion="3"
index 4ecfd0f..71aa3a8 100644 (file)
@@ -14,7 +14,7 @@
   <li><a href="scanning.html">How to scan</a></li>
   <li><a href="about1d.html">About 1D barcodes</a></li>
   <li><a href="about2d.html">About 2D barcodes</a></li>
-  <li><a href="sharing.html">How to use QR Codes to share information</a></li>
+  <li><a href="sharing.html">How to create QR Codes</a></li>
 </ul>
 </body>
 </html>
index 085f242..fcbb6ba 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
-<title>How to share</title>
-<link rel="stylesheet" href="style.css" type="text/css"/>  
+<title>How to create QR Codes</title>
+<link rel="stylesheet" href="style.css" type="text/css"/>
 </head>
 <body>
 <p>In addition to <a href="about2d.html">scanning 2D barcodes</a>, <b>Barcode Scanner</b> can also
@@ -9,7 +9,9 @@
   scan the barcode with their phone:</p>
 <center><p><img src="../images/scan-from-phone.png" alt="Scan from phone"></p></center>
 <p>To use this feature, press the Menu button from the main scanning screen, and tap Share. Then
-  choose whether you want to share a contact, a bookmark, or the contents of the clipboard. A QR
-  Code will be generated automatically. When you're done, press Back or Home.</p>
+  choose whether you want to share a contact, a bookmark, an application, or the contents of the
+  clipboard. A QR Code will be generated automatically. When you're done, press Back or Home.</p>
+<p>To generate QR Codes from your computer, try the
+  <a href="http://zxing.appspot.com/generator/">ZXing QR Code Generator</a>.</p>
 </body>
-</html>
\ No newline at end of file
+</html>
index 93f769a..3143e4d 100644 (file)
@@ -2,7 +2,7 @@ body {
   background-color: white;
   color: black;
   font-family: Arial sans-serif;
-  font-size: 14pt;
+  font-size: 12pt;
 }
 ul.touchable li {
   padding-top:8px;
index a88c86f..ec2d458 100644 (file)
@@ -6,12 +6,12 @@
 <body>
 <p><b>New in version 3.4:</b></p>
 <ul>
-  <li>Added suppport for WiFi base station creditials in QR Codes.</li>
+  <li>Added support for WiFi base station credentials in QR Codes. Use the
+  <a href="http://zxing.appspot.com/generator/">ZXing QR Code Generator</a> to make one.</li>
   <li>Added Code 93 support.</li>
-  <li>Added recognition of 5 digit UPC/EAN extensions.</li>
   <li>Added bulk scan mode to the preferences.</li>
   <li>Allowed the app to be moved to the SD card on Froyo devices.</li>
-  <li>Fixed a problem where scanning would not work when resuming the app.</li>
+  <li>Fixed scanning not working when resuming the app.</li>
   <li>Made Calendar event parsing more lenient.</li>
   <li>Fixed crashes in the QR Encoder with missing data.</li>
   <li>Updated the UI appearance a bit.</li>
diff --git a/android/res/drawable/launcher_icon_large.png b/android/res/drawable/launcher_icon_large.png
deleted file mode 100644 (file)
index 9497f22..0000000
Binary files a/android/res/drawable/launcher_icon_large.png and /dev/null differ
index 7a458b0..1056315 100755 (executable)
 
   <TextView
       android:layout_width="fill_parent"
-      android:layout_height="0dip"
-      android:layout_weight="1"
+      android:layout_height="wrap_content"
       android:textColor="@color/share_text"
       android:textSize="18sp"
-      android:text="@string/msg_share_explanation"/>
+      android:text="@string/msg_share_explanation"
+      android:paddingBottom="24dip"/>
 
   <LinearLayout
       android:layout_width="fill_parent"
-      android:layout_height="0dip"
-      android:layout_weight="2"
+      android:layout_height="wrap_content"
       android:background="@color/share_view"
       android:orientation="horizontal">
 
     <ImageView
-        android:layout_width="0dip"
-        android:layout_height="fill_parent"
-        android:layout_weight="2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         android:scaleType="center"
         android:src="@drawable/share_via_barcode"
-        android:paddingRight="32dip"/>
+        android:paddingRight="24dip"/>
 
     <LinearLayout
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="wrap_content"
         android:layout_weight="1"
         android:orientation="vertical">
 
-      <Button android:id="@+id/contact_button"
+      <Button android:id="@+id/app_button"
               android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_weight="1"
-              android:text="@string/button_share_contact"/>
+              android:layout_height="wrap_content"
+              android:text="@string/button_share_app"/>
 
-      <Button android:id="@+id/bookmark_button"
+      <Button android:id="@+id/contact_button"
               android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_weight="1"
-              android:text="@string/button_share_bookmark"/>
+              android:layout_height="wrap_content"
+              android:text="@string/button_share_contact"/>
 
     </LinearLayout>
 
     <LinearLayout
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="wrap_content"
         android:layout_weight="1"
         android:orientation="vertical">
 
-      <Button android:id="@+id/clipboard_button"
+      <Button android:id="@+id/bookmark_button"
               android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_weight="1"
-              android:text="@string/button_share_clipboard"/>
+              android:layout_height="wrap_content"
+              android:text="@string/button_share_bookmark"/>
 
-      <Button android:id="@+id/app_button"
+      <Button android:id="@+id/clipboard_button"
               android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_weight="1"
-              android:text="@string/button_share_app"/>
+              android:layout_height="wrap_content"
+              android:text="@string/button_share_clipboard"/>
 
     </LinearLayout>
 
index 50b3193..821de2e 100755 (executable)
@@ -58,7 +58,7 @@
                    android:maxHeight="150dip"
                    android:layout_marginBottom="4dip"
                    android:adjustViewBounds="true"
-                   android:scaleType="fitEnd"/>
+                   android:scaleType="centerInside"/>
 
         <LinearLayout
           android:orientation="horizontal"
index ec5a343..f79813a 100755 (executable)
@@ -58,7 +58,7 @@
                    android:maxHeight="160dip"
                    android:layout_marginBottom="4dip"
                    android:adjustViewBounds="true"
-                   android:scaleType="fitEnd"/>
+                   android:scaleType="centerInside"/>
 
         <LinearLayout
           android:orientation="horizontal"
index 3c96dde..e199b44 100755 (executable)
   <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
-      android:layout_weight="1"
       android:textColor="@color/share_text"
       android:textSize="18sp"
-      android:text="@string/msg_share_explanation"/>
+      android:text="@string/msg_share_explanation"
+      android:paddingBottom="24dip"/>
 
   <ImageView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
-      android:layout_weight="1"
       android:scaleType="center"
       android:src="@drawable/share_via_barcode"
       android:paddingBottom="24dip"/>
   <LinearLayout
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
-      android:layout_weight="1"
       android:orientation="horizontal"
       android:paddingBottom="8dip">
 
-    <Button android:id="@+id/contact_button"
+    <Button android:id="@+id/app_button"
             android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:text="@string/button_share_contact"/>
+            android:text="@string/button_share_app"/>
 
     <Button android:id="@+id/bookmark_button"
             android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_height="wrap_content"
             android:layout_weight="1"
             android:text="@string/button_share_bookmark"/>
 
   <LinearLayout
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
-      android:layout_weight="1"
       android:orientation="horizontal">
 
-    <Button android:id="@+id/clipboard_button"
+    <Button android:id="@+id/contact_button"
             android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:text="@string/button_share_clipboard"/>
+            android:text="@string/button_share_contact"/>
 
-    <Button android:id="@+id/app_button"
+    <Button android:id="@+id/clipboard_button"
             android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:text="@string/button_share_app"/>
+            android:text="@string/button_share_clipboard"/>
 
   </LinearLayout>
 
index 249fd84..687be89 100755 (executable)
@@ -37,6 +37,7 @@ import android.content.pm.PackageManager;
 import android.content.res.AssetFileDescriptor;
 import android.content.res.Configuration;
 import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.graphics.Paint;
 import android.graphics.Rect;
@@ -524,11 +525,11 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
 
     ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
     if (barcode == null) {
-      barcodeImageView.setImageResource(R.drawable.launcher_icon_large);
+      barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
+          R.drawable.launcher_icon));
     } else {
       barcodeImageView.setImageBitmap(barcode);
     }
-    barcodeImageView.setVisibility(View.VISIBLE);
 
     TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
     formatTextView.setText(rawResult.getBarcodeFormat().toString());
index ab0b5b2..f658d88 100644 (file)
@@ -53,7 +53,9 @@ public final class HelpActivity extends Activity {
   public static final String REQUESTED_PAGE_KEY = "requested_page_key";
   public static final String DEFAULT_PAGE = "index.html";
   public static final String WHATS_NEW_PAGE = "whatsnew.html";
+
   private static final String BASE_URL = "file:///android_asset/html/";
+  private static final String WEBVIEW_STATE_PRESENT = "webview_state_present";
 
   private static boolean initialized = false;
   private WebView webView;
@@ -88,8 +90,11 @@ public final class HelpActivity extends Activity {
     webView = (WebView)findViewById(R.id.help_contents);
     webView.setWebViewClient(new HelpClient());
 
+    // Froyo has a bug with calling onCreate() twice in a row, which causes the What's New page
+    // that's auto-loaded on first run to appear blank. As a workaround we only call restoreState()
+    // if a valid URL was loaded at the time the previous activity was torn down.
     Intent intent = getIntent();
-    if (icicle != null) {
+    if (icicle != null && icicle.getBoolean(WEBVIEW_STATE_PRESENT, false)) {
       webView.restoreState(icicle);
     } else if (intent != null) {
       String page = intent.getStringExtra(REQUESTED_PAGE_KEY);
@@ -132,7 +137,11 @@ public final class HelpActivity extends Activity {
 
   @Override
   protected void onSaveInstanceState(Bundle state) {
-    webView.saveState(state);
+    String url = webView.getUrl();
+    if (url != null && url.length() > 0) {
+      webView.saveState(state);
+      state.putBoolean(WEBVIEW_STATE_PRESENT, true);
+    }
   }
 
   @Override
@@ -152,5 +161,17 @@ public final class HelpActivity extends Activity {
       setTitle(view.getTitle());
       backButton.setEnabled(view.canGoBack());
     }
+
+    @Override
+    public boolean shouldOverrideUrlLoading(WebView view, String url) {
+      if (url.startsWith("file")) {
+        // Keep local assets in this WebView.
+        return false;
+      } else {
+        // Open external URLs in Browser.
+        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+        return true;
+      }
+    }
   }
 }