Small updates from code inspection

git-svn-id: https://zxing.googlecode.com/svn/trunk@823 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-01-10 17:01:34 +00:00
parent 6a9910a9b2
commit 37fbeaa36a
3 changed files with 10 additions and 15 deletions

View file

@ -18,7 +18,6 @@ package com.google.zxing.client.android;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;

View file

@ -24,6 +24,7 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Browser; import android.provider.Browser;
import android.provider.Contacts; import android.provider.Contacts;
import android.provider.BaseColumns;
import android.text.ClipboardManager; import android.text.ClipboardManager;
import android.view.View; import android.view.View;
import android.widget.Button; 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_BOOKMARK = 0;
private static final int PICK_CONTACT = 1; 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_KIND_COLUMN = 1;
private static final int METHODS_DATA_COLUMN = 2; private static final int METHODS_DATA_COLUMN = 2;
private static final String[] METHODS_PROJECTION = { private static final String[] METHODS_PROJECTION = {
Contacts.People.ContactMethods._ID, // 0 BaseColumns._ID, // 0
Contacts.People.ContactMethods.KIND, // 1 Contacts.ContactMethodsColumns.KIND, // 1
Contacts.People.ContactMethods.DATA, // 2 Contacts.ContactMethodsColumns.DATA, // 2
}; };
private Button mClipboardButton; 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() { private final Button.OnClickListener mContactListener = new Button.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
startActivityForResult(new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI), 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); Cursor contactCursor = resolver.query(contactUri, null, null, null, null);
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
if (contactCursor != null && contactCursor.moveToFirst()) { if (contactCursor != null && contactCursor.moveToFirst()) {
int nameColumn = contactCursor.getColumnIndex(Contacts.People.NAME); int nameColumn = contactCursor.getColumnIndex(Contacts.PeopleColumns.NAME);
String name = contactCursor.getString(nameColumn); String name = contactCursor.getString(nameColumn);
if (name == null || name.length() == 0) { if (name == null || name.length() == 0) {
// TODO: Show error // TODO: Show error
@ -146,16 +142,16 @@ public final class ShareActivity extends Activity {
} }
bundle.putString(Contacts.Intents.Insert.NAME, name); 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)); bundle.putString(Contacts.Intents.Insert.PHONE, contactCursor.getString(phoneColumn));
contactCursor.close(); contactCursor.close();
Uri methodsUri = Uri.withAppendedPath(contactUri, Uri methodsUri = Uri.withAppendedPath(contactUri,
Contacts.People.ContactMethods.CONTENT_DIRECTORY); Contacts.People.ContactMethods.CONTENT_DIRECTORY);
Cursor methodsCursor = resolver.query(methodsUri, METHODS_PROJECTION, null, null, null); Cursor methodsCursor = resolver.query(methodsUri, METHODS_PROJECTION, null, null, null);
boolean foundEmail = false;
boolean foundPostal = false;
if (methodsCursor != null) { if (methodsCursor != null) {
boolean foundEmail = false;
boolean foundPostal = false;
while (methodsCursor.moveToNext()) { while (methodsCursor.moveToNext()) {
int kind = methodsCursor.getInt(METHODS_KIND_COLUMN); int kind = methodsCursor.getInt(METHODS_KIND_COLUMN);
String data = methodsCursor.getString(METHODS_DATA_COLUMN); String data = methodsCursor.getString(METHODS_DATA_COLUMN);

View file

@ -101,7 +101,7 @@ final class FormatInformation {
* @param rawFormatInfo * @param rawFormatInfo
* @return * @return
*/ */
static FormatInformation decodeFormatInformation(int rawFormatInfo) throws ReaderException { static FormatInformation decodeFormatInformation(int rawFormatInfo) {
FormatInformation formatInfo = doDecodeFormatInformation(rawFormatInfo); FormatInformation formatInfo = doDecodeFormatInformation(rawFormatInfo);
if (formatInfo != null) { if (formatInfo != null) {
return formatInfo; return formatInfo;