diff options
10 files changed, 41 insertions, 130 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 207d29c80..770aa8c15 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">#DADCE0</color> + <color name="dialer_divider_line_color">#D8D8D8</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> +</resources>
\ No newline at end of file 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 4621be115..0ed8e7566 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">@color/google_blue_600</color> + <color name="dialer_theme_color">#2A56C6</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 439f6cf66..8316d76ee 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 8bfdcbaf6..f5da3effd 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 @@ -1005,7 +986,8 @@ 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(); @@ -1156,7 +1138,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/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/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/speakeasy/Annotations.java b/java/com/android/incallui/speakeasy/Annotations.java index 0d420a457..c66fe94c3 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 icon resource */ + /** A Speakeasy chip */ @Qualifier - public @interface SpeakEasyIconResourceId {} + public @interface SpeakEasyChipResourceId {} /** A Speakeasy text resource */ @Qualifier diff --git a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java index 84a21f3d1..422ebd6da 100644 --- a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java +++ b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java @@ -19,19 +19,20 @@ 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.SpeakEasyIconResourceId; +import com.android.incallui.speakeasy.Annotations.SpeakEasyChipResourceId; 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 ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component()) + return ((SpeakEasyComponent.HasComponent) + ((HasRootComponent) context.getApplicationContext()).component()) .speakEasyComponent(); } @@ -42,7 +43,7 @@ public abstract class SpeakEasyComponent { public abstract @SpeakEasySettingsObject Optional<Object> speakEasySettingsObject(); - public abstract @SpeakEasyIconResourceId Optional<Integer> speakEasyIconResource(); + public abstract @SpeakEasyChipResourceId Optional<Integer> speakEasyChip(); 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 781eee030..5441075ef 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.SpeakEasyIconResourceId; +import com.android.incallui.speakeasy.Annotations.SpeakEasyChipResourceId; 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.empty(); + return Optional.absent(); } @Provides static @SpeakEasySettingsObject Optional<Object> provideSpeakEasySettingsObject() { - return Optional.empty(); + return Optional.absent(); } @Provides - static @SpeakEasyIconResourceId Optional<Integer> provideSpeakEasyIconResource() { - return Optional.empty(); + static @SpeakEasyChipResourceId Optional<Integer> provideSpeakEasyChip() { + return Optional.absent(); } @Provides static @SpeakEasyTextResourceId Optional<Integer> provideSpeakEasyTextResource() { - return Optional.empty(); + return Optional.absent(); } } |