From 9d10e6487be420597dc40c2ef4a72796a13ec032 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Tue, 10 Jul 2018 18:48:42 +0000 Subject: Revert "Change reply with sms to chip." This reverts commit 19e85a54d723bbe23e51bed70df89bd3861570d7. Change-Id: Ic450c3012496a20c67327fc64e6b8a1047ea6995 --- .../dialer/theme/common/res/values/colors.xml | 4 +- .../hidden/res/values/colors_dialer_light.xml | 2 +- java/com/android/incallui/StatusBarNotifier.java | 2 +- .../incallui/answer/impl/AnswerFragment.java | 64 ++++++++-------------- .../drawable/secondary_action_chip_background.xml | 33 ----------- .../impl/res/layout/secondary_action_chip.xml | 37 ------------- .../incallui/answer/impl/res/values/strings.xml | 2 - .../android/incallui/speakeasy/Annotations.java | 4 +- .../incallui/speakeasy/SpeakEasyComponent.java | 9 +-- .../incallui/speakeasy/StubSpeakEasyModule.java | 14 ++--- 10 files changed, 41 insertions(+), 130 deletions(-) delete mode 100644 java/com/android/incallui/answer/impl/res/drawable/secondary_action_chip_background.xml delete mode 100644 java/com/android/incallui/answer/impl/res/layout/secondary_action_chip.xml (limited to 'java') 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 @@ #34A853 #D93025 - #DADCE0 + #D8D8D8 #2A56C6 #4285F4 @@ -31,4 +31,4 @@ #CFD8DC - + \ 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 @@ --> - @color/google_blue_600 + #2A56C6 #332A56C6 #1C3AA9 #F50057 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 speakEasyIconOptional = - SpeakEasyComponent.get(getContext()).speakEasyIconResource(); - Optional 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 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 @@ - - - - - - - - - - - - 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 @@ - - - - - - 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 @@ Swipe up to answer and hold ongoing call Swipe up to answer and end call on hold Swipe from icon to answer and end ongoing call - - Reply Write your own… Write your own… 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 speakEasySettingsObject(); - public abstract @SpeakEasyIconResourceId Optional speakEasyIconResource(); + public abstract @SpeakEasyChipResourceId Optional speakEasyChip(); public abstract @SpeakEasyTextResourceId Optional 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 provideSpeakEasySettingsActivity() { - return Optional.empty(); + return Optional.absent(); } @Provides static @SpeakEasySettingsObject Optional provideSpeakEasySettingsObject() { - return Optional.empty(); + return Optional.absent(); } @Provides - static @SpeakEasyIconResourceId Optional provideSpeakEasyIconResource() { - return Optional.empty(); + static @SpeakEasyChipResourceId Optional provideSpeakEasyChip() { + return Optional.absent(); } @Provides static @SpeakEasyTextResourceId Optional provideSpeakEasyTextResource() { - return Optional.empty(); + return Optional.absent(); } } -- cgit v1.2.3