diff options
author | Wenyi Wang <wenyiw@google.com> | 2015-11-24 15:31:41 -0800 |
---|---|---|
committer | Wenyi Wang <wenyiw@google.com> | 2015-11-30 09:55:21 -0800 |
commit | 8005ef13459021aaf1ef0f9ed545fb714df4bfc5 (patch) | |
tree | 322040137febfb84a1f679a99519cc6da5c36fda /src | |
parent | a31f24c1ace1ed10b87daa8d23af58e6598fa075 (diff) |
Avoid using prioritized mimetype on pre-M SDKs
Restores code deleted in ag/643285 because the code was used on pre-M.
Bug:25629359
Change-Id: Ief60d301fd8d3c018ce03388c56264a2db727224
Diffstat (limited to 'src')
5 files changed, 29 insertions, 10 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 34e49a99b..c045967a2 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -43,6 +43,7 @@ import com.android.contacts.common.ClipboardUtils; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.GeoUtil; +import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.interactions.TouchPointManager; import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.testing.NeededForTesting; @@ -249,7 +250,9 @@ public class CallDetailActivity extends AppCompatActivity mQuickContactBadge = (QuickContactBadge) findViewById(R.id.quick_contact_photo); mQuickContactBadge.setOverlay(null); - mQuickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); + if (CompatUtils.hasPrioritizedMimeType()) { + mQuickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); + } mCallerName = (TextView) findViewById(R.id.caller_name); mCallerNumber = (TextView) findViewById(R.id.caller_number); mAccountLabel = (TextView) findViewById(R.id.phone_account_label); diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java index 099877f1d..88af54785 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java +++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java @@ -43,6 +43,7 @@ import com.android.contacts.common.CallUtil; import com.android.contacts.common.ClipboardUtils; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; +import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.dialog.CallSubjectDialog; import com.android.contacts.common.testing.NeededForTesting; import com.android.contacts.common.util.UriUtils; @@ -240,8 +241,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder phoneCallDetailsViews.callLocationAndDate.setElegantTextHeight(false); quickContactView.setOverlay(null); - quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); - + if (CompatUtils.hasPrioritizedMimeType()) { + quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); + } primaryActionButtonView.setOnClickListener(this); primaryActionView.setOnClickListener(mExpandCollapseListener); primaryActionView.setOnCreateContextMenuListener(this); diff --git a/src/com/android/dialer/filterednumber/NumbersAdapter.java b/src/com/android/dialer/filterednumber/NumbersAdapter.java index 170610712..4e2e578a8 100644 --- a/src/com/android/dialer/filterednumber/NumbersAdapter.java +++ b/src/com/android/dialer/filterednumber/NumbersAdapter.java @@ -20,6 +20,7 @@ import android.app.FragmentManager; import android.content.Context; import android.content.res.Resources; import android.provider.ContactsContract; +import android.provider.ContactsContract.CommonDataKinds.Phone; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; @@ -30,6 +31,7 @@ import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; +import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.util.UriUtils; import com.android.dialer.R; import com.android.dialer.calllog.ContactInfo; @@ -63,9 +65,9 @@ public class NumbersAdapter extends SimpleCursorAdapter { final QuickContactBadge quickContactBadge = (QuickContactBadge) view.findViewById(R.id.quick_contact_photo); quickContactBadge.setOverlay(null); - quickContactBadge.setPrioritizedMimeType( - ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE); - + if (CompatUtils.hasPrioritizedMimeType()) { + quickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); + } final ContactInfo info = mContactInfoHelper.lookupNumber(number, countryIso); final CharSequence locationOrType = getNumberTypeOrLocation(info); final String displayNumber = getDisplayNumber(info); diff --git a/src/com/android/dialer/list/AllContactsFragment.java b/src/com/android/dialer/list/AllContactsFragment.java index 6ed1fbbbd..7e76279d9 100644 --- a/src/com/android/dialer/list/AllContactsFragment.java +++ b/src/com/android/dialer/list/AllContactsFragment.java @@ -34,6 +34,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; +import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.list.ContactEntryListAdapter; import com.android.contacts.common.list.ContactEntryListFragment; import com.android.contacts.common.list.ContactListFilter; @@ -152,8 +153,13 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final Uri uri = (Uri) view.getTag(); if (uri != null) { - QuickContact.showQuickContact(getContext(), view, uri, null, - Phone.CONTENT_ITEM_TYPE); + if (CompatUtils.hasPrioritizedMimeType()) { + QuickContact.showQuickContact(getContext(), view, uri, null, + Phone.CONTENT_ITEM_TYPE); + } else { + QuickContact.showQuickContact(getActivity(), view, uri, QuickContact.MODE_LARGE, + null); + } } } diff --git a/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java b/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java index c12bed737..69a230c8a 100644 --- a/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java +++ b/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java @@ -24,6 +24,7 @@ import android.view.View; import android.widget.ImageButton; import android.widget.TextView; +import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.list.ContactEntry; import com.android.dialer.R; @@ -63,8 +64,13 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView { } private void launchQuickContact() { - QuickContact.showQuickContact(getContext(), PhoneFavoriteSquareTileView.this, - getLookupUri(), null, Phone.CONTENT_ITEM_TYPE); + if (CompatUtils.hasPrioritizedMimeType()) { + QuickContact.showQuickContact(getContext(), PhoneFavoriteSquareTileView.this, + getLookupUri(), null, Phone.CONTENT_ITEM_TYPE); + } else { + QuickContact.showQuickContact(getContext(), PhoneFavoriteSquareTileView.this, + getLookupUri(), QuickContact.MODE_LARGE, null); + } } @Override |