Loading src/com/android/contacts/common/compat/CompatUtils.java 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2015 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 com.android.contacts.common.compat; import android.os.Build; import com.android.contacts.common.compat.SdkVersionOverride; public final class CompatUtils { /** * PrioritizedMimeType is added in API level 23. */ public static boolean hasPrioritizedMimeType() { return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) >= Build.VERSION_CODES.M; } } src/com/android/contacts/common/list/ContactEntryListAdapter.java +7 −4 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.R; import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.util.SearchUtil; import java.util.HashSet; Loading Loading @@ -723,10 +724,12 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter { QuickContactBadge quickContact = view.getQuickContact(); quickContact.assignContactUri( getContactUri(partitionIndex, cursor, contactIdColumn, lookUpKeyColumn)); if (CompatUtils.hasPrioritizedMimeType()) { // The Contacts app never uses the QuickContactBadge. Therefore, it is safe to assume // that only Dialer will use this QuickContact badge. This means prioritizing the phone // mimetype here is reasonable. quickContact.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); } if (photoId != 0 || photoUriColumn == -1) { getPhotoLoader().loadThumbnail(quickContact, photoId, mDarkTheme, mCircularPhotos, Loading Loading
src/com/android/contacts/common/compat/CompatUtils.java 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2015 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 com.android.contacts.common.compat; import android.os.Build; import com.android.contacts.common.compat.SdkVersionOverride; public final class CompatUtils { /** * PrioritizedMimeType is added in API level 23. */ public static boolean hasPrioritizedMimeType() { return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) >= Build.VERSION_CODES.M; } }
src/com/android/contacts/common/list/ContactEntryListAdapter.java +7 −4 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.R; import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.util.SearchUtil; import java.util.HashSet; Loading Loading @@ -723,10 +724,12 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter { QuickContactBadge quickContact = view.getQuickContact(); quickContact.assignContactUri( getContactUri(partitionIndex, cursor, contactIdColumn, lookUpKeyColumn)); if (CompatUtils.hasPrioritizedMimeType()) { // The Contacts app never uses the QuickContactBadge. Therefore, it is safe to assume // that only Dialer will use this QuickContact badge. This means prioritizing the phone // mimetype here is reasonable. quickContact.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); } if (photoId != 0 || photoUriColumn == -1) { getPhotoLoader().loadThumbnail(quickContact, photoId, mDarkTheme, mCircularPhotos, Loading