summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/answer
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/incallui/answer')
-rw-r--r--java/com/android/incallui/answer/impl/AnswerFragment.java77
-rw-r--r--java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java13
-rw-r--r--java/com/android/incallui/answer/impl/answermethod/res/values/styles.xml7
-rw-r--r--java/com/android/incallui/answer/impl/res/drawable/secondary_action_chip_background.xml33
-rw-r--r--java/com/android/incallui/answer/impl/res/drawable/urgent_call_background.xml2
-rw-r--r--java/com/android/incallui/answer/impl/res/layout/fragment_avatar.xml3
-rw-r--r--java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml14
-rw-r--r--java/com/android/incallui/answer/impl/res/layout/secondary_action_chip.xml37
-rw-r--r--java/com/android/incallui/answer/impl/res/values/strings.xml2
-rw-r--r--java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java11
10 files changed, 72 insertions, 127 deletions
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index 8bfdcbaf6..8d8b08791 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -50,12 +50,11 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.widget.ImageView;
import android.widget.LinearLayout;
-import android.widget.TextView;
import com.android.dialer.common.Assert;
import com.android.dialer.common.FragmentUtils;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.MathUtil;
-import com.android.dialer.logging.DialerImpression.Type;
+import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
import com.android.dialer.multimedia.MultimediaData;
import com.android.dialer.telecom.TelecomUtil;
@@ -84,15 +83,15 @@ import com.android.incallui.incalluilock.InCallUiLock;
import com.android.incallui.maps.MapsComponent;
import com.android.incallui.sessiondata.AvatarPresenter;
import com.android.incallui.sessiondata.MultimediaFragment;
-import com.android.incallui.sessiondata.MultimediaFragment.Holder;
+import com.android.incallui.speakeasy.Annotations.SpeakEasyChipResourceId;
import com.android.incallui.speakeasy.SpeakEasyComponent;
import com.android.incallui.util.AccessibilityUtil;
import com.android.incallui.video.protocol.VideoCallScreen;
import com.android.incallui.videotech.utils.VideoUtils;
+import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-import java.util.Optional;
/** The new version of the incoming call screen. */
@SuppressLint("ClickableViewAccessibility")
@@ -102,7 +101,7 @@ public class AnswerFragment extends Fragment
SmsSheetHolder,
CreateCustomSmsHolder,
AnswerMethodHolder,
- Holder {
+ MultimediaFragment.Holder {
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
static final String ARG_CALL_ID = "call_id";
@@ -433,11 +432,6 @@ public class AnswerFragment extends Fragment
secondaryButton.setFocusable(AccessibilityUtil.isAccessibilityEnabled(getContext()));
secondaryButton.setAccessibilityDelegate(accessibilityDelegate);
- // TODO(wangqi): Remove this when all secondary behavior is migrated to chip button.
- if (secondaryBehavior.equals(SecondaryBehavior.REJECT_WITH_SMS)) {
- secondaryButton.setVisibility(View.INVISIBLE);
- }
-
if (isVideoUpgradeRequest()) {
secondaryButton.setVisibility(View.INVISIBLE);
} else if (isVideoCall()) {
@@ -467,39 +461,26 @@ public class AnswerFragment extends Fragment
});
}
- private void addSecondaryActionChip(
- @DrawableRes int iconRes, @StringRes int textRes, OnClickListener onClickListener) {
- LinearLayout button =
- (LinearLayout)
- getLayoutInflater().inflate(R.layout.secondary_action_chip, chipContainer, false);
-
- ImageView icon = button.findViewById(R.id.secondary_action_icon);
- icon.setImageResource(iconRes);
- TextView text = button.findViewById(R.id.secondary_action_text);
- text.setText(textRes);
- button.setOnClickListener(onClickListener);
- chipContainer.addView(button);
- }
-
/** Initialize chip buttons */
private void initChips() {
- if (allowSpeakEasy()) {
- Optional<Integer> speakEasyIconOptional =
- SpeakEasyComponent.get(getContext()).speakEasyIconResource();
- Optional<Integer> speakEasyTextOptional =
- SpeakEasyComponent.get(getContext()).speakEasyTextResource();
- if (speakEasyIconOptional.isPresent() && speakEasyTextOptional.isPresent()) {
- addSecondaryActionChip(
- speakEasyIconOptional.get(), speakEasyTextOptional.get(), this::performSpeakEasy);
- }
+
+ if (!allowSpeakEasy()) {
+ chipContainer.setVisibility(View.GONE);
+ return;
}
- if (!isVideoCall() && !isVideoUpgradeRequest()) {
- addSecondaryActionChip(
- R.drawable.quantum_ic_message_white_24,
- R.string.call_incoming_reply_with_sms,
- v -> performSecondaryButtonAction());
+ chipContainer.setVisibility(View.VISIBLE);
+
+ @SpeakEasyChipResourceId
+ Optional<Integer> chipLayoutOptional = SpeakEasyComponent.get(getContext()).speakEasyChip();
+ if (chipLayoutOptional.isPresent()) {
+
+ LinearLayout chipLayout =
+ (LinearLayout) getLayoutInflater().inflate(chipLayoutOptional.get(), null);
+
+ chipLayout.setOnClickListener(this::performSpeakEasy);
+
+ chipContainer.addView(chipLayout);
}
- chipContainer.setVisibility(chipContainer.getChildCount() > 0 ? View.VISIBLE : View.GONE);
}
@Override
@@ -899,6 +880,8 @@ public class AnswerFragment extends Fragment
if (primaryCallState != null) {
contactGridManager.setCallState(primaryCallState);
}
+
+ restoreBackgroundMaskColor();
}
@Override
@@ -917,6 +900,12 @@ public class AnswerFragment extends Fragment
@Override
public void onAnswerProgressUpdate(@FloatRange(from = -1f, to = 1f) float answerProgress) {
+ // Don't fade the window background for call waiting or video upgrades. Fading the background
+ // shows the system wallpaper which looks bad because on reject we switch to another call.
+ if (primaryCallState.state() == DialerCallState.INCOMING && !isVideoCall()) {
+ answerScreenDelegate.updateWindowBackgroundColor(answerProgress);
+ }
+
// Fade and scale contact name and video call text
float startDelay = .25f;
// Header progress is zero over positiveAdjustedProgress = [0, startDelay],
@@ -945,6 +934,7 @@ public class AnswerFragment extends Fragment
@Override
public void resetAnswerProgress() {
affordanceHolderLayout.reset(true);
+ restoreBackgroundMaskColor();
}
private void animateEntry(@NonNull View rootView) {
@@ -1005,13 +995,18 @@ public class AnswerFragment extends Fragment
"AnswerFragment.rejectCall",
"Null context when rejecting call. Logger call was skipped");
} else {
- Logger.get(context).logImpression(Type.REJECT_INCOMING_CALL_FROM_ANSWER_SCREEN);
+ Logger.get(context)
+ .logImpression(DialerImpression.Type.REJECT_INCOMING_CALL_FROM_ANSWER_SCREEN);
}
buttonRejectClicked = true;
answerScreenDelegate.onReject();
}
}
+ private void restoreBackgroundMaskColor() {
+ answerScreenDelegate.updateWindowBackgroundColor(0);
+ }
+
private void restoreSwipeHintTexts() {
if (getAnswerMethod() != null) {
if (allowAnswerAndRelease()) {
@@ -1156,7 +1151,7 @@ public class AnswerFragment extends Fragment
public void onViewCreated(View view, @Nullable Bundle bundle) {
super.onViewCreated(view, bundle);
avatarImageView = ((ImageView) view.findViewById(R.id.contactgrid_avatar));
- FragmentUtils.getParentUnsafe(this, Holder.class).updateAvatar(this);
+ FragmentUtils.getParentUnsafe(this, MultimediaFragment.Holder.class).updateAvatar(this);
}
@NonNull
diff --git a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
index b06a0c681..6742e4a36 100644
--- a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
+++ b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
@@ -36,7 +36,6 @@ import android.widget.TextView;
import com.android.dialer.common.DpUtil;
import com.android.dialer.common.FragmentUtils;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.theme.base.ThemeComponent;
import com.android.incallui.incalluilock.InCallUiLock;
import java.util.ArrayList;
import java.util.List;
@@ -69,8 +68,6 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment {
}
}
layout.addView(newTextViewItem(null));
- int paddingVertical = (int) DpUtil.dpToPx(getContext(), 8);
- layout.setPadding(0, paddingVertical, 0, paddingVertical);
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
return layout;
}
@@ -103,11 +100,11 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment {
TextView textView = new TextView(context);
textView.setText(text == null ? getString(R.string.call_incoming_message_custom) : text);
- int paddingHorizontal = (int) DpUtil.dpToPx(context, 24);
- int paddingVertical = (int) DpUtil.dpToPx(context, 12);
- textView.setPadding(paddingHorizontal, paddingVertical, paddingHorizontal, paddingVertical);
+ int padding = (int) DpUtil.dpToPx(context, 16);
+ textView.setPadding(padding, padding, padding, padding);
textView.setBackground(background);
- textView.setTextAppearance(R.style.Dialer_TextAppearance_Primary2);
+ textView.setTextColor(context.getColor(R.color.blue_grey_100));
+ textView.setTextAppearance(R.style.TextAppearance_AppCompat_Widget_PopupMenu_Large);
LayoutParams params =
new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
@@ -127,7 +124,7 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment {
@Override
public int getTheme() {
- return ThemeComponent.get(getContext()).theme().getBottomSheetStyleRes();
+ return R.style.Theme_Design_Light_BottomSheetDialog;
}
@Override
diff --git a/java/com/android/incallui/answer/impl/answermethod/res/values/styles.xml b/java/com/android/incallui/answer/impl/answermethod/res/values/styles.xml
new file mode 100644
index 000000000..fd3ca7ca0
--- /dev/null
+++ b/java/com/android/incallui/answer/impl/answermethod/res/values/styles.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="Dialer.Incall.TextAppearance.Hint">
+ <item name="android:textSize">14sp</item>
+ <item name="android:textStyle">italic</item>
+ </style>
+</resources>
diff --git a/java/com/android/incallui/answer/impl/res/drawable/secondary_action_chip_background.xml b/java/com/android/incallui/answer/impl/res/drawable/secondary_action_chip_background.xml
deleted file mode 100644
index a185ebb3c..000000000
--- a/java/com/android/incallui/answer/impl/res/drawable/secondary_action_chip_background.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 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="@color/dialer_divider_line_color">
- <item>
- <shape>
- <solid android:color="?android:attr/colorBackgroundFloating"/>
- <stroke
- android:width="1dp"
- android:color="@color/dialer_divider_line_color"/>
- <padding
- android:bottom="9dp"
- android:left="8dp"
- android:right="8dp"
- android:top="9dp"/>
- <corners android:radius="40dp"/>
- </shape>
- </item>
-</ripple>
diff --git a/java/com/android/incallui/answer/impl/res/drawable/urgent_call_background.xml b/java/com/android/incallui/answer/impl/res/drawable/urgent_call_background.xml
index 769529025..d995980c6 100644
--- a/java/com/android/incallui/answer/impl/res/drawable/urgent_call_background.xml
+++ b/java/com/android/incallui/answer/impl/res/drawable/urgent_call_background.xml
@@ -18,5 +18,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="24dp"/>
- <solid android:color="?android:attr/colorPrimary"/>
+ <solid android:color="#F50057"/>
</shape> \ No newline at end of file
diff --git a/java/com/android/incallui/answer/impl/res/layout/fragment_avatar.xml b/java/com/android/incallui/answer/impl/res/layout/fragment_avatar.xml
index 246abc577..f8e48942c 100644
--- a/java/com/android/incallui/answer/impl/res/layout/fragment_avatar.xml
+++ b/java/com/android/incallui/answer/impl/res/layout/fragment_avatar.xml
@@ -21,4 +21,5 @@
android:id="@id/contactgrid_avatar"
android:layout_width="@dimen/answer_avatar_size"
android:layout_height="@dimen/answer_avatar_size"
- android:layout_gravity="center"/>
+ android:layout_gravity="center"
+ android:elevation="@dimen/answer_data_elevation"/>
diff --git a/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml b/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml
index b5f1e4bb3..1672bf984 100644
--- a/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml
+++ b/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml
@@ -118,18 +118,22 @@
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"/>
+ <!-- TODO(a bug): textColorPrimary or textColorPrimaryInverse? -->
<TextView
android:id="@+id/incall_important_call_badge"
- style="@style/Dialer.TextAppearance.SubHeader"
+ android:textStyle="bold"
android:layout_width="wrap_content"
- android:layout_height="32dp"
+ android:layout_height="48dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="@dimen/answer_importance_margin_bottom"
android:background="@drawable/urgent_call_background"
+ android:elevation="@dimen/answer_data_elevation"
android:gravity="center"
android:maxLines="1"
android:text="@string/call_incoming_important"
- android:textColor="?android:attr/colorBackground"/>
+ android:textAllCaps="true"
+ android:textColor="?android:attr/colorBackground"
+ android:textSize="14sp"/>
<FrameLayout
android:id="@+id/incall_location_holder"
@@ -137,7 +141,9 @@
android:layout_height="wrap_content"/>
<include
- layout="@layout/device_number_row"/>
+ layout="@layout/device_number_row"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
<FrameLayout
android:id="@+id/incall_data_container"
diff --git a/java/com/android/incallui/answer/impl/res/layout/secondary_action_chip.xml b/java/com/android/incallui/answer/impl/res/layout/secondary_action_chip.xml
deleted file mode 100644
index dd4199b0c..000000000
--- a/java/com/android/incallui/answer/impl/res/layout/secondary_action_chip.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 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="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/secondary_action_chip_background"
- android:clickable="true"
- android:layout_marginEnd="8dp"
- android:orientation="horizontal">
- <ImageView
- android:id="@+id/secondary_action_icon"
- android:layout_width="20dp"
- android:layout_height="20dp"
- android:tint="?android:attr/colorPrimary"/>
- <TextView
- android:id="@+id/secondary_action_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:layout_marginEnd="8dp"
- style="@style/Dialer.TextAppearance.SubHeader"/>
-</LinearLayout>
diff --git a/java/com/android/incallui/answer/impl/res/values/strings.xml b/java/com/android/incallui/answer/impl/res/values/strings.xml
index ac56460f1..2bc9ca09f 100644
--- a/java/com/android/incallui/answer/impl/res/values/strings.xml
+++ b/java/com/android/incallui/answer/impl/res/values/strings.xml
@@ -20,8 +20,6 @@
<string name="call_incoming_default_label_answer_and_release_second">Swipe up to answer and hold ongoing call</string>
<string name="call_incoming_default_label_answer_and_release_third">Swipe up to answer and end call on hold</string>
<string name="call_incoming_swipe_to_answer_and_release">Swipe from icon to answer and end ongoing call</string>
- <!-- Reply with SMS option on incoming call screen. [CHAT LIMIT=20] -->
- <string name="call_incoming_reply_with_sms">Reply</string>
<string name="call_incoming_message_custom">Write your own…</string>
<!-- "Respond via SMS" option that lets you compose a custom response. [CHAR LIMIT=30] -->
<string name="call_incoming_respond_via_sms_custom_message">Write your own…</string>
diff --git a/java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java b/java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java
index db2af9bbb..172d9646a 100644
--- a/java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java
+++ b/java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java
@@ -16,6 +16,7 @@
package com.android.incallui.answer.protocol;
+import android.support.annotation.FloatRange;
import com.android.incallui.incalluilock.InCallUiLock;
/** Callbacks implemented by the container app for this module. */
@@ -36,6 +37,16 @@ public interface AnswerScreenDelegate {
void onAnswerAndReleaseButtonEnabled();
void onAnswerAndReleaseButtonDisabled();
+ /**
+ * Sets the window background color based on foreground call's theme and the given progress. This
+ * is called from the answer UI to animate the accept and reject action.
+ *
+ * <p>When the user is rejecting we animate the background color to a mostly transparent gray. The
+ * end effect is that the home screen shows through.
+ *
+ * @param progress float from -1 to 1. -1 is fully rejected, 1 is fully accepted, and 0 is neutral
+ */
+ void updateWindowBackgroundColor(@FloatRange(from = -1f, to = 1.0f) float progress);
/** Returns true if any answer/reject action timed out. */
boolean isActionTimeout();