From 36d5b93da4f93e50deb496daa5ad820c48aa7b01 Mon Sep 17 00:00:00 2001 From: wangqi Date: Thu, 21 Jun 2018 16:34:40 -0700 Subject: UI refresh for ringing screen. Bug: 79878432 Test: manual PiperOrigin-RevId: 201608196 Change-Id: Idff45359c5ddf3dacbeb77b103d3b53d3bf34334 --- .../theme/base/res/values/theme_dialer_dark.xml | 2 +- .../dialer/theme/common/res/values/colors.xml | 2 +- .../android/incallui/AnswerScreenPresenter.java | 9 --- .../incallui/AnswerScreenPresenterStub.java | 4 -- java/com/android/incallui/InCallActivity.java | 64 ---------------------- java/com/android/incallui/ThemeColorManager.java | 52 +----------------- .../incallui/answer/impl/AnswerFragment.java | 13 ----- .../answer/impl/answermethod/res/values/styles.xml | 7 --- .../answer/impl/res/layout/fragment_avatar.xml | 3 +- .../answer/protocol/AnswerScreenDelegate.java | 11 ---- .../incallui/commontheme/res/values/styles.xml | 15 +++-- .../res/layout/incall_contactgrid_top_row.xml | 49 +++++++++-------- .../res/drawable/incall_background_gradient.xml | 23 -------- .../android/incallui/theme/res/values/colors.xml | 12 ---- .../android/incallui/theme/res/values/styles.xml | 26 +-------- 15 files changed, 41 insertions(+), 251 deletions(-) delete mode 100644 java/com/android/incallui/answer/impl/answermethod/res/values/styles.xml delete mode 100644 java/com/android/incallui/theme/res/drawable/incall_background_gradient.xml (limited to 'java') diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml index 142bb897b..4b5034023 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml @@ -56,7 +56,7 @@ ?android:attr/colorPrimary - ?android:attr/textColorSecondary + @color/google_grey_400 ?android:attr/textColorSecondary @android:color/white @android:color/white 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 1831862b1..6fea43665 100644 --- a/java/com/android/dialer/theme/common/res/values/colors.xml +++ b/java/com/android/dialer/theme/common/res/values/colors.xml @@ -16,7 +16,7 @@ --> - #00C853 + #34A853 #BD2A2A #D8D8D8 #2A56C6 diff --git a/java/com/android/incallui/AnswerScreenPresenter.java b/java/com/android/incallui/AnswerScreenPresenter.java index 8b789f317..35290dee9 100644 --- a/java/com/android/incallui/AnswerScreenPresenter.java +++ b/java/com/android/incallui/AnswerScreenPresenter.java @@ -18,7 +18,6 @@ package com.android.incallui; import android.content.Context; import android.os.SystemClock; -import android.support.annotation.FloatRange; import android.support.annotation.NonNull; import android.support.v4.os.UserManagerCompat; import android.telecom.VideoProfile; @@ -216,14 +215,6 @@ public class AnswerScreenPresenter } } - @Override - public void updateWindowBackgroundColor(@FloatRange(from = -1f, to = 1.0f) float progress) { - InCallActivity activity = (InCallActivity) answerScreen.getAnswerScreenFragment().getActivity(); - if (activity != null) { - activity.updateWindowBackgroundColor(progress); - } - } - private class AnswerOnDisconnected implements DialerCallListener { private final DialerCall disconnectingCall; diff --git a/java/com/android/incallui/AnswerScreenPresenterStub.java b/java/com/android/incallui/AnswerScreenPresenterStub.java index e85fdaa37..a96fee392 100644 --- a/java/com/android/incallui/AnswerScreenPresenterStub.java +++ b/java/com/android/incallui/AnswerScreenPresenterStub.java @@ -16,7 +16,6 @@ package com.android.incallui; -import android.support.annotation.FloatRange; import com.android.incallui.answer.protocol.AnswerScreenDelegate; import com.android.incallui.incalluilock.InCallUiLock; @@ -49,9 +48,6 @@ public class AnswerScreenPresenterStub implements AnswerScreenDelegate { @Override public void onAnswerAndReleaseButtonDisabled() {} - @Override - public void updateWindowBackgroundColor(@FloatRange(from = -1f, to = 1.0f) float progress) {} - @Override public boolean isActionTimeout() { return false; diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java index 46affdfcc..82139e2c3 100644 --- a/java/com/android/incallui/InCallActivity.java +++ b/java/com/android/incallui/InCallActivity.java @@ -25,12 +25,8 @@ import android.app.KeyguardManager; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; -import android.graphics.drawable.GradientDrawable; -import android.graphics.drawable.GradientDrawable.Orientation; import android.os.Bundle; import android.os.Trace; -import android.support.annotation.ColorInt; -import android.support.annotation.FloatRange; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -40,7 +36,6 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.content.res.ResourcesCompat; -import android.support.v4.graphics.ColorUtils; import android.telecom.Call; import android.telecom.CallAudioState; import android.telecom.PhoneAccountHandle; @@ -137,7 +132,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity private Animation dialpadSlideInAnimation; private Animation dialpadSlideOutAnimation; private Dialog errorDialog; - private GradientDrawable backgroundDrawable; private InCallOrientationEventListener inCallOrientationEventListener; private View pseudoBlackScreenOverlay; private SelectPhoneAccountDialogFragment selectPhoneAccountDialogFragment; @@ -156,7 +150,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity private boolean isVisible; private boolean needDismissPendingDialogs; private boolean touchDownWhenPseudoScreenOff; - private int[] backgroundDrawableColors; @DialpadRequestType private int showDialpadRequest = DIALPAD_REQUEST_NONE; private SpeakEasyCallManager speakEasyCallManager; private DialogFragment rttRequestDialogFragment; @@ -874,11 +867,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity public void onForegroundCallChanged(DialerCall newForegroundCall) { updateTaskDescription(); - - if (newForegroundCall == null || !didShowAnswerScreen) { - LogUtil.v("InCallActivity.onForegroundCallChanged", "resetting background color"); - updateWindowBackgroundColor(0 /* progress */); - } } private void updateTaskDescription() { @@ -892,58 +880,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity getResources().getString(R.string.notification_ongoing_call), null /* icon */, color)); } - public void updateWindowBackgroundColor(@FloatRange(from = -1f, to = 1.0f) float progress) { - ThemeColorManager themeColorManager = InCallPresenter.getInstance().getThemeColorManager(); - @ColorInt int top; - @ColorInt int middle; - @ColorInt int bottom; - @ColorInt int gray = 0x66000000; - - if (isInMultiWindowMode()) { - top = themeColorManager.getBackgroundColorSolid(); - middle = themeColorManager.getBackgroundColorSolid(); - bottom = themeColorManager.getBackgroundColorSolid(); - } else { - top = themeColorManager.getBackgroundColorTop(); - middle = themeColorManager.getBackgroundColorMiddle(); - bottom = themeColorManager.getBackgroundColorBottom(); - } - - if (progress < 0) { - float correctedProgress = Math.abs(progress); - top = ColorUtils.blendARGB(top, gray, correctedProgress); - middle = ColorUtils.blendARGB(middle, gray, correctedProgress); - bottom = ColorUtils.blendARGB(bottom, gray, correctedProgress); - } - - boolean backgroundDirty = false; - if (backgroundDrawable == null) { - backgroundDrawableColors = new int[] {top, middle, bottom}; - backgroundDrawable = new GradientDrawable(Orientation.TOP_BOTTOM, backgroundDrawableColors); - backgroundDirty = true; - } else { - if (backgroundDrawableColors[0] != top) { - backgroundDrawableColors[0] = top; - backgroundDirty = true; - } - if (backgroundDrawableColors[1] != middle) { - backgroundDrawableColors[1] = middle; - backgroundDirty = true; - } - if (backgroundDrawableColors[2] != bottom) { - backgroundDrawableColors[2] = bottom; - backgroundDirty = true; - } - if (backgroundDirty) { - backgroundDrawable.setColors(backgroundDrawableColors); - } - } - - if (backgroundDirty) { - getWindow().setBackgroundDrawable(backgroundDrawable); - } - } - public boolean isVisible() { return isVisible; } diff --git a/java/com/android/incallui/ThemeColorManager.java b/java/com/android/incallui/ThemeColorManager.java index 1d4c287be..967fae9ff 100644 --- a/java/com/android/incallui/ThemeColorManager.java +++ b/java/com/android/incallui/ThemeColorManager.java @@ -17,10 +17,8 @@ package com.android.incallui; import android.content.Context; -import android.graphics.Color; import android.support.annotation.ColorInt; import android.support.annotation.Nullable; -import android.support.v4.graphics.ColorUtils; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; @@ -36,10 +34,6 @@ public class ThemeColorManager { private final MaterialColorMapUtils colorMap; @ColorInt private int primaryColor; @ColorInt private int secondaryColor; - @ColorInt private int backgroundColorTop; - @ColorInt private int backgroundColorMiddle; - @ColorInt private int backgroundColorBottom; - @ColorInt private int backgroundColorSolid; /** * If there is no actual call currently in the call list, this will be used as a fallback to @@ -57,38 +51,21 @@ public class ThemeColorManager { public void onForegroundCallChanged(Context context, @Nullable DialerCall newForegroundCall) { if (newForegroundCall == null) { - updateThemeColors(context, getHighlightColor(context, pendingPhoneAccountHandle), false); + updateThemeColors(getHighlightColor(context, pendingPhoneAccountHandle), false); } else { updateThemeColors( - context, getHighlightColor(context, newForegroundCall.getAccountHandle()), newForegroundCall.isSpam()); } } - private void updateThemeColors(Context context, @ColorInt int highlightColor, boolean isSpam) { + private void updateThemeColors(@ColorInt int highlightColor, boolean isSpam) { MaterialPalette palette; if (isSpam) { palette = colorMap.calculatePrimaryAndSecondaryColor(R.color.incall_call_spam_background_color); - backgroundColorTop = context.getColor(R.color.incall_background_gradient_spam_top); - backgroundColorMiddle = context.getColor(R.color.incall_background_gradient_spam_middle); - backgroundColorBottom = context.getColor(R.color.incall_background_gradient_spam_bottom); - backgroundColorSolid = context.getColor(R.color.incall_background_multiwindow_spam); } else { palette = colorMap.calculatePrimaryAndSecondaryColor(highlightColor); - backgroundColorTop = context.getColor(R.color.incall_background_gradient_top); - backgroundColorMiddle = context.getColor(R.color.incall_background_gradient_middle); - backgroundColorBottom = context.getColor(R.color.incall_background_gradient_bottom); - backgroundColorSolid = context.getColor(R.color.incall_background_multiwindow); - if (highlightColor != PhoneAccount.NO_HIGHLIGHT_COLOR) { - // The default background gradient has a subtle alpha. We grab that alpha and apply it to - // the phone account color. - backgroundColorTop = applyAlpha(palette.mPrimaryColor, backgroundColorTop); - backgroundColorMiddle = applyAlpha(palette.mPrimaryColor, backgroundColorMiddle); - backgroundColorBottom = applyAlpha(palette.mPrimaryColor, backgroundColorBottom); - backgroundColorSolid = applyAlpha(palette.mPrimaryColor, backgroundColorSolid); - } } primaryColor = palette.mPrimaryColor; @@ -115,29 +92,4 @@ public class ThemeColorManager { public int getSecondaryColor() { return secondaryColor; } - - @ColorInt - public int getBackgroundColorTop() { - return backgroundColorTop; - } - - @ColorInt - public int getBackgroundColorMiddle() { - return backgroundColorMiddle; - } - - @ColorInt - public int getBackgroundColorBottom() { - return backgroundColorBottom; - } - - @ColorInt - public int getBackgroundColorSolid() { - return backgroundColorSolid; - } - - @ColorInt - private static int applyAlpha(@ColorInt int color, @ColorInt int sourceColorWithAlpha) { - return ColorUtils.setAlphaComponent(color, Color.alpha(sourceColorWithAlpha)); - } } diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java index 8d8b08791..f5da3effd 100644 --- a/java/com/android/incallui/answer/impl/AnswerFragment.java +++ b/java/com/android/incallui/answer/impl/AnswerFragment.java @@ -880,8 +880,6 @@ public class AnswerFragment extends Fragment if (primaryCallState != null) { contactGridManager.setCallState(primaryCallState); } - - restoreBackgroundMaskColor(); } @Override @@ -900,12 +898,6 @@ 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], @@ -934,7 +926,6 @@ public class AnswerFragment extends Fragment @Override public void resetAnswerProgress() { affordanceHolderLayout.reset(true); - restoreBackgroundMaskColor(); } private void animateEntry(@NonNull View rootView) { @@ -1003,10 +994,6 @@ public class AnswerFragment extends Fragment } } - private void restoreBackgroundMaskColor() { - answerScreenDelegate.updateWindowBackgroundColor(0); - } - private void restoreSwipeHintTexts() { if (getAnswerMethod() != null) { if (allowAnswerAndRelease()) { 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 deleted file mode 100644 index fd3ca7ca0..000000000 --- a/java/com/android/incallui/answer/impl/answermethod/res/values/styles.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - 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 f8e48942c..246abc577 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,5 +21,4 @@ android:id="@id/contactgrid_avatar" android:layout_width="@dimen/answer_avatar_size" android:layout_height="@dimen/answer_avatar_size" - android:layout_gravity="center" - android:elevation="@dimen/answer_data_elevation"/> + android:layout_gravity="center"/> diff --git a/java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java b/java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java index 172d9646a..db2af9bbb 100644 --- a/java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java +++ b/java/com/android/incallui/answer/protocol/AnswerScreenDelegate.java @@ -16,7 +16,6 @@ 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. */ @@ -37,16 +36,6 @@ 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. - * - *

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(); diff --git a/java/com/android/incallui/commontheme/res/values/styles.xml b/java/com/android/incallui/commontheme/res/values/styles.xml index 464eda5bb..f2ec2ccc3 100644 --- a/java/com/android/incallui/commontheme/res/values/styles.xml +++ b/java/com/android/incallui/commontheme/res/values/styles.xml @@ -17,15 +17,12 @@ - - + + - - -- cgit v1.2.3