Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Put URL, birthday in notes as there's not a better place for them by …

…Intent

git-svn-id: http://zxing.googlecode.com/svn/trunk@2131 59b500cc-1b3d-0410-9834-0bbf25fbcc57
  • Loading branch information...
commit 06a8413355f003d00042f4e9a7b4df640daa28ff 1 parent 3f64f0f
srowen authored
View
4 android/src/com/google/zxing/client/android/result/AddressBookResultHandler.java
@@ -127,7 +127,9 @@ public void handleButtonPress(int index) {
address1,
address1Type,
addressResult.getOrg(),
- addressResult.getTitle());
+ addressResult.getTitle(),
+ addressResult.getURL(),
+ addressResult.getBirthday());
break;
case 1:
String[] names = addressResult.getNames();
View
23 android/src/com/google/zxing/client/android/result/ResultHandler.java
@@ -285,11 +285,11 @@ private static long calculateMilliseconds(String when) {
}
final void addPhoneOnlyContact(String[] phoneNumbers,String[] phoneTypes) {
- addContact(null, null, phoneNumbers, phoneTypes, null, null, null, null, null, null, null, null);
+ addContact(null, null, phoneNumbers, phoneTypes, null, null, null, null, null, null, null, null, null, null);
}
final void addEmailOnlyContact(String[] emails, String[] emailTypes) {
- addContact(null, null, null, null, emails, emailTypes, null, null, null, null, null, null);
+ addContact(null, null, null, null, emails, emailTypes, null, null, null, null, null, null, null, null);
}
final void addContact(String[] names,
@@ -303,7 +303,9 @@ final void addContact(String[] names,
String address,
String addressType,
String org,
- String title) {
+ String title,
+ String url,
+ String birthday) {
// Only use the first name in the array, if present.
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT, ContactsContract.Contacts.CONTENT_URI);
@@ -334,7 +336,20 @@ final void addContact(String[] names,
}
}
- putExtra(intent, ContactsContract.Intents.Insert.NOTES, note);
+ // No field for URL, birthday; use notes
+ StringBuilder aggregatedNotes = new StringBuilder();
+ for (String aNote : new String[] { url, birthday, note }) {
+ if (aNote != null) {
+ if (aggregatedNotes.length() > 0) {
+ aggregatedNotes.append('\n');
+ }
+ aggregatedNotes.append(aNote);
+ }
+ }
+ if (aggregatedNotes.length() > 0) {
+ putExtra(intent, ContactsContract.Intents.Insert.NOTES, aggregatedNotes.toString());
+ }
+
putExtra(intent, ContactsContract.Intents.Insert.IM_HANDLE, instantMessenger);
putExtra(intent, ContactsContract.Intents.Insert.POSTAL, address);
if (addressType != null) {
Please sign in to comment.
Something went wrong with that request. Please try again.