1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Cosmetic changes

This commit is contained in:
cketti 2011-03-24 04:04:13 +01:00
parent 55440f8a18
commit b6561c8b29
2 changed files with 11 additions and 15 deletions

View File

@ -225,30 +225,30 @@ public class ContactsSdk3_4 extends com.fsck.k9.helper.Contacts {
@Override @Override
public Intent contactPickerIntent() { public Intent contactPickerIntent() {
return new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI); return new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI);
} }
@Override @Override
public String getEmailFromContactPicker(final Intent data) { public String getEmailFromContactPicker(final Intent data) {
Cursor cursor = null; Cursor cursor = null;
Cursor cursor2 = null; Cursor cursor2 = null;
String email = ""; String email = "";
try { try {
Uri result = data.getData(); Uri result = data.getData();
cursor = mContentResolver.query(result, null, null, null, null); cursor = mContentResolver.query(result, null, null, null, null);
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
String emailId = cursor.getString(cursor.getColumnIndex(Contacts.People.PRIMARY_EMAIL_ID)); String emailId = cursor.getString(cursor.getColumnIndex(Contacts.People.PRIMARY_EMAIL_ID));
cursor2 = mContext.getContentResolver().query(ContactMethods.CONTENT_EMAIL_URI, new String[] { ContactMethods.DATA }, "contact_methods._id=?", new String[] { emailId }, null); cursor2 = mContext.getContentResolver().query(
ContactMethods.CONTENT_EMAIL_URI,
new String[] { ContactMethods.DATA },
"contact_methods._id=?",
new String[] { emailId },
null);
if (cursor2.moveToFirst()) { if (cursor2.moveToFirst()) {
email = cursor2.getString(0); email = cursor2.getString(0);
} }
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(K9.LOG_TAG, "Failed to get email data", e); Log.e(K9.LOG_TAG, "Failed to get email data", e);
} finally { } finally {
@ -263,8 +263,6 @@ public class ContactsSdk3_4 extends com.fsck.k9.helper.Contacts {
return email; return email;
} }
/** /**
* Return a {@link Cursor} instance that can be used to fetch information * Return a {@link Cursor} instance that can be used to fetch information
* about the contact with the given email address. * about the contact with the given email address.

View File

@ -192,22 +192,20 @@ public class ContactsSdk5 extends com.fsck.k9.helper.Contacts {
} }
} }
@Override @Override
public Intent contactPickerIntent() { public Intent contactPickerIntent() {
return new Intent(Intent.ACTION_PICK, android.provider.ContactsContract.Contacts.CONTENT_URI); return new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
} }
@Override @Override
public String getEmailFromContactPicker(final Intent data) { public String getEmailFromContactPicker(final Intent data) {
Cursor cursor = null; Cursor cursor = null;
String email = ""; String email = "";
try { try {
Uri result = data.getData(); Uri result = data.getData();
Log.v(K9.LOG_TAG, "Got a contact result: " + result.toString());
// get the contact id from the Uri // Get the contact id from the Uri
String id = result.getLastPathSegment(); String id = result.getLastPathSegment();
cursor = mContentResolver.query(Email.CONTENT_URI, cursor = mContentResolver.query(Email.CONTENT_URI,
null, Email.CONTACT_ID + "=?", new String[] { id }, null, Email.CONTACT_ID + "=?", new String[] { id },