[SCM] Multi-format 1D/2D barcode image processing library branch, upstream, updated. 24d4480bc48cf9eabf7b2bd2f528248b0e458809

srowen srowen at 59b500cc-1b3d-0410-9834-0bbf25fbcc57
Wed Aug 4 01:32:31 UTC 2010


The following commit has been merged in the upstream branch:
commit 3e495a1b7f96cb3994694b49f255c8d67cbe2f20
Author: srowen <srowen at 59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Date:   Tue Jul 13 10:34:13 2010 +0000

    Make sure checkboxes are enabled correctly on first load
    
    git-svn-id: http://zxing.googlecode.com/svn/trunk@1479 59b500cc-1b3d-0410-9834-0bbf25fbcc57

diff --git a/android/src/com/google/zxing/client/android/PreferencesActivity.java b/android/src/com/google/zxing/client/android/PreferencesActivity.java
index 9a37e78..04e1441 100755
--- a/android/src/com/google/zxing/client/android/PreferencesActivity.java
+++ b/android/src/com/google/zxing/client/android/PreferencesActivity.java
@@ -56,16 +56,26 @@ public final class PreferencesActivity extends PreferenceActivity
     preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
     decode1D = (CheckBoxPreference) preferences.findPreference(KEY_DECODE_1D);
     decodeQR = (CheckBoxPreference) preferences.findPreference(KEY_DECODE_QR);
+    disableLastCheckedPref();
   }
 
-  // Prevent the user from turning off both decode options
   public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
-    if (key.equals(KEY_DECODE_1D)) {
-      decodeQR.setEnabled(decode1D.isChecked());
+    disableLastCheckedPref();
+  }
+
+  private void disableLastCheckedPref() {
+    if (decode1D.isChecked()) {
+      decodeQR.setEnabled(true);
+    } else {
+      decodeQR.setEnabled(false);
       decodeQR.setChecked(true);
-    } else if (key.equals(KEY_DECODE_QR)) {
-      decode1D.setEnabled(decodeQR.isChecked());
+    }
+    if (decodeQR.isChecked()) {
+      decode1D.setEnabled(true);
+    } else {
+      decode1D.setEnabled(false);
       decode1D.setChecked(true);
     }
   }
+
 }

-- 
Multi-format 1D/2D barcode image processing library



More information about the Pkg-google-commits mailing list