diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-04-24 00:41:24 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-04-24 00:41:24 +0000 |
commit | 24f0348fa71eb85fed2aabe871ae5057ee1f465e (patch) | |
tree | 818851f63faa07a0e76de52bba8791a5af9dceab /java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java | |
parent | 54468190f8c745eb4c6b443b2deef20f370b099c (diff) | |
parent | 4558ed566b2da4562b0ac9773cdb679e5d097277 (diff) |
Merge "Implement display name ordering in Speed Dial fragment."
Diffstat (limited to 'java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java')
-rw-r--r-- | java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java index 5b7906fdb..24bc776e7 100644 --- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java +++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java @@ -52,7 +52,7 @@ public abstract class SpeedDialUiItem { public static final int PHOTO_URI = 8; public static final int CARRIER_PRESENCE = 9; - public static final String[] PHONE_PROJECTION = { + private static final String[] PHONE_PROJECTION = { Phone.LOOKUP_KEY, Phone.CONTACT_ID, Phone.DISPLAY_NAME, @@ -65,12 +65,30 @@ public abstract class SpeedDialUiItem { Phone.CARRIER_PRESENCE }; + private static final String[] PHONE_PROJECTION_ALTERNATIVE = { + Phone.LOOKUP_KEY, + Phone.CONTACT_ID, + Phone.DISPLAY_NAME_ALTERNATIVE, + Phone.STARRED, + Phone.NUMBER, + Phone.TYPE, + Phone.LABEL, + Phone.PHOTO_ID, + Phone.PHOTO_URI, + Phone.CARRIER_PRESENCE + }; + + public static String[] getPhoneProjection(boolean primaryDisplayOrder) { + return primaryDisplayOrder ? PHONE_PROJECTION : PHONE_PROJECTION_ALTERNATIVE; + } + public static Builder builder() { return new AutoValue_SpeedDialUiItem.Builder().setChannels(ImmutableList.of()); } /** - * Convert a cursor with projection {@link #PHONE_PROJECTION} into a {@link SpeedDialUiItem}. + * Convert a cursor with projection {@link #getPhoneProjection(boolean)} into a {@link + * SpeedDialUiItem}. * * <p>This cursor is structured such that contacts are grouped by contact id and lookup key and * each row that shares the same contact id and lookup key represents a phone number that belongs |