Made upgrades load the What's New page, while new installs load the default help...
authordswitkin <dswitkin@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Fri, 5 Mar 2010 22:41:02 +0000 (22:41 +0000)
committerdswitkin <dswitkin@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Fri, 5 Mar 2010 22:41:02 +0000 (22:41 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@1242 59b500cc-1b3d-0410-9834-0bbf25fbcc57

android/AndroidManifest.xml
android/assets/html/whatsnew.html
android/src/com/google/zxing/client/android/CaptureActivity.java
android/src/com/google/zxing/client/android/HelpActivity.java

index 7d8538d..e93be78 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.2"
-          android:versionCode="45">
+          android:versionName="3.21 beta 1"
+          android:versionCode="46">
   <!-- We require Cupcake (Android 1.5) or later, but are really targeting Donut. -->
   <uses-sdk android:minSdkVersion="3"
             android:targetSdkVersion="4"/>
@@ -131,5 +131,5 @@ versionName is 2.31, 2.4, or 3.0. -->
   <uses-permission android:name="android.permission.INTERNET"/>
   <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
   <uses-permission android:name="android.permission.VIBRATE"/>
-  <uses-permission android:name="android.permission.FLASHLIGHT"/>  
+  <uses-permission android:name="android.permission.FLASHLIGHT"/>
 </manifest>
index 1ac9c38..e284fb0 100644 (file)
@@ -3,11 +3,15 @@
 <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.21:</p>
+<ul>
+  <li>Fixed a bug with detecting camera resolutions on some devices.</li>
+</ul>
 <p>New in version 3.2:</p>
 <ul>
+  <li>Added a Google Shopper button when scanning products.</li>
   <li>Allowed devices without autofocus to see Barcode Scanner in the Market.</li>
   <li>New Finnish, Swedish, 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>
index 217374f..f00aa85 100755 (executable)
@@ -561,9 +561,11 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
       int lastVersion = prefs.getInt(PreferencesActivity.KEY_HELP_VERSION_SHOWN, 0);
       if (currentVersion > lastVersion) {
         prefs.edit().putInt(PreferencesActivity.KEY_HELP_VERSION_SHOWN, currentVersion).commit();
-        Intent intent = new Intent(Intent.ACTION_VIEW);
-        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);        
-        intent.setClassName(this, HelpActivity.class.getName());
+        Intent intent = new Intent(this, HelpActivity.class);
+        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+        // Show the default page on a clean install, and the what's new page on an upgrade.
+        String page = (lastVersion == 0) ? HelpActivity.DEFAULT_PAGE : HelpActivity.WHATS_NEW_PAGE;
+        intent.putExtra(HelpActivity.REQUESTED_PAGE_KEY, page);
         startActivity(intent);
         return true;
       }
index cf56fd8..a02c5e5 100644 (file)
@@ -40,8 +40,15 @@ public final class HelpActivity extends Activity {
   private static final String TAG = HelpActivity.class.getName();
 
   private static final String[] BUGGY_MODEL_SUBSTRINGS = {"Behold II", "Pulse"};
-  private static final Uri BUGGY_URI = Uri.parse("http://code.google.com/p/zxing/wiki/FrequentlyAskedQuestions");
-  private static final String DEFAULT_URL = "file:///android_asset/html/index.html";
+  private static final Uri BUGGY_URI =
+      Uri.parse("http://code.google.com/p/zxing/wiki/FrequentlyAskedQuestions");
+
+  // Use this key and one of the values below when launching this activity via intent. If not
+  // present, the default page will be loaded.
+  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 WebView webView;
   private Button backButton;
@@ -58,10 +65,11 @@ public final class HelpActivity extends Activity {
     }
   };
 
-  private final DialogInterface.OnClickListener groupsListener = new DialogInterface.OnClickListener() {
+  private final DialogInterface.OnClickListener groupsListener =
+      new DialogInterface.OnClickListener() {
     public void onClick(DialogInterface dialogInterface, int i) {
       Intent intent = new Intent(Intent.ACTION_VIEW, BUGGY_URI);
-      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);              
+      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
       HelpActivity.this.startActivity(intent);
     }
   };
@@ -73,15 +81,23 @@ public final class HelpActivity extends Activity {
 
     webView = (WebView)findViewById(R.id.help_contents);
     webView.setWebViewClient(new HelpClient());
+
+    Intent intent = getIntent();
     if (icicle != null) {
       webView.restoreState(icicle);
+    } else if (intent != null) {
+      String page = intent.getStringExtra(REQUESTED_PAGE_KEY);
+      if (page != null && page.length() > 0) {
+        webView.loadUrl(BASE_URL + page);
+      } else {
+        webView.loadUrl(BASE_URL + DEFAULT_PAGE);
+      }
     } else {
-      webView.loadUrl(DEFAULT_URL);
+      webView.loadUrl(BASE_URL + DEFAULT_PAGE);
     }
 
     backButton = (Button)findViewById(R.id.back_button);
     backButton.setOnClickListener(backListener);
-
     Button doneButton = (Button)findViewById(R.id.done_button);
     doneButton.setOnClickListener(doneListener);
   }