Merge "Don't start the search if TAB is pressed"
diff --git a/src/com/android/contacts/quickcontact/QuickContactWindow.java b/src/com/android/contacts/quickcontact/QuickContactWindow.java
index 147e364..7f3aba3 100644
--- a/src/com/android/contacts/quickcontact/QuickContactWindow.java
+++ b/src/com/android/contacts/quickcontact/QuickContactWindow.java
@@ -541,7 +541,11 @@
// Recycle any chiclets in use
for (int i = mTrack.getChildCount() - 1; i >= 0; i--) {
- releaseView((CheckableImageView)mTrack.getChildAt(i));
+ final View child = mTrack.getChildAt(i);
+ // there can be non-CheckableImageView children, e.g. a "No Data" label
+ if (child instanceof CheckableImageView) {
+ releaseView((CheckableImageView)child);
+ }
mTrack.removeViewAt(i);
}
@@ -730,6 +734,11 @@
}
}
+ // Collapse Action Lists (remove e.g. duplicate e-mail addresses from different sources)
+ for (ArrayList<Action> actionChildren : mActions.values()) {
+ Collapser.collapseList(actionChildren);
+ }
+
// Make sure that we only display the "clear default" action if there
// are actually several items to chose from
boolean shouldDisplayClearDefaults = false;
@@ -911,9 +920,6 @@
// Add direct intent if single child, otherwise flag for multiple
List<Action> children = mActions.get(mimeType);
- if (children.size() > 1) {
- Collapser.collapseList(children);
- }
view.setTag(mimeType);
final Action firstInfo = children.get(0);
diff --git a/src/com/android/contacts/vcard/ExportProcessor.java b/src/com/android/contacts/vcard/ExportProcessor.java
index 4bd4ed9..7b5e001 100644
--- a/src/com/android/contacts/vcard/ExportProcessor.java
+++ b/src/com/android/contacts/vcard/ExportProcessor.java
@@ -22,7 +22,6 @@
import android.app.Notification;
import android.app.NotificationManager;
-import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -32,10 +31,13 @@
import android.provider.ContactsContract.RawContactsEntity;
import android.text.TextUtils;
import android.util.Log;
-import android.widget.RemoteViews;
+import java.io.BufferedWriter;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
/**
* Class for processing one export request from a user. Dropped after exporting requested Uri(s).
@@ -94,6 +96,7 @@
if (DEBUG) Log.d(LOG_TAG, String.format("vCard export (id: %d) has started.", mJobId));
final ExportRequest request = mExportRequest;
VCardComposer composer = null;
+ Writer writer = null;
boolean successful = false;
try {
if (isCancelled()) {
@@ -131,8 +134,7 @@
// VCardConfig.FLAG_USE_QP_TO_PRIMARY_PROPERTIES);
// composer = new VCardComposer(ExportVCardActivity.this, vcardType, true);
- composer.addHandler(composer.new HandlerForOutputStream(outputStream));
-
+ writer = new BufferedWriter(new OutputStreamWriter(outputStream));
final Uri contentUriForRawContactsEntity = RawContactsEntity.CONTENT_URI.buildUpon()
.appendQueryParameter(RawContactsEntity.FOR_EXPORT_ONLY, "1")
.build();
@@ -165,7 +167,9 @@
Log.i(LOG_TAG, "Export request is cancelled during composing vCard");
return;
}
- if (!composer.createOneEntryLegacy()) {
+ try {
+ writer.write(composer.createOneEntry());
+ } catch (IOException e) {
final String errorReason = composer.getErrorReason();
Log.e(LOG_TAG, "Failed to read a contact: " + errorReason);
final String translatedErrorReason =
@@ -200,7 +204,13 @@
if (composer != null) {
composer.terminate();
}
-
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ Log.w(LOG_TAG, "IOException is thrown during close(). Ignored. " + e);
+ }
+ }
mService.handleFinishExportNotification(mJobId, successful);
}
}