summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/theme/common/res/values/colors.xml4
-rw-r--r--java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml2
-rw-r--r--java/com/android/incallui/StatusBarNotifier.java2
-rw-r--r--java/com/android/incallui/answer/impl/AnswerFragment.java64
-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/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/speakeasy/Annotations.java4
-rw-r--r--java/com/android/incallui/speakeasy/SpeakEasyComponent.java9
-rw-r--r--java/com/android/incallui/speakeasy/StubSpeakEasyModule.java14
10 files changed, 130 insertions, 41 deletions
diff --git a/java/com/android/dialer/theme/common/res/values/colors.xml b/java/com/android/dialer/theme/common/res/values/colors.xml
index 770aa8c15..207d29c80 100644
--- a/java/com/android/dialer/theme/common/res/values/colors.xml
+++ b/java/com/android/dialer/theme/common/res/values/colors.xml
@@ -18,7 +18,7 @@
<resources>
<color name="dialer_call_green">#34A853</color>
<color name="dialer_end_call_button_color">#D93025</color>
- <color name="dialer_divider_line_color">#D8D8D8</color>
+ <color name="dialer_divider_line_color">#DADCE0</color>
<color name="dialer_link_color">#2A56C6</color>
<color name="dialer_snackbar_action_text_color">#4285F4</color>
@@ -31,4 +31,4 @@
<!-- Legacy -->
<color name="blue_grey_100">#CFD8DC</color>
-</resources> \ No newline at end of file
+</resources>
diff --git a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml
index 0ed8e7566..4621be115 100644
--- a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml
+++ b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml
@@ -15,7 +15,7 @@
-->
<resources>
<!-- Essential theme colors -->
- <color name="dialer_theme_color">#2A56C6</color>
+ <color name="dialer_theme_color">@color/google_blue_600</color>
<color name="dialer_theme_color_20pct">#332A56C6</color>
<color name="dialer_theme_color_dark">#1C3AA9</color>
<color name="dialer_secondary_color">#F50057</color>
diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java
index 8316d76ee..439f6cf66 100644
--- a/java/com/android/incallui/StatusBarNotifier.java
+++ b/java/com/android/incallui/StatusBarNotifier.java
@@ -93,8 +93,8 @@ import com.android.incallui.ringtone.InCallTonePlayer;
import com.android.incallui.ringtone.ToneGeneratorFactory;
import com.android.incallui.speakeasy.SpeakEasyComponent;
import com.android.incallui.videotech.utils.SessionModificationState;
-import com.google.common.base.Optional;
import java.util.Objects;
+import java.util.Optional;
/** This class adds Notifications to the status bar for the in-call experience. */
public class StatusBarNotifier
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index f5da3effd..8bfdcbaf6 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -50,11 +50,12 @@ 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;
+import com.android.dialer.logging.DialerImpression.Type;
import com.android.dialer.logging.Logger;
import com.android.dialer.multimedia.MultimediaData;
import com.android.dialer.telecom.TelecomUtil;
@@ -83,15 +84,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.speakeasy.Annotations.SpeakEasyChipResourceId;
+import com.android.incallui.sessiondata.MultimediaFragment.Holder;
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")
@@ -101,7 +102,7 @@ public class AnswerFragment extends Fragment
SmsSheetHolder,
CreateCustomSmsHolder,
AnswerMethodHolder,
- MultimediaFragment.Holder {
+ Holder {
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
static final String ARG_CALL_ID = "call_id";
@@ -432,6 +433,11 @@ 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()) {
@@ -461,26 +467,39 @@ 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()) {
- chipContainer.setVisibility(View.GONE);
- return;
+ 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);
+ }
}
- 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);
+ if (!isVideoCall() && !isVideoUpgradeRequest()) {
+ addSecondaryActionChip(
+ R.drawable.quantum_ic_message_white_24,
+ R.string.call_incoming_reply_with_sms,
+ v -> performSecondaryButtonAction());
}
+ chipContainer.setVisibility(chipContainer.getChildCount() > 0 ? View.VISIBLE : View.GONE);
}
@Override
@@ -986,8 +1005,7 @@ public class AnswerFragment extends Fragment
"AnswerFragment.rejectCall",
"Null context when rejecting call. Logger call was skipped");
} else {
- Logger.get(context)
- .logImpression(DialerImpression.Type.REJECT_INCOMING_CALL_FROM_ANSWER_SCREEN);
+ Logger.get(context).logImpression(Type.REJECT_INCOMING_CALL_FROM_ANSWER_SCREEN);
}
buttonRejectClicked = true;
answerScreenDelegate.onReject();
@@ -1138,7 +1156,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, MultimediaFragment.Holder.class).updateAvatar(this);
+ FragmentUtils.getParentUnsafe(this, Holder.class).updateAvatar(this);
}
@NonNull
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
new file mode 100644
index 000000000..a185ebb3c
--- /dev/null
+++ b/java/com/android/incallui/answer/impl/res/drawable/secondary_action_chip_background.xml
@@ -0,0 +1,33 @@
+<?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/layout/secondary_action_chip.xml b/java/com/android/incallui/answer/impl/res/layout/secondary_action_chip.xml
new file mode 100644
index 000000000..dd4199b0c
--- /dev/null
+++ b/java/com/android/incallui/answer/impl/res/layout/secondary_action_chip.xml
@@ -0,0 +1,37 @@
+<?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 2bc9ca09f..ac56460f1 100644
--- a/java/com/android/incallui/answer/impl/res/values/strings.xml
+++ b/java/com/android/incallui/answer/impl/res/values/strings.xml
@@ -20,6 +20,8 @@
<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/speakeasy/Annotations.java b/java/com/android/incallui/speakeasy/Annotations.java
index c66fe94c3..0d420a457 100644
--- a/java/com/android/incallui/speakeasy/Annotations.java
+++ b/java/com/android/incallui/speakeasy/Annotations.java
@@ -29,9 +29,9 @@ public final class Annotations {
@Qualifier
public @interface SpeakEasySettingsObject {}
- /** A Speakeasy chip */
+ /** A Speakeasy icon resource */
@Qualifier
- public @interface SpeakEasyChipResourceId {}
+ public @interface SpeakEasyIconResourceId {}
/** A Speakeasy text resource */
@Qualifier
diff --git a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java
index 422ebd6da..84a21f3d1 100644
--- a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java
+++ b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java
@@ -19,20 +19,19 @@ package com.android.incallui.speakeasy;
import android.content.Context;
import android.preference.PreferenceActivity;
import com.android.dialer.inject.HasRootComponent;
-import com.android.incallui.speakeasy.Annotations.SpeakEasyChipResourceId;
+import com.android.incallui.speakeasy.Annotations.SpeakEasyIconResourceId;
import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsActivity;
import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsObject;
import com.android.incallui.speakeasy.Annotations.SpeakEasyTextResourceId;
-import com.google.common.base.Optional;
import dagger.Subcomponent;
+import java.util.Optional;
/** Dagger component to get SpeakEasyCallManager. */
@Subcomponent
public abstract class SpeakEasyComponent {
public static SpeakEasyComponent get(Context context) {
- return ((SpeakEasyComponent.HasComponent)
- ((HasRootComponent) context.getApplicationContext()).component())
+ return ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component())
.speakEasyComponent();
}
@@ -43,7 +42,7 @@ public abstract class SpeakEasyComponent {
public abstract @SpeakEasySettingsObject Optional<Object> speakEasySettingsObject();
- public abstract @SpeakEasyChipResourceId Optional<Integer> speakEasyChip();
+ public abstract @SpeakEasyIconResourceId Optional<Integer> speakEasyIconResource();
public abstract @SpeakEasyTextResourceId Optional<Integer> speakEasyTextResource();
diff --git a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java
index 5441075ef..781eee030 100644
--- a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java
+++ b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java
@@ -19,14 +19,14 @@ package com.android.incallui.speakeasy;
import android.preference.PreferenceActivity;
import com.android.dialer.inject.DialerVariant;
import com.android.dialer.inject.InstallIn;
-import com.android.incallui.speakeasy.Annotations.SpeakEasyChipResourceId;
+import com.android.incallui.speakeasy.Annotations.SpeakEasyIconResourceId;
import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsActivity;
import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsObject;
import com.android.incallui.speakeasy.Annotations.SpeakEasyTextResourceId;
-import com.google.common.base.Optional;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
+import java.util.Optional;
/** Module which binds {@link SpeakEasyCallManagerStub}. */
@InstallIn(variants = {DialerVariant.DIALER_TEST})
@@ -39,21 +39,21 @@ public abstract class StubSpeakEasyModule {
@Provides
static @SpeakEasySettingsActivity Optional<PreferenceActivity>
provideSpeakEasySettingsActivity() {
- return Optional.absent();
+ return Optional.empty();
}
@Provides
static @SpeakEasySettingsObject Optional<Object> provideSpeakEasySettingsObject() {
- return Optional.absent();
+ return Optional.empty();
}
@Provides
- static @SpeakEasyChipResourceId Optional<Integer> provideSpeakEasyChip() {
- return Optional.absent();
+ static @SpeakEasyIconResourceId Optional<Integer> provideSpeakEasyIconResource() {
+ return Optional.empty();
}
@Provides
static @SpeakEasyTextResourceId Optional<Integer> provideSpeakEasyTextResource() {
- return Optional.absent();
+ return Optional.empty();
}
}