diff options
| author | Matt Garnes <matt@cyngn.com> | 2015-02-13 16:03:24 -0800 |
|---|---|---|
| committer | Matt Garnes <matt@cyngn.com> | 2015-02-13 16:03:24 -0800 |
| commit | 34d758d1b0e2de1cb36f7f9d757c7b65a2fb7772 (patch) | |
| tree | 371adc82072aa8ad13895ed9484a5c07776227af | |
| parent | c5cc89226093ef3ea39bb77b2196865b3a7bacf9 (diff) | |
| parent | 66f67fb5d5579c7a673f403c2f94100e72d30305 (diff) | |
| download | android_packages_apps_InCallUI-34d758d1b0e2de1cb36f7f9d757c7b65a2fb7772.tar.gz android_packages_apps_InCallUI-34d758d1b0e2de1cb36f7f9d757c7b65a2fb7772.tar.bz2 android_packages_apps_InCallUI-34d758d1b0e2de1cb36f7f9d757c7b65a2fb7772.zip | |
Merge CAF branch 'caf/LA.BR.1.2.1_rb2.17' into caf/cm-12.0.
Conflicts:
res/values-zh-rCN/strings.xml
Change-Id: Iad7d7a5af0334a1cf21890a1597b84faefc5fdbf
36 files changed, 1796 insertions, 31 deletions
diff --git a/res/drawable-hdpi/rcs_default_enhance_screen.png b/res/drawable-hdpi/rcs_default_enhance_screen.png Binary files differnew file mode 100644 index 00000000..f4893956 --- /dev/null +++ b/res/drawable-hdpi/rcs_default_enhance_screen.png diff --git a/res/drawable-hdpi/rcs_incall_message.png.png b/res/drawable-hdpi/rcs_incall_message.png.png Binary files differnew file mode 100644 index 00000000..fef52d7b --- /dev/null +++ b/res/drawable-hdpi/rcs_incall_message.png.png diff --git a/res/drawable-hdpi/rcs_incall_message_count.png b/res/drawable-hdpi/rcs_incall_message_count.png Binary files differnew file mode 100644 index 00000000..76683b92 --- /dev/null +++ b/res/drawable-hdpi/rcs_incall_message_count.png diff --git a/res/drawable-mdpi/rcs_default_enhance_screen.png b/res/drawable-mdpi/rcs_default_enhance_screen.png Binary files differnew file mode 100644 index 00000000..8600a9e0 --- /dev/null +++ b/res/drawable-mdpi/rcs_default_enhance_screen.png diff --git a/res/drawable-mdpi/rcs_incall_message.png.png b/res/drawable-mdpi/rcs_incall_message.png.png Binary files differnew file mode 100644 index 00000000..aae12db5 --- /dev/null +++ b/res/drawable-mdpi/rcs_incall_message.png.png diff --git a/res/drawable-mdpi/rcs_incall_message_count.png b/res/drawable-mdpi/rcs_incall_message_count.png Binary files differnew file mode 100644 index 00000000..dad888c7 --- /dev/null +++ b/res/drawable-mdpi/rcs_incall_message_count.png diff --git a/res/drawable-xhdpi/rcs_default_enhance_screen.png b/res/drawable-xhdpi/rcs_default_enhance_screen.png Binary files differnew file mode 100644 index 00000000..2c110b05 --- /dev/null +++ b/res/drawable-xhdpi/rcs_default_enhance_screen.png diff --git a/res/drawable-xhdpi/rcs_incall_message.png b/res/drawable-xhdpi/rcs_incall_message.png Binary files differnew file mode 100644 index 00000000..b5cd1423 --- /dev/null +++ b/res/drawable-xhdpi/rcs_incall_message.png diff --git a/res/drawable-xhdpi/rcs_incall_message_count.png b/res/drawable-xhdpi/rcs_incall_message_count.png Binary files differnew file mode 100644 index 00000000..96839fb4 --- /dev/null +++ b/res/drawable-xhdpi/rcs_incall_message_count.png diff --git a/res/drawable-xxhdpi/rcs_default_enhance_screen.png b/res/drawable-xxhdpi/rcs_default_enhance_screen.png Binary files differnew file mode 100644 index 00000000..84adb64b --- /dev/null +++ b/res/drawable-xxhdpi/rcs_default_enhance_screen.png diff --git a/res/drawable-xxhdpi/rcs_incall_message.png b/res/drawable-xxhdpi/rcs_incall_message.png Binary files differnew file mode 100644 index 00000000..b094e7c5 --- /dev/null +++ b/res/drawable-xxhdpi/rcs_incall_message.png diff --git a/res/drawable-xxhdpi/rcs_incall_message_count.png b/res/drawable-xxhdpi/rcs_incall_message_count.png Binary files differnew file mode 100644 index 00000000..27c7ab72 --- /dev/null +++ b/res/drawable-xxhdpi/rcs_incall_message_count.png diff --git a/res/drawable-xxxhdpi/rcs_default_enhance_screen.png b/res/drawable-xxxhdpi/rcs_default_enhance_screen.png Binary files differnew file mode 100644 index 00000000..2496111b --- /dev/null +++ b/res/drawable-xxxhdpi/rcs_default_enhance_screen.png diff --git a/res/drawable-xxxhdpi/rcs_incall_message.png b/res/drawable-xxxhdpi/rcs_incall_message.png Binary files differnew file mode 100644 index 00000000..b5cd1423 --- /dev/null +++ b/res/drawable-xxxhdpi/rcs_incall_message.png diff --git a/res/drawable-xxxhdpi/rcs_incall_message_count.png b/res/drawable-xxxhdpi/rcs_incall_message_count.png Binary files differnew file mode 100644 index 00000000..287895bd --- /dev/null +++ b/res/drawable-xxxhdpi/rcs_incall_message_count.png diff --git a/res/layout/primary_call_info.xml b/res/layout/primary_call_info.xml index 1f3b9549..219b64f8 100644 --- a/res/layout/primary_call_info.xml +++ b/res/layout/primary_call_info.xml @@ -73,18 +73,43 @@ android:ellipsize="end" /> </LinearLayout> - <!-- Name (or the phone number, if we don't have a name to display). --> - <com.android.phone.common.widget.ResizingTextTextView android:id="@+id/name" - xmlns:ex="http://schemas.android.com/apk/res-auto" + <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="-5dp" - android:fontFamily="sans-serif-light" - android:textAppearance="?android:attr/textAppearanceLarge" - android:textSize="@dimen/call_name_text_size" - android:singleLine="true" - ex:resizing_text_min_size="@dimen/call_name_text_min_size" /> - + android:gravity="center_vertical" + android:orientation="horizontal" > + <!-- Name (or the phone number, if we don't have a name to display). --> + <com.android.phone.common.widget.ResizingTextTextView android:id="@+id/name" + xmlns:ex="http://schemas.android.com/apk/res-auto" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@+id/sendMessage" + android:fontFamily="sans-serif-light" + android:textAppearance="?android:attr/textAppearanceLarge" + android:textSize="@dimen/call_name_text_size" + android:singleLine="true" + ex:resizing_text_min_size="@dimen/call_name_text_min_size" /> + + <LinearLayout + android:id="@+id/sendMessage" + android:layout_width="30dp" + android:layout_height="30dp" + android:layout_alignParentRight="true" + android:layout_centerInParent="true" + android:gravity="center" > + + <TextView + android:id="@+id/unreadMessageCount" + android:layout_width="16dp" + android:layout_height="16dp" + android:background="@drawable/rcs_incall_message" + android:gravity="center" + android:textColor="#0085d3" + android:textSize="12sp" + android:textStyle="bold" /> + </LinearLayout> + </RelativeLayout> <LinearLayout android:layout_width="match_parent" diff --git a/res/layout/rcs_call_card_content.xml b/res/layout/rcs_call_card_content.xml new file mode 100644 index 00000000..0acf149c --- /dev/null +++ b/res/layout/rcs_call_card_content.xml @@ -0,0 +1,214 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. +--> + +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <!-- The main content of the CallCard is either one or two "call info" + blocks, depending on whether one or two lines are in use. + + The call_info blocks are stacked vertically inside a CallCard (LinearLayout), + each with layout_weight="1". If only one line is in use (i.e. the + common case) then the 2nd call info will be GONE and thus the 1st one + will expand to fill the full height of the CallCard. --> + + <!-- Primary "call card" block, for the foreground call. --> + <LinearLayout + android:id="@+id/primary_call_info_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:elevation="@dimen/primary_call_elevation" + android:layout_centerHorizontal="true" + android:background="@color/incall_call_banner_background_color" + android:paddingTop="@dimen/call_banner_primary_call_container_top_padding" + android:clipChildren="false" + android:clipToPadding="false"> + + <include layout="@layout/rcs_primary_call_info" /> + + <fragment android:name="com.android.incallui.CallButtonFragment" + android:id="@+id/callButtonFragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + <TextView android:id="@+id/connectionServiceMessage" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceMedium" + android:visibility="gone" + android:padding="@dimen/call_banner_side_padding" + android:background="@android:color/white" /> + + </LinearLayout> + + <!-- More menu overflow button for call recording, blacklisting + only visible during the call. It sits above the primary call info + container in the top-right hand corner. --> + <ImageButton + android:id="@+id/moreMenuButton" + style="@style/InCallButton" + android:paddingTop="16dp" + android:paddingRight="16dp" + android:layout_width="40dp" + android:layout_height="40dp" + android:background="@drawable/overflow_thumbnail" + android:layout_alignParentRight="true" + android:layout_alignParentTop="true" + android:elevation="@dimen/primary_call_overflow_elevation" + android:rotation="90" + android:contentDescription="@string/onscreenMoreMenuText"/> + + <!-- Contact photo for primary call info --> + <FrameLayout + android:layout_below="@id/primary_call_info_container" + android:id="@+id/rcs_enhanced_screen" + android:layout_width="match_parent" + android:layout_height="match_parent" + > + <include layout="@layout/rcs_enhanced_screen_framement"/> + </FrameLayout> + <!-- Call recorder info --> + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentBottom="true"> + + <TextView android:id="@+id/recordingIcon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_marginLeft="24dp" + android:paddingBottom="119dp" + android:drawableRight="@drawable/ic_recording_indicator" + android:visibility="invisible" /> + + <TextView android:id="@+id/recordingTime" + android:text="@string/recording_time_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/recordingIcon" + android:layout_marginLeft="5dp" + android:paddingBottom="120dp" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_text_color" + android:visibility="invisible" + android:singleLine="true"/> + </RelativeLayout> + + <fragment android:name="com.android.incallui.VideoCallFragment" + android:id="@+id/videoCallFragment" + android:layout_alignParentTop="true" + android:layout_gravity="top|center_horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + + <!-- Progress spinner, useful for indicating pending operations such as upgrade to video. --> + <FrameLayout + android:id="@+id/progressSpinner" + android:layout_below="@id/primary_call_info_container" + android:background="#63000000" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layout_centerHorizontal="true" + android:layout_centerVertical="true" + android:visibility="gone"> + + <ProgressBar + android:id="@+id/progress_bar" + style="@android:style/Widget.Material.ProgressBar" + android:layout_gravity="center" + android:layout_width="48dp" + android:layout_height="48dp" + android:indeterminate="true" /> + </FrameLayout> + + <!-- Secondary "Call info" block, for the background ("on hold") call. --> + <include layout="@layout/secondary_call_info" /> + + <include layout="@layout/manage_conference_call_button" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignTop="@id/rcs_enhanced_screen" /> + + <!-- Volume boost and Volume enhancements in-call UI --> + <ImageButton android:id="@+id/volumeBoost" + android:layout_below="@id/primary_call_info_container" + android:layout_width="80dp" + android:layout_height="80dp" + android:visibility="invisible" + android:soundEffectsEnabled="false" + android:background="@drawable/vb_normal"/> + + <!-- SwitchCameraButton in-call UI --> + <ImageButton android:id="@+id/switchCamera" + android:layout_below="@id/primary_call_info_container" + android:layout_marginTop="24dp" + android:layout_marginLeft="24dp" + android:layout_width="30dp" + android:layout_height="30dp" + android:visibility="invisible" + android:soundEffectsEnabled="false" + android:background="@drawable/ic_toolbar_video_switch"/> + + <!-- Placeholder for the dialpad which is replaced with the dialpad fragment when shown. --> + <FrameLayout + android:id="@+id/dialpadFragmentContainer" + android:layout_below="@id/primary_call_info_container" + android:layout_gravity="bottom|center_horizontal" + android:layout_alignParentBottom="true" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:elevation="@dimen/dialpad_elevation" /> + + <fragment android:name="com.android.incallui.AnswerFragment" + android:id="@+id/answerFragment" + android:layout_below="@id/primary_call_info_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="bottom|center_horizontal" + android:layout_marginBottom="@dimen/glowpadview_margin_bottom" + android:visibility="gone" /> + + <FrameLayout + android:id="@+id/floating_end_call_action_button_container" + android:layout_width="@dimen/end_call_floating_action_button_diameter" + android:layout_height="@dimen/end_call_floating_action_button_diameter" + android:background="@drawable/fab_red" + android:layout_centerHorizontal="true" + android:layout_marginBottom="@dimen/end_call_button_margin_bottom" + android:layout_alignParentBottom="true" > + + <ImageButton android:id="@+id/floating_end_call_action_button" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/end_call_background" + android:src="@drawable/fab_ic_end_call" + android:scaleType="center" + android:contentDescription="@string/onscreenEndCallText" /> + + </FrameLayout> + +</RelativeLayout> diff --git a/res/layout/rcs_enhanced_screen_framement.xml b/res/layout/rcs_enhanced_screen_framement.xml new file mode 100644 index 00000000..c4f513e9 --- /dev/null +++ b/res/layout/rcs_enhanced_screen_framement.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/textlayout"> + + <TextView + android:id="@+id/greeting" + android:layout_width="380dp" + android:layout_height="wrap_content" + android:background="@android:color/black" + android:ellipsize="marquee" + android:focusable="true" + android:focusableInTouchMode="true" + android:gravity="center" + android:marqueeRepeatLimit="marquee_forever" + android:scrollHorizontally="true" + android:singleLine="true" + android:textColor="@android:color/white" + android:textSize="@dimen/call_label_text_size" /> + <TextView + android:id="@+id/missdnaddress" + android:layout_width="380dp" + android:layout_height="wrap_content" + android:layout_below="@id/greeting" + android:background="@android:color/black" + android:ellipsize="marquee" + android:focusable="true" + android:focusableInTouchMode="true" + android:gravity="center" + android:marqueeRepeatLimit="marquee_forever" + android:scrollHorizontally="true" + android:singleLine="true" + android:textColor="@android:color/white" + android:textSize="@dimen/call_label_text_size"/> + </RelativeLayout> + <!-- Contact photo for primary call info --> + <!-- android:scaleType="centerCrop" --> + + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_below="@id/textlayout"> + + <SurfaceView + android:id="@+id/surface" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center" > + </SurfaceView> + + <com.android.incallui.GifMovieView + android:id="@+id/incallgifview" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center_horizontal" + android:enabled="false" + android:scaleType="centerCrop" /> + + <ImageView + android:id="@+id/rcs_photo" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center_vertical" + android:background="@android:color/white" + android:contentDescription="@string/contactPhoto" + android:gravity="top|center_horizontal" + android:scaleType="centerCrop" + android:src="@drawable/rcs_default_enhance_screen" /> + </FrameLayout> + </RelativeLayout> + +</FrameLayout> diff --git a/res/layout/rcs_primary_call_info.xml b/res/layout/rcs_primary_call_info.xml new file mode 100644 index 00000000..ed188488 --- /dev/null +++ b/res/layout/rcs_primary_call_info.xml @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. +--> +<!-- + "Call Banner" for primary call, the foregound or ringing call. The "call banner" is a block + of info about a single call, including the contact name, phone number, call time counter, and + other status info. This info is shown as a "banner" overlaid across the top of contact photo. +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/primary_call_banner" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:animateLayoutChanges="true" + android:clipChildren="false" + android:clipToPadding="false" + android:gravity="center" + android:minHeight="@dimen/call_banner_height" + android:orientation="vertical" + android:paddingEnd="@dimen/call_banner_side_padding" + android:paddingStart="@dimen/call_banner_side_padding" > + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" > + + <!-- Contact photo for primary call info --> + + <ImageView + android:id="@+id/photo" + android:layout_width="48dp" + android:layout_height="48dp" + android:layout_below="@id/primary_call_info_container" + android:layout_gravity="center_vertical" + android:background="@android:color/white" + android:contentDescription="@string/contactPhoto" + android:gravity="top|center_horizontal" + android:scaleType="centerCrop" + android:src="@drawable/img_no_image_automirrored" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="10dp" + android:orientation="vertical" > + + <LinearLayout + android:id="@+id/callStateButton" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:clipChildren="false" + android:clipToPadding="false" + android:orientation="horizontal" > + + <!-- Subscription provider or WiFi calling icon displayed to the left of the label --> + + <ImageView + android:id="@+id/callStateIcon" + android:layout_width="16dp" + android:layout_height="16dp" + android:layout_marginEnd="4dp" + android:alpha="0.0" + android:baselineAlignBottom="true" + android:scaleType="centerInside" + android:tint="@color/incall_accent_color" + android:visibility="gone" /> + + <ImageView + android:id="@+id/videoCallIcon" + android:layout_width="16dp" + android:layout_height="16dp" + android:layout_marginEnd="4dp" + android:baselineAlignBottom="true" + android:scaleType="centerInside" + android:src="@drawable/ic_toolbar_video" + android:tint="@color/incall_accent_color" + android:visibility="gone" /> + + <TextView + android:id="@+id/callStateLabel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:alpha="0.7" + android:ellipsize="end" + android:gravity="start" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_accent_color" + android:textSize="18sp" /> + </LinearLayout> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="-5dp" + android:gravity="center_vertical" + android:orientation="horizontal" > + + <!-- Name (or the phone number, if we don't have a name to display). --> + <com.android.phone.common.widget.ResizingTextTextView android:id="@+id/name" + xmlns:ex="http://schemas.android.com/apk/res-auto" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="-5dp" + android:fontFamily="sans-serif-light" + android:layout_toLeftOf="@+id/sendMessage" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textSize="@dimen/call_name_text_size" + android:singleLine="true" + ex:resizing_text_min_size="@dimen/call_name_text_min_size" /> + + <LinearLayout + android:id="@+id/sendMessage" + android:layout_alignParentRight="true" + android:layout_width="30dp" + android:layout_height="30dp" + android:layout_centerInParent="true" + android:gravity="center" > + + <TextView + android:id="@+id/unreadMessageCount" + android:layout_width="16dp" + android:layout_height="16dp" + android:background="@drawable/rcs_incall_message" + android:gravity="center" + android:textColor="#0085d3" + android:textSize="12sp" + android:textStyle="bold" /> + </LinearLayout> + </RelativeLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:clipChildren="false" + android:clipToPadding="false" + android:orientation="horizontal" > + + <!-- Label (like "Mobile" or "Work", if present) and phone number, side by side --> + + <LinearLayout + android:id="@+id/labelAndNumber" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:orientation="horizontal" > + + <TextView + android:id="@+id/label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_subtext_color" + android:textDirection="ltr" + android:textSize="@dimen/call_label_text_size" /> + + <TextView + android:id="@+id/phoneNumber" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="6dp" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_subtext_color" + android:textSize="@dimen/call_label_text_size" /> + </LinearLayout> + </LinearLayout> + </LinearLayout> + <!-- Elapsed time indication for a call in progress. --> + + <TextView + android:id="@+id/elapsedTime" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_subtext_color" + android:textSize="@dimen/call_label_text_size" + android:visibility="gone" /> + </LinearLayout> + + <!-- + Call type indication: a special label and/or branding + for certain kinds of calls (like "SIP call" for a SIP call.) + --> + + <TextView + android:id="@+id/callTypeLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:maxLines="1" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_text_color" /> + +</LinearLayout> <!-- End of call_banner --> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 1208e56d..9a0b3f10 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -181,6 +181,9 @@ <string name="menu_add_call">添加通话</string> <string name="menu_merge_call">合并通话</string> <string name="incall_error_missing_voicemail_number">没有设置语音信箱,现在设置?</string> + <string name="display_rich_screen">显示增强屏显?</string> + <string name="rcs_missdnaddress_string">归属地:</string> + <string name="rcs_greeting_string">问候语:</string> <string name="change_video_message">升级到视频电话。你希望视频通话吗</string> <string name="modify_call_option_title">通话类型</string> <string name="modify_call_prompt_yes">是</string> diff --git a/res/values/rcs_attrs.xml b/res/values/rcs_attrs.xml new file mode 100644 index 00000000..3a01831f --- /dev/null +++ b/res/values/rcs_attrs.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. +--> + +<resources> + + <declare-styleable name="GifMoviewView"> + <attr name="gif" format="reference" /> + <attr name="paused" format="boolean" /> + </declare-styleable> + <declare-styleable name="CustomTheme"> + <attr name="gifMoviewViewStyle" format="reference" /> + </declare-styleable> + +</resources> diff --git a/res/values/rcs_styles.xml b/res/values/rcs_styles.xml new file mode 100644 index 00000000..a4c81658 --- /dev/null +++ b/res/values/rcs_styles.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. +--> + +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + + <style name="Widget.GifMoviewView" parent="@android:style/Widget"></style> + +</resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 12c9b424..b4fcd6ab 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -628,4 +628,7 @@ <string name="video_quality_low">Low</string> <!-- Video quality Unknown --> <string name="video_quality_unknown">Unknown</string> + <string name="display_rich_screen">Display rich screen ?</string> + <string name="rcs_missdnaddress_string">MissdnAddress:</string> + <string name="rcs_greeting_string">Gretting:</string> </resources> diff --git a/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java index 63cfb7b2..f8181b44 100644 --- a/src/com/android/incallui/Call.java +++ b/src/com/android/incallui/Call.java @@ -467,18 +467,18 @@ public final class Call { public long getSubId() { PhoneAccountHandle ph = getAccountHandle(); - - if (ph == null) { - return SubscriptionManager.INVALID_SUB_ID; - } - if (ph.getId() != null) { + if (ph != null) { try { - return Long.parseLong(getAccountHandle().getId()); + if (ph.getId() != null ) { + return Long.parseLong(getAccountHandle().getId()); + } } catch (NumberFormatException e) { - Log.w(this,"Sub Id is not a number " + e); + Log.w(this,"sub Id is Not a Number Exce:" + e); } + return SubscriptionManager.getDefaultVoiceSubId(); + } else { + return SubscriptionManager.INVALID_SUB_ID; } - return SubscriptionManager.getDefaultVoiceSubId(); } public VideoCall getVideoCall() { diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java index ad3efe2b..45948410 100644 --- a/src/com/android/incallui/CallButtonFragment.java +++ b/src/com/android/incallui/CallButtonFragment.java @@ -504,7 +504,6 @@ public class CallButtonFragment menu.findItem(R.id.overflow_resume_menu_item).setVisible( showHoldMenuOption && mHoldButton.isSelected()); menu.findItem(R.id.overflow_swap_menu_item).setVisible(showSwapMenuOption); - menu.findItem(R.id.menu_start_record).setVisible(true); menu.findItem(R.id.overflow_add_participant_menu_item).setVisible(showAddParticipantOption); menu.findItem(R.id.overflow_manage_conference_menu_item).setVisible( showManageConferenceVideoCallOption); @@ -837,6 +836,20 @@ public class CallButtonFragment @Override public void show() { + final Menu menu = getMenu(); + final MenuItem startRecord = menu.findItem(R.id.menu_start_record); + final MenuItem stopRecord = menu.findItem(R.id.menu_stop_record); + + boolean isRecording = ((InCallActivity)getActivity()).isCallRecording(); + boolean isRecordEnabled = ((InCallActivity)getActivity()).isCallRecorderEnabled(); + boolean startEnabled = !isRecording && isRecordEnabled; + boolean stopEnabled = isRecording && isRecordEnabled; + + startRecord.setVisible(startEnabled); + startRecord.setEnabled(startEnabled); + stopRecord.setVisible(stopEnabled); + stopRecord.setEnabled(stopEnabled); + super.show(); } } diff --git a/src/com/android/incallui/CallButtonPresenter.java b/src/com/android/incallui/CallButtonPresenter.java index 27b2c375..c0f282ba 100644 --- a/src/com/android/incallui/CallButtonPresenter.java +++ b/src/com/android/incallui/CallButtonPresenter.java @@ -33,6 +33,7 @@ import com.android.incallui.InCallPresenter.InCallDetailsListener; import android.content.DialogInterface; import android.telephony.PhoneNumberUtils; +import android.telephony.TelephonyManager; import com.android.internal.telephony.util.BlacklistUtils; import java.util.Objects; @@ -233,6 +234,11 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto } public void addParticipantClicked() { + if (getUi().getContext().getResources().getBoolean( + R.bool.add_multi_participants_enabled)){ + InCallPresenter.getInstance().sendAddMultiParticipantsIntent(); + return; + } InCallPresenter.getInstance().sendAddParticipantIntent(); } @@ -426,26 +432,34 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto final boolean showSwapOption = call.can(PhoneCapabilities.SWAP_CONFERENCE); final boolean showHoldOption = !showSwapOption && (enableHoldOption || supportHold); + boolean showRecordOption = + ((InCallActivity)((CallButtonFragment)ui).getActivity()).isCallRecorderEnabled(); + ui.setHold(call.getState() == Call.State.ONHOLD); - //Initialize buttonCount = 2. Because speaker and dialpad these two always show in Call UI. - int buttonCount = 2; + // Initialize buttonCount = 3. + // Because speaker and dialpad and mute these three always show in Call UI. + int buttonCount = 3; buttonCount += toInteger(canVideoCall); buttonCount += toInteger(showAddCallOption); buttonCount += toInteger(showMergeOption); buttonCount += toInteger(showAddParticipantOption); buttonCount += toInteger(showHoldOption); buttonCount += toInteger(showSwapOption); - buttonCount += toInteger(call.can(PhoneCapabilities.MUTE)); buttonCount += toInteger(showManageVideoCallConferenceOption); + buttonCount += toInteger(showRecordOption); Log.v(this, "show AddParticipant: " + showAddParticipantOption + " show ManageVideoCallConference: " + showManageVideoCallConferenceOption); Log.v(this, "No of InCall buttons: " + buttonCount + " canVideoCall: " + canVideoCall); - // Show overflow menu if number of buttons is greater than 5. - final boolean showOverflowMenu = - buttonCount > BUTTON_THRESOLD_TO_DISPLAY_OVERFLOW_MENU; + int phoneType = TelephonyManager.getDefault().getCurrentPhoneType(call.getSubId()); + int maxButtonCount = (TelephonyManager.PHONE_TYPE_CDMA != phoneType) ? + BUTTON_THRESOLD_TO_DISPLAY_OVERFLOW_MENU : + BUTTON_THRESOLD_TO_DISPLAY_OVERFLOW_MENU - 1; + + // Show overflow menu if number of buttons is greater than 5(4 in CDMA type). + final boolean showOverflowMenu = buttonCount > maxButtonCount; final boolean isVideoOverflowScenario = canVideoCall && showOverflowMenu; final boolean isOverflowScenario = !canVideoCall && showOverflowMenu; diff --git a/src/com/android/incallui/CallCardFragment.java b/src/com/android/incallui/CallCardFragment.java index 4b664177..2c69d546 100644 --- a/src/com/android/incallui/CallCardFragment.java +++ b/src/com/android/incallui/CallCardFragment.java @@ -31,6 +31,9 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.drawable.Drawable; @@ -39,6 +42,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.provider.Settings; +import android.provider.Telephony.Sms; import android.telecom.DisconnectCause; import android.telecom.VideoProfile; import android.telephony.PhoneNumberUtils; @@ -50,6 +54,7 @@ import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; +import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLayoutChangeListener; @@ -70,6 +75,7 @@ import android.widget.Toast; import android.telecom.AudioState; import android.telecom.VideoProfile; +import com.android.incallui.RcsApiManager; import com.android.contacts.common.widget.FloatingActionButtonController; import com.android.internal.telephony.util.BlacklistUtils; import com.android.phone.common.animation.AnimUtils; @@ -102,6 +108,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private View mCallNumberAndLabel; private ImageView mPhoto; private TextView mElapsedTime; + private View mSendMessageView; + private TextView mUnreadMessageCount; private ImageButton mMoreMenuButton; private MorePopupMenu mMoreMenu; @@ -160,6 +168,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private static final int MESSAGE_TIMER = 1; private InCallActivity mInCallActivity; + // for RCS + private RcsRichScreen mRcsRichScreen = null; + private boolean misEhanceScreenApkInstalled = false; + private static final String ENHANCE_SCREEN_APK_NAME = "com.cmdm.rcs"; + //RCS end private static final int DEFAULT_VIEW_OFFSET_Y = 0; @@ -198,7 +211,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr getActivity().registerReceiver(recorderStateReceiver, filter); mInCallActivity = (InCallActivity)getActivity(); - + misEhanceScreenApkInstalled = isEnhanceScreenInstalled(); if (mInCallActivity.isCallRecording()) { recorderHandler.sendEmptyMessage(MESSAGE_TIMER); } @@ -222,8 +235,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mDensity = getResources().getDisplayMetrics().density; mTranslationOffset = getResources().getDimensionPixelSize(R.dimen.call_card_anim_translate_y_offset); - - return inflater.inflate(R.layout.call_card_content, container, false); + if(!isRcsAvailable()){ + return inflater.inflate(R.layout.call_card_content, container, false); + } else { + return inflater.inflate(R.layout.rcs_call_card_content, container, false); + } } @Override @@ -251,6 +267,28 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mInCallMessageLabel = (TextView) view.findViewById(R.id.connectionServiceMessage); mProgressSpinner = view.findViewById(R.id.progressSpinner); + if(isRcsAvailable()){ + TextView rcsmissdnAddress = (TextView)view.findViewById(R.id.missdnaddress); + TextView rcsgreeting = (TextView)view.findViewById(R.id.greeting); + SurfaceView rcssurface = (SurfaceView)view.findViewById(R.id.surface); + ImageView rcsPhoto = (ImageView) view.findViewById(R.id.rcs_photo); + GifMovieView rcsGifMovieView = (GifMovieView) view.findViewById(R.id.incallgifview); + mRcsRichScreen = new RcsRichScreen(getActivity(), + rcsPhoto,rcsgreeting,rcsmissdnAddress,rcsGifMovieView,rcssurface); + } + if (RcsApiManager.isRcsServiceInstalled()) { + mSendMessageView = view.findViewById(R.id.sendMessage); + mSendMessageView.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + getPresenter().sendSmsClicked(); + } + }); + mUnreadMessageCount = (TextView) view.findViewById(R.id.unreadMessageCount); + updateUnReadSmsCount(); + } else { + mSendMessageView = view.findViewById(R.id.sendMessage); + mSendMessageView.setVisibility(View.GONE); + } mMoreMenuButton = (ImageButton) view.findViewById(R.id.moreMenuButton); final ContextThemeWrapper contextWrapper = new ContextThemeWrapper(getActivity(), R.style.InCallPopupMenuStyle); @@ -268,7 +306,6 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } }); - mFloatingActionButtonContainer = view.findViewById( R.id.floating_end_call_action_button_container); mFloatingActionButton = (ImageButton) view.findViewById( @@ -320,6 +357,21 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } mRecordingTimeLabel = (TextView) view.findViewById(R.id.recordingTime); mRecordingIcon = (TextView) view.findViewById(R.id.recordingIcon); + + IntentFilter filter = new IntentFilter(); + filter.addAction(Sms.Intents.SMS_RECEIVED_ACTION); + mInCallActivity.registerReceiver(mSmsReceiver, filter); + } + + private void updateUnReadSmsCount() { + int unRead = getPresenter().getUnReadMessageCount(mInCallActivity); + Log.d("RCS_UI", "CallCardFragment: updateUnReadMessageCount(" + unRead + ")"); + setUnReadMessageCount(unRead); + } + + public void onDestroyView() { + mInCallActivity.unregisterReceiver(mSmsReceiver); + super.onDestroyView(); } @Override @@ -448,6 +500,16 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr }); } + public void setUnReadMessageCount(int count) { + if (count > 0) { + mUnreadMessageCount.setBackgroundResource(R.drawable.rcs_incall_message_count); + mUnreadMessageCount.setText(String.valueOf(count)); + } else { + mUnreadMessageCount.setBackgroundResource(R.drawable.rcs_incall_message); + mUnreadMessageCount.setText(""); + } + } + /** * Determines the amount of space below the call card for portrait layouts), or beside the * call card for landscape layouts. @@ -530,7 +592,15 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr setPrimaryLabel(label); showCallTypeLabel(isSipCall, isForwarded); - + if(isRcsAvailable()){ + String rcsnumber = null; + if(!nameIsNumber){ + rcsnumber = number; + } else { + rcsnumber = name; + } + mRcsRichScreen.setNumber(rcsnumber); + } setDrawableToImageView(mPhoto, photo); } @@ -591,6 +661,10 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr // Nothing to do if the labels are the same return; } + // update Rcs RichScreen by call state + if(isRcsAvailable()){ + mRcsRichScreen.updateRichScreenByCallState(state,videoState); + } // Update the call state label and icon. if (!TextUtils.isEmpty(callStateLabel)) { @@ -1003,6 +1077,10 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr updateFabPosition(); } }); + if (RcsApiManager.isRcsServiceInstalled()) { + updateUnReadSmsCount(); + } + misEhanceScreenApkInstalled = isEnhanceScreenInstalled(); } /** @@ -1407,6 +1485,30 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr Toast.LENGTH_SHORT).show(); } + // RCS support start + private boolean isRcsAvailable() { + return RcsApiManager.isRcsServiceInstalled() + && RcsApiManager.isRcsOnline() && misEhanceScreenApkInstalled; + } + + private boolean isEnhanceScreenInstalled() { + boolean installed = false; + try { + ApplicationInfo info = getActivity().getPackageManager().getApplicationInfo( + ENHANCE_SCREEN_APK_NAME, PackageManager.GET_PROVIDERS); + installed = (info != null); + } catch (NameNotFoundException e) { + } + Log.i(this, "Is Enhance Screen installed ? " + installed); + return installed; + } + + private BroadcastReceiver mSmsReceiver = new BroadcastReceiver() { + public void onReceive(Context context, Intent data) { + updateUnReadSmsCount(); + }; + }; + private class MorePopupMenu extends PopupMenu implements PopupMenu.OnMenuItemClickListener { public MorePopupMenu(Context context, View anchor) { super(context, anchor); diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java index ba345ebb..4f17d50f 100644 --- a/src/com/android/incallui/CallCardPresenter.java +++ b/src/com/android/incallui/CallCardPresenter.java @@ -884,4 +884,30 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> videoCall.requestCameraCapabilities(); } } + + public void sendSmsClicked() { + String number; + if (mPrimary != null) { + number = mPrimary.getNumber(); + Log.d("RCS_UI", "sendSmsClicked: number=" + number); + } else { + number = null; + } + if (number == null) { + RcsSendSmsUtils.startSendSmsActivity(mContext); + } else { + RcsSendSmsUtils.startSendSmsActivity(mContext, new String[] { number }); + } + } + + public int getUnReadMessageCount(Context context) { + String phoneNumber; + if (mPrimary != null) { + phoneNumber = mPrimary.getNumber(); + } else { + phoneNumber = null; + } + return RcsSendSmsUtils.getUnReadMessageCount(context, phoneNumber); + } + } diff --git a/src/com/android/incallui/CallList.java b/src/com/android/incallui/CallList.java index e5c0d385..e9217b4a 100644 --- a/src/com/android/incallui/CallList.java +++ b/src/com/android/incallui/CallList.java @@ -684,7 +684,7 @@ public class CallList implements InCallPhoneListener { return true; } } catch (NumberFormatException e) { - Log.w(this,"Sub Id is not a number " + e); + Log.w(this,"Sub Id is not a number Exce:" +e); } } Log.i(this, "no active call "); diff --git a/src/com/android/incallui/GifMovieView.java b/src/com/android/incallui/GifMovieView.java new file mode 100644 index 00000000..7ed49ba3 --- /dev/null +++ b/src/com/android/incallui/GifMovieView.java @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +package com.android.incallui; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Movie; +import android.os.Build; +import android.util.AttributeSet; +import android.view.View; +import android.util.Log; + +public class GifMovieView extends View { + + private static final int DEFAULT_MOVIEW_DURATION = 1000; + private static final String TAG = "GifMovieView"; + private int mMovieResourceId; + private String mMovieString; + private Movie mMovie; + private long mMovieStart; + private int mCurrentAnimationTime = 0; + private float mLeft; + private float mTop; + private float mScale; + private int mMeasuredMovieWidth; + private int mMeasuredMovieHeight; + private volatile boolean mPaused = false; + private boolean mVisible = true; + + public GifMovieView(Context context) { + this(context, null); + } + + public GifMovieView(Context context, AttributeSet attrs) { + this(context, attrs, R.styleable.CustomTheme_gifMoviewViewStyle); + } + + public GifMovieView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + setViewAttributes(context, attrs, defStyle); + } + + @SuppressLint("NewApi") + private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) { + + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + setLayerType(View.LAYER_TYPE_SOFTWARE, null); + } + + final TypedArray array = context.obtainStyledAttributes(attrs, + R.styleable.GifMoviewView, defStyle, + R.style.Widget_GifMoviewView); + + mMovieResourceId = array.getResourceId(R.styleable.GifMoviewView_gif, -1); + mPaused = array.getBoolean(R.styleable.GifMoviewView_paused, false); + + array.recycle(); + + if (mMovieResourceId != -1) { + mMovie = Movie.decodeFile(mMovieString); + } + } + + public void setMovieResource(String path) { + this.mMovieString = path; + Log.d(TAG,path); + BufferedInputStream is = null; + try { + is = new BufferedInputStream(new FileInputStream(path)); + } catch (FileNotFoundException e) { + Log.d(TAG,"FileNotFoundException"); + e.printStackTrace(); + } + Log.d(TAG,is.toString()); + mMovie = Movie.decodeStream(is); + requestLayout(); + } + + + public void setMovie(Movie movie) { + this.mMovie = movie; + requestLayout(); + } + + public Movie getMovie() { + return mMovie; + } + + public void setMovieTime(int time) { + mCurrentAnimationTime = time; + invalidate(); + } + + public void setPaused(boolean paused) { + this.mPaused = paused; + + + if (!paused) { + mMovieStart = android.os.SystemClock.uptimeMillis() - mCurrentAnimationTime; + } + + invalidate(); + } + + public boolean isPaused() { + return this.mPaused; + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + + if (mMovie != null) { + int movieWidth = mMovie.width(); + int movieHeight = mMovie.height(); + + /* + * Calculate horizontal scaling + */ + float scaleH = 1f; + int measureModeWidth = MeasureSpec.getMode(widthMeasureSpec); + + if (measureModeWidth != MeasureSpec.UNSPECIFIED) { + int maximumWidth = MeasureSpec.getSize(widthMeasureSpec); + if (movieWidth > maximumWidth) { + scaleH = (float) movieWidth / (float) maximumWidth; + } + } + + /* + * calculate vertical scaling + */ + float scaleW = 1f; + int measureModeHeight = MeasureSpec.getMode(heightMeasureSpec); + + if (measureModeHeight != MeasureSpec.UNSPECIFIED) { + int maximumHeight = MeasureSpec.getSize(heightMeasureSpec); + if (movieHeight > maximumHeight) { + scaleW = (float) movieHeight / (float) maximumHeight; + } + } + + /* + * calculate overall scale + */ + mScale = 2.3f / Math.max(scaleH, scaleW); + + mMeasuredMovieWidth = (int) (movieWidth * mScale); + mMeasuredMovieHeight = (int) (movieHeight * mScale); + + setMeasuredDimension(mMeasuredMovieWidth, mMeasuredMovieHeight); + + } else { + /* + * No movie set, just set minimum available size. + */ + setMeasuredDimension(getSuggestedMinimumWidth(), getSuggestedMinimumHeight()); + } + } + + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + super.onLayout(changed, l, t, r, b); + + /* + * Calculate left / top for drawing in center + */ + mLeft = (getWidth() - mMeasuredMovieWidth) / 2f; + mTop = (getHeight() - mMeasuredMovieHeight) / 2f; + mVisible = getVisibility() == View.VISIBLE; + } + + @Override + protected void onDraw(Canvas canvas) { + if (mMovie != null) { + if (!mPaused) { + updateAnimationTime(); + drawMovieFrame(canvas); + invalidateView(); + } else { + drawMovieFrame(canvas); + } + } + } + + @SuppressLint("NewApi") + private void invalidateView() { + if(mVisible) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + postInvalidateOnAnimation(); + } else { + invalidate(); + } + } + } + + + private void updateAnimationTime() { + long now = android.os.SystemClock.uptimeMillis(); + + if (mMovieStart == 0) { + mMovieStart = now; + } + + int dur = mMovie.duration(); + + if (dur == 0) { + dur = DEFAULT_MOVIEW_DURATION; + } + + mCurrentAnimationTime = (int) ((now - mMovieStart) % dur); + } + + + private void drawMovieFrame(Canvas canvas) { + + mMovie.setTime(mCurrentAnimationTime); + + canvas.save(Canvas.MATRIX_SAVE_FLAG); + canvas.scale(mScale, mScale); + mMovie.draw(canvas, mLeft / mScale, mTop / mScale); + canvas.restore(); + } + + @SuppressLint("NewApi") + @Override + public void onScreenStateChanged(int screenState) { + super.onScreenStateChanged(screenState); + mVisible = screenState == SCREEN_STATE_ON; + invalidateView(); + } + + @SuppressLint("NewApi") + @Override + protected void onVisibilityChanged(View changedView, int visibility) { + super.onVisibilityChanged(changedView, visibility); + mVisible = visibility == View.VISIBLE; + invalidateView(); + } + + @Override + protected void onWindowVisibilityChanged(int visibility) { + super.onWindowVisibilityChanged(visibility); + mVisible = visibility == View.VISIBLE; + invalidateView(); + } +} diff --git a/src/com/android/incallui/InCallApp.java b/src/com/android/incallui/InCallApp.java index 414c3203..a0bdd43a 100644 --- a/src/com/android/incallui/InCallApp.java +++ b/src/com/android/incallui/InCallApp.java @@ -47,6 +47,7 @@ public class InCallApp extends Application { "com.android.incallui.ACTION_DECLINE_VIDEO_UPGRADE_REQUEST"; public static final String ADD_CALL_MODE_KEY = "add_call_mode"; public static final String ADD_PARTICIPANT_KEY = "add_participant"; + public static final String CURRENT_PARTICIPANT_LIST = "current_participant_list"; public InCallApp() { } diff --git a/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java index e243b7e1..caef6e60 100644 --- a/src/com/android/incallui/InCallPresenter.java +++ b/src/com/android/incallui/InCallPresenter.java @@ -1131,6 +1131,33 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } } + public void sendAddMultiParticipantsIntent() { + Intent intent = new Intent("android.intent.action.ADDPARTICIPANT"); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtra(InCallApp.ADD_PARTICIPANT_KEY, true); + + Call call = mCallList.getActiveOrBackgroundCall(); + List<String> childCallIdList = call.getChildCallIds(); + if (childCallIdList != null) { + StringBuffer sb = new StringBuffer(); + for (int k=0; k<childCallIdList.size(); k++) { + String tmp = childCallIdList.get(k); + String number = CallList.getInstance() + .getCallById(tmp).getNumber(); + sb.append(number).append(";"); + } + Log.d(this, "sendAddMultiParticipantsIntent, numbers " + sb.toString()); + intent.putExtra(InCallApp.CURRENT_PARTICIPANT_LIST, sb.toString()); + } else { + Log.e(this, "sendAddMultiParticipantsIntent, childCallIdList null."); + } + try { + mContext.startActivity(intent); + } catch (ActivityNotFoundException e) { + Log.e(this, "Activity for adding calls isn't found."); + } + } + /** * Retrieves the current in-call camera manager instance, creating if necessary. * diff --git a/src/com/android/incallui/RcsApiManager.java b/src/com/android/incallui/RcsApiManager.java new file mode 100644 index 00000000..64fdacd5 --- /dev/null +++ b/src/com/android/incallui/RcsApiManager.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +package com.android.incallui; + +import android.content.Context; +import android.os.RemoteException; +import android.util.Log; +import com.suntek.mway.rcs.client.api.autoconfig.RcsAccountApi; +import com.suntek.mway.rcs.client.api.capability.impl.CapabilityApi; +import com.suntek.mway.rcs.client.api.impl.groupchat.ConfApi; +import com.suntek.mway.rcs.client.api.support.RcsSupportApi; +import com.suntek.mway.rcs.client.api.RCSServiceListener; +import com.suntek.mway.rcs.client.api.util.ServiceDisconnectedException; +import com.suntek.mway.rcs.client.api.voip.impl.RichScreenApi; + +public class RcsApiManager { + private static boolean mIsRcsServiceInstalled; + private static String TAG = "InCallUI_RcsApiManager"; + private static ConfApi mConfApi = new ConfApi(); + private static RcsAccountApi mRcsAccountApi = new RcsAccountApi(); + private static CapabilityApi mCapabilityApi = new CapabilityApi(); + private static RichScreenApi mRichScreenApi = new RichScreenApi(null); + public static Context mContext; + public static void init(Context context) { + mContext = context; + Log.d(TAG, "RCS init"); + mIsRcsServiceInstalled = RcsSupportApi.isRcsServiceInstalled(context); + if (!mIsRcsServiceInstalled) { + Log.d(TAG, "mIsRcsServiceInstalled" + mIsRcsServiceInstalled); + return; + } + + mRcsAccountApi.init(context, new RCSServiceListener() { + @Override + public void onServiceDisconnected() throws RemoteException { + Log.d(TAG, "RcsAccountApi disconnected"); + } + + @Override + public void onServiceConnected() throws RemoteException { + Log.d(TAG, "RcsAccountApi connected"); + } + }); + + mConfApi.init(context, new RCSServiceListener() { + public void onServiceDisconnected() throws RemoteException { + Log.d(TAG, "ConfApi connected"); + } + + public void onServiceConnected() throws RemoteException { + Log.d(TAG, "ConfApi connected"); + } + }); + mRichScreenApi.init(context, new RCSServiceListener() { + public void onServiceDisconnected() throws RemoteException { + Log.d(TAG, "RichScreenApi connected"); + } + + public void onServiceConnected() throws RemoteException { + Log.d(TAG, "RichScreenApi connected"); + } + }); + mCapabilityApi.init(context, null); + } + + public static RcsAccountApi getRcsAccountApi() { + return mRcsAccountApi; + } + + public static ConfApi getConfApi() { + return mConfApi; + } + + public static boolean isRcsServiceInstalled() { + return mIsRcsServiceInstalled; + } + + public static RichScreenApi getRichScreenApi() { + return mRichScreenApi; + } + + public static boolean isRcsOnline() { + try { + return mRcsAccountApi.isOnline(); + } catch (ServiceDisconnectedException e) { + return false; + } + } + + public static CapabilityApi getCapabilityApi() { + return mCapabilityApi; + } +} diff --git a/src/com/android/incallui/RcsRichScreen.java b/src/com/android/incallui/RcsRichScreen.java new file mode 100644 index 00000000..2afef43c --- /dev/null +++ b/src/com/android/incallui/RcsRichScreen.java @@ -0,0 +1,431 @@ +/* + * Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +package com.android.incallui; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.media.AudioManager; +import android.media.MediaPlayer; +import android.os.Handler; +import android.text.TextUtils; +import android.util.Log; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; +import android.telecom.VideoProfile; +import com.android.incallui.RcsApiManager; +import com.suntek.mway.rcs.client.aidl.plugin.entity.richscrn.ResultInfo; +import com.suntek.mway.rcs.client.aidl.plugin.entity.richscrn.RichScrnShowing; +import com.suntek.mway.rcs.client.api.util.ServiceDisconnectedException; +import com.suntek.mway.rcs.client.api.voip.impl.RichScreenApi; +import com.suntek.mway.rcs.client.api.RCSServiceListener; +import android.os.RemoteException; + +public class RcsRichScreen { + private static String TAG = "RCS_UI_RcsRichScreen"; + // those Strings is use for rcs enhance screen(phone event) + // start a voice call + private static String INITIATE_A_VOICE_CALL = "111 00 00000"; + // incoming a voice call + private static String INCOMING_VOICE_CALL_THE_TERMINAL_STARTS_RINGING = "122 00 18000"; + // accepct a incoming voice call + private static String SWITCHED_VOICE_CALLS_CALLINGSIDE = "113 00 20000"; + // incoming vocie call been accepcted + private static String SWITCHED_VOICE_CALLS_CALLED_SIDE = "123 00 20000"; + // calling vocie call has been hanged up + private static String VOICE_CALL_HANG_UP_CALLING_SIDE = "114 00 20000"; + // incoming vocie call has been hanged up + private static String VOICE_CALL_HANG_UP_CALLED_SIDE = "124 00 20000"; + // dailing a video call + private static String OUTGOING_VIDEO_CALL = "211 00 00000"; + // incomming a video call and start ringing + private static String VIDEO_CALL_COMES_IN_THE_TERMINAL_STARTS_RINGING = "222 00 00000"; + // dailing video call was accepct + private static String VIDEO_CALL_IS_CONNECTED_CALLING_SIDE = "213 00 20000"; + // incoming video call has been accpet as a video call. + private static String VIDEO_CALL_IS_CONNECTED_CALLED_SIDE_SELECT_THE_VIDEO_CALL = "223 00 20000"; + // dailing video call has been hanged up + private static String VIDEO_CALL_HANG_UP_CALLING_SIDE = "214 00 20000"; + // imcoming video call has been hanged up + private static String VIDEO_CALL_HANG_UP_CALLED_SIDE = "224 00 20000"; + // phone book was being viewed and require to view the enhanced screen + private static String ADDRESS_BOOK_IS_BING_VIEWED_VIEW_ENHANCED_SCREEN = "933 10 11000"; + // phone book was being viewed and require to setin the enhance screen + private static String ADDRESS_BOOK_IS_BING_VIEWED_ENHANCED_OSD_SETTINGS = "933 10 12000"; + // phone book hans been update + private static String ADDRESS_BOOK_HAVE_BEEN_UPDATED = "934 10 20000"; + // completed terminal factory reset. + private static String COMPLETED_RESTORE_FACTORY_SETTINGS = "934 90 30000"; + // sim card has been switched + private static String SIM_CARD_HAS_BEEN_REPLACED = "944 90 40000"; + // invailable + private static String NON_SPECIFIC_EVENTS = "000 00 00000"; + + // RCS enhance screen resource type + private static final int RCS_STATIC_IMAGE = 0; + private static final int RCS_VIRTUAL_IMAGE = 1; + private static final int RCS_VIDEO = 2; + + private static final int DEFAULT_NUMBER_LENGTH = 11; + // for RCS + private SurfaceView msurface = null; + MediaPlayer mediaPlayer; + private SurfaceHolder surfaceholder; + private String mNumber = null; + private ImageView mRcsPhoto; + private GifMovieView mGifMovieView; + private TextView mGreeting; + private TextView missdnAddress; + private String videoPath = null; + private Context mContext; + private String mPhoneEevnt = null; + private boolean isGetRichScreenCompleted = false; + + public RcsRichScreen(Context context, ImageView rcsImageView, + TextView Greeting, TextView rcsMissdnAddress, + GifMovieView GifMovieView, SurfaceView surface) { + mGifMovieView = GifMovieView; + mGreeting = Greeting; + missdnAddress = rcsMissdnAddress; + mRcsPhoto = rcsImageView; + msurface = surface; + mContext = context; + initSurfaceView(); + } + + private void initSurfaceView() { + surfaceholder = msurface.getHolder(); + surfaceholder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + surfaceholder.addCallback(new SurfaceHolder.Callback() { + + @Override + public void surfaceDestroyed(SurfaceHolder arg0) { + // TODO Auto-generated method stub + if (mediaPlayer != null) { + mediaPlayer.release(); + } + } + + @Override + public void surfaceCreated(SurfaceHolder arg0) { + // TODO Auto-generated method stub + play(videoPath); + } + + @Override + public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, + int arg3) { + // TODO Auto-generated method stub + } + }); + } + + private void play(String videoPath) { + if (videoPath == null) { + return; + } + if(null != mediaPlayer){ + mediaPlayer.release(); + mediaPlayer = null; + } + mediaPlayer = new MediaPlayer(); + // set video type + mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); + mediaPlayer.setLooping(true); + mediaPlayer.setDisplay(surfaceholder); + try { + mediaPlayer.setDataSource(videoPath); + mediaPlayer.prepare(); + mediaPlayer.start(); + } catch (Exception e) { + Log.i(TAG, "play video wrong"); + } + } + + private void reset() { + if(null == mediaPlayer){ + return ; + } + mediaPlayer.seekTo(0); + mediaPlayer.start(); + } + + private void stop() { + if(null == mediaPlayer){ + return ; + } + Log.i(TAG, "stop the video"); + mediaPlayer.stop(); + mediaPlayer.release(); + mediaPlayer = null; + } + + public void getRichScreenInfo(String PhoneEevnt) { + if (mNumber == null) { + return; + } + RichScrnShowing result = null; + mPhoneEevnt = PhoneEevnt; + + if (mNumber != null) { + try { + Log.i(TAG, + "getRichScreenApi" + mNumber); + result = RcsApiManager.getRichScreenApi().getRichScrnObj( + mNumber, PhoneEevnt); + Log.i(TAG, "result" + result); + } catch (ServiceDisconnectedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + getResultUtilInfo(result); + } + + private void getResultUtilInfo(final RichScrnShowing result) { + if (result == null) { + Log.i(TAG, "getResultUtilInfo retult is null"); + setRcsFragmentVisibleDefault(); + return; + } + Log.i(TAG, "result.getGreeting()" + result.getGreeting()); + Log.i(TAG, "result.getSourceType()" + result.getSourceType()); + Log.i(TAG, "result.getSourceType()" + result.getLocalSourceUrl()); + mGreeting.setVisibility(View.GONE); + mRcsPhoto.setVisibility(View.GONE); + msurface.setVisibility(View.GONE); + mGifMovieView.setVisibility(View.GONE); + missdnAddress.setVisibility(View.GONE); + new Thread() { + @Override + public void run() { + if (null != result.getGreeting() + && !TextUtils.isEmpty(result.getGreeting())) { + mGreeting.setVisibility(View.VISIBLE); + StringBuilder greetingString = new StringBuilder(); + greetingString.append(mContext.getResources().getString( + R.string.rcs_greeting_string)); + greetingString.append(result.getGreeting()); + mGreeting.setText(greetingString.toString()); + } + if (null != result.getMissdnAddress() + && !TextUtils.isEmpty(result.getMissdnAddress())) { + missdnAddress.setVisibility(View.VISIBLE); + StringBuilder missdnAddressString = new StringBuilder(); + missdnAddressString.append(mContext.getResources().getString( + R.string.rcs_missdnaddress_string)); + missdnAddressString.append(result.getMissdnAddress()); + missdnAddress.setText(missdnAddressString.toString()); + } else { + missdnAddress.setVisibility(View.GONE); + try { + Log.i(TAG, "getRichScreenApi.DownloadHomeLocRules" + + RcsApiManager.getRichScreenApi()); + RcsApiManager.getRichScreenApi().downloadHomeLocRules( + mPhoneEevnt); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + String sorceType = result.getSourceType(); + switch (Integer.valueOf(sorceType)) { + case RCS_STATIC_IMAGE: { + + mRcsPhoto.setVisibility(View.VISIBLE); + Bitmap bitmap = BitmapFactory + .decodeFile(result.getLocalSourceUrl()); + mRcsPhoto.setImageBitmap(bitmap); + + } + break; + case RCS_VIRTUAL_IMAGE: { + mGifMovieView.setVisibility(View.VISIBLE); + mGifMovieView.setMovieResource(result.getLocalSourceUrl()); + } + break; + case RCS_VIDEO: { + msurface.setVisibility(View.VISIBLE); + videoPath = result.getLocalSourceUrl(); + } + break; + default: + mRcsPhoto.setVisibility(View.VISIBLE); + break; + } + } + }.start(); + } + + public String getPhoneEventForRichScreen(int state, int videoState) { + String phoneEevnt = INITIATE_A_VOICE_CALL; + Log.i(TAG, "PhoneEevnt:" + phoneEevnt); + switch (state) { + case Call.State.ACTIVE: + + if (phoneEevnt.equals(INITIATE_A_VOICE_CALL)) { + + if (VideoProfile.VideoState.isBidirectional(videoState)) { + // this is judge it is a video call or no + phoneEevnt = VIDEO_CALL_IS_CONNECTED_CALLING_SIDE; + } else { + phoneEevnt = SWITCHED_VOICE_CALLS_CALLINGSIDE; + } + + } else if (phoneEevnt + .equals(INCOMING_VOICE_CALL_THE_TERMINAL_STARTS_RINGING) + || phoneEevnt + .equals(VIDEO_CALL_COMES_IN_THE_TERMINAL_STARTS_RINGING)) { + + if (VideoProfile.VideoState.isBidirectional(videoState)) { + phoneEevnt = VIDEO_CALL_IS_CONNECTED_CALLED_SIDE_SELECT_THE_VIDEO_CALL; + setRcsFragmentVisibleGone(); + } else { + phoneEevnt = SWITCHED_VOICE_CALLS_CALLED_SIDE; + } + } + break; + case Call.State.CONNECTING: + case Call.State.DIALING: + case Call.State.REDIALING: + if (VideoProfile.VideoState.isBidirectional(videoState)) { + phoneEevnt = OUTGOING_VIDEO_CALL; + setRcsFragmentVisibleDefault(); + } else { + phoneEevnt = INITIATE_A_VOICE_CALL; + } + break; + case Call.State.INCOMING: + case Call.State.CALL_WAITING: + if (VideoProfile.VideoState.isBidirectional(videoState)) { + phoneEevnt = VIDEO_CALL_COMES_IN_THE_TERMINAL_STARTS_RINGING; + } else { + phoneEevnt = INCOMING_VOICE_CALL_THE_TERMINAL_STARTS_RINGING; + } + break; + default: + Log.i(TAG, "updateCallStateWidgets: unexpected call: " + state); + } + Log.i(TAG, "mPhoneEevnt:" + phoneEevnt); + return phoneEevnt; + } + + /** + * Changes the visibility of the RCS fragment + */ + private void setRcsFragmentVisibleGone() { + + mGreeting.setVisibility(View.GONE); + mRcsPhoto.setVisibility(View.GONE); + msurface.setVisibility(View.GONE); + mGifMovieView.setVisibility(View.GONE); + missdnAddress.setVisibility(View.GONE); + + } + + private void setRcsFragmentVisibleDefault() { + + mGreeting.setVisibility(View.GONE); + mRcsPhoto.setVisibility(View.VISIBLE); + msurface.setVisibility(View.GONE); + mGifMovieView.setVisibility(View.GONE); + missdnAddress.setVisibility(View.GONE); + + } + + private void createComfirmDialogInVideCall(final String phoneEvent) { + new AlertDialog.Builder(mContext) + .setMessage( + mContext.getResources().getString( + R.string.display_rich_screen)) + .setPositiveButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, + int which) { + getRichScreenInfo(phoneEvent); + } + }).setNegativeButton(android.R.string.cancel, null) + .create().show(); + + } + + public void updateRichScreenByCallState(int state, int videoState) { + if (state == Call.State.DISCONNECTED) { + Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + + @Override + public void run() { + // TODO Auto-generated method stub + try { + Log.i(TAG, "getRichScreenApi.downloadRichScreen:" + + mNumber); + RcsApiManager.getRichScreenApi().downloadRichScrnObj( + mNumber, mPhoneEevnt); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }, 1000); + } else { + String phoneEvent = getPhoneEventForRichScreen(state, videoState); + if (phoneEvent + .equals(VIDEO_CALL_COMES_IN_THE_TERMINAL_STARTS_RINGING)) { + Log.i(TAG, "video call income do not set richscreen"); + isGetRichScreenCompleted = true; + createComfirmDialogInVideCall(phoneEvent); + } + if (!isGetRichScreenCompleted) { + getRichScreenInfo(phoneEvent); + isGetRichScreenCompleted = true; + } + } + + } + + public void setNumber(String number) { + mNumber = getFormatNumber(number); + } + + public static String getFormatNumber(String number){ + if(null == number){ + return ""; + } + number = number.replaceAll("-", ""); + number = number.replaceAll(" ", ""); + number = number.replaceAll(",", ""); + int numberLen = number.length(); + if(numberLen > DEFAULT_NUMBER_LENGTH){ + number = number.substring(numberLen - DEFAULT_NUMBER_LENGTH, numberLen); + } + return number; + } +} diff --git a/src/com/android/incallui/RcsSendSmsUtils.java b/src/com/android/incallui/RcsSendSmsUtils.java new file mode 100644 index 00000000..6c3ae5ef --- /dev/null +++ b/src/com/android/incallui/RcsSendSmsUtils.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2014 pci-suntektech Technologies, Inc. All Rights Reserved. + * pci-suntektech Technologies Proprietary and Confidential. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +package com.android.incallui; + +import android.database.Cursor; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.telephony.PhoneNumberUtils; +import android.text.TextUtils; +import android.provider.Telephony; +import android.provider.Telephony.Mms; +import android.provider.Telephony.Sms; +import java.util.List; + +public class RcsSendSmsUtils { + /** + * Start the ACTION_SENDTO activity. + * + * @param context + * @param phoneNumber + * @param message + */ + public static void startSendSmsActivity(Context context) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setType("vnd.android-dir/mms-sms"); + if (isActivityIntentAvailable(context, intent)) { + context.startActivity(intent); + } + } + + /** + * Start the ACTION_SENDTO activity. + * + * @param context + * @param phoneNumber + * @param message + */ + public static void startSendSmsActivity(Context context, String[] phoneNumbers) { + if (phoneNumbers == null || phoneNumbers.length == 0) { + return; + } + + for (String phoneNumber : phoneNumbers) { + if (!PhoneNumberUtils.isGlobalPhoneNumber(phoneNumber)) { + return; + } + } + + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < phoneNumbers.length; i++) { + buffer.append(phoneNumbers[i]); + + if ((i + 1) < phoneNumbers.length) { + buffer.append(";"); + } + } + + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.putExtra("address", buffer.toString()); + intent.setType("vnd.android-dir/mms-sms"); + if (isActivityIntentAvailable(context, intent)) { + context.startActivity(intent); + } + } + + public static boolean isActivityIntentAvailable(Context context, Intent intent) { + final PackageManager packageManager = context.getPackageManager(); + List<ResolveInfo> list = packageManager.queryIntentActivities(intent, + PackageManager.MATCH_DEFAULT_ONLY); + return list.size() > 0; + } + + public static int getUnReadMessageCount(Context context, String phoneNumber) { + + if (phoneNumber == null) { + return 0; + } + Cursor cursor = context.getContentResolver().query(Telephony.Sms.CONTENT_URI, + new String[] { Telephony.MmsSms._ID }, + "read=? AND " + Telephony.Sms.ADDRESS + "=?", new String[] { String.valueOf(0), phoneNumber }, null); + + int count = 0; + if (cursor != null) { + try { + count = cursor.getCount(); + } finally { + cursor.close(); + } + } + return count; + } +} diff --git a/src/com/android/incallui/SelectPhoneAccountDialogFragment.java b/src/com/android/incallui/SelectPhoneAccountDialogFragment.java index 097dd893..4fba17ae 100644 --- a/src/com/android/incallui/SelectPhoneAccountDialogFragment.java +++ b/src/com/android/incallui/SelectPhoneAccountDialogFragment.java @@ -42,6 +42,7 @@ import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.TextView; +import com.android.contacts.common.MoreContactUtils; import com.android.contacts.common.R; import com.android.internal.telephony.PhoneConstants; @@ -225,7 +226,12 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { PhoneAccountHandle accountHandle = getItem(position); PhoneAccount account = mTelecomManager.getPhoneAccount(accountHandle); - holder.textView.setText(account.getLabel()); + if (MoreContactUtils.shouldShowOperator(mContext)) { + Long subId = Long.parseLong(accountHandle.getId()); + holder.textView.setText(MoreContactUtils.getNetworkSpnName(mContext, subId)); + } else { + holder.textView.setText(account.getLabel()); + } holder.imageView.setImageDrawable(account.getIcon(mContext)); return rowView; } |
