Introduce the new UX of call redirection dialog UX
The content of the UX:
<pic> Call
Choose how to place this call
Call using my phone number
Redirect call using <app name>
Cancel
More details:
1) The font size of the title is 18sp
2) The font size of button is 16sp
3) The upper margin of the icon is 16dp
4) The bottom margin of the icon is 16dp
5) The bottom margin of the title is 26dp
6) The upper and bottom margin of the button is 15dp
7) The left margin of the button is 15dp
8) The tint color of the icon is #4089F4
9) The color of the text is #212121
10) The color of the divider is #B8B8B8
11) The corner of the dialog is rounded as 15dp radius
12) All the buttons need to have ripple effect
Test: TestApp;
Screenshot at b/130755810#comment3;
Screenshot of Darkmode test at b/130755810#comment 4
Bug: 130755810
Change-Id: I1a3f0f71ada28389ce48445c06e62137c947cd9c
Merged-In: I1a3f0f71ada28389ce48445c06e62137c947cd9c
(cherry picked from commit 9fd718560fc0d0a1782b0bf118883e2f7fe905a3)
diff --git a/res/drawable/call_redirection_button_ripple_effect.xml b/res/drawable/call_redirection_button_ripple_effect.xml
new file mode 100644
index 0000000..b690c93
--- /dev/null
+++ b/res/drawable/call_redirection_button_ripple_effect.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 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
+ -->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?android:attr/colorControlHighlight" />
\ No newline at end of file
diff --git a/res/drawable/call_redirection_dialog_background.xml b/res/drawable/call_redirection_dialog_background.xml
new file mode 100644
index 0000000..71277fd
--- /dev/null
+++ b/res/drawable/call_redirection_dialog_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 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
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@android:color/white"/>
+ <corners android:radius="15dp" />
+</shape>
\ No newline at end of file
diff --git a/res/layout/call_redirection_confirm_dialog.xml b/res/layout/call_redirection_confirm_dialog.xml
new file mode 100644
index 0000000..98d78c8
--- /dev/null
+++ b/res/layout/call_redirection_confirm_dialog.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 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
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingTop="0dp"
+ android:paddingBottom="0dp"
+ android:background="@drawable/call_redirection_dialog_background"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:paddingTop="@dimen/call_redirection_dialog_image_upper_margin"
+ android:paddingBottom="@dimen/call_redirection_dialog_image_bottom_margin"
+ android:tint="@color/call_redirection_dialog_icon_tint_color"
+ android:src="@drawable/ic_phone"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:paddingBottom="@dimen/call_redirection_dialog_title_bottom_margin"
+ android:text="@string/alert_redirect_outgoing_call_or_not"
+ android:textColor="@color/call_redirection_dialog_text_color"
+ android:textSize="@dimen/call_redirection_dialog_title_font_size"
+ android:textStyle="bold"/>
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dp"
+ android:background="@color/call_redirection_dialog_view_divider_color"/>
+
+ <Button
+ android:id="@+id/buttonFirstLine"
+ android:text="@string/alert_place_unredirect_outgoing_call"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="left"
+ android:background="@drawable/call_redirection_button_ripple_effect"
+ android:paddingTop="@dimen/call_redirection_dialog_button_text_upper_bottom_margin"
+ android:paddingBottom="@dimen/call_redirection_dialog_button_text_upper_bottom_margin"
+ android:paddingLeft="@dimen/call_redirection_dialog_button_text_left_margin"
+ android:paddingRight="@dimen/call_redirection_dialog_button_text_left_margin"
+ android:textColor="@color/call_redirection_dialog_text_color"
+ android:textSize="@dimen/call_redirection_dialog_button_font_size"
+ android:textAllCaps="false"/>
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dp"
+ android:background="@color/call_redirection_dialog_view_divider_color"/>
+
+ <Button
+ android:id="@+id/buttonSecondLine"
+ android:text="@string/alert_place_outgoing_call_with_redirection"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="left"
+ android:background="@drawable/call_redirection_button_ripple_effect"
+ android:paddingTop="@dimen/call_redirection_dialog_button_text_upper_bottom_margin"
+ android:paddingBottom="@dimen/call_redirection_dialog_button_text_upper_bottom_margin"
+ android:paddingLeft="@dimen/call_redirection_dialog_button_text_left_margin"
+ android:textColor="@color/call_redirection_dialog_text_color"
+ android:textSize="@dimen/call_redirection_dialog_button_font_size"
+ android:textAllCaps="false"/>
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dp"
+ android:background="@color/call_redirection_dialog_view_divider_color"/>
+
+ <Button
+ android:id="@+id/buttonThirdLine"
+ android:text="@string/cancel"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="left"
+ android:background="@drawable/call_redirection_button_ripple_effect"
+ android:paddingTop="@dimen/call_redirection_dialog_button_text_upper_bottom_margin"
+ android:paddingBottom="@dimen/call_redirection_dialog_button_text_upper_bottom_margin"
+ android:paddingLeft="@dimen/call_redirection_dialog_button_text_left_margin"
+ android:paddingRight="@dimen/call_redirection_dialog_button_text_left_margin"
+ android:textColor="@color/call_redirection_dialog_text_color"
+ android:textSize="@dimen/call_redirection_dialog_button_font_size"
+ android:textAllCaps="false"/>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 0c7c175..144f699 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -27,4 +27,9 @@
<!--follows dialer color-->
<color name="notification_action_answer">#097138</color>
<color name="notification_action_decline">#A52714</color>
+
+ <color name="call_redirection_dialog_icon_tint_color">#4089F4</color>
+ <color name="call_redirection_dialog_text_color">#212121</color>
+ <color name="call_redirection_dialog_view_divider_color">#B8B8B8</color>
+
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 9986cb9..52b688c 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -33,4 +33,13 @@
<dimen name="blocked_numbers_line_spacing">8sp</dimen>
<dimen name="blocked_numbers_secondary_line_spacing">6sp</dimen>
<dimen name="blocked_numbers_divider_stroke">1dp</dimen>
+
+ <dimen name="call_redirection_dialog_title_font_size">18sp</dimen>
+ <dimen name="call_redirection_dialog_button_font_size">16sp</dimen>
+ <dimen name="call_redirection_dialog_image_upper_margin">16dp</dimen>
+ <dimen name="call_redirection_dialog_image_bottom_margin">10dp</dimen>
+ <dimen name="call_redirection_dialog_title_bottom_margin">26dp</dimen>
+ <dimen name="call_redirection_dialog_button_text_upper_bottom_margin">15dp</dimen>
+ <dimen name="call_redirection_dialog_button_text_left_margin">15dp</dimen>
+
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8546a61..e4e588c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -282,13 +282,13 @@
<string name="alert_outgoing_call">Placing this call will end your <xliff:g id="other_app">%1$s</xliff:g> call.</string>
<!-- Alert dialog content used to ask the user to confirm if they want to place a new outgoing call redirected by the app "other_app". -->
- <string name="alert_redirect_outgoing_call">Allow <xliff:g id="other_app">%1$s</xliff:g> to place call using a different number?</string>
+ <string name="alert_redirect_outgoing_call_or_not">Choose how to place this call</string>
<!-- A button in the alert dialog "alert_redirect_outgoing_call" to place the call with the redirected number provided by App. -->
- <string name="alert_place_redirect_outgoing_call">Call with <xliff:g id="other_app">%1$s</xliff:g></string>
+ <string name="alert_place_outgoing_call_with_redirection">Redirect call using <xliff:g id="other_app">%1$s</xliff:g></string>
<!-- A button in the alert dialog "alert_redirect_outgoing_call" to place the call without the redirected number provided by App. -->
- <string name="alert_place_unredirect_outgoing_call">Call without <xliff:g id="other_app">%1$s</xliff:g></string>
+ <string name="alert_place_unredirect_outgoing_call">Call using my phone number</string>
<!-- Alert dialog content used to tell the user the call is canceled because no response from the call redirection app "other_app". -->
<string name="alert_redirect_outgoing_call_timeout">Call can\'t be placed by <xliff:g id="other_app">%1$s</xliff:g>. Try using a different call redirecting app or contacting the developer for help.</string>
diff --git a/src/com/android/server/telecom/ui/CallRedirectionConfirmDialogActivity.java b/src/com/android/server/telecom/ui/CallRedirectionConfirmDialogActivity.java
index 9c52b2d..32b0960 100644
--- a/src/com/android/server/telecom/ui/CallRedirectionConfirmDialogActivity.java
+++ b/src/com/android/server/telecom/ui/CallRedirectionConfirmDialogActivity.java
@@ -24,8 +24,14 @@
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.telecom.Log;
+import android.view.LayoutInflater;
+import android.view.View.OnClickListener;
+import android.view.View;
+import android.widget.Button;
/**
* Dialog activity used when there is an ongoing call redirected by the call redirection service.
@@ -48,73 +54,83 @@
private void showDialog(final CharSequence redirectionAppName) {
Log.i(this, "showDialog: confirming redirection with %s", redirectionAppName);
- CharSequence message = getString(
- R.string.alert_redirect_outgoing_call, redirectionAppName);
- final AlertDialog confirmDialog = new AlertDialog.Builder(this)
- .setMessage(message)
- .setPositiveButton(getString(R.string.alert_place_redirect_outgoing_call,
- redirectionAppName), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Intent proceedWithRedirectedCall = new Intent(
- TelecomBroadcastIntentProcessor
- .ACTION_PLACE_REDIRECTED_CALL, null,
- CallRedirectionConfirmDialogActivity.this,
- TelecomBroadcastReceiver.class);
- proceedWithRedirectedCall.putExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID,
- getIntent().getStringExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID));
- sendBroadcast(proceedWithRedirectedCall);
- dialog.dismiss();
- finish();
- }
- })
- .setNegativeButton(getString(R.string.alert_place_unredirect_outgoing_call,
- redirectionAppName), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Intent proceedWithoutRedirectedCall = new Intent(
- TelecomBroadcastIntentProcessor.ACTION_PLACE_UNREDIRECTED_CALL,
- null, CallRedirectionConfirmDialogActivity.this,
- TelecomBroadcastReceiver.class);
- proceedWithoutRedirectedCall.putExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID,
- getIntent().getStringExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID));
- sendBroadcast(proceedWithoutRedirectedCall);
- dialog.dismiss();
- finish();
- }
- })
- .setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Intent cancelRedirectedCall = new Intent(
- TelecomBroadcastIntentProcessor.ACTION_CANCEL_REDIRECTED_CALL,
- null, CallRedirectionConfirmDialogActivity.this,
- TelecomBroadcastReceiver.class);
- cancelRedirectedCall.putExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID,
- getIntent().getStringExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID));
- sendBroadcast(cancelRedirectedCall);
- dialog.dismiss();
- finish();
- }
- })
- .setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- Intent cancelRedirectedCall = new Intent(
- TelecomBroadcastIntentProcessor.ACTION_CANCEL_REDIRECTED_CALL,
- null, CallRedirectionConfirmDialogActivity.this,
- TelecomBroadcastReceiver.class);
- cancelRedirectedCall.putExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID,
- getIntent().getStringExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID));
- sendBroadcast(cancelRedirectedCall);
- dialog.dismiss();
- finish();
- }
- })
- .create();
+
+ final AlertDialog confirmDialog = new AlertDialog.Builder(this).create();
+ LayoutInflater layoutInflater = LayoutInflater.from(this);
+ View dialogView = layoutInflater.inflate(R.layout.call_redirection_confirm_dialog, null);
+
+ Button buttonFirstLine = (Button) dialogView.findViewById(R.id.buttonFirstLine);
+ buttonFirstLine.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent proceedWithoutRedirectedCall = new Intent(
+ TelecomBroadcastIntentProcessor.ACTION_PLACE_UNREDIRECTED_CALL,
+ null, CallRedirectionConfirmDialogActivity.this,
+ TelecomBroadcastReceiver.class);
+ proceedWithoutRedirectedCall.putExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID,
+ getIntent().getStringExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID));
+ sendBroadcast(proceedWithoutRedirectedCall);
+ confirmDialog.dismiss();
+ finish();
+ }
+ });
+
+ Button buttonSecondLine = (Button) dialogView.findViewById(R.id.buttonSecondLine);
+ buttonSecondLine.setText(getString(R.string.alert_place_outgoing_call_with_redirection,
+ redirectionAppName));
+ buttonSecondLine.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent proceedWithRedirectedCall = new Intent(
+ TelecomBroadcastIntentProcessor
+ .ACTION_PLACE_REDIRECTED_CALL, null,
+ CallRedirectionConfirmDialogActivity.this,
+ TelecomBroadcastReceiver.class);
+ proceedWithRedirectedCall.putExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID,
+ getIntent().getStringExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID));
+ sendBroadcast(proceedWithRedirectedCall);
+ confirmDialog.dismiss();
+ finish();
+ }
+ });
+
+ Button buttonThirdLine = (Button) dialogView.findViewById(R.id.buttonThirdLine);
+ buttonThirdLine.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ Intent cancelRedirectedCall = new Intent(
+ TelecomBroadcastIntentProcessor.ACTION_CANCEL_REDIRECTED_CALL,
+ null, CallRedirectionConfirmDialogActivity.this,
+ TelecomBroadcastReceiver.class);
+ cancelRedirectedCall.putExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID,
+ getIntent().getStringExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID));
+ sendBroadcast(cancelRedirectedCall);
+ confirmDialog.dismiss();
+ finish();
+ }
+ });
+
+ confirmDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ Intent cancelRedirectedCall = new Intent(
+ TelecomBroadcastIntentProcessor.ACTION_CANCEL_REDIRECTED_CALL,
+ null, CallRedirectionConfirmDialogActivity.this,
+ TelecomBroadcastReceiver.class);
+ cancelRedirectedCall.putExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID,
+ getIntent().getStringExtra(EXTRA_REDIRECTION_OUTGOING_CALL_ID));
+ sendBroadcast(cancelRedirectedCall);
+ dialog.dismiss();
+ finish();
+ }
+ });
+
+ confirmDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+
+ confirmDialog.setCancelable(false);
+ confirmDialog.setCanceledOnTouchOutside(false);
+
+ confirmDialog.setView(dialogView);
+
confirmDialog.show();
- confirmDialog.getButton(DialogInterface.BUTTON_NEGATIVE).setAllCaps(false);
- confirmDialog.getButton(DialogInterface.BUTTON_POSITIVE).setAllCaps(false);
- confirmDialog.getButton(DialogInterface.BUTTON_NEUTRAL).setAllCaps(false);
}
}
diff --git a/testapps/src/com/android/server/telecom/testapps/TestCallRedirectionService.java b/testapps/src/com/android/server/telecom/testapps/TestCallRedirectionService.java
index b7a033c..ce48b3e 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestCallRedirectionService.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestCallRedirectionService.java
@@ -41,6 +41,8 @@
"com.android.server.telecom.testapps.TestCallRedirectionService"),
"TELECOM_TEST_APP_PHONE_ACCOUNT_ID");
+ private PhoneAccountHandle mDestinationPhoneAccount = SAMPLE_PHONE_ACCOUNT;
+
/**
* Handles request from the system to redirect an outgoing call.
*/
@@ -49,7 +51,7 @@
boolean allowInteractiveResponse) {
Log.i(this, "onPlaceCall: received call %s", handle);
sTestCallRedirectionService = this;
-
+ mDestinationPhoneAccount = initialPhoneAccount;
Intent intent = new Intent(this, CallRedirectionActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
@@ -57,6 +59,6 @@
public void tryRedirectCallAndAskToConfirm() {
// Provide call identification
- redirectCall(SAMPLE_HANDLE, SAMPLE_PHONE_ACCOUNT, true);
+ redirectCall(SAMPLE_HANDLE, mDestinationPhoneAccount, true);
}
}