Use the framework version of Loader and friends now that they exist.
Change-Id: I1c99aec7c60545a1b41b241e95447565c8bd4df4
diff --git a/src/android/app/patterns/AsyncTaskLoader.java b/src/android/app/patterns/AsyncTaskLoader.java
deleted file mode 100644
index 84effaf..0000000
--- a/src/android/app/patterns/AsyncTaskLoader.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package android.app.patterns;
-
-import android.content.Context;
-import android.os.AsyncTask;
-
-/**
- * Abstract Loader that provides an {@link AsyncTask} to do the work.
- *
- * @param <D> the data type to be loaded.
- */
-public abstract class AsyncTaskLoader<D> extends Loader<D> {
- final class LoadListTask extends AsyncTask<Void, Void, D> {
- /* Runs on a worker thread */
- @Override
- protected D doInBackground(Void... params) {
- return AsyncTaskLoader.this.loadInBackground();
- }
-
- /* Runs on the UI thread */
- @Override
- protected void onPostExecute(D data) {
- AsyncTaskLoader.this.dispatchOnLoadComplete(data);
- }
- }
-
- private LoadListTask mTask;
-
- public AsyncTaskLoader(Context context) {
- super(context);
- }
-
- /**
- * Force an asynchronous load. Unlike {@link #startLoading()} this will ignore a previously
- * loaded data set and load a new one.
- */
- @Override
- public void forceLoad() {
- mTask = new LoadListTask();
- mTask.execute((Void[]) null);
- }
-
- /**
- * Attempt to cancel the current load task. See {@link AsyncTask#cancel(boolean)}
- * for more info.
- *
- * @return <tt>false</tt> if the task could not be cancelled,
- * typically because it has already completed normally, or
- * because {@link startLoading()} hasn't been called, and
- * <tt>true</tt> otherwise
- */
- public boolean cancelLoad() {
- if (mTask != null) {
- return mTask.cancel(false);
- }
- return false;
- }
-
- private void dispatchOnLoadComplete(D data) {
- mTask = null;
- onLoadComplete(data);
- }
-
- /**
- * Called on a worker thread to perform the actual load. Implementions should not deliver the
- * results directly, but should return them from this this method and deliver them from
- * {@link #onPostExecute()}
- *
- * @return the result of the load
- */
- protected abstract D loadInBackground();
-
- /**
- * Called on the UI thread with the result of the load.
- *
- * @param data the result of the load
- */
- protected abstract void onLoadComplete(D data);
-}
diff --git a/src/android/app/patterns/CursorLoader.java b/src/android/app/patterns/CursorLoader.java
deleted file mode 100644
index 04b58f5..0000000
--- a/src/android/app/patterns/CursorLoader.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package android.app.patterns;
-
-import android.content.Context;
-import android.database.Cursor;
-import android.net.Uri;
-
-public class CursorLoader extends AsyncTaskLoader<Cursor> {
- Cursor mCursor;
- ForceLoadContentObserver mObserver;
- boolean mStopped;
- Uri mUri;
- String[] mProjection;
- String mSelection;
- String[] mSelectionArgs;
- String mSortOrder;
-
- /* Runs on a worker thread */
- @Override
- protected Cursor loadInBackground() {
- Cursor cursor = getContext().getContentResolver().query(mUri, mProjection, mSelection,
- mSelectionArgs, mSortOrder);
- // Ensure the cursor window is filled
- if (cursor != null) {
- cursor.getCount();
- cursor.registerContentObserver(mObserver);
- }
- return cursor;
- }
-
- /* Runs on the UI thread */
- @Override
- protected void onLoadComplete(Cursor cursor) {
- if (mStopped) {
- // An async query came in while the loader is stopped
- cursor.close();
- return;
- }
- mCursor = cursor;
- deliverResult(cursor);
- }
-
- public CursorLoader(Context context, Uri uri, String[] projection, String selection,
- String[] selectionArgs, String sortOrder) {
- super(context);
- mObserver = new ForceLoadContentObserver();
- mUri = uri;
- mProjection = projection;
- mSelection = selection;
- mSelectionArgs = selectionArgs;
- mSortOrder = sortOrder;
- }
-
- /**
- * Starts an asynchronous load of the contacts list data. When the result is ready the callbacks
- * will be called on the UI thread. If a previous load has been completed and is still valid
- * the result may be passed to the callbacks immediately.
- *
- * Must be called from the UI thread
- */
- @Override
- public void startLoading() {
- mStopped = false;
-
- if (mCursor != null) {
- deliverResult(mCursor);
- } else {
- forceLoad();
- }
- }
-
- /**
- * Must be called from the UI thread
- */
- @Override
- public void stopLoading() {
- if (mCursor != null && !mCursor.isClosed()) {
- mCursor.close();
- mCursor = null;
- }
-
- // Attempt to cancel the current load task if possible.
- cancelLoad();
-
- // Make sure that any outstanding loads clean themselves up properly
- mStopped = true;
- }
-
- @Override
- public void destroy() {
- // Ensure the loader is stopped
- stopLoading();
- }
-
- public Uri getUri() {
- return mUri;
- }
-
- public void setUri(Uri uri) {
- mUri = uri;
- }
-
- public String[] getProjection() {
- return mProjection;
- }
-
- public void setProjection(String[] projection) {
- mProjection = projection;
- }
-
- public String getSelection() {
- return mSelection;
- }
-
- public void setSelection(String selection) {
- mSelection = selection;
- }
-
- public String[] getSelectionArgs() {
- return mSelectionArgs;
- }
-
- public void setSelectionArgs(String[] selectionArgs) {
- mSelectionArgs = selectionArgs;
- }
-
- public String getSortOrder() {
- return mSortOrder;
- }
-
- public void setSortOrder(String sortOrder) {
- mSortOrder = sortOrder;
- }
-}
diff --git a/src/android/app/patterns/Loader.java b/src/android/app/patterns/Loader.java
deleted file mode 100644
index 18c64f3..0000000
--- a/src/android/app/patterns/Loader.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package android.app.patterns;
-
-import android.content.Context;
-import android.database.ContentObserver;
-import android.os.Handler;
-
-public abstract class Loader<D> {
- private int mId;
- private OnLoadCompleteListener<D> mListener;
- private Context mContext;
-
- protected final class ForceLoadContentObserver extends ContentObserver {
- public ForceLoadContentObserver() {
- super(new Handler());
- }
-
- @Override
- public boolean deliverSelfNotifications() {
- return true;
- }
-
- @Override
- public void onChange(boolean selfChange) {
- forceLoad();
- }
- }
-
- public interface OnLoadCompleteListener<D> {
- /**
- * Called on the thread that created the Loader when the load is complete.
- *
- * @param loader the loader that completed the load
- * @param data the result of the load
- */
- public void onLoadComplete(Loader<D> loader, D data);
- }
-
- /**
- * Sends the result of the load to the register listener.
- *
- * @param data the result of the load
- */
- protected void deliverResult(D data) {
- if (mListener != null) {
- mListener.onLoadComplete(this, data);
- }
- }
-
- /**
- * Stores away the application context associated with context. Since Loaders can be used
- * across multiple activities it's dangerous to store the context directly.
- *
- * @param context used to retrieve the application context.
- */
- public Loader(Context context) {
- mContext = context.getApplicationContext();
- }
-
- /**
- * @return an application context retrieved from the Context passed to the constructor.
- */
- public Context getContext() {
- return mContext;
- }
-
- /**
- * @return the ID of this loader
- */
- public int getId() {
- return mId;
- }
-
- /**
- * Registers a class that will receive callbacks when a load is complete. The callbacks will
- * be called on the UI thread so it's safe to pass the results to widgets.
- *
- * Must be called from the UI thread
- */
- public void registerListener(int id, OnLoadCompleteListener<D> listener) {
- if (mListener != null) {
- throw new IllegalStateException("There is already a listener registered");
- }
- mListener = listener;
- mId = id;
- }
-
- /**
- * Must be called from the UI thread
- */
- public void unregisterListener(OnLoadCompleteListener<D> listener) {
- if (mListener == null) {
- throw new IllegalStateException("No listener register");
- }
- if (mListener != listener) {
- throw new IllegalArgumentException("Attempting to unregister the wrong listener");
- }
- mListener = null;
- }
-
- /**
- * Starts an asynchronous load of the contacts list data. When the result is ready the callbacks
- * will be called on the UI thread. If a previous load has been completed and is still valid
- * the result may be passed to the callbacks immediately. The loader will monitor the source of
- * the data set and may deliver future callbacks if the source changes. Calling
- * {@link #stopLoading} will stop the delivery of callbacks.
- *
- * Must be called from the UI thread
- */
- public abstract void startLoading();
-
- /**
- * Force an asynchronous load. Unlike {@link #startLoading()} this will ignore a previously
- * loaded data set and load a new one.
- */
- public abstract void forceLoad();
-
- /**
- * Stops delivery of updates until the next time {@link #startLoading()} is called
- *
- * Must be called from the UI thread
- */
- public abstract void stopLoading();
-
- /**
- * Destroys the loader and frees it's resources, making it unusable.
- *
- * Must be called from the UI thread
- */
- public abstract void destroy();
-}
\ No newline at end of file
diff --git a/src/android/app/patterns/LoaderActivity.java b/src/android/app/patterns/LoaderActivity.java
deleted file mode 100644
index bcb3692..0000000
--- a/src/android/app/patterns/LoaderActivity.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package android.app.patterns;
-
-
-import android.app.Activity;
-import android.os.Bundle;
-
-import java.util.HashMap;
-
-/**
- * The idea here was to abstract the generic life cycle junk needed to properly keep loaders going.
- * It didn't work out as-is because registering the callbacks post config change didn't work.
- */
-public abstract class LoaderActivity<D> extends Activity implements
- Loader.OnLoadCompleteListener<D> {
- private boolean mStarted = false;
-
- static final class LoaderInfo<D> {
- public Bundle args;
- public Loader<D> loader;
- }
- private HashMap<Integer, LoaderInfo<D>> mLoaders;
- private HashMap<Integer, LoaderInfo<D>> mInactiveLoaders;
-
- /**
- * Registers a loader with this activity, registers the callbacks on it, and starts it loading.
- * If a loader with the same id has previously been started it will automatically be destroyed
- * when the new loader completes it's work. The callback will be delivered before the old loader
- * is destroyed.
- */
- protected void startLoading(int id, Bundle args) {
- LoaderInfo<D> info = mLoaders.get(id);
- if (info != null) {
- // Keep track of the previous instance of this loader so we can destroy
- // it when the new one completes.
- mInactiveLoaders.put(id, info);
- }
- info = new LoaderInfo<D>();
- info.args = args;
- mLoaders.put(id, info);
- Loader<D> loader = onCreateLoader(id, args);
- info.loader = loader;
- if (mStarted) {
- // The activity will start all existing loaders in it's onStart(), so only start them
- // here if we're past that point of the activitiy's life cycle
- loader.registerListener(id, this);
- loader.startLoading();
- }
- }
-
- protected abstract Loader<D> onCreateLoader(int id, Bundle args);
- protected abstract void onInitializeLoaders();
- protected abstract void onLoadFinished(Loader<D> loader, D data);
-
- public final void onLoadComplete(Loader<D> loader, D data) {
- // Notify of the new data so the app can switch out the old data before
- // we try to destroy it.
- onLoadFinished(loader, data);
-
- // Look for an inactive loader and destroy it if found
- int id = loader.getId();
- LoaderInfo<D> info = mInactiveLoaders.get(id);
- if (info != null) {
- Loader<D> oldLoader = info.loader;
- if (oldLoader != null) {
- oldLoader.destroy();
- }
- mInactiveLoaders.remove(id);
- }
- }
-
- @Override
- public void onCreate(Bundle savedState) {
- super.onCreate(savedState);
-
- if (mLoaders == null) {
- // Look for a passed along loader and create a new one if it's not there
- mLoaders = (HashMap<Integer, LoaderInfo<D>>) getLastNonConfigurationInstance();
- if (mLoaders == null) {
- mLoaders = new HashMap<Integer, LoaderInfo<D>>();
- onInitializeLoaders();
- }
- }
- if (mInactiveLoaders == null) {
- mInactiveLoaders = new HashMap<Integer, LoaderInfo<D>>();
- }
- }
-
- @Override
- public void onStart() {
- super.onStart();
-
- // Call out to sub classes so they can start their loaders
- // Let the existing loaders know that we want to be notified when a load is complete
- for (HashMap.Entry<Integer, LoaderInfo<D>> entry : mLoaders.entrySet()) {
- LoaderInfo<D> info = entry.getValue();
- Loader<D> loader = info.loader;
- int id = entry.getKey();
- if (loader == null) {
- loader = onCreateLoader(id, info.args);
- info.loader = loader;
- }
- loader.registerListener(id, this);
- loader.startLoading();
- }
-
- mStarted = true;
- }
-
- @Override
- public void onStop() {
- super.onStop();
-
- for (HashMap.Entry<Integer, LoaderInfo<D>> entry : mLoaders.entrySet()) {
- LoaderInfo<D> info = entry.getValue();
- Loader<D> loader = info.loader;
- if (loader == null) {
- continue;
- }
-
- // Let the loader know we're done with it
- loader.unregisterListener(this);
-
- // The loader isn't getting passed along to the next instance so ask it to stop loading
-// if (!isChangingConfigurations()) {
-// loader.stopLoading();
-// }
- }
-
- mStarted = false;
- }
-
- @Override
- public Object onRetainNonConfigurationInstance() {
- // Pass the loader along to the next guy
- Object result = mLoaders;
- mLoaders = null;
- return result;
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
-
- if (mLoaders != null) {
- for (HashMap.Entry<Integer, LoaderInfo<D>> entry : mLoaders.entrySet()) {
- LoaderInfo<D> info = entry.getValue();
- Loader<D> loader = info.loader;
- if (loader == null) {
- continue;
- }
- loader.destroy();
- }
- }
- }
-}
diff --git a/src/android/app/patterns/LoaderManagingFragment.java b/src/android/app/patterns/LoaderManagingFragment.java
deleted file mode 100644
index a337b1f..0000000
--- a/src/android/app/patterns/LoaderManagingFragment.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package android.app.patterns;
-
-import android.app.Fragment;
-import android.os.Bundle;
-
-import java.util.HashMap;
-
-public abstract class LoaderManagingFragment<D> extends Fragment
- implements Loader.OnLoadCompleteListener<D> {
- private boolean mStarted = false;
-
- static final class LoaderInfo<D> {
- public Bundle args;
- public Loader<D> loader;
- }
- private HashMap<Integer, LoaderInfo<D>> mLoaders;
- private HashMap<Integer, LoaderInfo<D>> mInactiveLoaders;
-
- /**
- * Registers a loader with this activity, registers the callbacks on it, and starts it loading.
- * If a loader with the same id has previously been started it will automatically be destroyed
- * when the new loader completes it's work. The callback will be delivered before the old loader
- * is destroyed.
- */
- protected Loader<D> startLoading(int id, Bundle args) {
- LoaderInfo<D> info = mLoaders.get(id);
- if (info != null) {
- // Keep track of the previous instance of this loader so we can destroy
- // it when the new one completes.
- mInactiveLoaders.put(id, info);
- }
- info = new LoaderInfo<D>();
- info.args = args;
- mLoaders.put(id, info);
- Loader<D> loader = onCreateLoader(id, args);
- info.loader = loader;
- if (mStarted) {
- // The activity will start all existing loaders in it's onStart(), so only start them
- // here if we're past that point of the activitiy's life cycle
- loader.registerListener(id, this);
- loader.startLoading();
- }
- return loader;
- }
-
- protected abstract Loader<D> onCreateLoader(int id, Bundle args);
- protected abstract void onInitializeLoaders();
- protected abstract void onLoadFinished(Loader<D> loader, D data);
-
- public final void onLoadComplete(Loader<D> loader, D data) {
- // Notify of the new data so the app can switch out the old data before
- // we try to destroy it.
- onLoadFinished(loader, data);
-
- // Look for an inactive loader and destroy it if found
- int id = loader.getId();
- LoaderInfo<D> info = mInactiveLoaders.get(id);
- if (info != null) {
- Loader<D> oldLoader = info.loader;
- if (oldLoader != null) {
- oldLoader.destroy();
- }
- mInactiveLoaders.remove(id);
- }
- }
-
- @Override
- public void onCreate(Bundle savedState) {
- super.onCreate(savedState);
-
- if (mLoaders == null) {
- // Look for a passed along loader and create a new one if it's not there
-// TODO: uncomment once getLastNonConfigurationInstance method is available
-// mLoaders = (HashMap<Integer, LoaderInfo>) getLastNonConfigurationInstance();
- if (mLoaders == null) {
- mLoaders = new HashMap<Integer, LoaderInfo<D>>();
- onInitializeLoaders();
- }
- }
- if (mInactiveLoaders == null) {
- mInactiveLoaders = new HashMap<Integer, LoaderInfo<D>>();
- }
- }
-
- @Override
- public void onStart() {
- super.onStart();
-
- // Call out to sub classes so they can start their loaders
- // Let the existing loaders know that we want to be notified when a load is complete
- for (HashMap.Entry<Integer, LoaderInfo<D>> entry : mLoaders.entrySet()) {
- LoaderInfo<D> info = entry.getValue();
- Loader<D> loader = info.loader;
- int id = entry.getKey();
- if (loader == null) {
- loader = onCreateLoader(id, info.args);
- info.loader = loader;
- }
- loader.registerListener(id, this);
- loader.startLoading();
- }
-
- mStarted = true;
- }
-
- @Override
- public void onStop() {
- super.onStop();
-
- for (HashMap.Entry<Integer, LoaderInfo<D>> entry : mLoaders.entrySet()) {
- LoaderInfo<D> info = entry.getValue();
- Loader<D> loader = info.loader;
- if (loader == null) {
- continue;
- }
-
- // Let the loader know we're done with it
- loader.unregisterListener(this);
-
- // The loader isn't getting passed along to the next instance so ask it to stop loading
-// TODO: uncomment once isChangingConfig method is available
-// if (!getActivity().isChangingConfigurations()) {
- loader.stopLoading();
-// }
- }
-
- mStarted = false;
- }
-
- /** TO DO: This needs to be turned into a retained fragment.
- @Override
- public Object onRetainNonConfigurationInstance() {
- // Pass the loader along to the next guy
- Object result = mLoaders;
- mLoaders = null;
- return result;
- }
- **/
-
- @Override
- public void onDestroy() {
- super.onDestroy();
-
- if (mLoaders != null) {
- for (HashMap.Entry<Integer, LoaderInfo<D>> entry : mLoaders.entrySet()) {
- LoaderInfo<D> info = entry.getValue();
- Loader<D> loader = info.loader;
- if (loader == null) {
- continue;
- }
- loader.destroy();
- }
- }
- }
-}
diff --git a/src/com/android/contacts/list/ContactEntryListAdapter.java b/src/com/android/contacts/list/ContactEntryListAdapter.java
index b6d8169..7c2a16a 100644
--- a/src/com/android/contacts/list/ContactEntryListAdapter.java
+++ b/src/com/android/contacts/list/ContactEntryListAdapter.java
@@ -21,8 +21,8 @@
import com.android.contacts.widget.PinnedHeaderListAdapter;
import com.android.contacts.widget.TextWithHighlightingFactory;
-import android.app.patterns.CursorLoader;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.ContactsContract.ContactCounts;
diff --git a/src/com/android/contacts/list/ContactEntryListFragment.java b/src/com/android/contacts/list/ContactEntryListFragment.java
index bb8484d..2c01892 100644
--- a/src/com/android/contacts/list/ContactEntryListFragment.java
+++ b/src/com/android/contacts/list/ContactEntryListFragment.java
@@ -26,14 +26,14 @@
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
-import android.app.patterns.CursorLoader;
-import android.app.patterns.Loader;
-import android.app.patterns.LoaderManagingFragment;
+import android.app.LoaderManagingFragment;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
+import android.content.CursorLoader;
import android.content.IContentService;
import android.content.Intent;
+import android.content.Loader;
import android.database.ContentObserver;
import android.database.Cursor;
import android.os.Bundle;
diff --git a/src/com/android/contacts/list/DefaultContactListAdapter.java b/src/com/android/contacts/list/DefaultContactListAdapter.java
index 4c4323f..6e0daf5 100644
--- a/src/com/android/contacts/list/DefaultContactListAdapter.java
+++ b/src/com/android/contacts/list/DefaultContactListAdapter.java
@@ -15,8 +15,8 @@
*/
package com.android.contacts.list;
-import android.app.patterns.CursorLoader;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
diff --git a/src/com/android/contacts/list/JoinContactListAdapter.java b/src/com/android/contacts/list/JoinContactListAdapter.java
index 614e4e5..f1c9a83 100644
--- a/src/com/android/contacts/list/JoinContactListAdapter.java
+++ b/src/com/android/contacts/list/JoinContactListAdapter.java
@@ -17,8 +17,8 @@
import com.android.contacts.R;
-import android.app.patterns.CursorLoader;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
diff --git a/src/com/android/contacts/list/JoinContactListFragment.java b/src/com/android/contacts/list/JoinContactListFragment.java
index 202ee67..ebad6f2 100644
--- a/src/com/android/contacts/list/JoinContactListFragment.java
+++ b/src/com/android/contacts/list/JoinContactListFragment.java
@@ -18,9 +18,9 @@
import com.android.contacts.R;
import android.app.Activity;
-import android.app.patterns.CursorLoader;
-import android.app.patterns.Loader;
import android.content.ContentUris;
+import android.content.CursorLoader;
+import android.content.Loader;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.ContactsContract.Contacts;
diff --git a/src/com/android/contacts/list/JoinContactLoader.java b/src/com/android/contacts/list/JoinContactLoader.java
index c15acb1..dc04165 100644
--- a/src/com/android/contacts/list/JoinContactLoader.java
+++ b/src/com/android/contacts/list/JoinContactLoader.java
@@ -15,8 +15,8 @@
*/
package com.android.contacts.list;
-import android.app.patterns.CursorLoader;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
@@ -51,7 +51,7 @@
}
@Override
- protected Cursor loadInBackground() {
+ public Cursor loadInBackground() {
if (mLoadSuggestionsAndAllContact) {
// First execute the suggestions query, then call super.loadInBackground
// to load the entire list
diff --git a/src/com/android/contacts/list/LegacyContactListAdapter.java b/src/com/android/contacts/list/LegacyContactListAdapter.java
index 753596b..fb23e4a 100644
--- a/src/com/android/contacts/list/LegacyContactListAdapter.java
+++ b/src/com/android/contacts/list/LegacyContactListAdapter.java
@@ -15,9 +15,9 @@
*/
package com.android.contacts.list;
-import android.app.patterns.CursorLoader;
import android.content.ContentUris;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.provider.Contacts.People;
diff --git a/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java b/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java
index a98ed07..a2b9aa5 100644
--- a/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java
+++ b/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java
@@ -15,9 +15,9 @@
*/
package com.android.contacts.list;
-import android.app.patterns.CursorLoader;
import android.content.ContentUris;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.provider.Contacts.People;
diff --git a/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java b/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java
index 1eff102..f90c564 100644
--- a/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java
+++ b/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java
@@ -15,9 +15,9 @@
*/
package com.android.contacts.list;
-import android.app.patterns.CursorLoader;
import android.content.ContentUris;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.provider.Contacts.ContactMethods;
diff --git a/src/com/android/contacts/list/PhoneNumberListAdapter.java b/src/com/android/contacts/list/PhoneNumberListAdapter.java
index ffac30b..0d8975e 100644
--- a/src/com/android/contacts/list/PhoneNumberListAdapter.java
+++ b/src/com/android/contacts/list/PhoneNumberListAdapter.java
@@ -15,9 +15,9 @@
*/
package com.android.contacts.list;
-import android.app.patterns.CursorLoader;
import android.content.ContentUris;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
diff --git a/src/com/android/contacts/list/PostalAddressListAdapter.java b/src/com/android/contacts/list/PostalAddressListAdapter.java
index 1b645fe..7c86c75 100644
--- a/src/com/android/contacts/list/PostalAddressListAdapter.java
+++ b/src/com/android/contacts/list/PostalAddressListAdapter.java
@@ -15,9 +15,9 @@
*/
package com.android.contacts.list;
-import android.app.patterns.CursorLoader;
import android.content.ContentUris;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
diff --git a/src/com/android/contacts/list/ProviderStatusLoader.java b/src/com/android/contacts/list/ProviderStatusLoader.java
index c7bd547..1da32d0 100644
--- a/src/com/android/contacts/list/ProviderStatusLoader.java
+++ b/src/com/android/contacts/list/ProviderStatusLoader.java
@@ -19,11 +19,11 @@
import com.android.contacts.PhoneDisambigDialog;
import com.android.contacts.R;
-import android.app.patterns.CursorLoader;
-import android.app.patterns.LoaderManagingFragment;
+import android.app.LoaderManagingFragment;
import android.content.AsyncQueryHandler;
import android.content.ContentValues;
import android.content.Context;
+import android.content.CursorLoader;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
diff --git a/src/com/android/contacts/list/StrequentContactListAdapter.java b/src/com/android/contacts/list/StrequentContactListAdapter.java
index 1fa4077..78bd51a 100644
--- a/src/com/android/contacts/list/StrequentContactListAdapter.java
+++ b/src/com/android/contacts/list/StrequentContactListAdapter.java
@@ -17,8 +17,8 @@
import com.android.contacts.R;
-import android.app.patterns.CursorLoader;
import android.content.Context;
+import android.content.CursorLoader;
import android.database.Cursor;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index b4e74d3..d85e7a3 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -35,8 +35,7 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.patterns.Loader;
-import android.app.patterns.LoaderManagingFragment;
+import android.app.LoaderManagingFragment;
import android.content.ActivityNotFoundException;
import android.content.ContentUris;
import android.content.ContentValues;
@@ -44,6 +43,7 @@
import android.content.DialogInterface;
import android.content.Entity;
import android.content.Intent;
+import android.content.Loader;
import android.content.Entity.NamedContentValues;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
diff --git a/src/com/android/contacts/views/detail/ContactDetailLoader.java b/src/com/android/contacts/views/detail/ContactDetailLoader.java
index 147ec3c..e8ec96a 100644
--- a/src/com/android/contacts/views/detail/ContactDetailLoader.java
+++ b/src/com/android/contacts/views/detail/ContactDetailLoader.java
@@ -18,12 +18,12 @@
import com.android.contacts.util.DataStatus;
-import android.app.patterns.Loader;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Entity;
import android.content.EntityIterator;
+import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
diff --git a/src/com/android/contacts/views/edit/ContactEditFragment.java b/src/com/android/contacts/views/edit/ContactEditFragment.java
index a2629b1..3f10ea7 100644
--- a/src/com/android/contacts/views/edit/ContactEditFragment.java
+++ b/src/com/android/contacts/views/edit/ContactEditFragment.java
@@ -47,9 +47,8 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.LoaderManagingFragment;
import android.app.ProgressDialog;
-import android.app.patterns.Loader;
-import android.app.patterns.LoaderManagingFragment;
import android.content.ActivityNotFoundException;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
@@ -59,6 +58,7 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.Loader;
import android.content.OperationApplicationException;
import android.content.ContentProviderOperation.Builder;
import android.content.DialogInterface.OnDismissListener;
diff --git a/src/com/android/contacts/views/edit/ContactEditLoader.java b/src/com/android/contacts/views/edit/ContactEditLoader.java
index 3506c59..b89273c 100644
--- a/src/com/android/contacts/views/edit/ContactEditLoader.java
+++ b/src/com/android/contacts/views/edit/ContactEditLoader.java
@@ -7,10 +7,10 @@
import com.android.contacts.model.EntitySet;
import com.android.contacts.model.Sources;
-import android.app.patterns.Loader;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
+import android.content.Loader;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
diff --git a/tests/src/com/android/contacts/ContactDetailLoaderTest.java b/tests/src/com/android/contacts/ContactDetailLoaderTest.java
index 77cfb1f..97d2d9d 100644
--- a/tests/src/com/android/contacts/ContactDetailLoaderTest.java
+++ b/tests/src/com/android/contacts/ContactDetailLoaderTest.java
@@ -20,9 +20,9 @@
import com.android.contacts.tests.mocks.MockContentProvider;
import com.android.contacts.views.detail.ContactDetailLoader;
-import android.app.patterns.Loader;
-import android.app.patterns.Loader.OnLoadCompleteListener;
import android.content.ContentUris;
+import android.content.Loader;
+import android.content.Loader.OnLoadCompleteListener;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Handler;