Loading src/com/android/dialer/CallDetailActivity.java +5 −6 Original line number Diff line number Diff line Loading @@ -57,9 +57,9 @@ import com.android.dialer.calllog.ContactInfo; import com.android.dialer.calllog.ContactInfoHelper; import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.calllog.PhoneNumberDisplayUtil; import com.android.dialer.calllog.PhoneNumberUtilsWrapper; import com.android.dialer.util.IntentUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.util.TelecomUtil; import java.util.List; Loading Loading @@ -116,11 +116,10 @@ public class CallDetailActivity extends Activity // Cache the details about the phone number. final boolean canPlaceCallsTo = PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation); final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper(mContext); PhoneNumberUtil.canPlaceCallsTo(mNumber, numberPresentation); mIsVoicemailNumber = phoneUtils.isVoicemailNumber(accountHandle, mNumber); final boolean isSipNumber = PhoneNumberUtilsWrapper.isSipNumber(mNumber); PhoneNumberUtil.isVoicemailNumber(mContext, accountHandle, mNumber); final boolean isSipNumber = PhoneNumberUtil.isSipNumber(mNumber); final CharSequence callLocationOrType = getNumberTypeOrLocation(firstDetails); Loading src/com/android/dialer/calllog/CallLogAdapter.java +16 −14 Original line number Diff line number Diff line Loading @@ -42,10 +42,10 @@ import android.view.accessibility.AccessibilityEvent; import com.android.contacts.common.util.PermissionsUtil; import com.android.dialer.PhoneCallDetails; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.R; import com.android.dialer.contactinfo.ContactInfoCache; import com.android.dialer.contactinfo.ContactInfoCache.OnContactInfoChangedListener; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.voicemail.VoicemailPlaybackPresenter; import com.google.common.annotations.VisibleForTesting; Loading Loading @@ -123,10 +123,11 @@ public class CallLogAdapter extends GroupingListAdapter private boolean mShowPromoCard = false; /** Instance of helper class for managing views. */ private final CallLogListItemHelper mCallLogViewsHelper; private final CallLogListItemHelper mCallLogListItemHelper; /** Cache for repeated requests to TelecomManager. */ protected final TelecomCallLogCache mTelecomCallLogCache; /** Helper to access Telephony phone number utils class */ protected final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper; /** Helper to group call log entries. */ private final CallLogGroupBuilder mCallLogGroupBuilder; Loading Loading @@ -256,10 +257,11 @@ public class CallLogAdapter extends GroupingListAdapter Resources resources = mContext.getResources(); CallTypeHelper callTypeHelper = new CallTypeHelper(resources); mPhoneNumberUtilsWrapper = new PhoneNumberUtilsWrapper(mContext); mTelecomCallLogCache = new TelecomCallLogCache(mContext); PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper(mContext, resources, mPhoneNumberUtilsWrapper); mCallLogViewsHelper = new CallLogListItemHelper(phoneCallDetailsHelper, resources); new PhoneCallDetailsHelper(mContext, resources, mTelecomCallLogCache); mCallLogListItemHelper = new CallLogListItemHelper(phoneCallDetailsHelper, resources, mTelecomCallLogCache); mCallLogGroupBuilder = new CallLogGroupBuilder(this); mPrefs = PreferenceManager.getDefaultSharedPreferences(context); maybeShowVoicemailPromoCard(); Loading Loading @@ -329,6 +331,7 @@ public class CallLogAdapter extends GroupingListAdapter public void pauseCache() { mContactInfoCache.stop(); mTelecomCallLogCache.reset(); } @Override Loading Loading @@ -359,8 +362,8 @@ public class CallLogAdapter extends GroupingListAdapter view, mContext, mExpandCollapseListener, mPhoneNumberUtilsWrapper, mCallLogViewsHelper, mTelecomCallLogCache, mCallLogListItemHelper, mVoicemailPlaybackPresenter); viewHolder.callLogEntryView.setTag(viewHolder); Loading Loading @@ -432,14 +435,13 @@ public class CallLogAdapter extends GroupingListAdapter final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO); final ContactInfo cachedContactInfo = mContactInfoHelper.getContactInfo(c); final boolean isVoicemailNumber = mPhoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number); mTelecomCallLogCache.isVoicemailNumber(accountHandle, number); // Note: Binding of the action buttons is done as required in configureActionViews when the // user expands the actions ViewStub. ContactInfo info = ContactInfo.EMPTY; if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation) && !isVoicemailNumber) { if (PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation) && !isVoicemailNumber) { // Lookup contacts with this number info = mContactInfoCache.getValue(number, countryIso, cachedContactInfo); } Loading Loading @@ -499,7 +501,7 @@ public class CallLogAdapter extends GroupingListAdapter views.dayGroupHeader.setVisibility(View.GONE); } mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details); mCallLogListItemHelper.setPhoneCallDetails(views, details); if (mCurrentlyExpandedRowId == views.rowId) { // In case ViewHolders were added/removed, update the expanded position if the rowIds Loading @@ -522,7 +524,7 @@ public class CallLogAdapter extends GroupingListAdapter views.setPhoto(info.photoId, info.photoUri, info.lookupUri, nameForDefaultImage, isVoicemailNumber, mContactInfoHelper.isBusiness(info.sourceType)); mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details); mCallLogListItemHelper.setPhoneCallDetails(views, details); // Listen for the first draw if (mViewTreeObserver == null) { Loading src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java +3 −5 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.contacts.common.GeoUtil; import com.android.dialer.PhoneCallDetails; import com.android.dialer.util.AsyncTaskExecutor; import com.android.dialer.util.AsyncTaskExecutors; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.util.TelecomUtil; import com.google.common.annotations.VisibleForTesting; Loading Loading @@ -151,12 +152,9 @@ public class CallLogAsyncTaskUtil { // If this is not a regular number, there is no point in looking it up in the contacts. ContactInfoHelper contactInfoHelper = new ContactInfoHelper(context, GeoUtil.getCurrentCountryIso(context)); PhoneNumberUtilsWrapper phoneNumberUtilsWrapper = new PhoneNumberUtilsWrapper(context); boolean isVoicemail = phoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number); boolean isVoicemail = PhoneNumberUtil.isVoicemailNumber(context, accountHandle, number); boolean shouldLookupNumber = PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation) && !isVoicemail; PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation) && !isVoicemail; ContactInfo info = shouldLookupNumber ? contactInfoHelper.lookupNumber(number, countryIso) : ContactInfo.EMPTY; Loading src/com/android/dialer/calllog/CallLogListItemHelper.java +10 −6 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.text.TextUtils; import android.util.Log; import com.android.dialer.PhoneCallDetails; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.R; /** Loading @@ -37,6 +36,7 @@ import com.android.dialer.R; private final PhoneCallDetailsHelper mPhoneCallDetailsHelper; /** Resources to look up strings. */ private final Resources mResources; private final TelecomCallLogCache mTelecomCallLogCache; /** * Creates a new helper instance. Loading @@ -45,9 +45,12 @@ import com.android.dialer.R; * @param phoneNumberHelper used to process phone number */ public CallLogListItemHelper( PhoneCallDetailsHelper phoneCallDetailsHelper, Resources resources) { PhoneCallDetailsHelper phoneCallDetailsHelper, Resources resources, TelecomCallLogCache telecomCallLogCache) { mPhoneCallDetailsHelper = phoneCallDetailsHelper; mResources = resources; mTelecomCallLogCache = telecomCallLogCache; } /** Loading @@ -58,14 +61,15 @@ import com.android.dialer.R; * @param details the details of a phone call needed to fill in the data */ public void setPhoneCallDetails( Context context, CallLogListItemViewHolder views, PhoneCallDetails details) { CallLogListItemViewHolder views, PhoneCallDetails details) { mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details); // Set the accessibility text for the contact badge views.quickContactView.setContentDescription(getContactBadgeDescription(details)); // Set the primary action accessibility description views.primaryActionView.setContentDescription(getCallDescription(context, details)); views.primaryActionView.setContentDescription(getCallDescription(details)); // Cache name or number of caller. Used when setting the content descriptions of buttons // when the actions ViewStub is inflated. Loading Loading @@ -151,7 +155,7 @@ import com.android.dialer.R; * @param details Details of call. * @return Return call action description. */ public CharSequence getCallDescription(Context context, PhoneCallDetails details) { public CharSequence getCallDescription(PhoneCallDetails details) { int lastCallType = getLastCallType(details.callTypes); boolean isVoiceMail = lastCallType == Calls.VOICEMAIL_TYPE; Loading Loading @@ -183,7 +187,7 @@ import com.android.dialer.R; } int stringID = getCallDescriptionStringID(details.callTypes); String accountLabel = PhoneAccountUtils.getAccountLabel(context, details.accountHandle); String accountLabel = mTelecomCallLogCache.getAccountLabel(details.accountHandle); // Use chosen string resource to build up the message. CharSequence onAccountLabel = accountLabel == null Loading src/com/android/dialer/calllog/CallLogListItemViewHolder.java +14 −16 Original line number Diff line number Diff line Loading @@ -39,11 +39,10 @@ import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.testing.NeededForTesting; import com.android.contacts.common.util.UriUtils; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.PhoneCallDetailsViews; import com.android.dialer.R; import com.android.dialer.calllog.CallLogAsyncTaskUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.voicemail.VoicemailPlaybackPresenter; import com.android.dialer.voicemail.VoicemailPlaybackLayout; Loading Loading @@ -139,7 +138,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder private static final int VOICEMAIL_TRANSCRIPTION_MAX_LINES = 10; private final Context mContext; private final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper; private final TelecomCallLogCache mTelecomCallLogCache; private final CallLogListItemHelper mCallLogListItemHelper; private final VoicemailPlaybackPresenter mVoicemailPlaybackPresenter; Loading @@ -151,7 +150,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder private CallLogListItemViewHolder( Context context, View.OnClickListener expandCollapseListener, PhoneNumberUtilsWrapper phoneNumberUtilsWrapper, TelecomCallLogCache telecomCallLogCache, CallLogListItemHelper callLogListItemHelper, VoicemailPlaybackPresenter voicemailPlaybackPresenter, View rootView, Loading @@ -165,7 +164,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder mContext = context; mExpandCollapseListener = expandCollapseListener; mPhoneNumberUtilsWrapper = phoneNumberUtilsWrapper; mTelecomCallLogCache = telecomCallLogCache; mCallLogListItemHelper = callLogListItemHelper; mVoicemailPlaybackPresenter = voicemailPlaybackPresenter; Loading Loading @@ -194,14 +193,14 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder View view, Context context, View.OnClickListener expandCollapseListener, PhoneNumberUtilsWrapper phoneNumberUtilsWrapper, TelecomCallLogCache telecomCallLogCache, CallLogListItemHelper callLogListItemHelper, VoicemailPlaybackPresenter voicemailPlaybackPresenter) { return new CallLogListItemViewHolder( context, expandCollapseListener, phoneNumberUtilsWrapper, telecomCallLogCache, callLogListItemHelper, voicemailPlaybackPresenter, view, Loading Loading @@ -263,11 +262,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } else { // Treat as normal list item; show call button, if possible. boolean canPlaceCallToNumber = PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation); PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation); if (canPlaceCallToNumber) { boolean isVoicemailNumber = mPhoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number); mTelecomCallLogCache.isVoicemailNumber(accountHandle, number); if (isVoicemailNumber) { // Call to generic voicemail number, in case there are multiple accounts. primaryActionButtonView.setTag( Loading @@ -294,8 +293,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder * buttons. */ private void bindActionButtons() { boolean canPlaceCallToNumber = PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation); boolean canPlaceCallToNumber = PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation); if (!TextUtils.isEmpty(voicemailUri) && canPlaceCallToNumber) { callButtonView.setTag(IntentProvider.getReturnCallIntentProvider(number)); Loading @@ -309,7 +307,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } // If one of the calls had video capabilities, show the video call button. if (CallUtil.isVideoEnabled(mContext) && canPlaceCallToNumber && if (mTelecomCallLogCache.isVideoEnabled() && canPlaceCallToNumber && phoneCallDetailsViews.callTypeIcons.isVideoShown()) { videoCallButtonView.setTag(IntentProvider.getReturnVideoCallIntentProvider(number)); videoCallButtonView.setVisibility(View.VISIBLE); Loading Loading @@ -440,15 +438,15 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder @NeededForTesting public static CallLogListItemViewHolder createForTest(Context context) { Resources resources = context.getResources(); PhoneNumberUtilsWrapper phoneNumberUtilsWrapper = new PhoneNumberUtilsWrapper(context); TelecomCallLogCache telecomCallLogCache = new TelecomCallLogCache(context); PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper( context, resources, phoneNumberUtilsWrapper); context, resources, telecomCallLogCache); CallLogListItemViewHolder viewHolder = new CallLogListItemViewHolder( context, null /* expandCollapseListener */, phoneNumberUtilsWrapper, new CallLogListItemHelper(phoneCallDetailsHelper, resources), telecomCallLogCache, new CallLogListItemHelper(phoneCallDetailsHelper, resources, telecomCallLogCache), null /* voicemailPlaybackPresenter */, new View(context), new QuickContactBadge(context), Loading Loading
src/com/android/dialer/CallDetailActivity.java +5 −6 Original line number Diff line number Diff line Loading @@ -57,9 +57,9 @@ import com.android.dialer.calllog.ContactInfo; import com.android.dialer.calllog.ContactInfoHelper; import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.calllog.PhoneNumberDisplayUtil; import com.android.dialer.calllog.PhoneNumberUtilsWrapper; import com.android.dialer.util.IntentUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.util.TelecomUtil; import java.util.List; Loading Loading @@ -116,11 +116,10 @@ public class CallDetailActivity extends Activity // Cache the details about the phone number. final boolean canPlaceCallsTo = PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation); final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper(mContext); PhoneNumberUtil.canPlaceCallsTo(mNumber, numberPresentation); mIsVoicemailNumber = phoneUtils.isVoicemailNumber(accountHandle, mNumber); final boolean isSipNumber = PhoneNumberUtilsWrapper.isSipNumber(mNumber); PhoneNumberUtil.isVoicemailNumber(mContext, accountHandle, mNumber); final boolean isSipNumber = PhoneNumberUtil.isSipNumber(mNumber); final CharSequence callLocationOrType = getNumberTypeOrLocation(firstDetails); Loading
src/com/android/dialer/calllog/CallLogAdapter.java +16 −14 Original line number Diff line number Diff line Loading @@ -42,10 +42,10 @@ import android.view.accessibility.AccessibilityEvent; import com.android.contacts.common.util.PermissionsUtil; import com.android.dialer.PhoneCallDetails; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.R; import com.android.dialer.contactinfo.ContactInfoCache; import com.android.dialer.contactinfo.ContactInfoCache.OnContactInfoChangedListener; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.voicemail.VoicemailPlaybackPresenter; import com.google.common.annotations.VisibleForTesting; Loading Loading @@ -123,10 +123,11 @@ public class CallLogAdapter extends GroupingListAdapter private boolean mShowPromoCard = false; /** Instance of helper class for managing views. */ private final CallLogListItemHelper mCallLogViewsHelper; private final CallLogListItemHelper mCallLogListItemHelper; /** Cache for repeated requests to TelecomManager. */ protected final TelecomCallLogCache mTelecomCallLogCache; /** Helper to access Telephony phone number utils class */ protected final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper; /** Helper to group call log entries. */ private final CallLogGroupBuilder mCallLogGroupBuilder; Loading Loading @@ -256,10 +257,11 @@ public class CallLogAdapter extends GroupingListAdapter Resources resources = mContext.getResources(); CallTypeHelper callTypeHelper = new CallTypeHelper(resources); mPhoneNumberUtilsWrapper = new PhoneNumberUtilsWrapper(mContext); mTelecomCallLogCache = new TelecomCallLogCache(mContext); PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper(mContext, resources, mPhoneNumberUtilsWrapper); mCallLogViewsHelper = new CallLogListItemHelper(phoneCallDetailsHelper, resources); new PhoneCallDetailsHelper(mContext, resources, mTelecomCallLogCache); mCallLogListItemHelper = new CallLogListItemHelper(phoneCallDetailsHelper, resources, mTelecomCallLogCache); mCallLogGroupBuilder = new CallLogGroupBuilder(this); mPrefs = PreferenceManager.getDefaultSharedPreferences(context); maybeShowVoicemailPromoCard(); Loading Loading @@ -329,6 +331,7 @@ public class CallLogAdapter extends GroupingListAdapter public void pauseCache() { mContactInfoCache.stop(); mTelecomCallLogCache.reset(); } @Override Loading Loading @@ -359,8 +362,8 @@ public class CallLogAdapter extends GroupingListAdapter view, mContext, mExpandCollapseListener, mPhoneNumberUtilsWrapper, mCallLogViewsHelper, mTelecomCallLogCache, mCallLogListItemHelper, mVoicemailPlaybackPresenter); viewHolder.callLogEntryView.setTag(viewHolder); Loading Loading @@ -432,14 +435,13 @@ public class CallLogAdapter extends GroupingListAdapter final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO); final ContactInfo cachedContactInfo = mContactInfoHelper.getContactInfo(c); final boolean isVoicemailNumber = mPhoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number); mTelecomCallLogCache.isVoicemailNumber(accountHandle, number); // Note: Binding of the action buttons is done as required in configureActionViews when the // user expands the actions ViewStub. ContactInfo info = ContactInfo.EMPTY; if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation) && !isVoicemailNumber) { if (PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation) && !isVoicemailNumber) { // Lookup contacts with this number info = mContactInfoCache.getValue(number, countryIso, cachedContactInfo); } Loading Loading @@ -499,7 +501,7 @@ public class CallLogAdapter extends GroupingListAdapter views.dayGroupHeader.setVisibility(View.GONE); } mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details); mCallLogListItemHelper.setPhoneCallDetails(views, details); if (mCurrentlyExpandedRowId == views.rowId) { // In case ViewHolders were added/removed, update the expanded position if the rowIds Loading @@ -522,7 +524,7 @@ public class CallLogAdapter extends GroupingListAdapter views.setPhoto(info.photoId, info.photoUri, info.lookupUri, nameForDefaultImage, isVoicemailNumber, mContactInfoHelper.isBusiness(info.sourceType)); mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details); mCallLogListItemHelper.setPhoneCallDetails(views, details); // Listen for the first draw if (mViewTreeObserver == null) { Loading
src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java +3 −5 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.contacts.common.GeoUtil; import com.android.dialer.PhoneCallDetails; import com.android.dialer.util.AsyncTaskExecutor; import com.android.dialer.util.AsyncTaskExecutors; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.util.TelecomUtil; import com.google.common.annotations.VisibleForTesting; Loading Loading @@ -151,12 +152,9 @@ public class CallLogAsyncTaskUtil { // If this is not a regular number, there is no point in looking it up in the contacts. ContactInfoHelper contactInfoHelper = new ContactInfoHelper(context, GeoUtil.getCurrentCountryIso(context)); PhoneNumberUtilsWrapper phoneNumberUtilsWrapper = new PhoneNumberUtilsWrapper(context); boolean isVoicemail = phoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number); boolean isVoicemail = PhoneNumberUtil.isVoicemailNumber(context, accountHandle, number); boolean shouldLookupNumber = PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation) && !isVoicemail; PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation) && !isVoicemail; ContactInfo info = shouldLookupNumber ? contactInfoHelper.lookupNumber(number, countryIso) : ContactInfo.EMPTY; Loading
src/com/android/dialer/calllog/CallLogListItemHelper.java +10 −6 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.text.TextUtils; import android.util.Log; import com.android.dialer.PhoneCallDetails; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.R; /** Loading @@ -37,6 +36,7 @@ import com.android.dialer.R; private final PhoneCallDetailsHelper mPhoneCallDetailsHelper; /** Resources to look up strings. */ private final Resources mResources; private final TelecomCallLogCache mTelecomCallLogCache; /** * Creates a new helper instance. Loading @@ -45,9 +45,12 @@ import com.android.dialer.R; * @param phoneNumberHelper used to process phone number */ public CallLogListItemHelper( PhoneCallDetailsHelper phoneCallDetailsHelper, Resources resources) { PhoneCallDetailsHelper phoneCallDetailsHelper, Resources resources, TelecomCallLogCache telecomCallLogCache) { mPhoneCallDetailsHelper = phoneCallDetailsHelper; mResources = resources; mTelecomCallLogCache = telecomCallLogCache; } /** Loading @@ -58,14 +61,15 @@ import com.android.dialer.R; * @param details the details of a phone call needed to fill in the data */ public void setPhoneCallDetails( Context context, CallLogListItemViewHolder views, PhoneCallDetails details) { CallLogListItemViewHolder views, PhoneCallDetails details) { mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details); // Set the accessibility text for the contact badge views.quickContactView.setContentDescription(getContactBadgeDescription(details)); // Set the primary action accessibility description views.primaryActionView.setContentDescription(getCallDescription(context, details)); views.primaryActionView.setContentDescription(getCallDescription(details)); // Cache name or number of caller. Used when setting the content descriptions of buttons // when the actions ViewStub is inflated. Loading Loading @@ -151,7 +155,7 @@ import com.android.dialer.R; * @param details Details of call. * @return Return call action description. */ public CharSequence getCallDescription(Context context, PhoneCallDetails details) { public CharSequence getCallDescription(PhoneCallDetails details) { int lastCallType = getLastCallType(details.callTypes); boolean isVoiceMail = lastCallType == Calls.VOICEMAIL_TYPE; Loading Loading @@ -183,7 +187,7 @@ import com.android.dialer.R; } int stringID = getCallDescriptionStringID(details.callTypes); String accountLabel = PhoneAccountUtils.getAccountLabel(context, details.accountHandle); String accountLabel = mTelecomCallLogCache.getAccountLabel(details.accountHandle); // Use chosen string resource to build up the message. CharSequence onAccountLabel = accountLabel == null Loading
src/com/android/dialer/calllog/CallLogListItemViewHolder.java +14 −16 Original line number Diff line number Diff line Loading @@ -39,11 +39,10 @@ import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.testing.NeededForTesting; import com.android.contacts.common.util.UriUtils; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.PhoneCallDetailsViews; import com.android.dialer.R; import com.android.dialer.calllog.CallLogAsyncTaskUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.voicemail.VoicemailPlaybackPresenter; import com.android.dialer.voicemail.VoicemailPlaybackLayout; Loading Loading @@ -139,7 +138,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder private static final int VOICEMAIL_TRANSCRIPTION_MAX_LINES = 10; private final Context mContext; private final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper; private final TelecomCallLogCache mTelecomCallLogCache; private final CallLogListItemHelper mCallLogListItemHelper; private final VoicemailPlaybackPresenter mVoicemailPlaybackPresenter; Loading @@ -151,7 +150,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder private CallLogListItemViewHolder( Context context, View.OnClickListener expandCollapseListener, PhoneNumberUtilsWrapper phoneNumberUtilsWrapper, TelecomCallLogCache telecomCallLogCache, CallLogListItemHelper callLogListItemHelper, VoicemailPlaybackPresenter voicemailPlaybackPresenter, View rootView, Loading @@ -165,7 +164,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder mContext = context; mExpandCollapseListener = expandCollapseListener; mPhoneNumberUtilsWrapper = phoneNumberUtilsWrapper; mTelecomCallLogCache = telecomCallLogCache; mCallLogListItemHelper = callLogListItemHelper; mVoicemailPlaybackPresenter = voicemailPlaybackPresenter; Loading Loading @@ -194,14 +193,14 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder View view, Context context, View.OnClickListener expandCollapseListener, PhoneNumberUtilsWrapper phoneNumberUtilsWrapper, TelecomCallLogCache telecomCallLogCache, CallLogListItemHelper callLogListItemHelper, VoicemailPlaybackPresenter voicemailPlaybackPresenter) { return new CallLogListItemViewHolder( context, expandCollapseListener, phoneNumberUtilsWrapper, telecomCallLogCache, callLogListItemHelper, voicemailPlaybackPresenter, view, Loading Loading @@ -263,11 +262,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } else { // Treat as normal list item; show call button, if possible. boolean canPlaceCallToNumber = PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation); PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation); if (canPlaceCallToNumber) { boolean isVoicemailNumber = mPhoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number); mTelecomCallLogCache.isVoicemailNumber(accountHandle, number); if (isVoicemailNumber) { // Call to generic voicemail number, in case there are multiple accounts. primaryActionButtonView.setTag( Loading @@ -294,8 +293,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder * buttons. */ private void bindActionButtons() { boolean canPlaceCallToNumber = PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation); boolean canPlaceCallToNumber = PhoneNumberUtil.canPlaceCallsTo(number, numberPresentation); if (!TextUtils.isEmpty(voicemailUri) && canPlaceCallToNumber) { callButtonView.setTag(IntentProvider.getReturnCallIntentProvider(number)); Loading @@ -309,7 +307,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } // If one of the calls had video capabilities, show the video call button. if (CallUtil.isVideoEnabled(mContext) && canPlaceCallToNumber && if (mTelecomCallLogCache.isVideoEnabled() && canPlaceCallToNumber && phoneCallDetailsViews.callTypeIcons.isVideoShown()) { videoCallButtonView.setTag(IntentProvider.getReturnVideoCallIntentProvider(number)); videoCallButtonView.setVisibility(View.VISIBLE); Loading Loading @@ -440,15 +438,15 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder @NeededForTesting public static CallLogListItemViewHolder createForTest(Context context) { Resources resources = context.getResources(); PhoneNumberUtilsWrapper phoneNumberUtilsWrapper = new PhoneNumberUtilsWrapper(context); TelecomCallLogCache telecomCallLogCache = new TelecomCallLogCache(context); PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper( context, resources, phoneNumberUtilsWrapper); context, resources, telecomCallLogCache); CallLogListItemViewHolder viewHolder = new CallLogListItemViewHolder( context, null /* expandCollapseListener */, phoneNumberUtilsWrapper, new CallLogListItemHelper(phoneCallDetailsHelper, resources), telecomCallLogCache, new CallLogListItemHelper(phoneCallDetailsHelper, resources, telecomCallLogCache), null /* voicemailPlaybackPresenter */, new View(context), new QuickContactBadge(context), Loading