From b6c615dba7609e5134e960a92e723cfeadfbc589 Mon Sep 17 00:00:00 2001 From: wangqi Date: Fri, 22 Jun 2018 16:27:21 -0700 Subject: UI refresh for voice call screen. Bug: 79878432 Test: screen diff tests PiperOrigin-RevId: 201758864 Change-Id: Ib3ed6636df3d337cb2fa7c5f6d8f24da035cbd0c --- java/com/android/dialer/theme/base/Theme.java | 3 +++ .../dialer/theme/base/impl/AospThemeImpl.java | 9 +++++++++ .../theme/base/res/values/theme_dialer_dark.xml | 2 +- .../theme/base/res/values/theme_dialer_light.xml | 4 ++-- .../dialer/theme/common/res/values/colors.xml | 2 +- .../res/color/dialer_dark_primary_text_color.xml | 2 +- .../res/color/dialer_dark_secondary_text_color.xml | 2 +- .../theme/hidden/res/color/dialer_icon_color.xml | 22 ++++++++++++++++++++++ .../hidden/res/values/colors_dialer_light.xml | 1 - .../dialer/theme/hidden/res/values/styles.xml | 1 - java/com/android/incallui/CallButtonPresenter.java | 5 ----- .../res/drawable/answer_answer_background.xml | 17 ++++++++++++++++- .../res/drawable/answer_decline_background.xml | 17 ++++++++++++++++- .../res/drawable/incall_end_call_background.xml | 17 ++++++++++++++++- .../incallui/commontheme/res/values/styles.xml | 2 +- .../incall/impl/CheckableLabeledButton.java | 14 ++------------ .../incall/impl/InCallButtonGridFragment.java | 7 ------- .../incallui/incall/impl/InCallFragment.java | 6 ------ .../incall/impl/res/color/incall_button_icon.xml | 4 ++-- .../drawable/incall_button_background_checked.xml | 17 ++++++++++++++++- .../incall/impl/res/layout/frag_incall_voice.xml | 3 +-- .../incallui/incall/protocol/InCallButtonUi.java | 3 --- .../android/incallui/rtt/impl/RttChatFragment.java | 3 --- .../video/impl/SurfaceViewVideoCallFragment.java | 4 ---- .../incallui/video/impl/VideoCallFragment.java | 4 ---- 25 files changed, 110 insertions(+), 61 deletions(-) create mode 100644 java/com/android/dialer/theme/hidden/res/color/dialer_icon_color.xml (limited to 'java') diff --git a/java/com/android/dialer/theme/base/Theme.java b/java/com/android/dialer/theme/base/Theme.java index 6e0d20a7a..2a9975b4b 100644 --- a/java/com/android/dialer/theme/base/Theme.java +++ b/java/com/android/dialer/theme/base/Theme.java @@ -17,6 +17,7 @@ package com.android.dialer.theme.base; import android.content.Context; +import android.content.res.ColorStateList; import android.support.annotation.ColorInt; import android.support.annotation.IntDef; import android.support.annotation.StyleRes; @@ -50,6 +51,8 @@ public interface Theme { @ColorInt int getColorIcon(); + ColorStateList getColorIconStateList(); + @ColorInt int getColorIconSecondary(); diff --git a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java index c8f20c731..35dcef27c 100644 --- a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java +++ b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java @@ -17,6 +17,7 @@ package com.android.dialer.theme.base.impl; import android.content.Context; +import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.support.annotation.ColorInt; import android.support.annotation.StyleRes; @@ -33,6 +34,7 @@ import javax.inject.Singleton; public class AospThemeImpl implements Theme { private int colorIcon = -1; + private final ColorStateList colorIconStateList; private int colorIconSecondary = -1; private int colorPrimary = -1; private int colorPrimaryDark = -1; @@ -80,6 +82,7 @@ public class AospThemeImpl implements Theme { colorBackground = array.getColor(/* index= */ 7, /* defValue= */ -1); colorBackgroundFloating = array.getColor(/* index= */ 8, /* defValue= */ -1); colorIcon = array.getColor(/* index= */ 9, /* defValue= */ -1); + colorIconStateList = array.getColorStateList(/* index= */ 9); colorIconSecondary = array.getColor(/* index= */ 10, /* defValue= */ -1); colorTextOnUnthemedDarkBackground = array.getColor(/* index= */ 11, /* defValue= */ -1); colorIconOnUnthemedDarkBackground = array.getColor(/* index= */ 12, /* defValue= */ -1); @@ -125,6 +128,12 @@ public class AospThemeImpl implements Theme { return colorIcon; } + @Override + public ColorStateList getColorIconStateList() { + Assert.checkArgument(colorIconStateList != null); + return colorIconStateList; + } + @Override public @ColorInt int getColorIconSecondary() { Assert.checkArgument(colorIconSecondary != -1); 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 4b5034023..142bb897b 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 - @color/google_grey_400 + ?android:attr/textColorSecondary ?android:attr/textColorSecondary @android:color/white @android:color/white diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml index db06df4bd..e3eefe69a 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml @@ -39,7 +39,7 @@ diff --git a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java index bfc2781a9..4e8fa82c4 100644 --- a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java +++ b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java @@ -18,14 +18,11 @@ package com.android.incallui.incall.impl; import android.animation.AnimatorInflater; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.TypedArray; -import android.graphics.Color; import android.graphics.PorterDuff.Mode; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; import android.text.TextUtils.TruncateAt; @@ -36,6 +33,7 @@ import android.widget.Checkable; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import com.android.dialer.theme.base.ThemeComponent; /** A button to show on the incall screen */ public class CheckableLabeledButton extends LinearLayout implements Checkable { @@ -94,8 +92,7 @@ public class CheckableLabeledButton extends LinearLayout implements Checkable { iconView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding); iconView.setImageDrawable(icon); iconView.setImageTintMode(Mode.SRC_IN); - iconView.setImageTintList( - getResources().getColorStateList(R.color.incall_button_icon, context.getTheme())); + iconView.setImageTintList(ThemeComponent.get(context).theme().getColorIconStateList()); iconView.setBackground( getResources().getDrawable(R.drawable.incall_button_background, context.getTheme())); @@ -134,13 +131,6 @@ public class CheckableLabeledButton extends LinearLayout implements Checkable { labelView.setAlpha(isEnabled() ? 1f : DISABLED_STATE_OPACITY); } - public void setCheckedColor(@ColorInt int color) { - iconView.setImageTintList( - new ColorStateList( - new int[][] {new int[] {android.R.attr.state_checked}, new int[] {}}, - new int[] {color, Color.WHITE})); - } - public Drawable getIconDrawable() { return iconView.getDrawable(); } diff --git a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java index a0eead128..db0b5b9b8 100644 --- a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java +++ b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java @@ -17,7 +17,6 @@ package com.android.incallui.incall.impl; import android.os.Bundle; -import android.support.annotation.ColorInt; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.ArraySet; @@ -128,12 +127,6 @@ public class InCallButtonGridFragment extends Fragment { 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 7f20b407f..6e57058f9 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; import android.os.Handler; -import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; @@ -495,11 +494,6 @@ public class InCallFragment extends Fragment } } - @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 000525f5f..292d91f9b 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 @@ --> - - + + 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 73c6947e2..0d8732b4f 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,20 @@ + - + diff --git a/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml b/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml index 9cc599dc7..d200547b0 100644 --- a/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml +++ b/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml @@ -41,8 +41,7 @@ android:id="@id/contactgrid_avatar" android:layout_width="@dimen/incall_avatar_size" android:layout_height="@dimen/incall_avatar_size" - android:layout_marginBottom="8dp" - android:elevation="2dp"/> + android:layout_marginBottom="8dp"/>