diff options
author | jiadongz <jiadongz@codeaurora.org> | 2014-01-23 04:32:22 +0800 |
---|---|---|
committer | emancebo <emancebo@cyngn.com> | 2014-09-03 16:58:11 -0700 |
commit | dc34c89fb48a6ed78e17d272268440be76b3c795 (patch) | |
tree | a0cc1c2bc628b8e62e46d37a14c4cd0b33aaa28a | |
parent | 2548933d51dea223c139a6848af16bfda3c3d159 (diff) | |
download | android_packages_apps_Dialer-dc34c89fb48a6ed78e17d272268440be76b3c795.tar.gz android_packages_apps_Dialer-dc34c89fb48a6ed78e17d272268440be76b3c795.tar.bz2 android_packages_apps_Dialer-dc34c89fb48a6ed78e17d272268440be76b3c795.zip |
CSVT: add CSVT calltype in calllog and CSVT entry in calllog details
Conflicts:
src/com/android/dialer/CallDetailActivity.java
Change-Id: I1453e9740207607ddfb76493ce02f5bebc786be3
15 files changed, 192 insertions, 0 deletions
diff --git a/res/drawable-hdpi/ic_video_incoming_holo_dark.png b/res/drawable-hdpi/ic_video_incoming_holo_dark.png Binary files differnew file mode 100644 index 000000000..b4fd7caa9 --- /dev/null +++ b/res/drawable-hdpi/ic_video_incoming_holo_dark.png diff --git a/res/drawable-hdpi/ic_video_missed_holo_dark.png b/res/drawable-hdpi/ic_video_missed_holo_dark.png Binary files differnew file mode 100644 index 000000000..7308effca --- /dev/null +++ b/res/drawable-hdpi/ic_video_missed_holo_dark.png diff --git a/res/drawable-hdpi/ic_video_outgoing_holo_dark.png b/res/drawable-hdpi/ic_video_outgoing_holo_dark.png Binary files differnew file mode 100644 index 000000000..b6a020825 --- /dev/null +++ b/res/drawable-hdpi/ic_video_outgoing_holo_dark.png diff --git a/res/drawable-mdpi/ic_contact_quick_contact_call_video_holo_dark.png b/res/drawable-mdpi/ic_contact_quick_contact_call_video_holo_dark.png Binary files differnew file mode 100644 index 000000000..562cdc9e1 --- /dev/null +++ b/res/drawable-mdpi/ic_contact_quick_contact_call_video_holo_dark.png diff --git a/res/drawable-mdpi/ic_video_incoming_holo_dark.png b/res/drawable-mdpi/ic_video_incoming_holo_dark.png Binary files differnew file mode 100644 index 000000000..eb19c1855 --- /dev/null +++ b/res/drawable-mdpi/ic_video_incoming_holo_dark.png diff --git a/res/drawable-mdpi/ic_video_missed_holo_dark.png b/res/drawable-mdpi/ic_video_missed_holo_dark.png Binary files differnew file mode 100644 index 000000000..3865fce7d --- /dev/null +++ b/res/drawable-mdpi/ic_video_missed_holo_dark.png diff --git a/res/drawable-mdpi/ic_video_outgoing_holo_dark.png b/res/drawable-mdpi/ic_video_outgoing_holo_dark.png Binary files differnew file mode 100644 index 000000000..34d91b024 --- /dev/null +++ b/res/drawable-mdpi/ic_video_outgoing_holo_dark.png diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml index 5f319bcb8..0c6b78142 100644 --- a/res/layout/call_detail.xml +++ b/res/layout/call_detail.xml @@ -197,6 +197,46 @@ android:focusable="true" android:background="?android:attr/selectableItemBackground" /> + + <View android:id="@+id/videocall_and_sms_divider" + android:layout_width="1px" + android:layout_height="32dip" + android:background="@drawable/ic_divider_dashed_holo_dark" + android:layout_gravity="center_vertical" + android:visibility="gone" + /> + + <ImageView android:id="@+id/videocall" + android:layout_width="@color/call_log_voicemail_highlight_color" + android:layout_height="match_parent" + android:paddingLeft="@dimen/call_log_inner_margin" + android:paddingRight="@dimen/call_log_outer_margin" + android:gravity="center" + android:scaleType="centerInside" + android:visibility="gone" + android:focusable="true" + android:background="?android:attr/selectableItemBackground" + /> + + <View android:id="@+id/videocall_and_sms_divider" + android:layout_width="1px" + android:layout_height="32dip" + android:background="@drawable/ic_divider_dashed_holo_dark" + android:layout_gravity="center_vertical" + android:visibility="gone" + /> + + <ImageView android:id="@+id/videocall" + android:layout_width="@color/call_log_voicemail_highlight_color" + android:layout_height="match_parent" + android:paddingLeft="@dimen/call_log_inner_margin" + android:paddingRight="@dimen/call_log_outer_margin" + android:gravity="center" + android:scaleType="centerInside" + android:visibility="gone" + android:focusable="true" + android:background="?android:attr/selectableItemBackground" + /> </LinearLayout> </FrameLayout> </RelativeLayout> diff --git a/res/menu/call_details_options.xml b/res/menu/call_details_options.xml index 549203998..bf0f4868f 100644 --- a/res/menu/call_details_options.xml +++ b/res/menu/call_details_options.xml @@ -15,6 +15,11 @@ --> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item + android:id="@+id/menu_calllog_detail_video_call" + android:title="@string/videocall" + android:onClick="onMenuVTCall" + /> + <item android:id="@+id/menu_trash" android:icon="@drawable/ic_menu_delete_dk" android:showAsAction="ifRoom" diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 104df68ad..2bfbe8211 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -575,12 +575,16 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware public boolean onPrepareOptionsMenu(Menu menu) { // This action deletes all elements in the group from the call log. // We don't have this action for voicemails, because you can just use the trash button. + menu.findItem(R.id.menu_calllog_detail_video_call).setVisible(mCallDetailHeader.hasVideoCallOption()); menu.findItem(R.id.menu_remove_from_call_log).setVisible(mHasRemoveFromCallLogOption); menu.findItem(R.id.menu_edit_number_before_call).setVisible(mHasEditNumberBeforeCallOption); menu.findItem(R.id.menu_add_to_blacklist).setVisible(mHasAddToBlacklistOption); menu.findItem(R.id.menu_trash).setVisible(mHasTrashOption); return super.onPrepareOptionsMenu(menu); } + public void onMenuVTCall(MenuItem menuItem) { + startActivity(CallDetailHeader.getVTCallIntent(mNumber)); + } public void onMenuRemoveFromCallLog(MenuItem menuItem) { final StringBuilder callIds = new StringBuilder(); diff --git a/src/com/android/dialer/CallDetailHeader.java b/src/com/android/dialer/CallDetailHeader.java index f1e7f1a3a..45e649600 100644 --- a/src/com/android/dialer/CallDetailHeader.java +++ b/src/com/android/dialer/CallDetailHeader.java @@ -23,6 +23,7 @@ import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; +import android.os.SystemProperties; import android.provider.ContactsContract.Intents.Insert; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; @@ -67,6 +68,8 @@ public class CallDetailHeader { private static final char LEFT_TO_RIGHT_EMBEDDING = '\u202A'; private static final char POP_DIRECTIONAL_FORMATTING = '\u202C'; + private static final boolean MOVE_VTCALL_BTN_TO_OPTIONSMENU = true; + private Activity mActivity; private Resources mResources; private PhoneNumberDisplayHelper mPhoneNumberDisplayHelper; @@ -88,6 +91,8 @@ public class CallDetailHeader { private CharSequence mPhoneNumberLabelToCopy; private CharSequence mPhoneNumberToCopy; + private boolean mHasVideoCallOption = false; + public interface Data { CharSequence getName(); CharSequence getNumber(); @@ -122,6 +127,13 @@ public class CallDetailHeader { } }; + private final View.OnClickListener mThirdActionListener = new View.OnClickListener() { + @Override + public void onClick(View view) { + mActivity.startActivity(((ViewEntry) view.getTag()).thirdIntent); + } + }; + private final View.OnLongClickListener mPrimaryLongClickListener = new View.OnLongClickListener() { @Override @@ -355,6 +367,23 @@ public class CallDetailHeader { mResources.getString(R.string.description_send_text_message, nameOrNumber)); } + boolean isVTSupported = + SystemProperties.getBoolean("persist.radio.csvt.enabled", false); + + // The third action allows to invoke videocall to the number that placed the + // call. + final boolean canVTCall = isVTSupported && !isSipNumber; + if (!MOVE_VTCALL_BTN_TO_OPTIONSMENU && canVTCall) { + entry.setThirdAction( + R.drawable.ic_contact_quick_contact_call_video_holo_dark, + getVTCallIntent(mNumber), + mResources.getString(R.string.description_videocall, + nameOrNumber)); + mHasVideoCallOption = false; + } else { + mHasVideoCallOption = canVTCall; + } + configureCallButton(entry); mPhoneNumberToCopy = displayNumber; mPhoneNumberLabelToCopy = entry.label; @@ -421,6 +450,12 @@ public class CallDetailHeader { public Intent secondaryIntent = null; /** The description for accessibility of the secondary action. */ public String secondaryDescription = null; + /** add for csvt Icon for the third action. */ + public int thirdIcon = 0; + /** Intent for the third action. If not null, an icon must be defined. */ + public Intent thirdIntent = null; + /** The description for accessibility of the third action. */ + public String thirdDescription = null; public ViewEntry(String text, Intent intent, String description) { this.text = text; @@ -433,6 +468,12 @@ public class CallDetailHeader { secondaryIntent = intent; secondaryDescription = description; } + + public void setThirdAction(int icon, Intent intent, String description) { + thirdIcon = icon; + thirdIntent = intent; + thirdDescription = description; + } } /** Disables the call button area, e.g., for private numbers. */ @@ -448,6 +489,8 @@ public class CallDetailHeader { ImageView icon = (ImageView) convertView.findViewById(R.id.call_and_sms_icon); View divider = convertView.findViewById(R.id.call_and_sms_divider); TextView text = (TextView) convertView.findViewById(R.id.call_and_sms_text); + ImageView icon_third = (ImageView) convertView.findViewById(R.id.videocall); + View divider_third = convertView.findViewById(R.id.videocall_and_sms_divider); View mainAction = convertView.findViewById(R.id.call_and_sms_main_action); mainAction.setOnClickListener(mPrimaryActionListener); @@ -468,6 +511,14 @@ public class CallDetailHeader { } text.setText(entry.text); + if(entry.thirdIntent != null) { + icon_third.setOnClickListener(mThirdActionListener); + icon_third.setImageResource(R.drawable.ic_contact_quick_contact_call_video_holo_dark); + icon_third.setTag(entry); + icon_third.setContentDescription(entry.thirdDescription); + } + icon_third.setVisibility(entry.thirdIntent != null? View.VISIBLE : View.GONE); + TextView label = (TextView) convertView.findViewById(R.id.call_and_sms_label); if (TextUtils.isEmpty(entry.label)) { label.setVisibility(View.GONE); @@ -507,4 +558,28 @@ public class CallDetailHeader { sb.append(POP_DIRECTIONAL_FORMATTING); return sb.toString(); } + + //add for csvt + public static Intent getVTCallIntent(String number) { + Intent intent = new Intent("com.borqs.videocall.action.LaunchVideoCallScreen"); + intent.addCategory(Intent.CATEGORY_DEFAULT); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); + + intent.putExtra("IsCallOrAnswer", true); // true as a + // call, + // while + // false as + // answer + + intent.putExtra("LaunchMode", 1); // nLaunchMode: 1 as + // telephony, while + // 0 as socket + intent.putExtra("call_number_key", number); + return intent; + } + + public boolean hasVideoCallOption() { + return mHasVideoCallOption; + } } diff --git a/src/com/android/dialer/calllog/CallLogGroupBuilder.java b/src/com/android/dialer/calllog/CallLogGroupBuilder.java index 213f1e774..379194e90 100644 --- a/src/com/android/dialer/calllog/CallLogGroupBuilder.java +++ b/src/com/android/dialer/calllog/CallLogGroupBuilder.java @@ -76,6 +76,14 @@ public class CallLogGroupBuilder { } else if (firstCallType == Calls.VOICEMAIL_TYPE) { // never group voicemail. shouldGroup = false; + } else if (firstCallType == CallTypeHelper.MISSED_CSVT_TYPE) { + // Voicemail and missed calls should only be grouped with subsequent missed calls. + shouldGroup = callType == CallTypeHelper.MISSED_CSVT_TYPE; + } else if (firstCallType == CallTypeHelper.INCOMING_CSVT_TYPE + || firstCallType == CallTypeHelper.OUTGOING_CSVT_TYPE) { + // Incoming and outgoing calls group together. + shouldGroup = callType == CallTypeHelper.INCOMING_CSVT_TYPE + || callType == CallTypeHelper.OUTGOING_CSVT_TYPE; } else { // Incoming, outgoing, and missed calls group together. shouldGroup = callType != Calls.VOICEMAIL_TYPE; diff --git a/src/com/android/dialer/calllog/CallLogQueryHandler.java b/src/com/android/dialer/calllog/CallLogQueryHandler.java index bfed77147..767960093 100644 --- a/src/com/android/dialer/calllog/CallLogQueryHandler.java +++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java @@ -184,6 +184,13 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler { where.append(String.format("(%s = ?)", Calls.TYPE)); // Add a clause to fetch only items newer than the requested date selectionArgs.add(Integer.toString(callType)); + if (callType == Calls.INCOMING_TYPE) { + selectionArgs.add(Integer.toString(CallTypeHelper.INCOMING_CSVT_TYPE)); + } else if (callType == Calls.OUTGOING_TYPE) { + selectionArgs.add(Integer.toString(CallTypeHelper.OUTGOING_CSVT_TYPE)); + } else if (callType == Calls.MISSED_TYPE) { + selectionArgs.add(Integer.toString(CallTypeHelper.MISSED_CSVT_TYPE)); + } } if (sub > CALL_SUB_ALL) { diff --git a/src/com/android/dialer/calllog/CallTypeHelper.java b/src/com/android/dialer/calllog/CallTypeHelper.java index 1c4f44f23..2c8b5aa39 100644 --- a/src/com/android/dialer/calllog/CallTypeHelper.java +++ b/src/com/android/dialer/calllog/CallTypeHelper.java @@ -38,6 +38,11 @@ public class CallTypeHelper { /** Color used to identify new voicemail calls. */ private final int mNewVoicemailColor; + //add for csvt call log type + public static final int INCOMING_CSVT_TYPE = 5; + public static final int OUTGOING_CSVT_TYPE = 6; + public static final int MISSED_CSVT_TYPE = 7; + public CallTypeHelper(Resources resources) { // Cache these values so that we do not need to look them up each time. mIncomingName = resources.getString(R.string.type_incoming); @@ -63,6 +68,16 @@ public class CallTypeHelper { case Calls.VOICEMAIL_TYPE: return mVoicemailName; + //add for csvt call log type + case INCOMING_CSVT_TYPE: + return mIncomingName; + + case OUTGOING_CSVT_TYPE: + return mOutgoingName; + + case MISSED_CSVT_TYPE: + return mMissedName; + default: return mMissedName; } @@ -72,14 +87,17 @@ public class CallTypeHelper { public Integer getHighlightedColor(int callType) { switch (callType) { case Calls.INCOMING_TYPE: + case INCOMING_CSVT_TYPE: // New incoming calls are not highlighted. return null; case Calls.OUTGOING_TYPE: + case OUTGOING_CSVT_TYPE: // New outgoing calls are not highlighted. return null; case Calls.MISSED_TYPE: + case MISSED_CSVT_TYPE: return mNewMissedColor; case Calls.VOICEMAIL_TYPE: diff --git a/src/com/android/dialer/calllog/CallTypeIconsView.java b/src/com/android/dialer/calllog/CallTypeIconsView.java index a65f2c279..439312532 100644 --- a/src/com/android/dialer/calllog/CallTypeIconsView.java +++ b/src/com/android/dialer/calllog/CallTypeIconsView.java @@ -19,6 +19,7 @@ package com.android.dialer.calllog; import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable.Drawable; +import android.os.SystemProperties; import android.provider.CallLog.Calls; import android.util.AttributeSet; import android.view.View; @@ -85,6 +86,25 @@ public class CallTypeIconsView extends View { return mResources.missed; case Calls.VOICEMAIL_TYPE: return mResources.voicemail; + //add for csvt call log type + case CallTypeHelper.INCOMING_CSVT_TYPE: + if (isVTSupported()) { + return mResources.csvt_incoming; + } else { + return mResources.incoming; + } + case CallTypeHelper.OUTGOING_CSVT_TYPE: + if (isVTSupported()) { + return mResources.csvt_outgoing; + } else { + return mResources.outgoing; + } + case CallTypeHelper.MISSED_CSVT_TYPE: + if (isVTSupported()) { + return mResources.csvt_missed; + } else { + return mResources.missed; + } default: // It is possible for users to end up with calls with unknown call types in their // call history, possibly due to 3rd party call log implementations (e.g. to @@ -115,6 +135,10 @@ public class CallTypeIconsView extends View { public final Drawable incoming; public final Drawable outgoing; public final Drawable missed; + //add for csvt call log type + public final Drawable csvt_incoming; + public final Drawable csvt_outgoing; + public final Drawable csvt_missed; public final Drawable voicemail; public final int iconMargin; @@ -123,8 +147,19 @@ public class CallTypeIconsView extends View { incoming = r.getDrawable(R.drawable.ic_call_incoming_holo_dark); outgoing = r.getDrawable(R.drawable.ic_call_outgoing_holo_dark); missed = r.getDrawable(R.drawable.ic_call_missed_holo_dark); + //add for csvt call log type + csvt_incoming = r.getDrawable(R.drawable.ic_video_incoming_holo_dark); + csvt_outgoing = r.getDrawable(R.drawable.ic_video_outgoing_holo_dark); + csvt_missed = r.getDrawable(R.drawable.ic_video_missed_holo_dark); voicemail = r.getDrawable(R.drawable.ic_call_voicemail_holo_dark); iconMargin = r.getDimensionPixelSize(R.dimen.call_log_icon_margin); } } + + //add for csvt call log type + private boolean isVTSupported() { + return SystemProperties.getBoolean( + "persist.radio.csvt.enabled" + /* TelephonyProperties.PROPERTY_CSVT_ENABLED*/, false); + } } |