Dialer: Redesign InCallUI
* Light one keeps the gradient background,
dark moves to a unicolor solid background
* Buttons get non phone dependent icon color
* Call end button also varies (icon) color
on light/dark theme
Change-Id: I378718ff6ee9af63ba8b4ec9b3532f7f30b5e44a
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index 125647b..d93a8d7 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -446,11 +446,6 @@
return;
}
- if (call != null) {
- inCallButtonUi.updateInCallButtonUiColors(
- InCallPresenter.getInstance().getThemeColorManager().getSecondaryColor());
- }
-
final boolean isEnabled =
state.isConnectingOrConnected() && !state.isIncoming() && call != null;
inCallButtonUi.setEnabled(isEnabled);
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index f6f27b4..8d3e45f 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -870,7 +870,6 @@
"InCallPresenter.setBoundAndWaitingForOutgoingCall",
"setBoundAndWaitingForOutgoingCall: " + isBound);
boundAndWaitingForOutgoingCall = isBound;
- themeColorManager.setPendingPhoneAccountHandle(handle);
if (isBound && inCallState == InCallState.NO_CALLS) {
inCallState = InCallState.PENDING_OUTGOING;
}
diff --git a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
index c566f79..7c47e54 100644
--- a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
+++ b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
@@ -21,6 +21,7 @@
import android.content.res.TypedArray;
import android.telecom.PhoneAccount;
import com.android.contacts.common.util.MaterialColorMapUtils;
+import com.android.dialer.R;
import com.android.dialer.theme.base.ThemeComponent;
public class InCallUIMaterialColorMapUtils extends MaterialColorMapUtils {
@@ -55,17 +56,6 @@
*/
@Override
public MaterialPalette calculatePrimaryAndSecondaryColor(int color) {
- if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) {
- return getDefaultPrimaryAndSecondaryColors(context);
- }
-
- for (int i = 0; i < primaryColors.length(); i++) {
- if (primaryColors.getColor(i, 0) == color) {
- return new MaterialPalette(primaryColors.getColor(i, 0), secondaryColors.getColor(i, 0));
- }
- }
-
- // The color isn't in the list, so use the superclass to find an approximate color.
- return super.calculatePrimaryAndSecondaryColor(color);
+ return getDefaultPrimaryAndSecondaryColors(context);
}
}
diff --git a/java/com/android/incallui/ThemeColorManager.java b/java/com/android/incallui/ThemeColorManager.java
index 59697f0..e6f0f0b 100644
--- a/java/com/android/incallui/ThemeColorManager.java
+++ b/java/com/android/incallui/ThemeColorManager.java
@@ -17,11 +17,6 @@
package com.android.incallui;
import android.content.Context;
-import android.graphics.Color;
-import android.support.v4.graphics.ColorUtils;
-import android.telecom.PhoneAccount;
-import android.telecom.PhoneAccountHandle;
-import android.telecom.TelecomManager;
import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;
@@ -31,6 +26,8 @@
import com.android.dialer.R;
import com.android.incallui.call.DialerCall;
+import static android.telecom.PhoneAccount.NO_HIGHLIGHT_COLOR;
+
/**
* Calculates the background color for the in call window. The background color is based on the SIM
* and spam status.
@@ -44,32 +41,19 @@
@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
- * determine the theme color for InCallUI.
- */
- @Nullable private PhoneAccountHandle pendingPhoneAccountHandle;
-
public ThemeColorManager(MaterialColorMapUtils colorMap) {
this.colorMap = colorMap;
}
- public void setPendingPhoneAccountHandle(@Nullable PhoneAccountHandle pendingPhoneAccountHandle) {
- this.pendingPhoneAccountHandle = pendingPhoneAccountHandle;
- }
-
public void onForegroundCallChanged(Context context, @Nullable DialerCall newForegroundCall) {
if (newForegroundCall == null) {
- updateThemeColors(context, getHighlightColor(context, pendingPhoneAccountHandle), false);
+ updateThemeColors(context, false);
} else {
- updateThemeColors(
- context,
- getHighlightColor(context, newForegroundCall.getAccountHandle()),
- newForegroundCall.isSpam());
+ updateThemeColors(context, newForegroundCall.isSpam());
}
}
- private void updateThemeColors(Context context, @ColorInt int highlightColor, boolean isSpam) {
+ private void updateThemeColors(Context context, boolean isSpam) {
MaterialPalette palette;
if (isSpam) {
palette =
@@ -79,7 +63,7 @@
backgroundColorBottom = context.getColor(R.color.incall_background_gradient_spam_bottom);
backgroundColorSolid = context.getColor(R.color.incall_background_multiwindow_spam);
} else {
- palette = colorMap.calculatePrimaryAndSecondaryColor(highlightColor);
+ palette = colorMap.calculatePrimaryAndSecondaryColor(NO_HIGHLIGHT_COLOR);
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);
@@ -91,17 +75,6 @@
}
@ColorInt
- private int getHighlightColor(Context context, @Nullable PhoneAccountHandle handle) {
- if (handle != null) {
- PhoneAccount account = context.getSystemService(TelecomManager.class).getPhoneAccount(handle);
- if (account != null) {
- return account.getHighlightColor();
- }
- }
- return PhoneAccount.NO_HIGHLIGHT_COLOR;
- }
-
- @ColorInt
public int getPrimaryColor() {
return primaryColor;
}
diff --git a/java/com/android/incallui/commontheme/res/color/incall_button_background.xml b/java/com/android/incallui/commontheme/res/color/incall_button_background.xml
index 5df441f..79c8710 100644
--- a/java/com/android/incallui/commontheme/res/color/incall_button_background.xml
+++ b/java/com/android/incallui/commontheme/res/color/incall_button_background.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@android:color/white" android:state_enabled="true"/>
+ <item android:color="@color/incall_button_background_color" android:state_enabled="true"/>
<item android:color="#99ffffff" android:state_enabled="false"/>
</selector>
diff --git a/java/com/android/incallui/commontheme/res/drawable/answer_answer_background.xml b/java/com/android/incallui/commontheme/res/drawable/answer_answer_background.xml
index 090506a..7ad8020 100644
--- a/java/com/android/incallui/commontheme/res/drawable/answer_answer_background.xml
+++ b/java/com/android/incallui/commontheme/res/drawable/answer_answer_background.xml
@@ -4,7 +4,7 @@
<item>
<shape
android:shape="oval">
- <solid android:color="#09ad00"/>
+ <solid android:color="@color/dialer_call_green"/>
</shape>
</item>
</ripple>
diff --git a/java/com/android/incallui/commontheme/res/values-night/colors.xml b/java/com/android/incallui/commontheme/res/values-night/colors.xml
new file mode 100644
index 0000000..edf0e9e
--- /dev/null
+++ b/java/com/android/incallui/commontheme/res/values-night/colors.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="incall_button_background_color">@*android:color/system_neutral1_50</color>
+ <color name="incall_end_call_icon_color">@android:color/black</color>
+</resources>
diff --git a/java/com/android/incallui/commontheme/res/values/colors.xml b/java/com/android/incallui/commontheme/res/values/colors.xml
index 50b0617..565446b 100644
--- a/java/com/android/incallui/commontheme/res/values/colors.xml
+++ b/java/com/android/incallui/commontheme/res/values/colors.xml
@@ -21,4 +21,7 @@
<!-- Background color for spam. This color must match one of background_colors_dark in call UI. -->
<color name="incall_call_spam_background_color">@color/blocked_contact_background</color>
+
+ <color name="incall_button_background_color">@*android:color/system_neutral1_50</color>
+ <color name="incall_end_call_icon_color">@android:color/white</color>
</resources>
diff --git a/java/com/android/incallui/commontheme/res/values/styles.xml b/java/com/android/incallui/commontheme/res/values/styles.xml
index d3ed5c0..0e557d1 100644
--- a/java/com/android/incallui/commontheme/res/values/styles.xml
+++ b/java/com/android/incallui/commontheme/res/values/styles.xml
@@ -48,6 +48,7 @@
<item name="android:layout_width">@dimen/incall_end_call_button_size</item>
<item name="android:padding">8dp</item>
<item name="android:src">@drawable/quantum_ic_call_end_vd_theme_24</item>
+ <item name="android:tint">@color/incall_end_call_icon_color</item>
<item name="android:stateListAnimator">@animator/disabled_alpha</item>
</style>
@@ -60,7 +61,7 @@
</style>
<style name="Answer.Button.Decline">
- <item name="android:background">@drawable/answer_decline_background</item>
+ <item name="android:background">@drawable/incall_end_call_background</item>
</style>
</resources>
diff --git a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java
index 46de11b..018783b 100644
--- a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java
+++ b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java
@@ -131,12 +131,6 @@
return numVisibleButtons;
}
- public void updateButtonColor(@ColorInt int color) {
- for (CheckableLabeledButton button : buttons) {
- button.setCheckedColor(color);
- }
- }
-
/** Interface to let the listener know the status of the button grid. */
public interface OnButtonGridCreatedListener {
void onButtonGridCreated(InCallButtonGridFragment inCallButtonGridFragment);
diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java
index e1e8da5..0e6776c 100644
--- a/java/com/android/incallui/incall/impl/InCallFragment.java
+++ b/java/com/android/incallui/incall/impl/InCallFragment.java
@@ -526,11 +526,6 @@
}
@Override
- public void updateInCallButtonUiColors(@ColorInt int color) {
- inCallButtonGridFragment.updateButtonColor(color);
- }
-
- @Override
public Fragment getInCallButtonUiFragment() {
return this;
}
diff --git a/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml b/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml
index 000525f..a24ae70 100644
--- a/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml
+++ b/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml
@@ -16,6 +16,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="?android:attr/colorPrimaryDark" android:state_checked="true"/>
+ <item android:color="@color/incall_button_icon_color" android:state_checked="true"/>
<item android:color="?android:attr/textColorPrimary"/>
</selector>
diff --git a/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_checked.xml b/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_checked.xml
index 73c6947..b0f310b 100644
--- a/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_checked.xml
+++ b/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_checked.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
- <solid android:color="@color/incall_button_white"/>
+ <solid android:color="@color/incall_button_background"/>
</shape>
diff --git a/java/com/android/incallui/incall/protocol/InCallButtonUi.java b/java/com/android/incallui/incall/protocol/InCallButtonUi.java
index 9312d0b..dcfa512 100644
--- a/java/com/android/incallui/incall/protocol/InCallButtonUi.java
+++ b/java/com/android/incallui/incall/protocol/InCallButtonUi.java
@@ -50,8 +50,6 @@
*/
void updateButtonStates();
- void updateInCallButtonUiColors(@ColorInt int color);
-
Fragment getInCallButtonUiFragment();
void showAudioRouteSelector();
diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java
index a71a25f..0a9f0d5 100644
--- a/java/com/android/incallui/rtt/impl/RttChatFragment.java
+++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java
@@ -569,9 +569,6 @@
public void updateButtonStates() {}
@Override
- public void updateInCallButtonUiColors(int color) {}
-
- @Override
public Fragment getInCallButtonUiFragment() {
return this;
}
diff --git a/java/com/android/incallui/theme/res/values-night/colors.xml b/java/com/android/incallui/theme/res/values-night/colors.xml
new file mode 100644
index 0000000..09c3a4e
--- /dev/null
+++ b/java/com/android/incallui/theme/res/values-night/colors.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="incall_background_gradient_top">@color/dialer_theme_color_dark</color>
+ <color name="incall_background_gradient_middle">@color/dialer_theme_color_dark</color>
+ <color name="incall_background_gradient_bottom">@color/dialer_theme_color_dark</color>
+ <color name="incall_background_multiwindow">@color/dialer_theme_color_dark</color>
+ <color name="incall_button_icon_color">@android:color/black</color>
+</resources>
diff --git a/java/com/android/incallui/theme/res/values/colors.xml b/java/com/android/incallui/theme/res/values/colors.xml
index 0ed34ff..fda75a2 100644
--- a/java/com/android/incallui/theme/res/values/colors.xml
+++ b/java/com/android/incallui/theme/res/values/colors.xml
@@ -62,4 +62,6 @@
<color name="incall_background_gradient_spam_bottom">#B8E55135</color>
<color name="incall_background_multiwindow_spam">#E9C22E2E</color>
+
+ <color name="incall_button_icon_color">@android:color/black</color>
</resources>
diff --git a/java/com/android/incallui/theme/res/values/styles.xml b/java/com/android/incallui/theme/res/values/styles.xml
index 970d7b7..24e5aa4 100644
--- a/java/com/android/incallui/theme/res/values/styles.xml
+++ b/java/com/android/incallui/theme/res/values/styles.xml
@@ -26,7 +26,7 @@
<item name="colorPrimaryDark">@color/dialer_theme_color_dark</item>
<item name="dialpad_style">@style/InCallDialpad</item>
<item name="android:windowAnimationStyle">@null</item>
- <item name="android:windowBackground">@drawable/incall_background_gradient</item>
+ <item name="android:windowBackground">@color/dialer_theme_color_dark</item>
<item name="android:windowShowWallpaper">true</item>
<item name="bottomSheetDialogTheme">@style/TransparentBottomSheetDialogTheme</item>
</style>
diff --git a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java
index 0335411..97c24ca 100644
--- a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java
+++ b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java
@@ -817,9 +817,6 @@
}
@Override
- public void updateInCallButtonUiColors(@ColorInt int color) {}
-
- @Override
public Fragment getInCallButtonUiFragment() {
return this;
}
diff --git a/java/com/android/incallui/video/impl/VideoCallFragment.java b/java/com/android/incallui/video/impl/VideoCallFragment.java
index 1af650b..316c18a 100644
--- a/java/com/android/incallui/video/impl/VideoCallFragment.java
+++ b/java/com/android/incallui/video/impl/VideoCallFragment.java
@@ -929,9 +929,6 @@
}
@Override
- public void updateInCallButtonUiColors(@ColorInt int color) {}
-
- @Override
public Fragment getInCallButtonUiFragment() {
return this;
}
diff --git a/java/com/android/incallui/video/impl/res/drawable/videocall_background_circle_white.xml b/java/com/android/incallui/video/impl/res/drawable/videocall_background_circle_white.xml
index ee514c7..4675f75 100644
--- a/java/com/android/incallui/video/impl/res/drawable/videocall_background_circle_white.xml
+++ b/java/com/android/incallui/video/impl/res/drawable/videocall_background_circle_white.xml
@@ -4,7 +4,7 @@
<item>
<shape
android:shape="oval">
- <solid android:color="@color/incall_button_white"/>
+ <solid android:color="@color/incall_button_background"/>
</shape>
</item>
</ripple>