diff options
author | calderwoodra <calderwoodra@google.com> | 2018-05-19 00:05:02 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-21 13:17:30 -0700 |
commit | 929539eb864822d669265b142bdcc49b6cf8ea6b (patch) | |
tree | fcaef3fac4068e3669ca5916f7a743d0d5e41bbb /java/com/android/dialer/theme | |
parent | ea7399a7c0c8a3832a6592aee0a0372c300b11f5 (diff) |
Implement a global theme to be easily configured in Dialer.
deleted several colors and unified them across the app
migrated several alert dialogs to support alert dialogs
added many todos
migrated several tests from GoogleRobolectricTestRunner to RobolectricTestRunner
Because of the test migration:
- moved dialpad theme attributes into dialpad/theme
- moved incall ui theme attributes into incallui/theme
Bug: 79883035
Test: tap
PiperOrigin-RevId: 197246477
Change-Id: Ifc534793bc32757bbbf2007a7c40287c8d0817ad
Diffstat (limited to 'java/com/android/dialer/theme')
14 files changed, 486 insertions, 197 deletions
diff --git a/java/com/android/dialer/theme/ThemeUtil.java b/java/com/android/dialer/theme/ThemeUtil.java new file mode 100644 index 000000000..227224448 --- /dev/null +++ b/java/com/android/dialer/theme/ThemeUtil.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.dialer.theme; + +import android.content.Context; +import android.content.res.TypedArray; +import android.support.annotation.ColorInt; +import android.support.annotation.StyleRes; +import android.view.ContextThemeWrapper; +import android.view.LayoutInflater; +import com.android.dialer.common.Assert; + +/** Utility for fetching */ +@SuppressWarnings("unused") +public class ThemeUtil { + + private static int theme = -1; + private static int colorIcon = -1; + private static int colorPrimary = -1; + private static int colorPrimaryDark = -1; + private static int colorAccent = -1; + private static int textColorPrimary = -1; + private static int textColorSecondary = -1; + private static int textColorPrimaryInverse = -1; + private static int textColorHint = -1; + private static int colorBackground = -1; + private static int colorBackgroundFloating = -1; + + public static void initializeTheme(Context context) { + // TODO(a bug): add share prefs check to configure this + theme = R.style.Dialer_ThemeBase_NoActionBar; + context = context.getApplicationContext(); + context.setTheme(theme); + TypedArray array = + context + .getTheme() + .obtainStyledAttributes( + theme, + new int[] { + android.R.attr.colorPrimary, + android.R.attr.colorPrimaryDark, + android.R.attr.colorAccent, + android.R.attr.textColorPrimary, + android.R.attr.textColorSecondary, + android.R.attr.textColorPrimaryInverse, + android.R.attr.textColorHint, + android.R.attr.colorBackground, + android.R.attr.colorBackgroundFloating, + R.attr.colorIcon, + }); + colorPrimary = array.getColor(/* index= */ 0, /* defValue= */ -1); + colorPrimaryDark = array.getColor(/* index= */ 1, /* defValue= */ -1); + colorAccent = array.getColor(/* index= */ 2, /* defValue= */ -1); + textColorPrimary = array.getColor(/* index= */ 3, /* defValue= */ -1); + textColorSecondary = array.getColor(/* index= */ 4, /* defValue= */ -1); + textColorPrimaryInverse = array.getColor(/* index= */ 5, /* defValue= */ -1); + textColorHint = array.getColor(/* index= */ 6, /* defValue= */ -1); + colorBackground = array.getColor(/* index= */ 7, /* defValue= */ -1); + colorBackgroundFloating = array.getColor(/* index= */ 8, /* defValue= */ -1); + colorIcon = array.getColor(/* index= */ 9, /* defValue= */ -1); + array.recycle(); + } + + public static @ColorInt int getColorIcon() { + Assert.checkArgument(colorIcon != -1); + return colorIcon; + } + + public static @ColorInt int getColorPrimary() { + Assert.checkArgument(colorPrimary != -1); + return colorPrimary; + } + + public static @ColorInt int getColorAccent() { + Assert.checkArgument(colorAccent != -1); + return colorAccent; + } + + public static @ColorInt int getTextColorSecondary() { + Assert.checkArgument(textColorSecondary != -1); + return textColorSecondary; + } + + public static @StyleRes int getTheme() { + Assert.checkArgument(theme != -1); + return theme; + } + + public static Context getThemedContext(Context context) { + return new ContextThemeWrapper(context, getTheme()); + } + + public static LayoutInflater getThemedLayoutInflator(LayoutInflater inflater) { + return inflater.cloneInContext(getThemedContext(inflater.getContext())); + } +} diff --git a/java/com/android/dialer/theme/attributes/AndroidManifest.xml b/java/com/android/dialer/theme/attributes/AndroidManifest.xml new file mode 100644 index 000000000..1a50716d2 --- /dev/null +++ b/java/com/android/dialer/theme/attributes/AndroidManifest.xml @@ -0,0 +1,16 @@ +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<manifest package="com.android.dialer.theme.attributes"/> diff --git a/java/com/android/dialer/theme/attributes/res/values/attr.xml b/java/com/android/dialer/theme/attributes/res/values/attr.xml new file mode 100644 index 000000000..6db0aa8d3 --- /dev/null +++ b/java/com/android/dialer/theme/attributes/res/values/attr.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<resources> + + <!-- Used to style all icons in Dialer. --> + <attr name="colorIcon" format="reference"/> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml b/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml index 347db41bc..6612b17ab 100644 --- a/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml +++ b/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml @@ -16,6 +16,6 @@ --> <!-- Primary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" android:color="@color/dialer_disabled_text_color"/> - <item android:color="#212121"/> + <item android:state_enabled="false" android:color="@color/dialer_text_color_disabled"/> + <item android:color="@color/dialer_primary_text_color_enabled"/> </selector>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml b/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml index 920b46792..e1c000aef 100644 --- a/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml +++ b/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml @@ -16,6 +16,6 @@ --> <!-- Secondary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" android:color="@color/dialer_disabled_text_color"/> - <item android:color="#636363"/> + <item android:state_enabled="false" android:color="@color/dialer_text_color_disabled"/> + <item android:color="@color/dialer_secondary_text_color_enabled"/> </selector>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/color/settings_text_color_primary.xml b/java/com/android/dialer/theme/res/color/settings_text_color_primary.xml new file mode 100644 index 000000000..ba259088a --- /dev/null +++ b/java/com/android/dialer/theme/res/color/settings_text_color_primary.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@color/setting_disabled_color" android:state_enabled="false"/> + <item android:color="@color/setting_primary_color"/> +</selector> diff --git a/java/com/android/dialer/theme/res/color/settings_text_color_secondary.xml b/java/com/android/dialer/theme/res/color/settings_text_color_secondary.xml new file mode 100644 index 000000000..2f7899272 --- /dev/null +++ b/java/com/android/dialer/theme/res/color/settings_text_color_secondary.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@color/setting_disabled_color" android:state_enabled="false"/> + <item android:color="@color/setting_secondary_color"/> +</selector> diff --git a/java/com/android/dialer/theme/res/values/colors.xml b/java/com/android/dialer/theme/res/values/colors.xml index 2185d861c..7c62a2103 100644 --- a/java/com/android/dialer/theme/res/values/colors.xml +++ b/java/com/android/dialer/theme/res/values/colors.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2012 The Android Open Source Project ~ @@ -13,65 +14,18 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - +<!-- The colors in this file aren't configured at the theme level. --> <resources> - <!-- Note: The following colors are used in the Dialer settings screens. Since Dialer's settings - link into the Telephony settings as well, changes to these colors should be mirrored in - Telephony: - - Android source path: packages/apps/PhoneCommon/res/values/colors.xml - - Local: dialer_theme_color Android Source: dialer_theme_color - - Local: dialer_theme_color_dark Android Source: dialer_theme_color_dark - Android source path: packages/services/Telecomm/res/values/colors.xml - - Local: dialer_theme_color Android Source: theme_color - - Local: dialer_theme_color_dark Android Source: dialer_settings_color_dark - --> - <color name="dialer_theme_color">#2A56C6</color> - <color name="dialer_theme_color_dark">#1C3AA9</color> - - <color name="dialer_snackbar_action_text_color">#4285F4</color> - <color name="dialer_theme_color_20pct">#332A56C6</color> - <color name="dialpad_fab_green">#00C853</color> - - <color name="dialer_secondary_color">#F50057</color> - - <color name="dialer_primary_text_color_white">#ffffff</color> - <color name="dialer_edit_text_hint_color">#DE78909C</color> - - <!-- 38% opacity --> - <color name="dialer_disabled_text_color">#9E9E9E</color> - + <color name="dialer_end_call_button_color">#BD2A2A</color> + <color name="dialer_divider_line_color">#D8D8D8</color> <color name="dialer_link_color">#2A56C6</color> - <!-- Color of the theme of the Dialer app --> - <color name="dialtacts_theme_color">@color/dialer_theme_color</color> - - <!-- Background color of new dialer activity --> - <color name="background_dialer_light">#fafafa</color> - <!-- White background for dialer --> - <color name="background_dialer_white">#ffffff</color> - <color name="background_dialer_call_log_list_item">@color/background_dialer_white</color> - <!-- Colors for the notification actions --> <color name="notification_action_accept">#097138</color> <color name="notification_action_dismiss">#A52714</color> <color name="notification_action_answer_video">#097138</color> - <!-- Background color of action bars --> - <color name="actionbar_background_color">@color/dialer_theme_color</color> - - <!-- Background color of title bars in recents --> - <color name="titlebar_in_recents_background_color">@color/dialer_theme_color_dark</color> - + <!-- Legacy --> <color name="blue_grey_100">#CFD8DC</color> - - <!-- 54% opacity --> - <color name="icon_color_grey">#89000000</color> - - <!-- Color for bubble --> - <color name="dialer_end_call_button_color">#BD2A2A</color> - - <!-- Color for list dividers --> - <color name="divider_line_color">#D8D8D8</color> -</resources> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/values/colors_dialer_light.xml b/java/com/android/dialer/theme/res/values/colors_dialer_light.xml new file mode 100644 index 000000000..ea8247414 --- /dev/null +++ b/java/com/android/dialer/theme/res/values/colors_dialer_light.xml @@ -0,0 +1,55 @@ +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<resources> + <!-- Note: The following colors are used in the Dialer settings screens. Since Dialer's settings + link into the Telephony settings as well, changes to these colors should be mirrored in + Telephony: + + Android source path: packages/apps/PhoneCommon/res/values/colors.xml + - Local: dialer_theme_color Android Source: dialer_theme_color + - Local: dialer_theme_color_dark Android Source: dialer_theme_color_dark + Android source path: packages/services/Telecomm/res/values/colors.xml + - Local: dialer_theme_color Android Source: theme_color + - Local: dialer_theme_color_dark Android Source: dialer_settings_color_dark + --> + <!-- Essential theme colors --> + <color name="dialer_theme_color">#2A56C6</color> + <color name="dialer_theme_color_dark">#1C3AA9</color> + <color name="dialer_secondary_color">#F50057</color> + <color name="dialer_theme_color_20pct">#332A56C6</color> + + <!-- Text colors --> + <color name="dialer_primary_text_color_enabled">#212121</color> + <color name="dialer_secondary_text_color_enabled">#636363</color> + <color name="dialer_text_color_disabled">#9E9E9E</color> + <color name="dialer_text_hint_color">#DE78909C</color> + <color name="dialer_primary_text_color_inverse">#FFFFFF</color> + <color name="dialer_secondary_text_color_inverse">#DDFFFFFF</color> + <color name="dialer_snackbar_action_text_color">#4285F4</color> + + <!-- Colors for the setting text. --> + <!-- TODO(a bug): investigate if these should be removed. --> + <color name="setting_primary_color">@color/dialer_primary_text_color</color> + <color name="setting_secondary_color">@color/dialer_secondary_text_color</color> + <color name="setting_disabled_color">#AAAAAA</color> + + <!-- Background colors --> + <color name="dialer_background_light">#FAFAFA</color> + <color name="dialer_background_floating_light">#FFFFFF</color> + + <!-- Other useful colors --> + <color name="dialer_icon_color">#89000000</color> +</resources> diff --git a/java/com/android/dialer/theme/res/values/dimens.xml b/java/com/android/dialer/theme/res/values/dimens.xml index 88b8a0423..4abe4b53a 100644 --- a/java/com/android/dialer/theme/res/values/dimens.xml +++ b/java/com/android/dialer/theme/res/values/dimens.xml @@ -54,4 +54,8 @@ <!-- Padding to be applied to the bottom of lists to make space for the floating action button --> <dimen name="floating_action_button_list_bottom_padding">88dp</dimen> + + <!-- TODO(a bug): add a comment here --> + <dimen name="primary_text_size">16sp</dimen> + <dimen name="secondary_text_size">14sp</dimen> </resources> diff --git a/java/com/android/dialer/theme/res/values/styles.xml b/java/com/android/dialer/theme/res/values/styles.xml deleted file mode 100644 index 8412aaadf..000000000 --- a/java/com/android/dialer/theme/res/values/styles.xml +++ /dev/null @@ -1,62 +0,0 @@ -<!-- - ~ Copyright (C) 2012 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> - -<resources> - - <style name="CallLogCardStyle" parent="CardView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_margin">4dp</item> - <item name="android:baselineAligned">false</item> - <item name="cardCornerRadius">2dp</item> - <item name="cardBackgroundColor">@color/background_dialer_call_log_list_item</item> - </style> - - <!-- Inherit from Theme.Material.Light.Dialog instead of Theme.Material.Light.Dialog.Alert - since the Alert dialog is private. They are identical anyway. --> - <style name="AlertDialogTheme" parent="@android:style/Theme.Material.Light.Dialog"> - <item name="android:colorAccent">@color/dialtacts_theme_color</item> - </style> - - <style name="TextActionStyle"> - <item name="android:layout_width">wrap_content</item> - <item name="android:layout_height">@dimen/call_log_action_height</item> - <item name="android:gravity">end|center_vertical</item> - <item name="android:paddingStart">@dimen/call_log_action_horizontal_padding</item> - <item name="android:paddingEnd">@dimen/call_log_action_horizontal_padding</item> - <item name="android:textColor">@color/dialtacts_theme_color</item> - <item name="android:fontFamily">"sans-serif-medium"</item> - <item name="android:focusable">true</item> - <item name="android:singleLine">true</item> - <item name="android:textAllCaps">true</item> - </style> - - <style name="DialerButtonTextStyle" parent="@android:style/TextAppearance.Material.Widget.Button"> - <item name="android:textColor">@color/dialer_primary_text_color_white</item> - </style> - - <style name="DialerActionBarBaseStyle" - parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> - <item name="android:background">@color/actionbar_background_color</item> - <item name="background">@color/actionbar_background_color</item> - </style> - - <!-- This Checkbox style helps align checkboxes with the common list element layout(Image + text) --> - <style name="DialerCheckboxStyle" parent="Widget.AppCompat.CompoundButton.CheckBox"> - <item name="android:layout_marginStart">20dp</item> - <item name="android:paddingLeft">12dp</item> - </style> -</resources> diff --git a/java/com/android/dialer/theme/res/values/styles_dialer_light.xml b/java/com/android/dialer/theme/res/values/styles_dialer_light.xml new file mode 100644 index 000000000..6ce3b1960 --- /dev/null +++ b/java/com/android/dialer/theme/res/values/styles_dialer_light.xml @@ -0,0 +1,110 @@ +<!-- + ~ Copyright (C) 2012 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<resources> + + <style name="CallLogCardStyle" parent="CardView"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:layout_margin">4dp</item> + <item name="android:baselineAligned">false</item> + <item name="cardCornerRadius">2dp</item> + <item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item> + </style> + + <!-- TODO(a bug): properly document this or delete it --> + <style name="Theme.PreCall.DialogHolder" parent="Dialer.ThemeBase.NoActionBar"> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:windowActivityTransitions">false</item> + <item name="android:windowIsTranslucent">true</item> + + <item name="android:statusBarColor">@android:color/transparent</item> + <item name="android:navigationBarColor">@android:color/transparent</item> + <item name="android:windowDrawsSystemBarBackgrounds">true</item> + </style> + + <!-- Style applied to the "Settings" screen. Keep in sync with SettingsLight in Telephony. --> + <style name="SettingsStyle" parent="Dialer.ThemeBase"> + <!-- Setting text. --> + <item name="android:textColorPrimary">@color/settings_text_color_primary</item> + <!-- Setting description. --> + <item name="android:textColorSecondary">@color/settings_text_color_secondary</item> + <item name="android:windowBackground">?android:attr/colorBackground</item> + <item name="android:colorAccent">?android:attr/colorPrimary</item> + <item name="android:textColorLink">?android:attr/colorPrimary</item> + </style> + + <style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert"> + <!-- TODO(a bug): figure out why ?android:attr/colorPrimary doesn't work here --> + <item name="colorAccent">@color/dialer_theme_color</item> + </style> + + <style name="TextActionStyle"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">@dimen/call_log_action_height</item> + <item name="android:gravity">end|center_vertical</item> + <item name="android:paddingStart">@dimen/call_log_action_horizontal_padding</item> + <item name="android:paddingEnd">@dimen/call_log_action_horizontal_padding</item> + <item name="android:textColor">?android:attr/colorPrimary</item> + <item name="android:fontFamily">"sans-serif-medium"</item> + <item name="android:focusable">true</item> + <item name="android:singleLine">true</item> + <item name="android:textAllCaps">true</item> + </style> + + <style name="DialerButtonTextStyle" parent="@android:style/TextAppearance.Material.Widget.Button"> + <item name="android:textColor">?android:attr/textColorPrimaryInverse</item> + </style> + + <style name="DialerActionBarBaseStyle" + parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> + <item name="android:background">?android:attr/colorPrimary</item> + <item name="background">?android:attr/colorPrimary</item> + </style> + + <!-- This Checkbox style helps align checkboxes with the common list element layout(Image + text) --> + <style name="DialerCheckboxStyle" parent="Widget.AppCompat.CompoundButton.CheckBox"> + <item name="android:layout_marginStart">20dp</item> + <item name="android:paddingLeft">12dp</item> + </style> + + <style name="Dialer.TextAppearance.Header" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">20sp</item> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.Primary" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">@dimen/primary_text_size</item> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.Secondary" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorSecondary</item> + <item name="android:textSize">@dimen/secondary_text_size</item> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="SubHeader" parent="TextAppearance.AppCompat"> + <item name="android:textColor">#212121</item> + <item name="android:textSize">14sp</item> + <item name="android:lineSpacingMultiplier">1.1</item> + </style> +</resources> diff --git a/java/com/android/dialer/theme/res/values/theme_dialer_light.xml b/java/com/android/dialer/theme/res/values/theme_dialer_light.xml new file mode 100644 index 000000000..728842915 --- /dev/null +++ b/java/com/android/dialer/theme/res/values/theme_dialer_light.xml @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<resources> + + <style name="Dialer"/> + + <!-- Should be kept in sync with the theme below (minus anything related to actionbars) --> + <style name="Dialer.ThemeBase" parent="@style/Theme.AppCompat.Light.DarkActionBar"> + <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> + + <!-- These values should be used to color all backgrounds. --> + <item name="android:colorBackground">@color/dialer_background_light</item> + <item name="android:colorBackgroundFloating">@color/dialer_background_floating_light</item> + + <!-- These values should be used to set text color. --> + <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> + <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> + <item name="android:textColorPrimaryInverse">@color/dialer_primary_text_color_inverse</item> + <item name="android:textColorSecondaryInverse">@color/dialer_secondary_text_color_inverse</item> + <item name="android:textColorHint">@color/dialer_text_hint_color</item> + + <!-- These will be automatically used to color most Appcompat/Material widgets. --> + <item name="android:colorPrimary">@color/dialer_theme_color</item> + <item name="colorPrimary">@color/dialer_theme_color</item> + <item name="android:colorPrimaryDark">@color/dialer_theme_color</item> + <item name="colorPrimaryDark">@color/dialer_theme_color</item> + <item name="android:colorAccent">@color/dialer_secondary_color</item> + <item name="colorAccent">@color/dialer_secondary_color</item> + + <!-- Used to automatically style check/selected checkbox, switches and radio buttons --> + <item name="colorControlActivated">?android:attr/colorPrimary</item> + + <!-- Used to automatically style AlertDialogs --> + <item name="alertDialogTheme">@style/AlertDialogTheme</item> + + <!-- Dialer specific attributes. --> + <item name="colorIcon">@color/dialer_secondary_text_color</item> + + <!-- These are used to style the actionbar. --> + <item name="actionBarStyle">@style/DialerActionBarBaseStyle</item> + <item name="actionBarSize">@dimen/action_bar_height</item> + + <!-- Theme for the dialpad. --> + <item name="dialpad_style">@style/Dialpad.Light</item> + </style> + + <!-- Should be kept in sync with the theme above (minus anything related to actionbars) --> + <style name="Dialer.ThemeBase.NoActionBar" parent="@style/Theme.AppCompat.Light.NoActionBar"> + <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> + + <!-- These values should be used to color all backgrounds. --> + <item name="android:colorBackground">@color/dialer_background_light</item> + <item name="android:colorBackgroundFloating">@color/dialer_background_floating_light</item> + + <!-- These values should be used to set text color. --> + <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> + <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> + <item name="android:textColorPrimaryInverse">@color/dialer_primary_text_color_inverse</item> + <item name="android:textColorSecondaryInverse">@color/dialer_secondary_text_color_inverse</item> + <item name="android:textColorHint">@color/dialer_text_hint_color</item> + + <!-- These will be automatically used to color most Appcompat/Material widgets. --> + <item name="android:colorPrimary">@color/dialer_theme_color</item> + <item name="colorPrimary">@color/dialer_theme_color</item> + <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> + <item name="colorPrimaryDark">@color/dialer_theme_color_dark</item> + <item name="android:colorAccent">@color/dialer_secondary_color</item> + <item name="colorAccent">@color/dialer_secondary_color</item> + + <!-- Used to automatically style check/selected checkbox, switches and radio buttons --> + <item name="colorControlActivated">?android:attr/colorPrimary</item> + + <!-- Used to automatically style AlertDialogs --> + <item name="alertDialogTheme">@style/AlertDialogTheme</item> + + <!-- Dialer specific attributes. --> + <item name="colorIcon">@color/dialer_secondary_text_color</item> + + <!-- Theme for the dialpad. --> + <item name="dialpad_style">@style/Dialpad.Light</item> + </style> + + <!-- TODO(a bug): flesh this out some more. --> + <style name="Dialer.ThemeBase.NoActionBar.Dark" parent="Dialer.ThemeBase.NoActionBar"> + <!-- swap text colors. --> + <item name="android:textColorPrimary">@color/dialer_primary_text_color_inverse</item> + <item name="android:textColorSecondary">@color/dialer_secondary_text_color_inverse</item> + <item name="android:textColorPrimaryInverse">@color/dialer_primary_text_color</item> + <item name="android:textColorSecondaryInverse">@color/dialer_secondary_text_color</item> + </style> + + <!-- TODO(a bug): investigate making this style's parent Dialer.ThemeBase.NoActionBar --> + <style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar"> + <item name="android:windowNoTitle">true</item> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:colorBackgroundCacheHint">@null</item> + <item name="android:windowIsTranslucent">true</item> + <item name="android:windowAnimationStyle">@android:style/Animation</item> + </style> +</resources> diff --git a/java/com/android/dialer/theme/res/values/themes.xml b/java/com/android/dialer/theme/res/values/themes.xml deleted file mode 100644 index 1c5706623..000000000 --- a/java/com/android/dialer/theme/res/values/themes.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> -<resources> - - <style name="DialerThemeBase" parent="@style/Theme.AppCompat.Light.DarkActionBar"> - <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> - <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> - <!-- This is used for title bar color in recents --> - <item name="android:colorPrimary">@color/titlebar_in_recents_background_color</item> - <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> - <item name="android:colorControlActivated">@color/dialer_theme_color</item> - <item name="android:colorButtonNormal">@color/dialer_theme_color</item> - <item name="android:colorAccent">@color/dialtacts_theme_color</item> - <item name="android:alertDialogTheme">@style/AlertDialogTheme</item> - <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> - - <item name="android:actionBarStyle">@style/DialerActionBarBaseStyle</item> - <item name="actionBarStyle">@style/DialerActionBarBaseStyle</item> - <item name="android:actionBarSize">@dimen/action_bar_height</item> - <item name="actionBarSize">@dimen/action_bar_height</item> - </style> - - <!-- Should be kept in sync with the theme above (minus anything related to actionbars --> - <style name="DialerThemeBase.NoActionBar" parent="@style/Theme.AppCompat.Light.NoActionBar"> - <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> - <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> - <!-- This is used for title bar color in recents --> - <item name="android:colorPrimary">@color/titlebar_in_recents_background_color</item> - <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> - <item name="android:colorControlActivated">@color/dialer_theme_color</item> - <item name="android:colorButtonNormal">@color/dialer_theme_color</item> - <item name="android:colorAccent">@color/dialtacts_theme_color</item> - <item name="android:alertDialogTheme">@style/AlertDialogTheme</item> - <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> - </style> - - <style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar"> - <item name="android:windowNoTitle">true</item> - <item name="android:windowBackground">@android:color/transparent</item> - <item name="android:colorBackgroundCacheHint">@null</item> - <item name="android:windowIsTranslucent">true</item> - <item name="android:windowAnimationStyle">@android:style/Animation</item> - </style> - - <style name="PrimaryText" parent="TextAppearance.AppCompat"> - <item name="android:textColor">#DE000000</item> - <item name="android:textSize">16sp</item> - <item name="android:ellipsize">end</item> - <item name="android:maxLines">1</item> - </style> - - <style name="SecondaryText" parent="TextAppearance.AppCompat"> - <item name="android:textColor">#8A000000</item> - <item name="android:textSize">14sp</item> - <item name="android:ellipsize">end</item> - <item name="android:maxLines">1</item> - </style> - - <style name="SubHeader" parent="TextAppearance.AppCompat"> - <item name="android:textColor">#212121</item> - <item name="android:textSize">14sp</item> - <item name="android:lineSpacingMultiplier">1.1</item> - </style> - -</resources> |