diff options
author | twyen <twyen@google.com> | 2018-06-25 12:36:26 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-26 13:42:08 -0700 |
commit | 5578d928bf777f721ec0ec04c84ddb7d3ea56edb (patch) | |
tree | 150f643cf67aee21a2ac730d3f7b1f6cada7db47 /java/com/android/dialer/app/calllog/CallLogAdapter.java | |
parent | 03bacec1394032712c534605476fb634b85eee28 (diff) |
Refactor ContactPreference
Moving it outside contacts.commons reduces dependency to legacy code. Also removed redundant implementations such as caching SharedPreferences (it is already cached), custom ListPreferences (standard ListPreferences already have what we want), and corrected preference storage location (allow standard ListPreferences to work)
TEST=TAP
Test: TAP
PiperOrigin-RevId: 202000393
Change-Id: I45374e610b3510784b5a4da92e5d8462cbfc92bb
Diffstat (limited to 'java/com/android/dialer/app/calllog/CallLogAdapter.java')
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogAdapter.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index d3fd36520..f5474eec6 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -53,7 +53,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.android.contacts.common.ContactsUtils; -import com.android.contacts.common.preference.ContactsPreferences; import com.android.dialer.app.R; import com.android.dialer.app.calllog.CallLogFragment.CallLogFragmentListener; import com.android.dialer.app.calllog.CallLogGroupBuilder.GroupCreator; @@ -73,6 +72,7 @@ import com.android.dialer.common.concurrent.AsyncTaskExecutor; import com.android.dialer.common.concurrent.AsyncTaskExecutors; import com.android.dialer.compat.android.provider.VoicemailCompat; import com.android.dialer.configprovider.ConfigProviderComponent; +import com.android.dialer.contacts.ContactsComponent; import com.android.dialer.duo.Duo; import com.android.dialer.duo.DuoComponent; import com.android.dialer.duo.DuoListener; @@ -506,7 +506,6 @@ public class CallLogAdapter extends GroupingListAdapter private final Map<Long, Integer> dayGroups = new ArrayMap<>(); private boolean loading = true; - private ContactsPreferences contactsPreferences; private boolean isSpamEnabled; @@ -551,8 +550,6 @@ public class CallLogAdapter extends GroupingListAdapter callLogGroupBuilder = new CallLogGroupBuilder(activity.getApplicationContext(), this); this.filteredNumberAsyncQueryHandler = Assert.isNotNull(filteredNumberAsyncQueryHandler); - contactsPreferences = new ContactsPreferences(this.activity); - blockReportSpamListener = new BlockReportSpamListener( this.activity, @@ -674,7 +671,6 @@ public class CallLogAdapter extends GroupingListAdapter if (PermissionsUtil.hasPermission(activity, android.Manifest.permission.READ_CONTACTS)) { contactInfoCache.start(); } - contactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY); isSpamEnabled = SpamComponent.get(activity).spamSettings().isSpamEnabled(); getDuo().registerListener(this); notifyDataSetChanged(); @@ -1078,7 +1074,8 @@ public class CallLogAdapter extends GroupingListAdapter details.contactUri = info.lookupUri; details.namePrimary = info.name; details.nameAlternative = info.nameAlternative; - details.nameDisplayOrder = contactsPreferences.getDisplayOrder(); + details.nameDisplayOrder = + ContactsComponent.get(activity).contactDisplayPreferences().getDisplayOrder(); details.numberType = info.type; details.numberLabel = info.label; details.photoUri = info.photoUri; |