summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/ThemeColorManager.java
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-07-10 20:56:34 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-07-10 20:56:34 +0000
commite0dbd9f9074559d73e93aeacc3ba27f65e820670 (patch)
tree7d98ebc6935ef764aa392f340a2dab4b69132d79 /java/com/android/incallui/ThemeColorManager.java
parent127998d2dde1014930e10d6dbd8841ab2c8228e4 (diff)
parent57ac221e28cd86ecd2b114ab1a0a9465d1c757de (diff)
Merge changes from topic "ui-update"
* changes: Revert "Ignore display cutout for in call UI." Revert "UI refresh for ringing screen." Revert "Internal change" Revert "UI refresh for voice call screen." Revert "Fix color for disabled button in voice call." Revert "Update style for important call badge." Revert "Change reply with sms to chip." Revert "Update emergency call map and device number UI." Revert "UI refresh for search bar." Revert "UI refersh for status bar." Revert "UI refresh for search fragment." Revert "UI refresh for FAB." Revert "UI refresh for bottom nav bar." Revert "UI refresh for reply with sms bottom sheet." Revert "UI refresh for call log items." Revert "UI Refresh for contacts."
Diffstat (limited to 'java/com/android/incallui/ThemeColorManager.java')
-rw-r--r--java/com/android/incallui/ThemeColorManager.java52
1 files changed, 50 insertions, 2 deletions
diff --git a/java/com/android/incallui/ThemeColorManager.java b/java/com/android/incallui/ThemeColorManager.java
index 967fae9ff..1d4c287be 100644
--- a/java/com/android/incallui/ThemeColorManager.java
+++ b/java/com/android/incallui/ThemeColorManager.java
@@ -17,8 +17,10 @@
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;
@@ -34,6 +36,10 @@ 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
@@ -51,21 +57,38 @@ public class ThemeColorManager {
public void onForegroundCallChanged(Context context, @Nullable DialerCall newForegroundCall) {
if (newForegroundCall == null) {
- updateThemeColors(getHighlightColor(context, pendingPhoneAccountHandle), false);
+ updateThemeColors(context, getHighlightColor(context, pendingPhoneAccountHandle), false);
} else {
updateThemeColors(
+ context,
getHighlightColor(context, newForegroundCall.getAccountHandle()),
newForegroundCall.isSpam());
}
}
- private void updateThemeColors(@ColorInt int highlightColor, boolean isSpam) {
+ private void updateThemeColors(Context context, @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;
@@ -92,4 +115,29 @@ 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));
+ }
}