diff options
author | Tyler Gunn <tgunn@google.com> | 2014-07-15 12:40:28 -0700 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2014-07-15 12:44:01 -0700 |
commit | 5619f2ed87cb207352c0ff5578348baeb69ee202 (patch) | |
tree | a794e13d436109711c0ba759eafa6d65fe258fa8 /src | |
parent | 57750bca2f46ed9f6da4be0dea3959a0d9f49c01 (diff) |
Various call log / call details video call changes.
Requires cl/501841.
Call log:
1. Add video call affordance.
2. Add accessibility text for calls, video call afforance.
3. Fixed unit test
Call details:
1. Showing video icon when a call had video.
2. Changing call headings to indicate they were video calls.
Bug: 16013879
Bug: 16013344
Bug: 16013684
Change-Id: I53b5bf9b0b1a63f9d119318d59f690d310cca7c8
Diffstat (limited to 'src')
7 files changed, 80 insertions, 8 deletions
diff --git a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java index cc116e7ad..105462ffe 100644 --- a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java +++ b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java @@ -122,11 +122,12 @@ public class CallDetailHistoryAdapter extends BaseAdapter { TextView durationView = (TextView) result.findViewById(R.id.duration); int callType = details.callTypes[0]; + boolean isVideoCall = (details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO; + callTypeIconView.clear(); callTypeIconView.add(callType); - callTypeIconView.setShowVideo( - (details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO); - callTypeTextView.setText(mCallTypeHelper.getCallTypeText(callType)); + callTypeIconView.setShowVideo(isVideoCall); + callTypeTextView.setText(mCallTypeHelper.getCallTypeText(callType, isVideoCall)); // Set the date. CharSequence dateValue = DateUtils.formatDateRange(mContext, details.date, details.date, DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index f4b9f3a94..d70a40dea 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -895,6 +895,7 @@ public class CallLogAdapter extends GroupingListAdapter // focus was successful. The first successful focus will satisfy the OR // block and block further attempts to set focus. boolean focused = views.callBackButtonView.requestAccessibilityFocus() || + views.videoCallButtonView.requestAccessibilityFocus() || views.voicemailButtonView.requestAccessibilityFocus() || views.detailsButtonView.requestAccessibilityFocus(); } else { @@ -929,6 +930,11 @@ public class CallLogAdapter extends GroupingListAdapter R.id.call_back_action); } + if (views.videoCallButtonView == null) { + views.videoCallButtonView = (TextView)views.actionsView.findViewById( + R.id.video_call_action); + } + if (views.voicemailButtonView == null) { views.voicemailButtonView = (TextView)views.actionsView.findViewById( R.id.voicemail_action); @@ -960,8 +966,10 @@ public class CallLogAdapter extends GroupingListAdapter * @param views The call log item views. */ private void bindActionButtons(CallLogListItemViews views) { + boolean canPlaceCallToNumber = + PhoneNumberUtilsWrapper.canPlaceCallsTo(views.number, views.numberPresentation); // Set return call intent, otherwise null. - if (PhoneNumberUtilsWrapper.canPlaceCallsTo(views.number, views.numberPresentation)) { + if (canPlaceCallToNumber) { // Sets the primary action to call the number. views.callBackButtonView.setTag( IntentProvider.getReturnCallIntentProvider(views.number, views.mAccount)); @@ -973,6 +981,18 @@ public class CallLogAdapter extends GroupingListAdapter views.callBackButtonView.setVisibility(View.GONE); } + // If one of the calls had video capabilities, show the video call button. + if (canPlaceCallToNumber && views.phoneCallDetailsViews.callTypeIcons.isVideoShown()) { + views.videoCallButtonView.setTag( + IntentProvider.getReturnVideoCallIntentProvider(views.number, + views.mAccount)); + views.videoCallButtonView.setVisibility(View.VISIBLE); + views.videoCallButtonView.setOnClickListener(mActionListener); + } else { + views.videoCallButtonView.setTag(null); + views.videoCallButtonView.setVisibility(View.GONE); + } + // For voicemail calls, show the "VOICEMAIL" action button; hide otherwise. if (views.callType == Calls.VOICEMAIL_TYPE) { views.voicemailButtonView.setOnClickListener(mActionListener); @@ -991,6 +1011,7 @@ public class CallLogAdapter extends GroupingListAdapter IntentProvider.getCallDetailIntentProvider( views.rowId, views.callIds, null) ); + if (views.isExternal && !views.reported) { views.reportButtonView.setVisibility(View.VISIBLE); } diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java index cb7c7cda3..b2c1e2d14 100644 --- a/src/com/android/dialer/calllog/CallLogListItemHelper.java +++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java @@ -77,6 +77,9 @@ import com.android.dialer.R; views.callBackButtonView.setContentDescription( mResources.getString(R.string.description_call_back_action, views.nameOrNumber)); + views.videoCallButtonView.setContentDescription( + mResources.getString(R.string.description_video_call_action, views.nameOrNumber)); + views.voicemailButtonView.setContentDescription( mResources.getString(R.string.description_voicemail_action, views.nameOrNumber)); @@ -149,6 +152,11 @@ import com.android.dialer.R; details.callTypes.length)); } + // If call had video capabilities, add the "Video Call" string. + if ((details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) { + callDescription.append(mResources.getString(R.string.description_video_call)); + } + int stringID = getCallDescriptionStringID(details); // Use chosen string resource to build up the message. diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java index 3efa5cbea..70d545e89 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViews.java +++ b/src/com/android/dialer/calllog/CallLogListItemViews.java @@ -44,6 +44,8 @@ public final class CallLogListItemViews { public View actionsView; /** The "call back" action button - assigned only when the action section is expanded. */ public TextView callBackButtonView; + /** The "video call" action button - assigned only when the action section is expanded. */ + public TextView videoCallButtonView; /** The "voicemail" action button - assigned only when the action section is expanded. */ public TextView voicemailButtonView; /** The "details" action button - assigned only when the action section is expanded. */ diff --git a/src/com/android/dialer/calllog/CallTypeHelper.java b/src/com/android/dialer/calllog/CallTypeHelper.java index 1c4f44f23..36c0975bd 100644 --- a/src/com/android/dialer/calllog/CallTypeHelper.java +++ b/src/com/android/dialer/calllog/CallTypeHelper.java @@ -31,6 +31,12 @@ public class CallTypeHelper { private final CharSequence mOutgoingName; /** Name used to identify missed calls. */ private final CharSequence mMissedName; + /** Name used to identify incoming video calls. */ + private final CharSequence mIncomingVideoName; + /** Name used to identify outgoing video calls. */ + private final CharSequence mOutgoingVideoName; + /** Name used to identify missed video calls. */ + private final CharSequence mMissedVideoName; /** Name used to identify voicemail calls. */ private final CharSequence mVoicemailName; /** Color used to identify new missed calls. */ @@ -43,22 +49,37 @@ public class CallTypeHelper { mIncomingName = resources.getString(R.string.type_incoming); mOutgoingName = resources.getString(R.string.type_outgoing); mMissedName = resources.getString(R.string.type_missed); + mIncomingVideoName = resources.getString(R.string.type_incoming_video); + mOutgoingVideoName = resources.getString(R.string.type_outgoing_video); + mMissedVideoName = resources.getString(R.string.type_missed_video); mVoicemailName = resources.getString(R.string.type_voicemail); mNewMissedColor = resources.getColor(R.color.call_log_missed_call_highlight_color); mNewVoicemailColor = resources.getColor(R.color.call_log_voicemail_highlight_color); } /** Returns the text used to represent the given call type. */ - public CharSequence getCallTypeText(int callType) { + public CharSequence getCallTypeText(int callType, boolean isVideoCall) { switch (callType) { case Calls.INCOMING_TYPE: - return mIncomingName; + if (isVideoCall) { + return mIncomingVideoName; + } else { + return mIncomingName; + } case Calls.OUTGOING_TYPE: - return mOutgoingName; + if (isVideoCall) { + return mOutgoingVideoName; + } else { + return mOutgoingName; + } case Calls.MISSED_TYPE: - return mMissedName; + if (isVideoCall) { + return mMissedVideoName; + } else { + return mMissedName; + } case Calls.VOICEMAIL_TYPE: return mVoicemailName; diff --git a/src/com/android/dialer/calllog/CallTypeIconsView.java b/src/com/android/dialer/calllog/CallTypeIconsView.java index 382056c72..ef729ae39 100644 --- a/src/com/android/dialer/calllog/CallTypeIconsView.java +++ b/src/com/android/dialer/calllog/CallTypeIconsView.java @@ -85,6 +85,15 @@ public class CallTypeIconsView extends View { } } + /** + * Determines if the video icon should be shown. + * + * @return True if the video icon should be shown. + */ + public boolean isVideoShown() { + return mShowVideo; + } + @NeededForTesting public int getCount() { return mCallTypes.size(); diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java index 9820102d2..c52dff87f 100644 --- a/src/com/android/dialer/calllog/IntentProvider.java +++ b/src/com/android/dialer/calllog/IntentProvider.java @@ -47,6 +47,16 @@ public abstract class IntentProvider { }; } + public static IntentProvider getReturnVideoCallIntentProvider(final String number, + final PhoneAccount account) { + return new IntentProvider() { + @Override + public Intent getIntent(Context context) { + return CallUtil.getVideoCallIntent(number, account); + } + }; + } + public static IntentProvider getPlayVoicemailIntentProvider(final long rowId, final String voicemailUri) { return new IntentProvider() { |