Small updates from code inspection
authorsrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Sat, 10 Jan 2009 17:01:34 +0000 (17:01 +0000)
committersrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Sat, 10 Jan 2009 17:01:34 +0000 (17:01 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@823 59b500cc-1b3d-0410-9834-0bbf25fbcc57

android/src/com/google/zxing/client/android/CaptureActivity.java
android/src/com/google/zxing/client/android/ShareActivity.java
core/src/com/google/zxing/qrcode/decoder/FormatInformation.java

index 05be038..0e71b39 100755 (executable)
@@ -18,7 +18,6 @@ package com.google.zxing.client.android;
 
 import android.app.Activity;
 import android.app.AlertDialog;
-import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
index e480c35..8dc4c0f 100755 (executable)
@@ -24,6 +24,7 @@ import android.net.Uri;
 import android.os.Bundle;
 import android.provider.Browser;
 import android.provider.Contacts;
+import android.provider.BaseColumns;
 import android.text.ClipboardManager;
 import android.view.View;
 import android.widget.Button;
@@ -33,14 +34,14 @@ public final class ShareActivity extends Activity {
   private static final int PICK_BOOKMARK = 0;
   private static final int PICK_CONTACT = 1;
 
-  private static final int METHODS_ID_COLUMN = 0;
+  //private static final int METHODS_ID_COLUMN = 0;
   private static final int METHODS_KIND_COLUMN = 1;
   private static final int METHODS_DATA_COLUMN = 2;
 
   private static final String[] METHODS_PROJECTION = {
-    Contacts.People.ContactMethods._ID, // 0
-    Contacts.People.ContactMethods.KIND, // 1
-    Contacts.People.ContactMethods.DATA, // 2
+      BaseColumns._ID, // 0
+      Contacts.ContactMethodsColumns.KIND, // 1
+      Contacts.ContactMethodsColumns.DATA, // 2
   };
 
   private Button mClipboardButton;
@@ -72,11 +73,6 @@ public final class ShareActivity extends Activity {
     }
   }
 
-  @Override
-  protected void onPause() {
-    super.onPause();
-  }
-
   private final Button.OnClickListener mContactListener = new Button.OnClickListener() {
     public void onClick(View v) {
       startActivityForResult(new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI),
@@ -138,7 +134,7 @@ public final class ShareActivity extends Activity {
     Cursor contactCursor = resolver.query(contactUri, null, null, null, null);
     Bundle bundle = new Bundle();
     if (contactCursor != null && contactCursor.moveToFirst()) {
-      int nameColumn = contactCursor.getColumnIndex(Contacts.People.NAME);
+      int nameColumn = contactCursor.getColumnIndex(Contacts.PeopleColumns.NAME);
       String name = contactCursor.getString(nameColumn);
       if (name == null || name.length() == 0) {
         // TODO: Show error
@@ -146,16 +142,16 @@ public final class ShareActivity extends Activity {
       }
       bundle.putString(Contacts.Intents.Insert.NAME, name);
 
-      int phoneColumn = contactCursor.getColumnIndex(Contacts.People.NUMBER);
+      int phoneColumn = contactCursor.getColumnIndex(Contacts.PhonesColumns.NUMBER);
       bundle.putString(Contacts.Intents.Insert.PHONE, contactCursor.getString(phoneColumn));
       contactCursor.close();
 
       Uri methodsUri = Uri.withAppendedPath(contactUri,
           Contacts.People.ContactMethods.CONTENT_DIRECTORY);
       Cursor methodsCursor = resolver.query(methodsUri, METHODS_PROJECTION, null, null, null);
-      boolean foundEmail = false;
-      boolean foundPostal = false;
       if (methodsCursor != null) {
+        boolean foundEmail = false;
+        boolean foundPostal = false;
         while (methodsCursor.moveToNext()) {
           int kind = methodsCursor.getInt(METHODS_KIND_COLUMN);
           String data = methodsCursor.getString(METHODS_DATA_COLUMN);
index 34a7356..2568d77 100644 (file)
@@ -101,7 +101,7 @@ final class FormatInformation {
    * @param rawFormatInfo
    * @return
    */
-  static FormatInformation decodeFormatInformation(int rawFormatInfo) throws ReaderException {
+  static FormatInformation decodeFormatInformation(int rawFormatInfo) {
     FormatInformation formatInfo = doDecodeFormatInformation(rawFormatInfo);
     if (formatInfo != null) {
       return formatInfo;