summaryrefslogtreecommitdiff
path: root/java/com/android/contacts/common/list
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/contacts/common/list')
-rw-r--r--java/com/android/contacts/common/list/ContactEntryListAdapter.java62
-rw-r--r--java/com/android/contacts/common/list/ContactEntryListFragment.java22
-rw-r--r--java/com/android/contacts/common/list/ContactListAdapter.java2
-rw-r--r--java/com/android/contacts/common/list/ContactListFilterController.java8
-rw-r--r--java/com/android/contacts/common/list/ContactListItemView.java218
-rw-r--r--java/com/android/contacts/common/list/ContactTileView.java24
-rw-r--r--java/com/android/contacts/common/list/PhoneNumberListAdapter.java83
-rw-r--r--java/com/android/contacts/common/list/PhoneNumberPickerFragment.java73
-rw-r--r--java/com/android/contacts/common/list/ViewPagerTabs.java29
9 files changed, 264 insertions, 257 deletions
diff --git a/java/com/android/contacts/common/list/ContactEntryListAdapter.java b/java/com/android/contacts/common/list/ContactEntryListAdapter.java
index 18bbae382..117825dce 100644
--- a/java/com/android/contacts/common/list/ContactEntryListAdapter.java
+++ b/java/com/android/contacts/common/list/ContactEntryListAdapter.java
@@ -26,20 +26,23 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Directory;
import android.text.TextUtils;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.QuickContactBadge;
import android.widget.SectionIndexer;
import android.widget.TextView;
-import com.android.contacts.common.ContactPhotoManager;
-import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.ContactsUtils;
import com.android.contacts.common.R;
import com.android.contacts.common.compat.DirectoryCompat;
import com.android.contacts.common.util.SearchUtil;
+import com.android.dialer.common.LogUtil;
import com.android.dialer.compat.CompatUtils;
+import com.android.dialer.configprovider.ConfigProviderBindings;
+import com.android.dialer.contactphoto.ContactPhotoManager;
+import com.android.dialer.contactphoto.ContactPhotoManager.DefaultImageRequest;
+import com.android.dialer.logging.InteractionEvent;
+import com.android.dialer.logging.Logger;
import java.util.HashSet;
/**
@@ -53,7 +56,6 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {
*/
public static final boolean LOCAL_INVISIBLE_DIRECTORY_ENABLED = false;
- private static final String TAG = "ContactEntryListAdapter";
private int mDisplayOrder;
private int mSortOrder;
@@ -80,6 +82,8 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {
private ContactListFilter mFilter;
private boolean mDarkTheme = false;
+ public static final int SUGGESTIONS_LOADER_ID = 0;
+
/** Resource used to provide header-text for default filter. */
private CharSequence mDefaultFilterHeaderText;
@@ -128,9 +132,22 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {
}
protected void addPartitions() {
+ if (ConfigProviderBindings.get(getContext()).getBoolean("p13n_ranker_should_enable", false)) {
+ addPartition(createSuggestionsDirectoryPartition());
+ }
addPartition(createDefaultDirectoryPartition());
}
+ protected DirectoryPartition createSuggestionsDirectoryPartition() {
+ DirectoryPartition partition = new DirectoryPartition(true, true);
+ partition.setDirectoryId(SUGGESTIONS_LOADER_ID);
+ partition.setDirectoryType(getContext().getString(R.string.contact_suggestions));
+ partition.setPriorityDirectory(true);
+ partition.setPhotoSupported(true);
+ partition.setLabel(getContext().getString(R.string.local_suggestions_search_label));
+ return partition;
+ }
+
protected DirectoryPartition createDefaultDirectoryPartition() {
DirectoryPartition partition = new DirectoryPartition(true, true);
partition.setDirectoryId(Directory.DEFAULT);
@@ -243,6 +260,11 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {
} else {
mUpperCaseQueryString = SearchUtil.cleanStartAndEndOfSearchQuery(queryString.toUpperCase());
}
+
+ // Enable default partition header if in search mode (including zero-suggest).
+ if (mQueryString != null) {
+ setDefaultPartitionHeader(true);
+ }
}
public String getUpperCaseQueryString() {
@@ -354,9 +376,9 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {
if (cursor.getCount() == 0) {
// Directory table must have at least local directory, without which this adapter will
// enter very weird state.
- Log.e(
- TAG,
- "Directory search loader returned an empty cursor, which implies we have "
+ LogUtil.i(
+ "ContactEntryListAdapter.changeDirectories",
+ "directory search loader returned an empty cursor, which implies we have "
+ "no directory entries.",
new RuntimeException());
return;
@@ -529,22 +551,27 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {
return false;
}
- /** Changes visibility parameters for the default directory partition. */
- public void configureDefaultPartition(boolean showIfEmpty, boolean hasHeader) {
+ /** Configures visibility parameters for the directory partitions. */
+ public void configurePartitionsVisibility(boolean isInSearchMode) {
+ for (int i = 0; i < getPartitionCount(); i++) {
+ setShowIfEmpty(i, false);
+ setHasHeader(i, isInSearchMode);
+ }
+ }
+
+ // Sets header for the default partition.
+ private void setDefaultPartitionHeader(boolean setHeader) {
+ // Iterate in reverse here to ensure the first DEFAULT directory has header.
+ // Both "Suggestions" and "All Contacts" directories have DEFAULT id.
int defaultPartitionIndex = -1;
- int count = getPartitionCount();
- for (int i = 0; i < count; i++) {
+ for (int i = getPartitionCount() - 1; i >= 0; i--) {
Partition partition = getPartition(i);
if (partition instanceof DirectoryPartition
&& ((DirectoryPartition) partition).getDirectoryId() == Directory.DEFAULT) {
defaultPartitionIndex = i;
- break;
}
}
- if (defaultPartitionIndex != -1) {
- setShowIfEmpty(defaultPartitionIndex, showIfEmpty);
- setHasHeader(defaultPartitionIndex, hasHeader);
- }
+ setHasHeader(defaultPartitionIndex, setHeader);
}
@Override
@@ -678,6 +705,9 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {
// mimetype here is reasonable.
quickContact.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
}
+ Logger.get(mContext)
+ .logQuickContactOnTouch(
+ quickContact, InteractionEvent.Type.OPEN_QUICK_CONTACT_FROM_SEARCH, true);
if (photoId != 0 || photoUriColumn == -1) {
getPhotoLoader().loadThumbnail(quickContact, photoId, mDarkTheme, mCircularPhotos, null);
diff --git a/java/com/android/contacts/common/list/ContactEntryListFragment.java b/java/com/android/contacts/common/list/ContactEntryListFragment.java
index 278175c0b..94551a8c8 100644
--- a/java/com/android/contacts/common/list/ContactEntryListFragment.java
+++ b/java/com/android/contacts/common/list/ContactEntryListFragment.java
@@ -43,10 +43,11 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import com.android.common.widget.CompositeCursorAdapter.Partition;
-import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.preference.ContactsPreferences;
import com.android.contacts.common.util.ContactListViewUtils;
import com.android.dialer.common.LogUtil;
+import com.android.dialer.contactphoto.ContactPhotoManager;
+import com.android.dialer.performancereport.PerformanceReport;
import java.lang.ref.WeakReference;
import java.util.Locale;
@@ -440,6 +441,11 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter
return;
}
+ // Return for non-"Suggestions" if on the zero-suggest screen.
+ if (TextUtils.isEmpty(mQueryString) && partitionIndex > 0) {
+ return;
+ }
+
mAdapter.changeCursor(partitionIndex, data);
setProfileHeader();
@@ -555,7 +561,6 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter
protected void setSearchMode(boolean flag) {
if (mSearchMode != flag) {
mSearchMode = flag;
- setSectionHeaderDisplayEnabled(!mSearchMode);
if (!flag) {
mDirectoryListStatus = STATUS_NOT_LOADED;
@@ -572,7 +577,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter
// should be cleaned up on exiting the search mode.
mAdapter.removeDirectoriesAfterDefault();
}
- mAdapter.configureDefaultPartition(false, flag);
+ mAdapter.configurePartitionsVisibility(flag);
}
if (mListView != null) {
@@ -676,22 +681,16 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter
boolean searchMode = isSearchMode();
mAdapter.setSearchMode(searchMode);
- mAdapter.configureDefaultPartition(false, searchMode);
+ mAdapter.configurePartitionsVisibility(searchMode);
mAdapter.setPhotoLoader(mPhotoManager);
mListView.setAdapter(mAdapter);
-
- if (!isSearchMode()) {
- mListView.setFocusableInTouchMode(true);
- mListView.requestFocus();
- }
-
return mView;
}
protected void onCreateView(LayoutInflater inflater, ViewGroup container) {
mView = inflateView(inflater, container);
- mListView = (ListView) mView.findViewById(android.R.id.list);
+ mListView = mView.findViewById(android.R.id.list);
if (mListView == null) {
throw new RuntimeException(
"Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
@@ -770,6 +769,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
+ PerformanceReport.recordScrollStateChange(scrollState);
if (scrollState == OnScrollListener.SCROLL_STATE_FLING) {
mPhotoManager.pause();
} else if (isPhotoLoaderEnabled()) {
diff --git a/java/com/android/contacts/common/list/ContactListAdapter.java b/java/com/android/contacts/common/list/ContactListAdapter.java
index 6cd311811..721609d1d 100644
--- a/java/com/android/contacts/common/list/ContactListAdapter.java
+++ b/java/com/android/contacts/common/list/ContactListAdapter.java
@@ -23,9 +23,9 @@ import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Directory;
import android.provider.ContactsContract.SearchSnippets;
import android.view.ViewGroup;
-import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.R;
import com.android.contacts.common.preference.ContactsPreferences;
+import com.android.dialer.contactphoto.ContactPhotoManager.DefaultImageRequest;
/**
* A cursor adapter for the {@link ContactsContract.Contacts#CONTENT_TYPE} content type. Also
diff --git a/java/com/android/contacts/common/list/ContactListFilterController.java b/java/com/android/contacts/common/list/ContactListFilterController.java
index d2168f3f2..c5c078cb4 100644
--- a/java/com/android/contacts/common/list/ContactListFilterController.java
+++ b/java/com/android/contacts/common/list/ContactListFilterController.java
@@ -75,13 +75,13 @@ public abstract class ContactListFilterController {
*/
class ContactListFilterControllerImpl extends ContactListFilterController {
- private final Context mContext;
+ private final Context mAppContext;
private final List<ContactListFilterListener> mListeners =
new ArrayList<ContactListFilterListener>();
private ContactListFilter mFilter;
public ContactListFilterControllerImpl(Context context) {
- mContext = context;
+ mAppContext = context.getApplicationContext();
mFilter = ContactListFilter.restoreDefaultPreferences(getSharedPreferences());
checkFilterValidity(true /* notify listeners */);
}
@@ -102,7 +102,7 @@ class ContactListFilterControllerImpl extends ContactListFilterController {
}
private SharedPreferences getSharedPreferences() {
- return PreferenceManager.getDefaultSharedPreferences(mContext);
+ return PreferenceManager.getDefaultSharedPreferences(mAppContext);
}
@Override
@@ -162,7 +162,7 @@ class ContactListFilterControllerImpl extends ContactListFilterController {
/** @return true if the Account for the current filter exists. */
private boolean filterAccountExists() {
- final AccountTypeManager accountTypeManager = AccountTypeManager.getInstance(mContext);
+ final AccountTypeManager accountTypeManager = AccountTypeManager.getInstance(mAppContext);
final AccountWithDataSet filterAccount =
new AccountWithDataSet(mFilter.accountName, mFilter.accountType, mFilter.dataSet);
return accountTypeManager.contains(filterAccount, false);
diff --git a/java/com/android/contacts/common/list/ContactListItemView.java b/java/com/android/contacts/common/list/ContactListItemView.java
index 7a3194720..c605f4e87 100644
--- a/java/com/android/contacts/common/list/ContactListItemView.java
+++ b/java/com/android/contacts/common/list/ContactListItemView.java
@@ -30,8 +30,8 @@ import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.SearchSnippets;
import android.support.annotation.IntDef;
+import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
-import android.support.v4.graphics.drawable.DrawableCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
@@ -55,7 +55,7 @@ import com.android.contacts.common.format.TextHighlighter;
import com.android.contacts.common.list.PhoneNumberListAdapter.Listener;
import com.android.contacts.common.util.ContactDisplayUtils;
import com.android.contacts.common.util.SearchUtil;
-import com.android.dialer.compat.CompatUtils;
+import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.util.ViewUtil;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -81,13 +81,15 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
/** IntDef for indices of ViewPager tabs. */
@Retention(RetentionPolicy.SOURCE)
- @IntDef({NONE, VIDEO, CALL_AND_SHARE})
+ @IntDef({NONE, VIDEO, LIGHTBRINGER, CALL_AND_SHARE})
public @interface CallToAction {}
public static final int NONE = 0;
public static final int VIDEO = 1;
- public static final int CALL_AND_SHARE = 2;
+ public static final int LIGHTBRINGER = 2;
+ public static final int CALL_AND_SHARE = 3;
+ private final PhotoPosition mPhotoPosition = getDefaultPhotoPosition();
private static final Pattern SPLIT_PATTERN =
Pattern.compile("([\\w-\\.]+)@((?:[\\w]+\\.)+)([a-zA-Z]{2,4})|[\\w]+");
static final char SNIPPET_START_MATCH = '[';
@@ -106,7 +108,7 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
private int mNameTextViewTextSize;
private int mHeaderWidth;
private Drawable mActivatedBackgroundDrawable;
- private int mCallToActionSize = 32;
+ private int mCallToActionSize = 48;
private int mCallToActionMargin = 16;
// Set in onLayout. Represent left and right position of the View on the screen.
private int mLeftOffset;
@@ -122,10 +124,7 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
private String mHighlightedPrefix;
/** Indicates whether the view should leave room for the "video call" icon. */
private boolean mSupportVideoCall;
- /** Indicates whether the view should leave room for the "call and share" icon. */
- private boolean mSupportCallAndShare;
- private PhotoPosition mPhotoPosition = getDefaultPhotoPosition(false /* normal/non opposite */);
// Header layout data
private TextView mHeaderTextView;
private boolean mIsSectionHeaderEnabled;
@@ -139,7 +138,7 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
private TextView mSnippetView;
private TextView mStatusView;
private ImageView mPresenceIcon;
- private ImageView mCallToAction;
+ @NonNull private final ImageView mCallToActionView;
private ImageView mWorkProfileIcon;
private ColorStateList mSecondaryTextColor;
private int mDefaultPhotoViewSize = 0;
@@ -181,23 +180,14 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
private Rect mBoundsWithoutHeader = new Rect();
private CharSequence mUnknownNameText;
- public ContactListItemView(Context context) {
- super(context);
+ private String mPhoneNumber;
+ private int mPosition = -1;
+ private @CallToAction int mCallToAction = NONE;
- mTextHighlighter = new TextHighlighter(Typeface.BOLD);
- mNameHighlightSequence = new ArrayList<>();
- mNumberHighlightSequence = new ArrayList<>();
- }
-
- public ContactListItemView(
- Context context,
- AttributeSet attrs,
- boolean supportVideoCallIcon,
- boolean supportCallAndShare) {
+ public ContactListItemView(Context context, AttributeSet attrs, boolean supportVideoCallIcon) {
this(context, attrs);
mSupportVideoCall = supportVideoCallIcon;
- mSupportCallAndShare = supportCallAndShare;
}
public ContactListItemView(Context context, AttributeSet attrs) {
@@ -284,19 +274,20 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
mNameHighlightSequence = new ArrayList<>();
mNumberHighlightSequence = new ArrayList<>();
+ mCallToActionView = new ImageView(getContext());
+ mCallToActionView.setId(R.id.call_to_action);
+ mCallToActionView.setLayoutParams(new LayoutParams(mCallToActionSize, mCallToActionSize));
+ mCallToActionView.setScaleType(ScaleType.CENTER);
+ mCallToActionView.setImageTintList(
+ ContextCompat.getColorStateList(getContext(), R.color.search_video_call_icon_tint));
+ addView(mCallToActionView);
+
setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE);
}
- public static PhotoPosition getDefaultPhotoPosition(boolean opposite) {
- final Locale locale = Locale.getDefault();
- final int layoutDirection = TextUtils.getLayoutDirectionFromLocale(locale);
- switch (layoutDirection) {
- case View.LAYOUT_DIRECTION_RTL:
- return (opposite ? PhotoPosition.LEFT : PhotoPosition.RIGHT);
- case View.LAYOUT_DIRECTION_LTR:
- default:
- return (opposite ? PhotoPosition.RIGHT : PhotoPosition.LEFT);
- }
+ public static PhotoPosition getDefaultPhotoPosition() {
+ int layoutDirection = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault());
+ return layoutDirection == View.LAYOUT_DIRECTION_RTL ? PhotoPosition.RIGHT : PhotoPosition.LEFT;
}
/**
@@ -333,35 +324,48 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
* @param position The position in the adapter of the call to action.
*/
public void setCallToAction(@CallToAction int action, Listener listener, int position) {
- int drawable;
+ mCallToAction = action;
+ mPosition = position;
+
+ Drawable drawable;
int description;
OnClickListener onClickListener;
- if (action == CALL_AND_SHARE && mSupportCallAndShare) {
- drawable = R.drawable.ic_call_and_share;
- description = R.string.description_search_video_call;
+ if (action == CALL_AND_SHARE) {
+ drawable = ContextCompat.getDrawable(getContext(), R.drawable.ic_phone_attach);
+ drawable.setAutoMirrored(true);
+ description = R.string.description_search_call_and_share;
onClickListener = v -> listener.onCallAndShareIconClicked(position);
} else if (action == VIDEO && mSupportVideoCall) {
- drawable = R.drawable.ic_search_video_call;
- description = R.string.description_search_call_and_share;
+ drawable =
+ ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_videocam_vd_theme_24);
+ drawable.setAutoMirrored(true);
+ description = R.string.description_search_video_call;
onClickListener = v -> listener.onVideoCallIconClicked(position);
+ } else if (action == LIGHTBRINGER) {
+ CallIntentBuilder.increaseLightbringerCallButtonAppearInSearchCount();
+ drawable =
+ ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_videocam_vd_theme_24);
+ drawable.setAutoMirrored(true);
+ description = R.string.description_search_video_call;
+ onClickListener = v -> listener.onLightbringerIconClicked(position);
} else {
- if (mCallToAction != null) {
- mCallToAction.setVisibility(View.GONE);
- mCallToAction.setOnClickListener(null);
- }
+ mCallToActionView.setVisibility(View.GONE);
+ mCallToActionView.setOnClickListener(null);
return;
}
- if (mCallToAction == null) {
- mCallToAction = new ImageView(getContext());
- mCallToAction.setLayoutParams(new LayoutParams(mCallToActionSize, mCallToActionSize));
- mCallToAction.setScaleType(ScaleType.CENTER);
- addView(mCallToAction);
- }
- mCallToAction.setContentDescription(getContext().getString(description));
- mCallToAction.setOnClickListener(onClickListener);
- mCallToAction.setImageResource(drawable);
- mCallToAction.setVisibility(View.VISIBLE);
+ mCallToActionView.setContentDescription(getContext().getString(description));
+ mCallToActionView.setOnClickListener(onClickListener);
+ mCallToActionView.setImageDrawable(drawable);
+ mCallToActionView.setVisibility(View.VISIBLE);
+ }
+
+ public @CallToAction int getCallToAction() {
+ return mCallToAction;
+ }
+
+ public int getPosition() {
+ return mPosition;
}
/**
@@ -376,18 +380,6 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
mSupportVideoCall = supportVideoCall;
}
- /**
- * Sets whether the view supports a call and share icon. This is independent of whether the view
- * is actually showing an icon. Support for the icon ensures that the layout leaves space for it,
- * should it be shown.
- *
- * @param supportCallAndShare {@code true} if the call and share icon is supported, {@code false}
- * otherwise.
- */
- public void setSupportCallAndShareIcon(boolean supportCallAndShare) {
- mSupportCallAndShare = supportCallAndShare;
- }
-
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// We will match parent's width and wrap content vertically, but make sure
@@ -423,9 +415,7 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
effectiveWidth -= mHeaderWidth + mGapBetweenImageAndText;
}
- if (mSupportVideoCall || mSupportCallAndShare) {
- effectiveWidth -= (mCallToActionSize + mCallToActionMargin);
- }
+ effectiveWidth -= (mCallToActionSize + mCallToActionMargin);
// Go over all visible text views and measure actual width of each of them.
// Also calculate their heights to get the total height for this entire view.
@@ -496,11 +486,9 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
mStatusTextViewHeight = mPresenceIcon.getMeasuredHeight();
}
- if ((mSupportVideoCall || mSupportCallAndShare) && isVisible(mCallToAction)) {
- mCallToAction.measure(
- MeasureSpec.makeMeasureSpec(mCallToActionSize, MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(mCallToActionSize, MeasureSpec.EXACTLY));
- }
+ mCallToActionView.measure(
+ MeasureSpec.makeMeasureSpec(mCallToActionSize, MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(mCallToActionSize, MeasureSpec.EXACTLY));
if (isVisible(mWorkProfileIcon)) {
mWorkProfileIcon.measure(
@@ -629,34 +617,30 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
leftBound += mTextIndent;
}
- if (mSupportVideoCall || mSupportCallAndShare) {
- // Place the call to action at the end of the list (e.g. take into account RTL mode).
- if (isVisible(mCallToAction)) {
- // Center the icon vertically
- final int callToActionTop = topBound + (height - topBound - mCallToActionSize) / 2;
+ // Place the call to action at the end of the list (e.g. take into account RTL mode).
+ // Center the icon vertically
+ final int callToActionTop = topBound + (height - topBound - mCallToActionSize) / 2;
- if (!isLayoutRtl) {
- // When photo is on left, icon is placed on the right edge.
- mCallToAction.layout(
- rightBound - mCallToActionSize,
- callToActionTop,
- rightBound,
- callToActionTop + mCallToActionSize);
- } else {
- // When photo is on right, icon is placed on the left edge.
- mCallToAction.layout(
- leftBound,
- callToActionTop,
- leftBound + mCallToActionSize,
- callToActionTop + mCallToActionSize);
- }
- }
+ if (!isLayoutRtl) {
+ // When photo is on left, icon is placed on the right edge.
+ mCallToActionView.layout(
+ rightBound - mCallToActionSize,
+ callToActionTop,
+ rightBound,
+ callToActionTop + mCallToActionSize);
+ } else {
+ // When photo is on right, icon is placed on the left edge.
+ mCallToActionView.layout(
+ leftBound,
+ callToActionTop,
+ leftBound + mCallToActionSize,
+ callToActionTop + mCallToActionSize);
+ }
- if (mPhotoPosition == PhotoPosition.LEFT) {
- rightBound -= (mCallToActionSize + mCallToActionMargin);
- } else {
- leftBound += mCallToActionSize + mCallToActionMargin;
- }
+ if (mPhotoPosition == PhotoPosition.LEFT) {
+ rightBound -= (mCallToActionSize + mCallToActionMargin);
+ } else {
+ leftBound += mCallToActionSize + mCallToActionMargin;
}
// Center text vertically, then apply the top offset.
@@ -901,9 +885,7 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
}
if (mQuickContact == null) {
mQuickContact = new QuickContactBadge(getContext());
- if (CompatUtils.isLollipopCompatible()) {
- mQuickContact.setOverlay(null);
- }
+ mQuickContact.setOverlay(null);
mQuickContact.setLayoutParams(getDefaultPhotoLayoutParams());
if (mNameTextView != null) {
mQuickContact.setContentDescription(
@@ -1008,9 +990,7 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
mNameTextView.setGravity(Gravity.CENTER_VERTICAL);
mNameTextView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
mNameTextView.setId(R.id.cliv_name_textview);
- if (CompatUtils.isLollipopCompatible()) {
- mNameTextView.setElegantTextHeight(false);
- }
+ mNameTextView.setElegantTextHeight(false);
addView(mNameTextView);
}
return mNameTextView;
@@ -1056,6 +1036,7 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
* exists.
*/
public void setPhoneNumber(String text) {
+ mPhoneNumber = text;
if (text == null) {
if (mDataView != null) {
mDataView.setVisibility(View.GONE);
@@ -1086,6 +1067,10 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
}
}
+ public String getPhoneNumber() {
+ return mPhoneNumber;
+ }
+
private void setMarqueeText(TextView textView, CharSequence text) {
if (getTextEllipsis() == TruncateAt.MARQUEE) {
// To show MARQUEE correctly (with END effect during non-active state), we need
@@ -1109,9 +1094,7 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
mDataView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
mDataView.setActivated(isActivated());
mDataView.setId(R.id.cliv_data_view);
- if (CompatUtils.isLollipopCompatible()) {
- mDataView.setElegantTextHeight(false);
- }
+ mDataView.setElegantTextHeight(false);
addView(mDataView);
}
return mDataView;
@@ -1469,28 +1452,17 @@ public class ContactListItemView extends ViewGroup implements SelectionBoundsAdj
forceLayout();
}
- public void setPhotoPosition(PhotoPosition photoPosition) {
- mPhotoPosition = photoPosition;
- }
-
/**
* Set drawable resources directly for the drawable resource of the photo view.
*
- * @param drawableId Id of drawable resource.
+ * @param drawable A drawable resource.
*/
- public void setDrawableResource(int drawableId) {
+ public void setDrawable(Drawable drawable) {
ImageView photo = getPhotoView();
photo.setScaleType(ImageView.ScaleType.CENTER);
- final Drawable drawable = ContextCompat.getDrawable(getContext(), drawableId);
- final int iconColor = ContextCompat.getColor(getContext(), R.color.search_shortcut_icon_color);
- if (CompatUtils.isLollipopCompatible()) {
- photo.setImageDrawable(drawable);
- photo.setImageTintList(ColorStateList.valueOf(iconColor));
- } else {
- final Drawable drawableWrapper = DrawableCompat.wrap(drawable).mutate();
- DrawableCompat.setTint(drawableWrapper, iconColor);
- photo.setImageDrawable(drawableWrapper);
- }
+ int iconColor = ContextCompat.getColor(getContext(), R.color.search_shortcut_icon_color);
+ photo.setImageDrawable(drawable);
+ photo.setImageTintList(ColorStateList.valueOf(iconColor));
}
@Override
diff --git a/java/com/android/contacts/common/list/ContactTileView.java b/java/com/android/contacts/common/list/ContactTileView.java
index 9273b0583..cfd52f385 100644
--- a/java/com/android/contacts/common/list/ContactTileView.java
+++ b/java/com/android/contacts/common/list/ContactTileView.java
@@ -19,15 +19,17 @@ import android.content.Context;
import android.graphics.Rect;
import android.net.Uri;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
-import com.android.contacts.common.ContactPhotoManager;
-import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.MoreContactUtils;
import com.android.contacts.common.R;
+import com.android.dialer.callintent.CallInitiationType;
+import com.android.dialer.callintent.CallSpecificAppData;
+import com.android.dialer.common.LogUtil;
+import com.android.dialer.contactphoto.ContactPhotoManager;
+import com.android.dialer.contactphoto.ContactPhotoManager.DefaultImageRequest;
/** A ContactTile displays a contact's picture and name */
public abstract class ContactTileView extends FrameLayout {
@@ -60,8 +62,15 @@ public abstract class ContactTileView extends FrameLayout {
if (mListener == null) {
return;
}
+ CallSpecificAppData callSpecificAppData =
+ CallSpecificAppData.newBuilder()
+ .setCallInitiationType(CallInitiationType.Type.SPEED_DIAL)
+ .setAllowAssistedDialing(true)
+ .build();
mListener.onContactSelected(
- getLookupUri(), MoreContactUtils.getTargetRectFromView(ContactTileView.this));
+ getLookupUri(),
+ MoreContactUtils.getTargetRectFromView(ContactTileView.this),
+ callSpecificAppData);
}
};
}
@@ -97,7 +106,7 @@ public abstract class ContactTileView extends FrameLayout {
}
} else {
- Log.w(TAG, "contactPhotoManager not set");
+ LogUtil.w(TAG, "contactPhotoManager not set");
}
} else {
setVisibility(View.INVISIBLE);
@@ -163,9 +172,10 @@ public abstract class ContactTileView extends FrameLayout {
public interface Listener {
/** Notification that the contact was selected; no specific action is dictated. */
- void onContactSelected(Uri contactLookupUri, Rect viewRect);
+ void onContactSelected(
+ Uri contactLookupUri, Rect viewRect, CallSpecificAppData callSpecificAppData);
/** Notification that the specified number is to be called. */
- void onCallNumberDirectly(String phoneNumber);
+ void onCallNumberDirectly(String phoneNumber, CallSpecificAppData callSpecificAppData);
}
}
diff --git a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
index 9a490d78a..71d9dad5f 100644
--- a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
+++ b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
@@ -27,11 +27,10 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.SipAddress;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Directory;
+import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
-import com.android.contacts.common.ContactPhotoManager;
-import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.ContactsUtils;
import com.android.contacts.common.R;
import com.android.contacts.common.compat.CallableCompat;
@@ -41,13 +40,16 @@ import com.android.contacts.common.extensions.PhoneDirectoryExtenderAccessor;
import com.android.contacts.common.list.ContactListItemView.CallToAction;
import com.android.contacts.common.preference.ContactsPreferences;
import com.android.contacts.common.util.Constants;
-import com.android.dialer.callcomposer.CallComposerContact;
import com.android.dialer.common.LogUtil;
import com.android.dialer.compat.CompatUtils;
+import com.android.dialer.contactphoto.ContactPhotoManager.DefaultImageRequest;
+import com.android.dialer.dialercontact.DialerContact;
import com.android.dialer.enrichedcall.EnrichedCallCapabilities;
import com.android.dialer.enrichedcall.EnrichedCallComponent;
import com.android.dialer.enrichedcall.EnrichedCallManager;
-import com.android.dialer.location.GeoUtil;
+import com.android.dialer.lettertile.LetterTileDrawable;
+import com.android.dialer.lightbringer.LightbringerComponent;
+import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.util.CallUtil;
import java.util.ArrayList;
import java.util.Arrays;
@@ -68,16 +70,14 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
// A list of extended directories to add to the directories from the database
private final List<DirectoryPartition> mExtendedDirectories;
private final CharSequence mUnknownNameText;
- private final boolean mCallAndShareEnabled;
+ protected final boolean mIsImsVideoEnabled;
+
// Extended directories will have ID's that are higher than any of the id's from the database,
// so that we can identify them and set them up properly. If no extended directories
// exist, this will be Long.MAX_VALUE
private long mFirstExtendedDirectoryId = Long.MAX_VALUE;
- private ContactListItemView.PhotoPosition mPhotoPosition;
private boolean mUseCallableUri;
private Listener mListener;
- private boolean mIsVideoEnabled;
- private boolean mIsPresenceEnabled;
public PhoneNumberListAdapter(Context context) {
super(context);
@@ -88,11 +88,9 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
PhoneDirectoryExtenderAccessor.get(mContext).getExtendedDirectories(mContext);
int videoCapabilities = CallUtil.getVideoCallingAvailability(context);
- mIsVideoEnabled = (videoCapabilities & CallUtil.VIDEO_CALLING_ENABLED) != 0;
- mIsPresenceEnabled = (videoCapabilities & CallUtil.VIDEO_CALLING_PRESENCE) != 0;
-
- // TODO
- mCallAndShareEnabled = true;
+ mIsImsVideoEnabled =
+ CallUtil.isVideoEnabled(context)
+ && (videoCapabilities & CallUtil.VIDEO_CALLING_PRESENCE) != 0;
}
@Override
@@ -249,10 +247,10 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
return item != null ? item.getString(PhoneQuery.LOOKUP_KEY) : null;
}
- public CallComposerContact getCallComposerContact(int position) {
+ public DialerContact getDialerContact(int position) {
Cursor cursor = (Cursor) getItem(position);
if (cursor == null) {
- LogUtil.e("PhoneNumberListAdapter.getCallComposerContact", "cursor was null.");
+ LogUtil.e("PhoneNumberListAdapter.getDialerContact", "cursor was null.");
return null;
}
@@ -263,11 +261,11 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
Contacts.getLookupUri(
cursor.getLong(PhoneQuery.CONTACT_ID), cursor.getString(PhoneQuery.LOOKUP_KEY));
- CallComposerContact.Builder contact = CallComposerContact.newBuilder();
+ DialerContact.Builder contact = DialerContact.newBuilder();
contact
.setNumber(number)
.setPhotoId(cursor.getLong(PhoneQuery.PHOTO_ID))
- .setContactType(ContactPhotoManager.TYPE_DEFAULT)
+ .setContactType(LetterTileDrawable.TYPE_DEFAULT)
.setNameOrNumber(displayName)
.setNumberLabel(
Phone.getTypeLabel(
@@ -297,7 +295,6 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
ContactListItemView view = super.newView(context, partition, cursor, position, parent);
view.setUnknownNameText(mUnknownNameText);
view.setQuickContactEnabled(isQuickContactEnabled());
- view.setPhotoPosition(mPhotoPosition);
return view;
}
@@ -355,19 +352,14 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
}
final DirectoryPartition directory = (DirectoryPartition) getPartition(partition);
-
- // If the first partition does not have a header, then all subsequent partitions'
- // getPositionForPartition returns an index off by 1.
- int partitionOffset = 0;
- if (partition > 0 && !getPartition(0).getHasHeader()) {
- partitionOffset = 1;
- }
- position += getPositionForPartition(partition) + partitionOffset;
+ // All sections have headers, so scroll position is off by 1.
+ position += getPositionForPartition(partition) + 1;
bindPhoneNumber(view, cursor, directory.isDisplayNumber(), position);
}
- protected void bindPhoneNumber(
+ @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+ public void bindPhoneNumber(
ContactListItemView view, Cursor cursor, boolean displayNumber, int position) {
CharSequence label = null;
if (displayNumber && !cursor.isNull(PhoneQuery.PHONE_TYPE)) {
@@ -389,7 +381,7 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
text = phoneLabel;
} else {
final String phoneNumber = cursor.getString(PhoneQuery.PHONE_NUMBER);
- text = GeoUtil.getGeocodedLocationFor(mContext, phoneNumber);
+ text = PhoneNumberHelper.getGeoDescription(mContext, phoneNumber);
}
}
view.setPhoneNumber(text);
@@ -401,16 +393,21 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
int carrierPresence = cursor.getInt(PhoneQuery.CARRIER_PRESENCE);
boolean isPresent = (carrierPresence & Phone.CARRIER_PRESENCE_VT_CAPABLE) != 0;
- boolean isVideoIconShown = mIsVideoEnabled && (!mIsPresenceEnabled || isPresent);
- if (isVideoIconShown) {
+ boolean showViewIcon = mIsImsVideoEnabled && isPresent;
+ if (showViewIcon) {
action = ContactListItemView.VIDEO;
}
}
- if (isCallAndShareEnabled() && action == ContactListItemView.NONE && number != null) {
+ if (action == ContactListItemView.NONE
+ && LightbringerComponent.get(mContext).getLightbringer().isReachable(mContext, number)) {
+ action = ContactListItemView.LIGHTBRINGER;
+ }
+
+ if (action == ContactListItemView.NONE) {
EnrichedCallManager manager = EnrichedCallComponent.get(mContext).getEnrichedCallManager();
EnrichedCallCapabilities capabilities = manager.getCapabilities(number);
- if (capabilities != null && capabilities.supportsCallComposer()) {
+ if (capabilities != null && capabilities.isCallComposerCapable()) {
action = ContactListItemView.CALL_AND_SHARE;
} else if (capabilities == null
&& getQueryString() != null
@@ -481,14 +478,6 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
}
}
- public ContactListItemView.PhotoPosition getPhotoPosition() {
- return mPhotoPosition;
- }
-
- public void setPhotoPosition(ContactListItemView.PhotoPosition photoPosition) {
- mPhotoPosition = photoPosition;
- }
-
public void setUseCallableUri(boolean useCallableUri) {
mUseCallableUri = useCallableUri;
}
@@ -570,14 +559,12 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
mListener = listener;
}
- public boolean isCallAndShareEnabled() {
- return mCallAndShareEnabled;
- }
-
public interface Listener {
void onVideoCallIconClicked(int position);
+ void onLightbringerIconClicked(int position);
+
void onCallAndShareIconClicked(int position);
}
@@ -642,18 +629,14 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
static {
final List<String> projectionList =
new ArrayList<>(Arrays.asList(PROJECTION_PRIMARY_INTERNAL));
- if (CompatUtils.isMarshmallowCompatible()) {
- projectionList.add(Phone.CARRIER_PRESENCE); // 9
- }
+ projectionList.add(Phone.CARRIER_PRESENCE); // 9
PROJECTION_PRIMARY = projectionList.toArray(new String[projectionList.size()]);
}
static {
final List<String> projectionList =
new ArrayList<>(Arrays.asList(PROJECTION_ALTERNATIVE_INTERNAL));
- if (CompatUtils.isMarshmallowCompatible()) {
- projectionList.add(Phone.CARRIER_PRESENCE); // 9
- }
+ projectionList.add(Phone.CARRIER_PRESENCE); // 9
PROJECTION_ALTERNATIVE = projectionList.toArray(new String[projectionList.size()]);
}
}
diff --git a/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java b/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java
index 8f25f82a5..d704e5492 100644
--- a/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java
+++ b/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java
@@ -29,16 +29,20 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.android.contacts.common.R;
+import com.android.contacts.common.list.PhoneNumberListAdapter.Listener;
import com.android.contacts.common.util.AccountFilterUtil;
-import com.android.dialer.callcomposer.CallComposerContact;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallInitiationType.Type;
import com.android.dialer.callintent.CallSpecificAppData;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+import com.android.dialer.dialercontact.DialerContact;
import com.android.dialer.enrichedcall.EnrichedCallComponent;
import com.android.dialer.enrichedcall.EnrichedCallManager;
+import com.android.dialer.lightbringer.LightbringerComponent;
+import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
+import com.android.dialer.performancereport.PerformanceReport;
import com.android.dialer.protos.ProtoParsers;
import java.util.Set;
import org.json.JSONException;
@@ -61,9 +65,6 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
private boolean mUseCallableUri;
- private ContactListItemView.PhotoPosition mPhotoPosition =
- ContactListItemView.getDefaultPhotoPosition(false /* normal/non opposite */);
-
private final Set<OnLoadFinishedListener> mLoadFinishedListeners = new ArraySet<>();
private CursorReranker mCursorReranker;
@@ -71,7 +72,7 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
public PhoneNumberPickerFragment() {
setQuickContactEnabled(false);
setPhotoLoaderEnabled(true);
- setSectionHeaderDisplayEnabled(true);
+ setSectionHeaderDisplayEnabled(false);
setDirectorySearchMode(DirectoryListLoader.SEARCH_MODE_NONE);
// Show nothing instead of letting caller Activity show something.
@@ -85,17 +86,33 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
*/
@Override
public void onVideoCallIconClicked(int position) {
+ Logger.get(getContext()).logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_SEARCH);
callNumber(position, true /* isVideoCall */);
}
@Override
+ public void onLightbringerIconClicked(int position) {
+ PerformanceReport.stopRecording();
+ String phoneNumber = getPhoneNumber(position);
+ Intent intent =
+ LightbringerComponent.get(getContext())
+ .getLightbringer()
+ .getIntent(getContext(), phoneNumber);
+ // DialtactsActivity.ACTIVITY_REQUEST_CODE_LIGHTBRINGER
+ // Cannot reference because of cyclic dependencies
+ Logger.get(getContext())
+ .logImpression(DialerImpression.Type.LIGHTBRINGER_VIDEO_REQUESTED_FROM_SEARCH);
+ int dialactsActivityRequestCode = 3;
+ getActivity().startActivityForResult(intent, dialactsActivityRequestCode);
+ }
+
+ @Override
public void onCallAndShareIconClicked(int position) {
// Required because of cyclic dependencies of everything depending on contacts/common.
String componentName = "com.android.dialer.callcomposer.CallComposerActivity";
Intent intent = new Intent();
intent.setComponent(new ComponentName(getContext(), componentName));
- CallComposerContact contact =
- ((PhoneNumberListAdapter) getAdapter()).getCallComposerContact(position);
+ DialerContact contact = ((PhoneNumberListAdapter) getAdapter()).getDialerContact(position);
ProtoParsers.put(intent, "CALL_COMPOSER_CONTACT", contact);
startActivity(intent);
}
@@ -218,6 +235,7 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
cacheContactInfo(position);
CallSpecificAppData callSpecificAppData =
CallSpecificAppData.newBuilder()
+ .setAllowAssistedDialing(true)
.setCallInitiationType(getCallInitiationType(true /* isRemoteDirectory */))
.setPositionOfSelectedSearchResult(position)
.setCharactersInSearchString(getQueryString() == null ? 0 : getQueryString().length())
@@ -261,13 +279,13 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
@MainThread
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
Assert.isMainThread();
- // TODO: define and verify behavior for "Nearby places", corp directories,
+ // TODO(strongarm): define and verify behavior for "Nearby places", corp directories,
// and dividers listed in UI between these categories
if (mCursorReranker != null
&& data != null
&& !data.isClosed()
&& data.getCount() > 0
- && loader.getId() != -1) { // skip invalid directory ID of -1
+ && loader.getId() == 0) { // only re-rank if a suggestions loader with id of 0.
data = mCursorReranker.rerankCursor(data);
}
super.onLoadFinished(loader, data);
@@ -320,7 +338,27 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
@Override
public void onCapabilitiesUpdated() {
if (getAdapter() != null) {
- getAdapter().notifyDataSetChanged();
+ EnrichedCallManager manager =
+ EnrichedCallComponent.get(getContext()).getEnrichedCallManager();
+ Listener listener = ((PhoneNumberListAdapter) getAdapter()).getListener();
+
+ for (int i = 0; i < getListView().getChildCount(); i++) {
+ if (!(getListView().getChildAt(i) instanceof ContactListItemView)) {
+ continue;
+ }
+
+ // Since call and share is the lowest priority call to action, if any others are set,
+ // do not reset the call to action. Also do not set the call and share call to action if
+ // the number doesn't support call composer.
+ ContactListItemView view = (ContactListItemView) getListView().getChildAt(i);
+ if (view.getCallToAction() != ContactListItemView.NONE
+ || view.getPhoneNumber() == null
+ || manager.getCapabilities(view.getPhoneNumber()) == null
+ || !manager.getCapabilities(view.getPhoneNumber()).isCallComposerCapable()) {
+ continue;
+ }
+ view.setCallToAction(ContactListItemView.CALL_AND_SHARE, listener, view.getPosition());
+ }
}
}
@@ -360,12 +398,6 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
if (!isSearchMode() && mFilter != null) {
adapter.setFilter(mFilter);
}
-
- setPhotoPosition(adapter);
- }
-
- protected void setPhotoPosition(ContactEntryListAdapter adapter) {
- ((PhoneNumberListAdapter) adapter).setPhotoPosition(mPhotoPosition);
}
@Override
@@ -389,15 +421,6 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE
updateFilterHeaderView();
}
- public void setPhotoPosition(ContactListItemView.PhotoPosition photoPosition) {
- mPhotoPosition = photoPosition;
-
- final PhoneNumberListAdapter adapter = (PhoneNumberListAdapter) getAdapter();
- if (adapter != null) {
- adapter.setPhotoPosition(photoPosition);
- }
- }
-
/**
* @param isRemoteDirectory {@code true} if the call was initiated using a contact/phone number
* not in the local contacts database
diff --git a/java/com/android/contacts/common/list/ViewPagerTabs.java b/java/com/android/contacts/common/list/ViewPagerTabs.java
index 34f623ef4..1e6cf1354 100644
--- a/java/com/android/contacts/common/list/ViewPagerTabs.java
+++ b/java/com/android/contacts/common/list/ViewPagerTabs.java
@@ -33,7 +33,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.contacts.common.R;
-import com.android.dialer.compat.CompatUtils;
/**
* Lightweight implementation of ViewPager tabs. This looks similar to traditional actionBar tabs,
@@ -43,7 +42,13 @@ import com.android.dialer.compat.CompatUtils;
*/
public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnPageChangeListener {
- private static final ViewOutlineProvider VIEW_BOUNDS_OUTLINE_PROVIDER;
+ private static final ViewOutlineProvider VIEW_BOUNDS_OUTLINE_PROVIDER =
+ new ViewOutlineProvider() {
+ @Override
+ public void getOutline(View view, Outline outline) {
+ outline.setRect(0, 0, view.getWidth(), view.getHeight());
+ }
+ };
private static final int TAB_SIDE_PADDING_IN_DPS = 10;
// TODO: This should use <declare-styleable> in the future
private static final int[] ATTRS =
@@ -54,20 +59,6 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
android.R.attr.textAllCaps
};
- static {
- if (CompatUtils.isLollipopCompatible()) {
- VIEW_BOUNDS_OUTLINE_PROVIDER =
- new ViewOutlineProvider() {
- @Override
- public void getOutline(View view, Outline outline) {
- outline.setRect(0, 0, view.getWidth(), view.getHeight());
- }
- };
- } else {
- VIEW_BOUNDS_OUTLINE_PROVIDER = null;
- }
- }
-
/**
* Linearlayout that will contain the TextViews serving as tabs. This is the only child of the
* parent HorizontalScrollView.
@@ -111,10 +102,8 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
a.recycle();
- if (CompatUtils.isLollipopCompatible()) {
- // enable shadow casting from view bounds
- setOutlineProvider(VIEW_BOUNDS_OUTLINE_PROVIDER);
- }
+ // enable shadow casting from view bounds
+ setOutlineProvider(VIEW_BOUNDS_OUTLINE_PROVIDER);
}
public void setViewPager(ViewPager viewPager) {