Merge "Fixing preference dialog management in contacts"
diff --git a/res/drawable-hdpi/list_pressed_holo.9.png b/res/drawable-hdpi/list_pressed_holo.9.png
index f0742d0..423fa4b 100644
--- a/res/drawable-hdpi/list_pressed_holo.9.png
+++ b/res/drawable-hdpi/list_pressed_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_title_holo.9.png b/res/drawable-hdpi/list_title_holo.9.png
index acf9131..ebdd4e3 100644
--- a/res/drawable-hdpi/list_title_holo.9.png
+++ b/res/drawable-hdpi/list_title_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/panel_content.9.png b/res/drawable-hdpi/panel_content.9.png
index 3061fbc..4a9b90a 100644
--- a/res/drawable-hdpi/panel_content.9.png
+++ b/res/drawable-hdpi/panel_content.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_pressed_holo.9.png b/res/drawable-mdpi/list_pressed_holo.9.png
index aa4dab8..7ea8666 100644
--- a/res/drawable-mdpi/list_pressed_holo.9.png
+++ b/res/drawable-mdpi/list_pressed_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_title_holo.9.png b/res/drawable-mdpi/list_title_holo.9.png
index 1c2a351..e866452 100644
--- a/res/drawable-mdpi/list_title_holo.9.png
+++ b/res/drawable-mdpi/list_title_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/panel_content.9.png b/res/drawable-mdpi/panel_content.9.png
index a220dbb..1d30d5f 100644
--- a/res/drawable-mdpi/panel_content.9.png
+++ b/res/drawable-mdpi/panel_content.9.png
Binary files differ
diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml
index 32247b0..6410840 100644
--- a/res/values-xlarge/styles.xml
+++ b/res/values-xlarge/styles.xml
@@ -19,7 +19,7 @@
         <item name="activated_background">@drawable/list_item_activated_background</item>
         <item name="android:windowContentOverlay">@null</item>
         <item name="android:actionBarStyle">@style/TransparentActionBarStyle</item>
-        <item name="section_header_background">@drawable/section_header_holo</item>
+        <item name="section_header_background">@drawable/list_title_holo</item>
         <item name="list_item_divider">?android:attr/listDivider</item>
         <item name="list_item_padding_top">0dip</item>
         <item name="list_item_padding_right">24dip</item>
@@ -40,7 +40,7 @@
 
     <style name="ContactPickerTheme" parent="@android:Theme.Holo.Light.Dialog">
         <item name="list_item_height">66dip</item>
-        <item name="section_header_background">@drawable/section_header_holo</item>
+        <item name="section_header_background">@drawable/list_title_holo</item>
         <item name="list_item_divider">?android:attr/listDivider</item>
         <item name="list_item_padding_top">0dip</item>
         <item name="list_item_padding_right">24dip</item>
diff --git a/src/com/android/contacts/ContactLoader.java b/src/com/android/contacts/ContactLoader.java
index 7ceef91..e70cf69 100644
--- a/src/com/android/contacts/ContactLoader.java
+++ b/src/com/android/contacts/ContactLoader.java
@@ -981,7 +981,12 @@
         mContact = null;
     }
 
-    @Override
+    public void reset() {
+        unregisterObserver();
+        mContact = null;
+        mDestroyed = true;
+    }
+
     public void destroy() {
         unregisterObserver();
         mContact = null;
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index dde6b59..8d45ec8 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -53,6 +53,7 @@
 import android.content.Intent;
 import android.content.Loader;
 import android.content.res.Resources;
+import android.database.Cursor;
 import android.graphics.drawable.Drawable;
 import android.net.ParseException;
 import android.net.Uri;
@@ -1173,6 +1174,10 @@
                 mListener.onContactNotFound();
             }
         }
+
+        public void onLoaderReset(Loader<ContactLoader.Result> loader) {
+            mContactData = null;
+        }
     };
 
     private ContactDetailHeaderView.Listener mHeaderViewListener =
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index df748ae..80baa42 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -1641,6 +1641,9 @@
             }
             Log.v(TAG, "Time needed for setting UI: " + (setDataEndTime-setDataStartTime));
         }
+
+        public void onLoaderReset(Loader<ContactLoader.Result> loader) {
+        }
     };
 
     /**
@@ -1659,6 +1662,9 @@
             mGroupMetaData = data;
             bindGroupMetaData();
         }
+
+        public void onLoaderReset(Loader<Cursor> loader) {
+        }
     };
 
     @Override
diff --git a/src/com/android/contacts/interactions/ContactDeletionInteraction.java b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
index 78a98b8..7426593 100644
--- a/src/com/android/contacts/interactions/ContactDeletionInteraction.java
+++ b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
@@ -180,6 +180,9 @@
         showDialog(messageId, contactUri);
     }
 
+    public void onLoaderReset(Loader<Cursor> loader) {
+    }
+    
     /* Visible for testing */
     void showDialog(int messageId, final Uri contactUri) {
         mDialog = new AlertDialog.Builder(getActivity())
diff --git a/src/com/android/contacts/list/ContactBrowseListFragment.java b/src/com/android/contacts/list/ContactBrowseListFragment.java
index 6f06c82..e0626e0 100644
--- a/src/com/android/contacts/list/ContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/ContactBrowseListFragment.java
@@ -363,6 +363,9 @@
         refreshSelectedContactUri();
     }
 
+    public void onLoaderReset(Loader<Cursor> loader) {
+    }
+
     private void checkSelection() {
         if (mSelectionVerified) {
             return;
diff --git a/src/com/android/contacts/list/ContactEntryListFragment.java b/src/com/android/contacts/list/ContactEntryListFragment.java
index 6447a7c..c73b86e 100644
--- a/src/com/android/contacts/list/ContactEntryListFragment.java
+++ b/src/com/android/contacts/list/ContactEntryListFragment.java
@@ -433,6 +433,9 @@
 //            }
     }
 
+    public void onLoaderReset(Loader<Cursor> loader) {
+    }
+
     protected void onPartitionLoaded(int partitionIndex, Cursor data) {
         mAdapter.changeCursor(partitionIndex, data);
         showCount(partitionIndex, data);
diff --git a/src/com/android/contacts/list/ContactListFilterController.java b/src/com/android/contacts/list/ContactListFilterController.java
index 920ff86..111dcd0 100644
--- a/src/com/android/contacts/list/ContactListFilterController.java
+++ b/src/com/android/contacts/list/ContactListFilterController.java
@@ -24,6 +24,7 @@
 import android.content.Loader;
 import android.content.SharedPreferences;
 import android.content.res.TypedArray;
+import android.database.Cursor;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
 import android.text.TextUtils;
@@ -224,6 +225,9 @@
         }
     }
 
+    public void onLoaderReset(Loader<List<ContactListFilter>> loader) {
+    }
+
     private void setContactListFilter(int filterId) {
         ContactListFilter filter;
         if (filterId == ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS) {
diff --git a/src/com/android/contacts/list/JoinContactListFragment.java b/src/com/android/contacts/list/JoinContactListFragment.java
index 2b071ad..96bae93 100644
--- a/src/com/android/contacts/list/JoinContactListFragment.java
+++ b/src/com/android/contacts/list/JoinContactListFragment.java
@@ -86,6 +86,9 @@
                 }
             }
         }
+        
+        public void onLoaderReset(Loader<Cursor> loader) {
+        }
     };
 
     public JoinContactListFragment() {
diff --git a/tests/src/com/android/contacts/widget/TestLoaderManager.java b/tests/src/com/android/contacts/widget/TestLoaderManager.java
index dc78ff3..4c06970 100644
--- a/tests/src/com/android/contacts/widget/TestLoaderManager.java
+++ b/tests/src/com/android/contacts/widget/TestLoaderManager.java
@@ -58,12 +58,18 @@
         return loader;
     }
 
-    @Override
+    public <D> Loader<D> recreateLoader(int id, Bundle args, LoaderCallbacks<D> callbacks) {
+        return initLoader(id, args, callbacks);
+    }
+
     public <D> Loader<D> restartLoader(int id, Bundle args, LoaderCallbacks<D> callbacks) {
         return initLoader(id, args, callbacks);
     }
 
-    @Override
+    public void destroyLoader(int id) {
+        mStartedLoaders.get(id).stopLoading();
+    }
+
     public void stopLoader(int id) {
         mStartedLoaders.get(id).stopLoading();
     }