diff options
author | Andrew Lee <anwlee@google.com> | 2014-07-11 15:50:00 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-07-15 10:54:02 -0700 |
commit | c0be1faf6fa10b7b4ab025012cdffd98a5be7148 (patch) | |
tree | 47926d4f151c6cd9a35a7533846623bcbc9dde61 /InCallUI | |
parent | a39948564946dabae36a7201eb5c28d8941b96c3 (diff) |
Show different glowpad options for incoming video call.
- Refactor code be more flexibile/specific in specifying the targets
for the glow pad; went from "n-way" labeling of different target sets
to more explicit labeling of scenarios, such as "audio without sms".
- Add target sets and cases for showing targest in AnswerFragment.
- Added new drawable for the target to answer a video call.
- Add method to GlowPadView to allow changing the handle (now it may
be either a videocamera or phone icon, depending on the scenario).
- Add a new video handle for incoming video calls.
- TODO: Hook this up to show these glowpads if there is an incoming
video call.
- Deleted some unused resource files.
Bug: 16015750
Change-Id: I77ff08f45f57cd2817866b5d78648af8891bb675
Diffstat (limited to 'InCallUI')
17 files changed, 262 insertions, 51 deletions
diff --git a/InCallUI/res/drawable-hdpi/ic_in_call_touch_handle_normal.png b/InCallUI/res/drawable-hdpi/ic_in_call_touch_handle_normal.png Binary files differdeleted file mode 100644 index e85253489..000000000 --- a/InCallUI/res/drawable-hdpi/ic_in_call_touch_handle_normal.png +++ /dev/null diff --git a/InCallUI/res/drawable-ldrtl-hdpi/ic_in_call_touch_handle_normal.png b/InCallUI/res/drawable-ldrtl-hdpi/ic_in_call_touch_handle_normal.png Binary files differdeleted file mode 100644 index 4a3628bef..000000000 --- a/InCallUI/res/drawable-ldrtl-hdpi/ic_in_call_touch_handle_normal.png +++ /dev/null diff --git a/InCallUI/res/drawable-ldrtl-mdpi/ic_in_call_touch_handle_normal.png b/InCallUI/res/drawable-ldrtl-mdpi/ic_in_call_touch_handle_normal.png Binary files differdeleted file mode 100644 index 13b2ecfb5..000000000 --- a/InCallUI/res/drawable-ldrtl-mdpi/ic_in_call_touch_handle_normal.png +++ /dev/null diff --git a/InCallUI/res/drawable-ldrtl-xhdpi/ic_in_call_touch_handle_normal.png b/InCallUI/res/drawable-ldrtl-xhdpi/ic_in_call_touch_handle_normal.png Binary files differdeleted file mode 100644 index c70795071..000000000 --- a/InCallUI/res/drawable-ldrtl-xhdpi/ic_in_call_touch_handle_normal.png +++ /dev/null diff --git a/InCallUI/res/drawable-mdpi/ic_in_call_touch_handle_normal.png b/InCallUI/res/drawable-mdpi/ic_in_call_touch_handle_normal.png Binary files differdeleted file mode 100644 index cebdc4dee..000000000 --- a/InCallUI/res/drawable-mdpi/ic_in_call_touch_handle_normal.png +++ /dev/null diff --git a/InCallUI/res/drawable-xhdpi/ic_in_call_touch_handle_normal.png b/InCallUI/res/drawable-xhdpi/ic_in_call_touch_handle_normal.png Binary files differdeleted file mode 100644 index 1d112f2aa..000000000 --- a/InCallUI/res/drawable-xhdpi/ic_in_call_touch_handle_normal.png +++ /dev/null diff --git a/InCallUI/res/drawable-xxhdpi/ic_in_call_touch_handle_normal.png b/InCallUI/res/drawable-xxhdpi/ic_in_call_touch_handle_normal.png Binary files differdeleted file mode 100644 index b41967bd8..000000000 --- a/InCallUI/res/drawable-xxhdpi/ic_in_call_touch_handle_normal.png +++ /dev/null diff --git a/InCallUI/res/drawable/ic_in_call_touch_handle.xml b/InCallUI/res/drawable/ic_incall_audio_handle.xml index 47d902bb7..fd40e517c 100644 --- a/InCallUI/res/drawable/ic_in_call_touch_handle.xml +++ b/InCallUI/res/drawable/ic_incall_audio_handle.xml @@ -17,7 +17,7 @@ <!-- Touch handle for the GlowPadView widget on the incoming call screen --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <!-- Call icon on tinted floating action bar background. --> + <!-- Audio call icon on tinted floating action bar background. --> <item android:state_enabled="true" android:state_active="false" diff --git a/InCallUI/res/drawable/ic_incall_video_handle.xml b/InCallUI/res/drawable/ic_incall_video_handle.xml new file mode 100644 index 000000000..80636afec --- /dev/null +++ b/InCallUI/res/drawable/ic_incall_video_handle.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<!-- Touch handle for the GlowPadView widget on the incoming call screen --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + + <!-- Video call icon on tinted floating action bar background. --> + <item + android:state_enabled="true" + android:state_active="false" + android:state_focused="false"> + <layer-list> + <item> + <bitmap + android:src="@drawable/fab_teal_background" + android:tint="@color/glowpad_incoming_widget_background_tint" /> + </item> + <item> + <bitmap + android:gravity="center" + android:src="@drawable/ic_videocam" + android:tint="@color/glowpad_incoming_widget_tint" /> + </item> + </layer-list> + </item> + +</selector> diff --git a/InCallUI/res/drawable/ic_lockscreen_answer_video.xml b/InCallUI/res/drawable/ic_lockscreen_answer_video.xml new file mode 100644 index 000000000..05577979a --- /dev/null +++ b/InCallUI/res/drawable/ic_lockscreen_answer_video.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<!-- Used with incoming call wigdet. --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:state_enabled="true" android:state_active="false" android:state_focused="false" + android:drawable="@drawable/ic_lockscreen_answer_video_normal_layer"/> + <item + android:state_enabled="true" android:state_active="true" android:state_focused="false" + android:drawable="@drawable/ic_lockscreen_answer_video_activated_layer" /> + <item + android:state_enabled="true" android:state_active="false" android:state_focused="true" + android:drawable="@drawable/ic_lockscreen_answer_video_activated_layer" /> +</selector> diff --git a/InCallUI/res/drawable/ic_lockscreen_answer_video_activated_layer.xml b/InCallUI/res/drawable/ic_lockscreen_answer_video_activated_layer.xml new file mode 100644 index 000000000..3cb769223 --- /dev/null +++ b/InCallUI/res/drawable/ic_lockscreen_answer_video_activated_layer.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/fab_teal_background" /> + <item> + <bitmap + android:gravity="center" + android:src="@drawable/ic_videocam" + android:tint="@color/glowpad_widget_active_color" /> + </item> +</layer-list> diff --git a/InCallUI/res/drawable/ic_lockscreen_answer_video_normal_layer.xml b/InCallUI/res/drawable/ic_lockscreen_answer_video_normal_layer.xml new file mode 100644 index 000000000..708bbcc9c --- /dev/null +++ b/InCallUI/res/drawable/ic_lockscreen_answer_video_normal_layer.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- A fake circle to fix the size of this layer asset. --> + <item> + <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> + <solid android:color="#00000000"/> + <size + android:width="@dimen/incoming_call_widget_circle_size" + android:height="@dimen/incoming_call_widget_circle_size" /> + </shape> + </item> + <item> + <bitmap + android:gravity="center" + android:src="@drawable/ic_videocam" + android:tint="@color/glowpad_call_widget_normal_tint" /> + </item> +</layer-list> diff --git a/InCallUI/res/layout/answer_fragment.xml b/InCallUI/res/layout/answer_fragment.xml index 92630b89b..7026dd13c 100644 --- a/InCallUI/res/layout/answer_fragment.xml +++ b/InCallUI/res/layout/answer_fragment.xml @@ -28,10 +28,10 @@ android:background="@color/glowpad_background_color" android:visibility="gone" - dc:targetDrawables="@array/incoming_call_widget_3way_targets" - dc:targetDescriptions="@array/incoming_call_widget_3way_target_descriptions" - dc:directionDescriptions="@array/incoming_call_widget_3way_direction_descriptions" - dc:handleDrawable="@drawable/ic_in_call_touch_handle" + dc:targetDrawables="@array/incoming_call_widget_audio_with_sms_targets" + dc:targetDescriptions="@array/incoming_call_widget_audio_with_sms_target_descriptions" + dc:directionDescriptions="@array/incoming_call_widget_audio_with_sms_direction_descriptions" + dc:handleDrawable="@drawable/ic_incall_audio_handle" dc:outerRingDrawable="@drawable/ic_lockscreen_outerring" dc:outerRadius="@dimen/glowpadview_target_placement_radius" dc:innerRadius="@dimen/glowpadview_inner_radius" @@ -40,5 +40,4 @@ dc:vibrationDuration="20" dc:glowRadius="@dimen/glowpadview_glow_radius" dc:pointDrawable="@drawable/ic_lockscreen_glowdot" - dc:allowScaling="true" - /> + dc:allowScaling="true" /> diff --git a/InCallUI/res/values/array.xml b/InCallUI/res/values/array.xml index 3902e842f..b741905dd 100644 --- a/InCallUI/res/values/array.xml +++ b/InCallUI/res/values/array.xml @@ -20,50 +20,95 @@ <!-- "Target" resources for the GlowPadView widget used for incoming calls; see InCallTouchUi.showIncomingCallWidget() and incall_touch_ui.xml. --> - <!-- For most incoming calls the GlowPadView widget provides 3 choices: + <!-- For audio calls, if respond via SMS is disabled: - Answer (drag right) - - Reject (drag left) - - Respond via SMS (drag up) --> - <array name="incoming_call_widget_3way_targets"> + - Decline (drag left) --> + <array name="incoming_call_widget_audio_without_sms_targets"> + <item>@drawable/ic_lockscreen_answer</item> + <item>@null</item> + <item>@drawable/ic_lockscreen_decline</item> + <item>@null</item>" + </array> + <array name="incoming_call_widget_audio_without_sms_target_descriptions"> + <item>@string/description_target_answer</item> + <item>@null</item> + <item>@string/description_target_decline</item> + <item>@null</item>" + </array> + <array name="incoming_call_widget_audio_without_sms_direction_descriptions"> + <item>@string/description_direction_right</item> + <item>@null</item> + <item>@string/description_direction_left</item> + <item>@null</item> + </array> + + <!-- For audio calls, if respond via SMS is enabled: + - Answer (drag right) + - Respond via SMS (drag up) + - Decline (drag left) --> + <array name="incoming_call_widget_audio_with_sms_targets"> <item>@drawable/ic_lockscreen_answer</item> <item>@drawable/ic_lockscreen_text</item> <item>@drawable/ic_lockscreen_decline</item> <item>@null</item>" </array> - <array name="incoming_call_widget_3way_target_descriptions"> + <array name="incoming_call_widget_audio_with_sms_target_descriptions"> <item>@string/description_target_answer</item> <item>@string/description_target_send_sms</item> <item>@string/description_target_decline</item> <item>@null</item>" </array> - <array name="incoming_call_widget_3way_direction_descriptions"> + <array name="incoming_call_widget_audio_with_sms_direction_descriptions"> <item>@string/description_direction_right</item> <item>@string/description_direction_up</item> <item>@string/description_direction_left</item> <item>@null</item> </array> - <!-- But in some cases "Respond via SMS" isn't available, so there are - only 2 choices: - - Answer (drag right) - - Reject (drag left) --> - <array name="incoming_call_widget_2way_targets"> + <!-- For video calls, if respond via SMS is disabled: + - Answer as video call (drag right) + - Decline (drag left) + - Answer as audio call (drag down) --> + <array name="incoming_call_widget_video_without_sms_targets"> <item>@drawable/ic_lockscreen_answer</item> <item>@null</item> <item>@drawable/ic_lockscreen_decline</item> - <item>@null</item>" + <item>@drawable/ic_lockscreen_answer_video</item> </array> - <array name="incoming_call_widget_2way_target_descriptions"> - <item>@string/description_target_answer</item> + <array name="incoming_call_widget_video_without_sms_target_descriptions"> + <item>@string/description_target_answer_video_call</item> <item>@null</item> <item>@string/description_target_decline</item> - <item>@null</item>" + <item>@string/description_target_answer_audio_call</item> </array> - <array name="incoming_call_widget_2way_direction_descriptions"> + <array name="incoming_call_widget_video_without_sms_direction_descriptions"> <item>@string/description_direction_right</item> <item>@null</item> <item>@string/description_direction_left</item> - <item>@null</item> + <item>@string/description_direction_down</item> </array> + <!-- For video calls, if respond via SMS is enabled: + - Answer as video call (drag right) + - Respond via SMS (drag up) + - Decline (drag left) + - Answer as audio call (drag down) --> + <array name="incoming_call_widget_video_with_sms_targets"> + <item>@drawable/ic_lockscreen_answer_video</item> + <item>@drawable/ic_lockscreen_text</item> + <item>@drawable/ic_lockscreen_decline</item> + <item>@drawable/ic_lockscreen_answer</item> + </array> + <array name="incoming_call_widget_video_with_sms_target_descriptions"> + <item>@string/description_target_answer_video_call</item> + <item>@string/description_target_send_sms</item> + <item>@string/description_target_decline</item> + <item>@string/description_target_answer_audio_call</item> + </array> + <array name="incoming_call_widget_video_with_sms_direction_descriptions"> + <item>@string/description_direction_right</item> + <item>@string/description_direction_up</item> + <item>@string/description_direction_left</item> + <item>@string/description_direction_down</item> + </array> </resources> diff --git a/InCallUI/src/com/android/incallui/AnswerFragment.java b/InCallUI/src/com/android/incallui/AnswerFragment.java index dfc902dc8..371a3ca25 100644 --- a/InCallUI/src/com/android/incallui/AnswerFragment.java +++ b/InCallUI/src/com/android/incallui/AnswerFragment.java @@ -44,6 +44,11 @@ import java.util.List; public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresenter.AnswerUi> implements GlowPadWrapper.AnswerListener, AnswerPresenter.AnswerUi { + public static final int TARGET_SET_FOR_AUDIO_WITHOUT_SMS = 0; + public static final int TARGET_SET_FOR_AUDIO_WITH_SMS = 1; + public static final int TARGET_SET_FOR_VIDEO_WITHOUT_SMS = 2; + public static final int TARGET_SET_FOR_VIDEO_WITH_SMS = 3; + /** * The popup showing the list of canned responses. * @@ -112,29 +117,58 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente } } + /** + * Sets targets on the glowpad according to target set identified by the parameter. + * @param targetSet Integer identifying the set of targets to use. + */ @Override - public void showTextButton(boolean show) { - final int targetResourceId = show - ? R.array.incoming_call_widget_3way_targets - : R.array.incoming_call_widget_2way_targets; + public void showTargets(int targetSet) { + final int targetResourceId; + final int targetDescriptionsResourceId; + final int directionDescriptionsResourceId; + final int handleDrawableResourceId; + + switch (targetSet) { + case TARGET_SET_FOR_AUDIO_WITH_SMS: + targetResourceId = R.array.incoming_call_widget_audio_with_sms_targets; + targetDescriptionsResourceId = + R.array.incoming_call_widget_audio_with_sms_target_descriptions; + directionDescriptionsResourceId = + R.array.incoming_call_widget_audio_with_sms_direction_descriptions; + handleDrawableResourceId = R.drawable.ic_incall_audio_handle; + break; + case TARGET_SET_FOR_VIDEO_WITHOUT_SMS: + targetResourceId = R.array.incoming_call_widget_video_without_sms_targets; + targetDescriptionsResourceId = + R.array.incoming_call_widget_video_without_sms_target_descriptions; + directionDescriptionsResourceId = + R.array.incoming_call_widget_video_without_sms_direction_descriptions; + handleDrawableResourceId = R.drawable.ic_incall_video_handle; + break; + case TARGET_SET_FOR_VIDEO_WITH_SMS: + targetResourceId = R.array.incoming_call_widget_video_with_sms_targets; + targetDescriptionsResourceId = + R.array.incoming_call_widget_video_with_sms_target_descriptions; + directionDescriptionsResourceId = + R.array.incoming_call_widget_video_with_sms_direction_descriptions; + handleDrawableResourceId = R.drawable.ic_incall_video_handle; + break; + case TARGET_SET_FOR_AUDIO_WITHOUT_SMS: + default: + targetResourceId = R.array.incoming_call_widget_audio_without_sms_targets; + targetDescriptionsResourceId = + R.array.incoming_call_widget_audio_without_sms_target_descriptions; + directionDescriptionsResourceId = + R.array.incoming_call_widget_audio_without_sms_direction_descriptions; + handleDrawableResourceId = R.drawable.ic_incall_audio_handle; + break; + } if (targetResourceId != mGlowpad.getTargetResourceId()) { - if (show) { - // Answer, Decline, and Respond via SMS. - mGlowpad.setTargetResources(targetResourceId); - mGlowpad.setTargetDescriptionsResourceId( - R.array.incoming_call_widget_3way_target_descriptions); - mGlowpad.setDirectionDescriptionsResourceId( - R.array.incoming_call_widget_3way_direction_descriptions); - } else { - // Answer or Decline. - mGlowpad.setTargetResources(targetResourceId); - mGlowpad.setTargetDescriptionsResourceId( - R.array.incoming_call_widget_2way_target_descriptions); - mGlowpad.setDirectionDescriptionsResourceId( - R.array.incoming_call_widget_2way_direction_descriptions); - } - + mGlowpad.setTargetResources(targetResourceId); + mGlowpad.setTargetDescriptionsResourceId(targetDescriptionsResourceId); + mGlowpad.setDirectionDescriptionsResourceId(directionDescriptionsResourceId); + mGlowpad.setHandleDrawable(handleDrawableResourceId); mGlowpad.reset(false); } } diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index 5c7188e28..188fabb52 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -94,14 +94,13 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> getUi().showAnswerUi(true); if (call.can(CallCapabilities.RESPOND_VIA_TEXT) && textMsgs != null) { - getUi().showTextButton(true); + getUi().showTargets(AnswerFragment.TARGET_SET_FOR_AUDIO_WITH_SMS); getUi().configureMessageDialog(textMsgs); } else { - getUi().showTextButton(false); + getUi().showTargets(AnswerFragment.TARGET_SET_FOR_AUDIO_WITHOUT_SMS); } } - @Override public void onCallChanged(Call call) { Log.d(this, "onCallStateChange() " + call + " " + this); @@ -154,7 +153,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> interface AnswerUi extends Ui { public void showAnswerUi(boolean show); - public void showTextButton(boolean show); + public void showTargets(int targetSet); public void showMessageDialog(); public void configureMessageDialog(List<String> textResponses); } diff --git a/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java b/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java index e97691bb8..a5733de2c 100644 --- a/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java +++ b/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java @@ -223,8 +223,7 @@ public class GlowPadView extends View { mFeedbackCount); mAllowScaling = a.getBoolean(R.styleable.GlowPadView_allowScaling, false); TypedValue handle = a.peekValue(R.styleable.GlowPadView_handleDrawable); - mHandleDrawable = new TargetDrawable(res, handle != null ? handle.resourceId : 0, 2); - mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); + setHandleDrawable(handle != null ? handle.resourceId : R.drawable.ic_incall_audio_handle); mOuterRing = new TargetDrawable(res, getResourceId(a, R.styleable.GlowPadView_outerRingDrawable), 1); @@ -620,7 +619,6 @@ public class GlowPadView extends View { updatePointCloudPosition(mWaveCenterX, mWaveCenterY); } } - /** * Loads an array of drawables from the given resourceId. * @@ -640,6 +638,15 @@ public class GlowPadView extends View { } /** + * Sets teh handle drawable to the drawable specified by the resource ID. + * @param resourceId + */ + public void setHandleDrawable(int resourceId) { + mHandleDrawable = new TargetDrawable(getResources(), resourceId, 2); + mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); + } + + /** * Sets the resource id specifying the target descriptions for accessibility. * * @param resourceId The resource id. |