Adopted SocialContract and first pass at fast-track.
Showing live data from SocialProvider through recently added
SocialContract constants, symlinked for now since the contract
isn't in the framework yet.
Added first pass at fast-track using edge-based triggering
from the social list. Wraps the ListView in a EdgeTriggerView
that watches for "pull" actions from a specific edge. Also adds
concept of a FloatyListView to keep a "floaty" window anchored
with respect to ListView scrolling.
The fast-track window summarizes contact methods based on
anyone system-wide who offers an icon for the mime-types. For
example, the testing app pushes app-specific contact methods
into the Data table, and then provides icons through its
RemoteViewsMapping XML resource.
Changed SHOW_OR_CREATE to accept Aggregate Uris and now shows
fast-track in cases where a single matching aggregate is found.
Abstracted AsyncQueryHandler to a QueryCompletedListener callback
interface to clean up code that uses it while still protecting
against leaked Contexts.
diff --git a/src/com/android/contacts/NotifyingAsyncQueryHandler.java b/src/com/android/contacts/NotifyingAsyncQueryHandler.java
new file mode 100644
index 0000000..2223e9c
--- /dev/null
+++ b/src/com/android/contacts/NotifyingAsyncQueryHandler.java
@@ -0,0 +1,41 @@
+package com.android.contacts;
+
+import android.content.AsyncQueryHandler;
+import android.content.Context;
+import android.database.Cursor;
+
+import java.lang.ref.WeakReference;
+
+/**
+ * Slightly more abstract {@link android.content.AsyncQueryHandler} that helps
+ * keep a {@link WeakReference} back to a callback interface. Will properly
+ * close the completed query if the listener ceases to exist.
+ * <p>
+ * Using this pattern will help keep you from leaking a {@link Context}.
+ */
+public class NotifyingAsyncQueryHandler extends AsyncQueryHandler {
+ private final WeakReference<QueryCompleteListener> mListener;
+
+ /**
+ * Interface to listen for completed queries.
+ */
+ public static interface QueryCompleteListener {
+ public void onQueryComplete(int token, Object cookie, Cursor cursor);
+ }
+
+ public NotifyingAsyncQueryHandler(Context context, QueryCompleteListener listener) {
+ super(context.getContentResolver());
+ mListener = new WeakReference<QueryCompleteListener>(listener);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
+ final QueryCompleteListener listener = mListener.get();
+ if (listener != null) {
+ listener.onQueryComplete(token, cookie, cursor);
+ } else {
+ cursor.close();
+ }
+ }
+}