diff options
author | calderwoodra <calderwoodra@google.com> | 2018-05-23 12:59:03 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-29 23:26:22 -0700 |
commit | a93df43762f1539593da5f90bec16be2be01d281 (patch) | |
tree | 88c45d7ab1bd0242f6a0873158da6e5152e82ecd /java/com/android/incallui/InCallUIMaterialColorMapUtils.java | |
parent | ffd525d8eb9dbe1bc4d87909b01371743c296a16 (diff) |
Converted ThemeUtil into a DaggerModule.
This enables us to have Google-Sans font in GoogleDialer and Roboto in AOSP.
Bug: 79883035
Test: tap
PiperOrigin-RevId: 197774497
Change-Id: I1d490ab196a444c62e439444627d659fc42973ea
Diffstat (limited to 'java/com/android/incallui/InCallUIMaterialColorMapUtils.java')
-rw-r--r-- | java/com/android/incallui/InCallUIMaterialColorMapUtils.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java index 945e9fb5a..c566f7987 100644 --- a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java +++ b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java @@ -16,31 +16,35 @@ package com.android.incallui; +import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.telecom.PhoneAccount; import com.android.contacts.common.util.MaterialColorMapUtils; +import com.android.dialer.theme.base.ThemeComponent; public class InCallUIMaterialColorMapUtils extends MaterialColorMapUtils { private final TypedArray primaryColors; private final TypedArray secondaryColors; private final Resources resources; + private final Context context; - public InCallUIMaterialColorMapUtils(Resources resources) { - super(resources); + public InCallUIMaterialColorMapUtils(Context context) { + super(context.getResources()); + this.resources = context.getResources(); + this.context = context; primaryColors = resources.obtainTypedArray(R.array.background_colors); secondaryColors = resources.obtainTypedArray(R.array.background_colors_dark); - this.resources = resources; } /** * {@link Resources#getColor(int) used for compatibility */ @SuppressWarnings("deprecation") - public static MaterialPalette getDefaultPrimaryAndSecondaryColors(Resources resources) { - final int primaryColor = resources.getColor(R.color.dialer_theme_color); - final int secondaryColor = resources.getColor(R.color.dialer_theme_color_dark); + public static MaterialPalette getDefaultPrimaryAndSecondaryColors(Context context) { + final int primaryColor = ThemeComponent.get(context).theme().getColorPrimary(); + final int secondaryColor = ThemeComponent.get(context).theme().getColorPrimaryDark(); return new MaterialPalette(primaryColor, secondaryColor); } @@ -52,7 +56,7 @@ public class InCallUIMaterialColorMapUtils extends MaterialColorMapUtils { @Override public MaterialPalette calculatePrimaryAndSecondaryColor(int color) { if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) { - return getDefaultPrimaryAndSecondaryColors(resources); + return getDefaultPrimaryAndSecondaryColors(context); } for (int i = 0; i < primaryColors.length(); i++) { |