diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-05-15 22:08:51 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-15 22:08:51 +0000 |
commit | dd84cbcd28d387e937e2363258dbf50fbefdcd43 (patch) | |
tree | 56ba54cd2ea9e23daae429c659e567f7ca87a005 /java/com/android/dialer | |
parent | 5a6e0fb9787d1cb0db93b36870bc033c9939302f (diff) | |
parent | fa863beddae5b1eb69b5c14e66cb5e55ee6aff29 (diff) |
Merge "Clear frequents dialog now reloads the speed dial fragment."
Diffstat (limited to 'java/com/android/dialer')
-rw-r--r-- | java/com/android/dialer/speeddial/SpeedDialFragment.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/java/com/android/dialer/speeddial/SpeedDialFragment.java b/java/com/android/dialer/speeddial/SpeedDialFragment.java index d9593c211..f94ad7d9e 100644 --- a/java/com/android/dialer/speeddial/SpeedDialFragment.java +++ b/java/com/android/dialer/speeddial/SpeedDialFragment.java @@ -21,6 +21,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.database.ContentObserver; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract.CommonDataKinds.Phone; @@ -45,6 +46,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DefaultFutureCallback; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.SupportUiListener; +import com.android.dialer.common.concurrent.ThreadUtil; import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.historyitemactions.DividerModule; import com.android.dialer.historyitemactions.HistoryItemActionBottomSheet; @@ -99,6 +101,16 @@ public class SpeedDialFragment extends Fragment { } }; + /** Listen for changes to the strequents content observer. */ + private final ContentObserver strequentsContentObserver = + new ContentObserver(ThreadUtil.getUiThreadHandler()) { + @Override + public void onChange(boolean selfChange) { + super.onChange(selfChange); + loadContacts(); + } + }; + private final SpeedDialHeaderListener headerListener = new SpeedDialFragmentHeaderListener(); private final SpeedDialSuggestedListener suggestedListener = new SpeedDialSuggestedListener(); @@ -272,6 +284,9 @@ public class SpeedDialFragment extends Fragment { super.onStart(); PermissionsUtil.registerPermissionReceiver( getActivity(), readContactsPermissionGrantedReceiver, Manifest.permission.READ_CONTACTS); + getContext() + .getContentResolver() + .registerContentObserver(Contacts.CONTENT_STREQUENT_URI, true, strequentsContentObserver); } @Override @@ -279,6 +294,7 @@ public class SpeedDialFragment extends Fragment { super.onStop(); PermissionsUtil.unregisterPermissionReceiver( getContext(), readContactsPermissionGrantedReceiver); + getContext().getContentResolver().unregisterContentObserver(strequentsContentObserver); } private class SpeedDialFragmentHeaderListener implements SpeedDialHeaderListener { |