diff options
241 files changed, 2083 insertions, 1583 deletions
diff --git a/java/com/android/contacts/common/list/ViewPagerTabStrip.java b/java/com/android/contacts/common/list/ViewPagerTabStrip.java index 8835631f5..88c0369d6 100644 --- a/java/com/android/contacts/common/list/ViewPagerTabStrip.java +++ b/java/com/android/contacts/common/list/ViewPagerTabStrip.java @@ -24,7 +24,7 @@ import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; import com.android.contacts.common.R; -import com.android.dialer.theme.ThemeUtil; +import com.android.dialer.theme.base.ThemeComponent; public class ViewPagerTabStrip extends LinearLayout { @@ -43,8 +43,8 @@ public class ViewPagerTabStrip extends LinearLayout { final Resources res = context.getResources(); mSelectedUnderlineThickness = res.getDimensionPixelSize(R.dimen.tab_selected_underline_height); - int underlineColor = ThemeUtil.getColorAccent(); - int backgroundColor = ThemeUtil.getColorPrimary(); + int underlineColor = ThemeComponent.get(context).theme().getColorAccent(); + int backgroundColor = ThemeComponent.get(context).theme().getColorPrimary(); mSelectedUnderlinePaint = new Paint(); mSelectedUnderlinePaint.setColor(underlineColor); diff --git a/java/com/android/contacts/common/list/ViewPagerTabs.java b/java/com/android/contacts/common/list/ViewPagerTabs.java index 1e6cf1354..f48fd29ca 100644 --- a/java/com/android/contacts/common/list/ViewPagerTabs.java +++ b/java/com/android/contacts/common/list/ViewPagerTabs.java @@ -163,7 +163,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP } else { final TextView textView = new TextView(getContext()); textView.setText(tabTitle); - textView.setBackgroundResource(R.drawable.view_pager_tab_background); + textView.setClickable(true); // Assign various text appearance related attributes to child views. if (mTextStyle > 0) { diff --git a/java/com/android/contacts/common/res/drawable/dialog_background_material.xml b/java/com/android/contacts/common/res/drawable/dialog_background_material.xml index 1b71cd63a..c93d43ea6 100644 --- a/java/com/android/contacts/common/res/drawable/dialog_background_material.xml +++ b/java/com/android/contacts/common/res/drawable/dialog_background_material.xml @@ -18,6 +18,6 @@ android:inset="16dp"> <shape android:shape="rectangle"> <corners android:radius="2dp"/> - <solid android:color="@color/call_subject_history_background"/> + <solid android:color="?android:attr/colorBackground"/> </shape> </inset> diff --git a/java/com/android/contacts/common/res/drawable/ic_scroll_handle_default.xml b/java/com/android/contacts/common/res/drawable/ic_scroll_handle_default.xml index ac932f87c..9164ab1ab 100644 --- a/java/com/android/contacts/common/res/drawable/ic_scroll_handle_default.xml +++ b/java/com/android/contacts/common/res/drawable/ic_scroll_handle_default.xml @@ -17,4 +17,4 @@ <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/ic_scroll_handle" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> diff --git a/java/com/android/contacts/common/res/drawable/item_background_material_dark.xml b/java/com/android/contacts/common/res/drawable/item_background_material_dark.xml deleted file mode 100644 index 91ab763a5..000000000 --- a/java/com/android/contacts/common/res/drawable/item_background_material_dark.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2014 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. ---> - -<!-- Based on the Theme.Material's default selectableItemBackground --> -<ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="@color/dialer_ripple_material_dark"> - <item android:id="@android:id/mask"> - <color android:color="@android:color/white"/> - </item> -</ripple>
\ No newline at end of file diff --git a/java/com/android/contacts/common/res/drawable/item_background_material_light.xml b/java/com/android/contacts/common/res/drawable/item_background_material_light.xml deleted file mode 100644 index d41accb02..000000000 --- a/java/com/android/contacts/common/res/drawable/item_background_material_light.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2014 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. ---> - -<!-- Based on the Theme.Material's default selectableItemBackground --> -<ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="@color/dialer_ripple_material_light"> - <item android:id="@android:id/mask"> - <color android:color="@android:color/white"/> - </item> -</ripple>
\ No newline at end of file diff --git a/java/com/android/contacts/common/res/drawable/unread_count_background.xml b/java/com/android/contacts/common/res/drawable/unread_count_background.xml index 4fc6b9b60..b58baef7c 100644 --- a/java/com/android/contacts/common/res/drawable/unread_count_background.xml +++ b/java/com/android/contacts/common/res/drawable/unread_count_background.xml @@ -17,5 +17,5 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="@dimen/tab_unread_count_background_radius"/> - <solid android:color="@color/tab_unread_count_background_color"/> + <solid android:color="?android:attr/colorPrimaryDark"/> </shape> diff --git a/java/com/android/contacts/common/res/drawable/view_pager_tab_background.xml b/java/com/android/contacts/common/res/drawable/view_pager_tab_background.xml deleted file mode 100644 index bef30a434..000000000 --- a/java/com/android/contacts/common/res/drawable/view_pager_tab_background.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2014 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 - --> -<ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="@color/tab_ripple_color"> - <item android:id="@android:id/mask"> - <color android:color="@android:color/white"/> - </item> -</ripple>
\ No newline at end of file diff --git a/java/com/android/contacts/common/res/layout-ldrtl/unread_count_tab.xml b/java/com/android/contacts/common/res/layout-ldrtl/unread_count_tab.xml index 9e9be95e3..51d56bb22 100644 --- a/java/com/android/contacts/common/res/layout-ldrtl/unread_count_tab.xml +++ b/java/com/android/contacts/common/res/layout-ldrtl/unread_count_tab.xml @@ -19,7 +19,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/view_pager_tab_background" + android:background="@drawable/item_background_material_borderless_dark" android:layoutDirection="ltr"> <!-- The tab icon --> <ImageView @@ -42,7 +42,7 @@ android:layoutDirection="locale" android:minWidth="@dimen/tab_unread_count_background_size" android:textAlignment="center" - android:textColor="@color/tab_accent_color" + android:textColor="?android:attr/colorAccent" android:textSize="@dimen/tab_unread_count_text_size"/> </RelativeLayout> diff --git a/java/com/android/contacts/common/res/layout/account_filter_header.xml b/java/com/android/contacts/common/res/layout/account_filter_header.xml index a12ab08fd..592c240a9 100644 --- a/java/com/android/contacts/common/res/layout/account_filter_header.xml +++ b/java/com/android/contacts/common/res/layout/account_filter_header.xml @@ -23,7 +23,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/background_primary"> + android:background="?android:attr/colorBackground"> <!-- Used to show the touch feedback --> <FrameLayout android:id="@+id/account_filter_header_container" diff --git a/java/com/android/contacts/common/res/layout/call_subject_history_list_item.xml b/java/com/android/contacts/common/res/layout/call_subject_history_list_item.xml index c378f24b2..c08327c29 100644 --- a/java/com/android/contacts/common/res/layout/call_subject_history_list_item.xml +++ b/java/com/android/contacts/common/res/layout/call_subject_history_list_item.xml @@ -25,5 +25,5 @@ android:paddingEnd="@dimen/call_subject_dialog_margin" android:gravity="center_vertical" android:singleLine="true" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/call_subject_dialog_primary_text_size"/> diff --git a/java/com/android/contacts/common/res/layout/contact_list_card.xml b/java/com/android/contacts/common/res/layout/contact_list_card.xml index a04f4cad9..37bb8ea27 100644 --- a/java/com/android/contacts/common/res/layout/contact_list_card.xml +++ b/java/com/android/contacts/common/res/layout/contact_list_card.xml @@ -24,16 +24,16 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="@integer/contact_list_space_layout_weight" - android:background="@color/background_primary"/> + android:background="?android:attr/colorBackground"/> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="@integer/contact_list_card_layout_weight" - android:background="@color/contact_all_list_background_color" + android:background="?android:attr/colorBackground" android:elevation="@dimen/contact_list_card_elevation"/> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="@integer/contact_list_space_layout_weight" - android:background="@color/background_primary"/> + android:background="?android:attr/colorBackground"/> </LinearLayout> diff --git a/java/com/android/contacts/common/res/layout/default_account_checkbox.xml b/java/com/android/contacts/common/res/layout/default_account_checkbox.xml index 1e76b74f5..911098397 100644 --- a/java/com/android/contacts/common/res/layout/default_account_checkbox.xml +++ b/java/com/android/contacts/common/res/layout/default_account_checkbox.xml @@ -44,7 +44,7 @@ android:text="@string/set_default_account" android:textAlignment="viewStart" android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorSecondary" /> </LinearLayout> diff --git a/java/com/android/contacts/common/res/layout/dialog_call_subject.xml b/java/com/android/contacts/common/res/layout/dialog_call_subject.xml index df8e8d299..d20aa3b45 100644 --- a/java/com/android/contacts/common/res/layout/dialog_call_subject.xml +++ b/java/com/android/contacts/common/res/layout/dialog_call_subject.xml @@ -67,7 +67,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/call_subject_dialog_secondary_text_size"/> <TextView @@ -77,7 +77,7 @@ android:layout_marginTop="@dimen/call_subject_dialog_between_line_margin" android:layout_gravity="center_vertical" android:singleLine="true" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/call_subject_dialog_secondary_text_size"/> </LinearLayout> </LinearLayout> @@ -94,7 +94,7 @@ android:background="@null" android:gravity="top" android:hint="@string/call_subject_hint" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/call_subject_dialog_secondary_text_size" /> @@ -107,7 +107,7 @@ android:layout_marginStart="@dimen/call_subject_dialog_margin" android:layout_marginEnd="@dimen/call_subject_dialog_margin" android:singleLine="true" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/call_subject_dialog_secondary_text_size"/> <View @@ -130,7 +130,7 @@ android:layout_alignParentStart="true" android:layout_centerVertical="true" android:src="@drawable/quantum_ic_history_vd_theme_24" - android:tint="@color/call_subject_history_icon"/> + android:tint="?colorIcon"/> <TextView android:id="@+id/send_and_call_button" @@ -152,7 +152,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/dialog_view" - android:background="@color/call_subject_history_background" + android:background="?android:attr/colorBackground" android:divider="@null" android:elevation="8dp"/> diff --git a/java/com/android/contacts/common/res/layout/search_bar_expanded.xml b/java/com/android/contacts/common/res/layout/search_bar_expanded.xml index ccea3f76f..c9ab6a92d 100644 --- a/java/com/android/contacts/common/res/layout/search_bar_expanded.xml +++ b/java/com/android/contacts/common/res/layout/search_bar_expanded.xml @@ -29,7 +29,7 @@ android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/action_menu_back_from_search" android:src="@drawable/back_arrow" - android:tint="@color/contactscommon_actionbar_background_color"/> + android:tint="?colorTextOnUnthemedDarkBackground"/> <EditText android:id="@+id/search_view" @@ -44,8 +44,8 @@ android:imeOptions="flagNoExtractUi" android:inputType="textFilter" android:maxLines="1" - android:textColor="@color/searchbox_text_color" - android:textColorHint="@color/searchbox_hint_text_color" + android:textColor="?android:attr/textColorPrimary" + android:textColorHint="?android:attr/textColorHint" android:textCursorDrawable="@drawable/searchedittext_custom_cursor" android:textSize="@dimen/search_text_size"/> @@ -60,5 +60,5 @@ android:clickable="true" android:contentDescription="@string/description_clear_search" android:src="@drawable/quantum_ic_close_vd_theme_24" - android:tint="@color/searchbox_icon_tint"/> + android:tint="?colorIcon"/> </RelativeLayout> diff --git a/java/com/android/contacts/common/res/layout/select_account_list_item.xml b/java/com/android/contacts/common/res/layout/select_account_list_item.xml index 98e7c5454..e77c53c7e 100644 --- a/java/com/android/contacts/common/res/layout/select_account_list_item.xml +++ b/java/com/android/contacts/common/res/layout/select_account_list_item.xml @@ -46,7 +46,7 @@ android:layout_height="wrap_content" android:includeFontPadding="false" android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="@color/dialer_primary_text_color"/> + android:textColor="?android:attr/textColorPrimary"/> <TextView android:id="@+id/number" android:layout_width="match_parent" @@ -54,7 +54,7 @@ android:includeFontPadding="false" android:maxLines="1" android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorSecondary" android:visibility="gone"/> <TextView android:id="@+id/hint" @@ -62,7 +62,7 @@ android:layout_height="wrap_content" android:includeFontPadding="false" android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorSecondary" android:visibility="gone"/> </LinearLayout> diff --git a/java/com/android/contacts/common/res/layout/unread_count_tab.xml b/java/com/android/contacts/common/res/layout/unread_count_tab.xml index 83481ee2d..d8357f491 100644 --- a/java/com/android/contacts/common/res/layout/unread_count_tab.xml +++ b/java/com/android/contacts/common/res/layout/unread_count_tab.xml @@ -16,7 +16,7 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/view_pager_tab_background"> + android:background="@drawable/item_background_material_borderless_dark"> <!-- The tab icon --> <ImageView android:id="@+id/icon" @@ -38,6 +38,6 @@ android:importantForAccessibility="no" android:minWidth="@dimen/tab_unread_count_background_size" android:textAlignment="center" - android:textColor="@color/tab_accent_color" + android:textColor="?android:attr/colorAccent" android:textSize="@dimen/tab_unread_count_text_size"/> </RelativeLayout> diff --git a/java/com/android/contacts/common/res/values/colors.xml b/java/com/android/contacts/common/res/values/colors.xml index b05c19a83..ab9f19b29 100644 --- a/java/com/android/contacts/common/res/values/colors.xml +++ b/java/com/android/contacts/common/res/values/colors.xml @@ -15,20 +15,6 @@ --> <resources> - <!-- Color of ripples used for views with dark backgrounds --> - <color name="dialer_ripple_material_dark">#a0ffffff</color> - - <!-- Color of ripples used for views with light backgrounds --> - <color name="dialer_ripple_material_light">#30000000</color> - - <!-- Divider color for header separator --> - <color name="primary_text_color">#363636</color> - - <color name="secondary_text_color">@color/dialer_secondary_text_color</color> - - <!-- Text color for section header. --> - <color name="section_header_text_color">#2A56C6</color> - <!-- Color of the theme of the People app --> <color name="people_app_theme_color">#363636</color> @@ -51,36 +37,6 @@ <item>#424242</item> </array> - <color name="contactscommon_actionbar_background_color">?android:attr/colorPrimary</color> - - <color name="tab_ripple_color">#ffffff</color> - <color name="tab_accent_color">@color/tab_ripple_color</color> - <color name="tab_selected_underline_color">#f50057</color> - <color name="tab_unread_count_background_color">#1C3AA9</color> - - <!-- Color of the title to the Frequently Contacted section --> - <color name="frequently_contacted_title_color">@color/contactscommon_actionbar_background_color - </color> - - <!-- Color of action bar text. Ensure this stays in sync with packages/Telephony - phone_settings_actionbar_text_color--> - <color name="actionbar_text_color">#ffffff</color> - <color name="actionbar_unselected_text_color">#a6ffffff</color> - - <!-- Text color of the search box text as entered by user --> - <color name="searchbox_text_color">@color/dialer_primary_text_color</color> - <!-- Background color of the search box --> - <color name="searchbox_background_color">#ffffff</color> - - <color name="searchbox_hint_text_color">#737373</color> - <color name="searchbox_icon_tint">@color/searchbox_hint_text_color</color> - - <color name="search_shortcut_icon_color">?android:attr/colorPrimary</color> - - <!-- Color of the background of the contact detail and editor pages --> - <color name="background_primary">#f9f9f9</color> - <color name="contact_all_list_background_color">#FFFFFF</color> - <!-- Text color used for character counter when the max limit has been exceeded --> <color name="call_subject_limit_exceeded">#d1041c</color> @@ -92,8 +48,4 @@ <!-- Text color for the SEND & CALL button on the call subject dialog. --> <color name="call_subject_button">#00c853</color> - - <!-- Background color for the call subject history view. --> - <color name="call_subject_history_background">#ffffff</color> - <color name="search_video_call_icon_tint">@color/searchbox_hint_text_color</color> </resources> diff --git a/java/com/android/contacts/common/res/values/styles.xml b/java/com/android/contacts/common/res/values/styles.xml index bb19afe82..4f0b3f15f 100644 --- a/java/com/android/contacts/common/res/values/styles.xml +++ b/java/com/android/contacts/common/res/values/styles.xml @@ -23,13 +23,13 @@ <style name="SectionHeaderStyle" parent="@android:style/TextAppearance.Large"> <item name="android:textSize">16sp</item> <item name="android:textAllCaps">true</item> - <item name="android:textColor">@color/section_header_text_color</item> + <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textStyle">bold</item> </style> <style name="DirectoryHeaderStyle" parent="@android:style/TextAppearance.Small"> <item name="android:textSize">14sp</item> - <item name="android:textColor">@color/dialer_secondary_text_color</item> + <item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:fontFamily">sans-serif-medium</item> </style> diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java index 26b3a6260..e52591174 100644 --- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java +++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java @@ -18,6 +18,7 @@ package com.android.dialer.app.calllog; import android.content.Context; import android.database.Cursor; +import android.provider.CallLog.Calls; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.telephony.PhoneNumberUtils; @@ -26,7 +27,6 @@ import android.text.format.Time; import com.android.contacts.common.util.DateUtils; import com.android.dialer.calllogutils.CallbackActionHelper; import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction; -import com.android.dialer.compat.AppCompatConstants; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.inject.ApplicationContext; import com.android.dialer.phonenumbercache.CallLogQuery; @@ -267,18 +267,15 @@ public class CallLogGroupBuilder { } private boolean areBothNotVoicemail(int callType, int groupCallType) { - return callType != AppCompatConstants.CALLS_VOICEMAIL_TYPE - && groupCallType != AppCompatConstants.CALLS_VOICEMAIL_TYPE; + return callType != Calls.VOICEMAIL_TYPE && groupCallType != Calls.VOICEMAIL_TYPE; } private boolean areBothNotBlocked(int callType, int groupCallType) { - return callType != AppCompatConstants.CALLS_BLOCKED_TYPE - && groupCallType != AppCompatConstants.CALLS_BLOCKED_TYPE; + return callType != Calls.BLOCKED_TYPE && groupCallType != Calls.BLOCKED_TYPE; } private boolean areBothBlocked(int callType, int groupCallType) { - return callType == AppCompatConstants.CALLS_BLOCKED_TYPE - && groupCallType == AppCompatConstants.CALLS_BLOCKED_TYPE; + return callType == Calls.BLOCKED_TYPE && groupCallType == Calls.BLOCKED_TYPE; } private boolean meetsAssistedDialingGroupingCriteria(int groupFeatures, int callFeatures) { diff --git a/java/com/android/dialer/app/calllog/CallLogListItemHelper.java b/java/com/android/dialer/app/calllog/CallLogListItemHelper.java index 13ee9a41f..a30d4d76e 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemHelper.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemHelper.java @@ -26,7 +26,6 @@ import com.android.dialer.app.calllog.calllogcache.CallLogCache; import com.android.dialer.calllogutils.PhoneCallDetails; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.compat.AppCompatConstants; /** Helper class to fill in the views of a call log entry. */ /* package */ class CallLogListItemHelper { @@ -224,15 +223,15 @@ import com.android.dialer.compat.AppCompatConstants; int lastCallType = getLastCallType(callTypes); int stringID; - if (lastCallType == AppCompatConstants.CALLS_MISSED_TYPE) { + if (lastCallType == Calls.MISSED_TYPE) { //Message: Missed call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, //<PhoneAccount>. stringID = R.string.description_incoming_missed_call; - } else if (lastCallType == AppCompatConstants.CALLS_INCOMING_TYPE) { + } else if (lastCallType == Calls.INCOMING_TYPE) { //Message: Answered call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, //<PhoneAccount>. stringID = R.string.description_incoming_answered_call; - } else if (lastCallType == AppCompatConstants.CALLS_VOICEMAIL_TYPE) { + } else if (lastCallType == Calls.VOICEMAIL_TYPE) { //Message: (Unread) [V/v]oicemail from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, //<PhoneAccount>. stringID = diff --git a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java index f142399d7..ccf12ae12 100644 --- a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java @@ -37,6 +37,7 @@ import com.android.dialer.notification.DialerNotificationManager; import com.android.dialer.notification.NotificationChannelManager; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.theme.base.ThemeComponent; /** Shows a notification in the status bar for legacy vociemail. */ @TargetApi(VERSION_CODES.O) @@ -115,7 +116,7 @@ public final class LegacyVoicemailNotifier { Notification.Builder builder = new Notification.Builder(context) .setSmallIcon(android.R.drawable.stat_notify_voicemail) - .setColor(context.getColor(R.color.dialer_theme_color)) + .setColor(ThemeComponent.get(context).theme().getColorPrimary()) .setWhen(System.currentTimeMillis()) .setContentTitle(notificationTitle) .setContentText(contentText) diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java index f671fb7fd..4b5bfba8a 100644 --- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java +++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java @@ -62,6 +62,7 @@ import com.android.dialer.notification.missedcalls.MissedCallNotificationTags; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.precall.PreCall; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; import java.util.Iterator; @@ -396,7 +397,7 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> { return new Notification.Builder(context) .setGroup(MissedCallConstants.GROUP_KEY) .setSmallIcon(android.R.drawable.stat_notify_missed_call) - .setColor(context.getResources().getColor(R.color.dialer_theme_color, null)) + .setColor(ThemeComponent.get(context).theme().getColorPrimary()) .setAutoCancel(true) .setOnlyAlertOnce(true) .setShowWhen(true) diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java index 230c02328..2632fb380 100644 --- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java +++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java @@ -51,6 +51,7 @@ import com.android.dialer.oem.MotorolaUtils; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.spannable.ContentWithLearnMoreSpanner; import com.android.dialer.storage.StorageComponent; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.DialerUtils; import com.android.voicemail.VoicemailClient; import com.android.voicemail.VoicemailComponent; @@ -269,9 +270,9 @@ public class PhoneCallDetailsHelper views.voicemailTranscriptionBrandingView.setTypeface(typeface); views.callLocationAndDate.setTypeface(typeface); views.callLocationAndDate.setTextColor( - ContextCompat.getColor( - context, - details.isRead ? R.color.call_log_detail_color : R.color.call_log_unread_text_color)); + details.isRead + ? ThemeComponent.get(context).theme().getTextColorSecondary() + : ThemeComponent.get(context).theme().getTextColorPrimary()); } private void setNameView(PhoneCallDetailsViews views, PhoneCallDetails details) { @@ -392,17 +393,11 @@ public class PhoneCallDetailsHelper textView.setMovementMethod(LinkMovementMethod.getInstance()); Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE); if (positiveButton != null) { - positiveButton.setTextColor( - context - .getResources() - .getColor(R.color.voicemail_donation_promo_positive_button_text_color)); + positiveButton.setTextColor(ThemeComponent.get(context).theme().getColorPrimary()); } Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE); if (negativeButton != null) { - negativeButton.setTextColor( - context - .getResources() - .getColor(R.color.voicemail_donation_promo_negative_button_text_color)); + negativeButton.setTextColor(ThemeComponent.get(context).theme().getTextColorSecondary()); } } diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index 5b6eb0387..930edd186 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -113,7 +113,6 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { setupView(view); EmptyContentView emptyContentView = view.findViewById(R.id.empty_list_view); emptyContentView.setImage(R.drawable.quantum_ic_voicemail_vd_theme_24); - emptyContentView.setImageTint(R.color.empty_voicemail_icon_tint_color, null); return view; } diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java index 793d9627c..a29bb62da 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java @@ -47,6 +47,7 @@ import com.android.dialer.notification.NotificationChannelManager; import com.android.dialer.notification.NotificationManagerUtils; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.theme.base.ThemeComponent; import java.util.List; import java.util.Map; @@ -144,7 +145,7 @@ final class VisualVoicemailNotifier { private static NotificationCompat.Builder createNotificationBuilder(@NonNull Context context) { return new NotificationCompat.Builder(context) .setSmallIcon(android.R.drawable.stat_notify_voicemail) - .setColor(context.getColor(R.color.dialer_theme_color)) + .setColor(ThemeComponent.get(context).theme().getColorPrimary()) .setGroup(GROUP_KEY) .setOnlyAlertOnce(true) .setAutoCancel(true); diff --git a/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java b/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java index 270ec6d03..bf40fdf3a 100644 --- a/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java +++ b/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java @@ -23,7 +23,6 @@ import android.content.Loader; import android.database.Cursor; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; -import android.support.v4.app.ActivityCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; @@ -39,6 +38,7 @@ import com.android.dialer.blocking.FilteredNumbersUtil.CheckForSendToVoicemailCo import com.android.dialer.blocking.FilteredNumbersUtil.ImportSendToVoicemailContactsListener; import com.android.dialer.database.FilteredNumberContract; import com.android.dialer.lettertile.LetterTileDrawable; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker; /** TODO(calderwoodra): documentation */ @@ -74,8 +74,7 @@ public class BlockedNumbersFragment extends ListFragment //replace the icon for add number with LetterTileDrawable(), so it will have identical style LetterTileDrawable drawable = new LetterTileDrawable(getResources()); drawable.setLetter(ADD_BLOCKED_NUMBER_ICON_LETTER); - drawable.setColor( - ActivityCompat.getColor(getActivity(), R.color.add_blocked_number_icon_color)); + drawable.setColor(ThemeComponent.get(getContext()).theme().getColorIcon()); drawable.setIsCircular(true); if (adapter == null) { @@ -119,7 +118,7 @@ public class BlockedNumbersFragment extends ListFragment ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); ColorDrawable backgroundDrawable = - new ColorDrawable(ActivityCompat.getColor(getActivity(), R.color.dialer_theme_color)); + new ColorDrawable(ThemeComponent.get(getContext()).theme().getColorPrimary()); actionBar.setBackgroundDrawable(backgroundDrawable); actionBar.setDisplayShowCustomEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); diff --git a/java/com/android/dialer/app/list/RemoveView.java b/java/com/android/dialer/app/list/RemoveView.java index ed133d45b..575c5a890 100644 --- a/java/com/android/dialer/app/list/RemoveView.java +++ b/java/com/android/dialer/app/list/RemoveView.java @@ -53,7 +53,7 @@ public class RemoveView extends FrameLayout { removeText = (TextView) findViewById(R.id.remove_view_text); removeIcon = (ImageView) findViewById(R.id.remove_view_icon); final Resources r = getResources(); - unhighlightedColor = r.getColor(R.color.remove_text_color); + unhighlightedColor = r.getColor(android.R.color.white); highlightedColor = r.getColor(R.color.remove_highlighted_text_color); removeDrawable = r.getDrawable(R.drawable.ic_remove); } diff --git a/java/com/android/dialer/app/res/drawable/rounded_corner.xml b/java/com/android/dialer/app/res/drawable/rounded_corner.xml index 97b58b6b1..b4c10066d 100644 --- a/java/com/android/dialer/app/res/drawable/rounded_corner.xml +++ b/java/com/android/dialer/app/res/drawable/rounded_corner.xml @@ -17,6 +17,6 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="@color/searchbox_background_color"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> <corners android:radius="2dp"/> </shape> diff --git a/java/com/android/dialer/app/res/drawable/seekbar_drawable.xml b/java/com/android/dialer/app/res/drawable/seekbar_drawable.xml index e47a6406c..2288cf24a 100644 --- a/java/com/android/dialer/app/res/drawable/seekbar_drawable.xml +++ b/java/com/android/dialer/app/res/drawable/seekbar_drawable.xml @@ -19,7 +19,7 @@ <item android:id="@android:id/background"> <shape android:shape="line"> <stroke - android:color="@color/voicemail_playback_seek_bar_yet_to_play" + android:color="@color/dialer_divider_line_color" android:width="2dip" /> </shape> @@ -29,7 +29,7 @@ <clip> <shape android:shape="line"> <stroke - android:color="@color/voicemail_playback_seek_bar_already_played" + android:color="?android:attr/colorPrimary" android:width="2dip" /> </shape> @@ -42,7 +42,7 @@ <item android:id="@android:id/background"> <shape android:shape="line"> <stroke - android:color="@color/voicemail_playback_seek_bar_yet_to_play" + android:color="@color/dialer_divider_line_color" android:width="2dip" /> </shape> @@ -52,7 +52,7 @@ <clip> <shape android:shape="line"> <stroke - android:color="@color/voicemail_playback_seek_bar_yet_to_play" + android:color="@color/dialer_divider_line_color" android:width="2dip" /> </shape> diff --git a/java/com/android/dialer/app/res/layout-land/empty_content_view_dialpad_search.xml b/java/com/android/dialer/app/res/layout-land/empty_content_view_dialpad_search.xml index 59d13636a..bf2a816b0 100644 --- a/java/com/android/dialer/app/res/layout-land/empty_content_view_dialpad_search.xml +++ b/java/com/android/dialer/app/res/layout-land/empty_content_view_dialpad_search.xml @@ -41,8 +41,7 @@ android:paddingLeft="16dp" android:paddingRight="16dp" android:gravity="center_horizontal|top" - android:textColor="@color/empty_list_text_color" - android:textSize="@dimen/empty_list_message_text_size"/> + style="Dialer.TextAppearance.Primary"/> <TextView android:id="@+id/empty_list_view_action" diff --git a/java/com/android/dialer/app/res/layout/blocked_number_footer.xml b/java/com/android/dialer/app/res/layout/blocked_number_footer.xml index 9e05cfbf4..2d368605c 100644 --- a/java/com/android/dialer/app/res/layout/blocked_number_footer.xml +++ b/java/com/android/dialer/app/res/layout/blocked_number_footer.xml @@ -32,7 +32,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/block_number_footer_message_vvm" - android:textColor="@color/blocked_number_secondary_text_color" - android:textSize="@dimen/blocked_number_settings_description_text_size"/> + style="@style/Dialer.TextAppearance.Secondary"/> </LinearLayout> </LinearLayout> diff --git a/java/com/android/dialer/app/res/layout/blocked_number_fragment.xml b/java/com/android/dialer/app/res/layout/blocked_number_fragment.xml index 745b913cc..22dcfefa5 100644 --- a/java/com/android/dialer/app/res/layout/blocked_number_fragment.xml +++ b/java/com/android/dialer/app/res/layout/blocked_number_fragment.xml @@ -17,7 +17,7 @@ android:id="@+id/blocked_number_fragment" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/blocked_number_background" + android:background="?android:attr/colorBackground" android:orientation="vertical"> <ListView diff --git a/java/com/android/dialer/app/res/layout/blocked_number_header.xml b/java/com/android/dialer/app/res/layout/blocked_number_header.xml index e1019d1eb..27b624ccd 100644 --- a/java/com/android/dialer/app/res/layout/blocked_number_header.xml +++ b/java/com/android/dialer/app/res/layout/blocked_number_header.xml @@ -29,7 +29,7 @@ android:paddingBottom="29dp" android:paddingStart="@dimen/blocked_number_container_padding" android:paddingEnd="44dp" - android:background="@color/blocked_number_disabled_emergency_background_color" + android:background="?android:attr/colorBackground" android:focusable="true" android:orientation="vertical" android:visibility="gone"> @@ -69,7 +69,7 @@ android:paddingStart="@dimen/blocked_number_container_padding" android:gravity="center_vertical" android:text="@string/block_list" - android:textColor="@color/blocked_number_header_color"/> + android:textColor="?android:attr/textColorPrimary"/> <RelativeLayout android:id="@+id/import_settings" @@ -88,7 +88,7 @@ android:paddingStart="@dimen/blocked_number_container_padding" android:paddingEnd="@dimen/blocked_number_container_padding" android:text="@string/blocked_call_settings_import_description" - android:textColor="@color/secondary_text_color" + android:textColor="?colorIcon" android:textSize="@dimen/blocked_number_settings_description_text_size"/> <Button @@ -116,7 +116,7 @@ android:layout_height="1dp" android:layout_marginTop="8dp" android:layout_below="@id/import_button" - android:background="@color/divider_line_color"/> + android:background="@color/dialer_divider_line_color"/> </RelativeLayout> @@ -138,7 +138,7 @@ android:paddingEnd="@dimen/blocked_number_container_padding" android:gravity="center_vertical" android:text="@string/migrate_blocked_numbers_dialog_title" - android:textColor="@color/blocked_number_header_color"/> + android:textColor="?android:attr/textColorPrimary"/> <TextView android:id="@+id/migrate_promo_description" @@ -148,7 +148,7 @@ android:layout_marginStart="@dimen/blocked_number_container_padding" android:layout_marginEnd="@dimen/blocked_number_container_padding" android:text="@string/migrate_blocked_numbers_dialog_message" - android:textColor="@color/secondary_text_color"/> + android:textColor="?colorIcon"/> <Button android:id="@+id/migrate_promo_allow_button" @@ -171,7 +171,7 @@ android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginStart="72dp" - android:background="@color/divider_line_color"/> + android:background="@color/dialer_divider_line_color"/> </LinearLayout> diff --git a/java/com/android/dialer/app/res/layout/blocked_number_item.xml b/java/com/android/dialer/app/res/layout/blocked_number_item.xml index 92ebdc35d..921c476ec 100644 --- a/java/com/android/dialer/app/res/layout/blocked_number_item.xml +++ b/java/com/android/dialer/app/res/layout/blocked_number_item.xml @@ -45,17 +45,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:includeFontPadding="false" - android:singleLine="true" - android:textColor="@color/blocked_number_primary_text_color" - android:textSize="@dimen/blocked_number_primary_text_size"/> + style="@style/Dialer.TextAppearance.Primary.Ellipsize"/> <TextView android:id="@+id/caller_number" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:singleLine="true" - android:textColor="@color/blocked_number_secondary_text_color" - android:textSize="@dimen/blocked_number_settings_description_text_size"/> + style="@style/Dialer.TextAppearance.Secondary.Ellipsize"/> </LinearLayout> <ImageView @@ -67,6 +63,5 @@ android:contentDescription="@string/description_blocked_number_list_delete" android:scaleType="center" android:src="@drawable/ic_remove" - android:tint="@color/blocked_number_icon_tint"/> - + android:tint="?colorIcon"/> </LinearLayout> diff --git a/java/com/android/dialer/app/res/layout/call_log_activity.xml b/java/com/android/dialer/app/res/layout/call_log_activity.xml index d9d40a1a0..4b3c1e0f6 100644 --- a/java/com/android/dialer/app/res/layout/call_log_activity.xml +++ b/java/com/android/dialer/app/res/layout/call_log_activity.xml @@ -18,7 +18,7 @@ android:id="@+id/calllog_frame" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:attr/colorBackgroundFloating" + android:background="?android:attr/colorBackground" android:orientation="vertical"> <com.android.contacts.common.list.ViewPagerTabs android:id="@+id/viewpager_header" diff --git a/java/com/android/dialer/app/res/layout/call_log_fragment.xml b/java/com/android/dialer/app/res/layout/call_log_fragment.xml index 2fb63606a..bf91a3a07 100644 --- a/java/com/android/dialer/app/res/layout/call_log_fragment.xml +++ b/java/com/android/dialer/app/res/layout/call_log_fragment.xml @@ -47,8 +47,7 @@ android:gravity="center_vertical" android:text="@string/select_all" android:textAllCaps="true" - android:textStyle="bold" - android:textColor="@color/remove_text_color" + android:textColor="?android:attr/textColorPrimaryInverse" android:textSize="@dimen/select_all_text_size"/> </LinearLayout> diff --git a/java/com/android/dialer/app/res/layout/call_log_list_item.xml b/java/com/android/dialer/app/res/layout/call_log_list_item.xml index 23aeda3da..fd73e0bb4 100644 --- a/java/com/android/dialer/app/res/layout/call_log_list_item.xml +++ b/java/com/android/dialer/app/res/layout/call_log_list_item.xml @@ -29,11 +29,9 @@ android:layout_gravity="start" android:layout_marginStart="@dimen/call_log_start_margin" android:layout_marginEnd="@dimen/call_log_outer_margin" - android:fontFamily="sans-serif-medium" - android:textColor="@color/call_log_day_group_heading_color" - android:textSize="@dimen/call_log_day_group_heading_size" android:paddingTop="@dimen/call_log_day_group_padding_top" - android:paddingBottom="@dimen/call_log_day_group_padding_bottom"/> + android:paddingBottom="@dimen/call_log_day_group_padding_bottom" + style="@style/Dialer.TextAppearance.OVERLINE.Ellipsize"/> <android.support.v7.widget.CardView android:id="@+id/call_log_row" @@ -99,9 +97,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="@dimen/call_log_name_margin_bottom" android:layout_marginEnd="@dimen/call_log_icon_margin" - android:textColor="@color/call_log_primary_color" - android:textSize="@dimen/call_log_primary_text_size" - android:maxLines="1"/> + style="Dialer.TextAppearance.Primary.Ellipsize"/> <LinearLayout android:id="@+id/call_type" @@ -131,9 +127,7 @@ android:layout_height="wrap_content" android:layout_marginEnd="@dimen/call_log_icon_margin" android:layout_gravity="center_vertical" - android:textColor="@color/call_log_detail_color" - android:textSize="@dimen/call_log_detail_text_size" - android:maxLines="1"/> + style="Dialer.TextAppearance.Secondary.Ellipsize"/> </LinearLayout> @@ -143,10 +137,8 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/call_log_call_account_margin_bottom" android:layout_marginEnd="@dimen/call_log_icon_margin" - android:textColor="?android:attr/textColorSecondary" - android:textSize="@dimen/call_log_detail_text_size" android:visibility="gone" - android:maxLines="1"/> + style="Dialer.TextAppearance.Secondary2.Ellipsize"/> <LinearLayout android:id="@+id/transcription" @@ -160,22 +152,20 @@ android:id="@+id/voicemail_transcription" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/call_log_voicemail_transcript_color" - android:textSize="@dimen/call_log_voicemail_transcription_text_size" android:focusable="true" android:nextFocusDown="@+id/voicemail_transcription_branding" - android:textIsSelectable="true"/> + android:textIsSelectable="true" + style="Dialer.TextAppearance.Secondary2"/> <TextView android:id="@+id/voicemail_transcription_branding" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/call_log_voicemail_transcript_branding_color" - android:textSize="@dimen/call_log_voicemail_transcription_text_size" android:focusable="true" android:nextFocusUp="@id/voicemail_transcription" android:nextFocusDown="@+id/voicemail_transcription_rating" - android:paddingTop="2dp"/> + android:paddingTop="2dp" + style="Dialer.TextAppearance.Secondary2"/> <LinearLayout android:id="@+id/voicemail_transcription_rating" @@ -230,7 +220,7 @@ android:layout_gravity="center_vertical" android:background="?android:attr/selectableItemBackgroundBorderless" android:scaleType="center" - android:tint="@color/call_log_list_item_primary_action_icon_tint" + android:tint="?colorIcon" android:visibility="gone"/> </LinearLayout> diff --git a/java/com/android/dialer/app/res/layout/call_log_list_item_actions.xml b/java/com/android/dialer/app/res/layout/call_log_list_item_actions.xml index 56d1daf6a..7f2459486 100644 --- a/java/com/android/dialer/app/res/layout/call_log_list_item_actions.xml +++ b/java/com/android/dialer/app/res/layout/call_log_list_item_actions.xml @@ -31,7 +31,7 @@ <View android:layout_width="match_parent" android:layout_height="1dp" - android:background="@color/call_log_action_divider"/> + android:background="@color/dialer_divider_line_color"/> <LinearLayout android:id="@+id/call_action" diff --git a/java/com/android/dialer/app/res/layout/dialtacts_activity.xml b/java/com/android/dialer/app/res/layout/dialtacts_activity.xml index cf6591b63..f8e3000d4 100644 --- a/java/com/android/dialer/app/res/layout/dialtacts_activity.xml +++ b/java/com/android/dialer/app/res/layout/dialtacts_activity.xml @@ -19,7 +19,7 @@ android:id="@+id/dialtacts_mainlayout" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:attr/colorBackgroundFloating" + android:background="?android:attr/colorBackground" android:clipChildren="false" android:clipToPadding="false" android:focusable="true" @@ -48,7 +48,7 @@ android:contentDescription="@string/action_menu_dialpad_button" android:src="@drawable/quantum_ic_dialpad_white_24" app:elevation="@dimen/floating_action_button_translation_z" - app:backgroundTint="@color/dialer_secondary_color"/> + app:backgroundTint="?android:attr/colorAccent"/> <!-- Host container for the contact tile drag shadow --> <FrameLayout diff --git a/java/com/android/dialer/app/res/layout/empty_content_view_dialpad_search.xml b/java/com/android/dialer/app/res/layout/empty_content_view_dialpad_search.xml index 1d2047982..437fa7d18 100644 --- a/java/com/android/dialer/app/res/layout/empty_content_view_dialpad_search.xml +++ b/java/com/android/dialer/app/res/layout/empty_content_view_dialpad_search.xml @@ -28,12 +28,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal|top" - android:textSize="@dimen/empty_list_message_text_size" - android:textColor="@color/empty_list_text_color" android:paddingRight="16dp" android:paddingLeft="16dp" android:paddingTop="8dp" - android:paddingBottom="8dp"/> + android:paddingBottom="8dp" + style="Dialer.TextAppearance.Primary.Ellipsize"/> <TextView android:id="@+id/empty_list_view_action" diff --git a/java/com/android/dialer/app/res/layout/lists_fragment.xml b/java/com/android/dialer/app/res/layout/lists_fragment.xml index 1126b0e51..6be1fe08f 100644 --- a/java/com/android/dialer/app/res/layout/lists_fragment.xml +++ b/java/com/android/dialer/app/res/layout/lists_fragment.xml @@ -81,15 +81,15 @@ android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:src="@drawable/ic_remove" - android:tint="@color/remove_text_color"/> + android:tint="?colorTextOnUnthemedDarkBackground"/> <TextView android:id="@+id/remove_view_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/remove_contact" - android:textColor="@color/remove_text_color" - android:textSize="@dimen/remove_text_size"/> + android:textColor="?colorTextOnUnthemedDarkBackground" + style="@style/Dialer.TextAppearance.Primary"/> </LinearLayout> diff --git a/java/com/android/dialer/app/res/layout/phone_favorite_tile_view.xml b/java/com/android/dialer/app/res/layout/phone_favorite_tile_view.xml index 3aeba98a7..df7ce5c55 100644 --- a/java/com/android/dialer/app/res/layout/phone_favorite_tile_view.xml +++ b/java/com/android/dialer/app/res/layout/phone_favorite_tile_view.xml @@ -74,7 +74,7 @@ android:fontFamily="sans-serif-medium" android:singleLine="true" android:textAlignment="viewStart" - android:textColor="@color/contact_tile_name_color" + android:textColor="?colorTextOnUnthemedDarkBackground" android:textSize="15sp"/> <ImageView android:id="@+id/contact_star_icon" @@ -95,7 +95,7 @@ android:gravity="center_vertical" android:singleLine="true" android:textAlignment="viewStart" - android:textColor="@color/contact_tile_name_color" + android:textColor="?colorTextOnUnthemedDarkBackground" android:textSize="11sp"/> </LinearLayout> @@ -103,7 +103,7 @@ android:id="@+id/contact_tile_push_state" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/item_background_material_dark" + android:background="?android:selectableItemBackground" android:importantForAccessibility="no"/> <!-- Wrap the ImageButton in a layout with a transparent background so the ripple has something to draw on --> diff --git a/java/com/android/dialer/app/res/layout/search_edittext.xml b/java/com/android/dialer/app/res/layout/search_edittext.xml index 8a2cfd483..aba5ba8ea 100644 --- a/java/com/android/dialer/app/res/layout/search_edittext.xml +++ b/java/com/android/dialer/app/res/layout/search_edittext.xml @@ -43,7 +43,7 @@ android:importantForAccessibility="no" android:scaleType="center" android:src="@drawable/quantum_ic_search_vd_theme_24" - android:tint="@color/searchbox_icon_tint"/> + android:tint="?colorIcon"/> <TextView android:id="@+id/search_box_start_search" @@ -55,7 +55,6 @@ android:fontFamily="@string/search_font_family" android:gravity="center_vertical" android:hint="@string/dialer_hint_find_contact" - android:textColorHint="@color/searchbox_hint_text_color" android:textSize="@dimen/search_collapsed_text_size"/> <ImageView @@ -68,7 +67,7 @@ android:contentDescription="@string/description_start_voice_search" android:scaleType="center" android:src="@drawable/ic_mic_grey600" - android:tint="@color/searchbox_icon_tint"/> + android:tint="?colorIcon"/> <ImageButton android:id="@+id/dialtacts_options_menu_button" @@ -79,7 +78,7 @@ android:contentDescription="@string/action_menu_overflow_description" android:scaleType="center" android:src="@drawable/quantum_ic_more_vert_white_24" - android:tint="@color/searchbox_icon_tint"/> + android:tint="?colorIcon"/> </RelativeLayout> <include layout="@layout/search_bar_expanded"/> diff --git a/java/com/android/dialer/app/res/layout/view_numbers_to_import_fragment.xml b/java/com/android/dialer/app/res/layout/view_numbers_to_import_fragment.xml index be691748a..e821c0637 100644 --- a/java/com/android/dialer/app/res/layout/view_numbers_to_import_fragment.xml +++ b/java/com/android/dialer/app/res/layout/view_numbers_to_import_fragment.xml @@ -16,7 +16,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/blocked_number_background" + android:background="?android:attr/colorBackground" android:orientation="vertical"> <ListView diff --git a/java/com/android/dialer/app/res/layout/voicemail_playback_layout.xml b/java/com/android/dialer/app/res/layout/voicemail_playback_layout.xml index a9b866e89..c352e02d1 100644 --- a/java/com/android/dialer/app/res/layout/voicemail_playback_layout.xml +++ b/java/com/android/dialer/app/res/layout/voicemail_playback_layout.xml @@ -28,7 +28,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" - android:textSize="14sp"/> + style="@style/Dialer.TextAppearance.Secondary"/> <LinearLayout android:layout_width="match_parent" @@ -42,7 +42,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="no" - android:textSize="14sp"/> + style="@style/Dialer.TextAppearance.Secondary"/> <SeekBar android:id="@+id/playback_seek" @@ -60,7 +60,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="no" - android:textSize="14sp"/> + style="@style/Dialer.TextAppearance.Secondary"/> </LinearLayout> @@ -80,7 +80,7 @@ style="@style/VoicemailPlaybackLayoutButtonStyle" android:contentDescription="@string/description_playback_speakerphone" android:src="@drawable/quantum_ic_volume_down_white_24" - android:tint="@color/voicemail_icon_tint"/> + android:tint="?colorIcon"/> <Space android:layout_width="0dp" @@ -103,7 +103,7 @@ style="@style/VoicemailPlaybackLayoutButtonStyle" android:contentDescription="@string/call_log_trash_voicemail" android:src="@drawable/quantum_ic_delete_white_24" - android:tint="@color/voicemail_icon_tint"/> + android:tint="?colorIcon"/> <Space android:layout_width="0dp" diff --git a/java/com/android/dialer/app/res/values-v27/styles.xml b/java/com/android/dialer/app/res/values-v27/styles.xml index 76ae4ba62..bc9b119a5 100644 --- a/java/com/android/dialer/app/res/values-v27/styles.xml +++ b/java/com/android/dialer/app/res/values-v27/styles.xml @@ -15,7 +15,7 @@ ~ limitations under the License --> <resources> - <style name="DialtactsTheme" parent="Dialer.ThemeBase"> + <style name="DialtactsTheme" parent="Dialer.ThemeBase.ActionBar"> <item name="android:windowLightNavigationBar">true</item> <item name="android:navigationBarColor">?android:attr/windowBackground</item> <item name="android:navigationBarDividerColor">#E0E0E0</item> diff --git a/java/com/android/dialer/app/res/values/colors.xml b/java/com/android/dialer/app/res/values/colors.xml index 2b8d63ac0..a9713474d 100644 --- a/java/com/android/dialer/app/res/values/colors.xml +++ b/java/com/android/dialer/app/res/values/colors.xml @@ -15,67 +15,12 @@ --> <resources> - <color name="dialer_flat_button_text_color">?android:attr/colorPrimary</color> - - <color name="setting_background_color">#ffffff</color> - - <!-- 54% black --> - <color name="call_log_icon_tint">#8a000000</color> - <!-- 87% black --> - <color name="call_log_primary_color">#de000000</color> - <!-- 54% black --> - <color name="call_log_detail_color">#8a000000</color> - <!-- 87% black --> - <color name="call_log_voicemail_transcript_color">#de000000</color> - <!-- 54% black --> - <color name="call_log_voicemail_transcript_branding_color">#8a000000</color> - <!-- 100% blue --> - <color name="call_log_voicemail_transcript_rating_color">#ff2a56c6</color> - <!-- 70% black --> - <color name="call_log_action_color">#b3000000</color> - <!-- 54% black --> - <color name="call_log_day_group_heading_color">#8a000000</color> - <!-- 87% black--> - <color name="call_log_unread_text_color">#de000000</color> - <color name="call_log_list_item_primary_action_icon_tint">@color/call_log_icon_tint</color> - - <color name="voicemail_icon_tint">@color/call_log_icon_tint</color> <color name="voicemail_icon_disabled_tint">#80000000</color> - <color name="voicemail_playpause_icon_tint">@color/voicemail_icon_tint</color> - <!-- Colour of voicemail progress bar to the right of position indicator. --> - <color name="voicemail_playback_seek_bar_yet_to_play">#cecece</color> - <!-- Colour of voicemail progress bar to the left of position indicator. --> - <color name="voicemail_playback_seek_bar_already_played">?android:attr/colorPrimary</color> - - <!-- Background color for search results and call details --> - <color name="background_dialer_results">#f9f9f9</color> - - <!-- Color of the contact name in favorite tiles --> - <color name="contact_tile_name_color">#ffffff</color> - - <color name="contact_list_name_text_color">@color/dialer_primary_text_color</color> - - <color name="remove_text_color">#ffffff</color> + <color name="voicemail_playpause_icon_tint">?colorIcon</color> <!-- Text color for the "Remove" text when a contact is dragged on top of the remove view --> <color name="remove_highlighted_text_color">#FF3F3B</color> - <color name="dialer_dialpad_touch_tint">@color/dialer_theme_color_20pct</color> - - <color name="call_log_action_divider">#eeeeee</color> - <color name="divider_line_color">#D8D8D8</color> - <!-- Colors for blocked numbers list --> - <color name="blocked_number_primary_text_color">@color/dialer_primary_text_color</color> - <color name="blocked_number_secondary_text_color">@color/dialer_secondary_text_color</color> - <color name="blocked_number_icon_tint">#616161</color> - <color name="blocked_number_background">#FFFFFF</color> <color name="blocked_number_block_color">#F44336</color> - <color name="blocked_number_header_color">?android:attr/colorPrimary</color> - <color name="blocked_number_disabled_emergency_background_color">#E0E0E0</color> - <color name="add_blocked_number_icon_color">#bdbdbd</color> - - <color name="voicemail_donation_promo_positive_button_text_color">#FF2A56C6</color> - <color name="voicemail_donation_promo_negative_button_text_color">#FF757575</color> - </resources> diff --git a/java/com/android/dialer/app/res/values/styles.xml b/java/com/android/dialer/app/res/values/styles.xml index 54d18f103..c2cad315c 100644 --- a/java/com/android/dialer/app/res/values/styles.xml +++ b/java/com/android/dialer/app/res/values/styles.xml @@ -15,7 +15,9 @@ ~ limitations under the License --> <resources> - <style name="DialtactsTheme" parent="Dialer.ThemeBase"/> + <style name="DialtactsTheme" parent="Dialer.ThemeBase.ActionBar"> + <!-- todo(calderwoodra): fill this in with dialpad theme and call log card theme --> + </style> <style name="DialpadTheme" parent="DialtactsTheme"> <item name="android:textColorPrimary">?android:attr/textColorPrimaryInverse</item> @@ -32,13 +34,13 @@ <!-- Text in the action bar at the top of the screen --> <style name="DialtactsActionBarTitleText" parent="@android:style/TextAppearance.Material.Widget.ActionBar.Title"> - <item name="android:textColor">@color/actionbar_text_color</item> + <item name="android:textColor">?colorTextOnUnthemedDarkBackground</item> </style> <!-- Text style for tabs. --> <style name="DialtactsActionBarTabTextStyle" parent="android:style/Widget.Material.Light.ActionBar.TabText"> - <item name="android:textColor">@color/tab_text_color</item> + <item name="android:textColor">?colorTextOnUnthemedDarkBackground</item> <item name="android:textSize">@dimen/tab_text_size</item> <item name="android:fontFamily">"sans-serif-medium"</item> </style> @@ -51,29 +53,29 @@ <item name="android:gravity">center_vertical</item> </style> - <style name="CallLogActionTextStyle"> + <style name="CallLogActionTextStyle" parent="Dialer.TextAppearance.Primary.Ellipsize"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</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/call_log_action_color</item> - <item name="android:textSize">@dimen/call_log_primary_text_size</item> - <item name="android:fontFamily">"sans-serif"</item> <item name="android:focusable">true</item> - <item name="android:singleLine">true</item> <item name="android:importantForAccessibility">no</item> </style> - <style name="CallLogActionSupportTextStyle" parent="@style/CallLogActionTextStyle"> - <item name="android:textSize">@dimen/call_log_detail_text_size</item> - <item name="android:textColor">@color/call_log_detail_color</item> + <style name="CallLogActionSupportTextStyle" parent="Dialer.TextAppearance.Secondary.Ellipsize"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">wrap_content</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:focusable">true</item> + <item name="android:importantForAccessibility">no</item> </style> <style name="CallLogActionIconStyle"> <item name="android:layout_width">@dimen/call_log_action_icon_dimen</item> <item name="android:layout_height">@dimen/call_log_action_icon_dimen</item> <item name="android:layout_marginStart">@dimen/call_log_action_icon_margin_start</item> - <item name="android:tint">?android:attr/textColorSecondary</item> + <item name="android:tint">?colorIcon</item> <item name="android:importantForAccessibility">no</item> </style> @@ -122,7 +124,7 @@ <item name="android:background">?android:attr/selectableItemBackground</item> <item name="android:paddingEnd">@dimen/button_horizontal_padding</item> <item name="android:paddingStart">@dimen/button_horizontal_padding</item> - <item name="android:textColor">@color/dialer_flat_button_text_color</item> + <item name="android:textColor">?android:attr/colorPrimary</item> </style> <!-- Style for the 'primary' button in a view. Unlike the DialerFlatButtonStyle, this button --> @@ -147,9 +149,7 @@ <item name="android:background">?android:attr/listDivider</item> </style> - <style name="TranscriptionQualityRating"> - <item name="android:textColor">@color/call_log_voicemail_transcript_branding_color</item> - <item name="android:textSize">@dimen/call_log_voicemail_transcription_text_size</item> + <style name="TranscriptionQualityRating" parent="Dialer.TextAppearance.Secondary"> <item name="android:textStyle">italic</item> <item name="android:paddingRight">20dp</item> <item name="android:minHeight">56dp</item> @@ -167,5 +167,4 @@ <item name="android:textColor">?android:attr/colorPrimary</item> <item name="android:fontFamily">"sans-serif-medium"</item> </style> - </resources> diff --git a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java index e650e77f8..ae068ac6b 100644 --- a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java +++ b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java @@ -41,6 +41,7 @@ import com.android.dialer.simulator.stub.StubSimulatorEnrichedCallModule; import com.android.dialer.spam.stub.StubSpamModule; import com.android.dialer.storage.StorageModule; import com.android.dialer.strictmode.impl.SystemStrictModeModule; +import com.android.dialer.theme.base.impl.AospThemeModule; import com.android.incallui.calllocation.stub.StubCallLocationModule; import com.android.incallui.maps.stub.StubMapsModule; import com.android.incallui.speakeasy.StubSpeakEasyModule; @@ -79,6 +80,7 @@ import javax.inject.Singleton; StubSpamModule.class, StubSpeakEasyModule.class, SystemStrictModeModule.class, + AospThemeModule.class, VoicemailModule.class, }) public interface AospDialerRootComponent extends BaseDialerRootComponent {} diff --git a/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java b/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java index 1d346accf..666a0be50 100644 --- a/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java +++ b/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java @@ -42,6 +42,7 @@ import com.android.dialer.spam.SpamComponent; import com.android.dialer.speeddial.loader.UiItemLoaderComponent; import com.android.dialer.storage.StorageComponent; import com.android.dialer.strictmode.StrictModeComponent; +import com.android.dialer.theme.base.ThemeComponent; import com.android.incallui.calllocation.CallLocationComponent; import com.android.incallui.maps.MapsComponent; import com.android.incallui.speakeasy.SpeakEasyComponent; @@ -81,4 +82,5 @@ public interface BaseDialerRootComponent SpeakEasyComponent.HasComponent, StorageComponent.HasComponent, StrictModeComponent.HasComponent, + ThemeComponent.HasComponent, VoicemailComponent.HasComponent {} diff --git a/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java index 8c0ac56a2..622bd5d4f 100644 --- a/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java +++ b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java @@ -41,6 +41,7 @@ import com.android.dialer.simulator.stub.StubSimulatorEnrichedCallModule; import com.android.dialer.spam.stub.StubSpamModule; import com.android.dialer.storage.StorageModule; import com.android.dialer.strictmode.impl.SystemStrictModeModule; +import com.android.dialer.theme.base.impl.AospThemeModule; import com.android.incallui.calllocation.impl.CallLocationModule; import com.android.incallui.maps.impl.MapsModule; import com.android.incallui.speakeasy.StubSpeakEasyModule; @@ -82,6 +83,7 @@ import javax.inject.Singleton; StubSpamModule.class, StubSpeakEasyModule.class, SystemStrictModeModule.class, + AospThemeModule.class, VoicemailModule.class, }) public interface GoogleStubDialerRootComponent extends BaseDialerRootComponent {} diff --git a/java/com/android/dialer/blockreportspam/res/layout/block_report_spam_dialog.xml b/java/com/android/dialer/blockreportspam/res/layout/block_report_spam_dialog.xml index 82e8d80b3..af89ab779 100644 --- a/java/com/android/dialer/blockreportspam/res/layout/block_report_spam_dialog.xml +++ b/java/com/android/dialer/blockreportspam/res/layout/block_report_spam_dialog.xml @@ -16,7 +16,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="25dp" + android:padding="24dp" android:orientation="vertical"> <TextView android:id="@+id/block_details" @@ -24,13 +24,13 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:text="@string/block_report_number_alert_details" - android:textColor="@color/block_report_spam_primary_text_color" - android:textSize="@dimen/blocked_report_spam_primary_text_size"/> + style="@style/Dialer.TextAppearance.Secondary"/> <CheckBox android:id="@+id/report_number_as_spam_action" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/checkbox_report_as_spam_action" - android:textSize="@dimen/blocked_report_spam_primary_text_size"/> + android:textSize="@dimen/blocked_report_spam_primary_text_size" + style="@style/DialerCheckboxStyle"/> </LinearLayout> diff --git a/java/com/android/dialer/callcomposer/CameraComposerFragment.java b/java/com/android/dialer/callcomposer/CameraComposerFragment.java index a5c65fd9d..4881220e7 100644 --- a/java/com/android/dialer/callcomposer/CameraComposerFragment.java +++ b/java/com/android/dialer/callcomposer/CameraComposerFragment.java @@ -26,7 +26,6 @@ import android.os.Bundle; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.v4.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -49,6 +48,7 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.PermissionsUtil; /** Fragment used to compose call with image from the user's camera. */ @@ -117,8 +117,7 @@ public class CameraComposerFragment extends CallComposerFragment allowPermission.setOnClickListener(this); permissionText.setText(R.string.camera_permission_text); permissionImage.setImageResource(R.drawable.quantum_ic_camera_alt_white_48); - permissionImage.setColorFilter( - ContextCompat.getColor(getContext(), R.color.dialer_theme_color)); + permissionImage.setColorFilter(ThemeComponent.get(getContext()).theme().getColorPrimary()); permissionView.setVisibility(View.VISIBLE); } else { if (bundle != null) { diff --git a/java/com/android/dialer/callcomposer/GalleryComposerFragment.java b/java/com/android/dialer/callcomposer/GalleryComposerFragment.java index e604ec1b0..626530887 100644 --- a/java/com/android/dialer/callcomposer/GalleryComposerFragment.java +++ b/java/com/android/dialer/callcomposer/GalleryComposerFragment.java @@ -29,7 +29,6 @@ import android.provider.Settings; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.LoaderManager.LoaderCallbacks; -import android.support.v4.content.ContextCompat; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.view.LayoutInflater; @@ -44,6 +43,7 @@ import com.android.dialer.common.concurrent.DialerExecutor; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.PermissionsUtil; import java.util.ArrayList; import java.util.List; @@ -94,8 +94,7 @@ public class GalleryComposerFragment extends CallComposerFragment allowPermission.setOnClickListener(this); permissionText.setText(R.string.gallery_permission_text); permissionImage.setImageResource(R.drawable.quantum_ic_photo_white_48); - permissionImage.setColorFilter( - ContextCompat.getColor(getContext(), R.color.dialer_theme_color)); + permissionImage.setColorFilter(ThemeComponent.get(getContext()).theme().getColorPrimary()); permissionView.setVisibility(View.VISIBLE); } else { if (bundle != null) { diff --git a/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml b/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml index 4d3769b6d..49d278f30 100644 --- a/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml +++ b/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml @@ -54,7 +54,7 @@ android:gravity="center" android:maxLines="1" android:ellipsize="end" - android:textColor="?android:attr/colorBackground" + android:textColor="?android:attr/textColorPrimaryInverse" android:textSize="@dimen/call_composer_name_text_size"/> <TextView @@ -62,10 +62,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" - android:maxLines="1" - android:ellipsize="end" - android:textColor="?android:attr/colorBackground" - android:textSize="@dimen/call_composer_number_text_size"/> + android:textColor="?android:attr/textColorPrimaryInverse" + style="@style/Dialer.TextAppearance.Primary"/> </LinearLayout> <QuickContactBadge @@ -151,9 +149,8 @@ android:drawablePadding="@dimen/send_and_call_drawable_padding" android:textAllCaps="true" android:text="@string/share_and_call" - android:textSize="@dimen/send_and_call_text_size" - android:fontFamily="sans-serif-medium" - android:textColor="?android:attr/colorBackground"/> + style="@style/Dialer.TextAppearance.Header2" + android:textColor="?android:attr/textColorPrimaryInverse"/> </FrameLayout> </FrameLayout> diff --git a/java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml b/java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml index 49df9e679..6255e7289 100644 --- a/java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml +++ b/java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml @@ -64,7 +64,7 @@ android:paddingBottom="64dp" android:textSize="@dimen/message_compose_item_text_size" android:hint="@string/message_composer_custom_message_hint" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textColorHint="?android:attr/textColorHint" android:background="?android:attr/colorBackground" android:textCursorDrawable="@drawable/searchedittext_custom_cursor" diff --git a/java/com/android/dialer/callcomposer/res/layout/permission_view.xml b/java/com/android/dialer/callcomposer/res/layout/permission_view.xml index 783ba9867..4248046dc 100644 --- a/java/com/android/dialer/callcomposer/res/layout/permission_view.xml +++ b/java/com/android/dialer/callcomposer/res/layout/permission_view.xml @@ -33,7 +33,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/permission_item_margin" - style="@style/TextAppearanceMedium"/> + style="@style/Dialer.TextAppearance.Header2"/> <TextView android:id="@+id/allow" diff --git a/java/com/android/dialer/callcomposer/res/values/styles.xml b/java/com/android/dialer/callcomposer/res/values/styles.xml index aeec2a369..cc0cc9028 100644 --- a/java/com/android/dialer/callcomposer/res/values/styles.xml +++ b/java/com/android/dialer/callcomposer/res/values/styles.xml @@ -30,12 +30,10 @@ <item name="android:actionBarItemBackground">@drawable/item_background_material_borderless_dark</item> </style> - <style name="message_composer_textview"> - <item name="android:textSize">@dimen/message_compose_item_text_size</item> - <item name="android:textColor">@color/dialer_primary_text_color</item> + <style name="message_composer_textview" parent="Dialer.TextAppearance.Primary"> <item name="android:paddingStart">@dimen/message_composer_item_padding</item> <item name="android:paddingEnd">@dimen/message_composer_item_padding</item> - <item name="android:background">@drawable/item_background_material_light</item> + <item name="android:background">?android:attr/selectableItemBackground</item> <item name="android:gravity">center_vertical</item> </style> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/calldetails/AndroidManifest.xml b/java/com/android/dialer/calldetails/AndroidManifest.xml index 54d9f2fad..cea106a74 100644 --- a/java/com/android/dialer/calldetails/AndroidManifest.xml +++ b/java/com/android/dialer/calldetails/AndroidManifest.xml @@ -20,14 +20,12 @@ <activity android:label="@string/call_details" android:exported="false" - android:name="com.android.dialer.calldetails.OldCallDetailsActivity" - android:theme="@style/Dialer.ThemeBase.NoActionBar"> + android:name="com.android.dialer.calldetails.OldCallDetailsActivity"> </activity> <activity android:label="@string/call_details" android:exported="false" - android:name="com.android.dialer.calldetails.CallDetailsActivity" - android:theme="@style/Dialer.ThemeBase.NoActionBar"> + android:name="com.android.dialer.calldetails.CallDetailsActivity"> </activity> </application> </manifest> diff --git a/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java index 4de7af796..05957ae80 100644 --- a/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java +++ b/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java @@ -34,7 +34,6 @@ import com.android.dialer.calllogutils.CallLogDurations; import com.android.dialer.calllogutils.CallTypeHelper; import com.android.dialer.calllogutils.CallTypeIconsView; import com.android.dialer.common.LogUtil; -import com.android.dialer.compat.AppCompatConstants; import com.android.dialer.enrichedcall.historyquery.proto.HistoryResult; import com.android.dialer.enrichedcall.historyquery.proto.HistoryResult.Type; import com.android.dialer.glidephotomanager.PhotoInfo; @@ -217,20 +216,20 @@ public class CallDetailsEntryViewHolder extends ViewHolder { private static @ColorInt int getColorForCallType(Context context, int callType) { switch (callType) { - case AppCompatConstants.CALLS_OUTGOING_TYPE: - case AppCompatConstants.CALLS_VOICEMAIL_TYPE: - case AppCompatConstants.CALLS_BLOCKED_TYPE: - case AppCompatConstants.CALLS_INCOMING_TYPE: - case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE: - case AppCompatConstants.CALLS_REJECTED_TYPE: + case Calls.OUTGOING_TYPE: + case Calls.VOICEMAIL_TYPE: + case Calls.BLOCKED_TYPE: + case Calls.INCOMING_TYPE: + case Calls.ANSWERED_EXTERNALLY_TYPE: + case Calls.REJECTED_TYPE: return ContextCompat.getColor(context, R.color.dialer_secondary_text_color); - case AppCompatConstants.CALLS_MISSED_TYPE: + case Calls.MISSED_TYPE: default: // It is possible for users to end up with calls with unknown call types in their // call history, possibly due to 3rd party call log implementations (e.g. to // distinguish between rejected and missed calls). Instead of crashing, just // assume that all unknown call types are missed calls. - return ContextCompat.getColor(context, R.color.missed_call); + return ContextCompat.getColor(context, R.color.dialer_red); } } } diff --git a/java/com/android/dialer/calldetails/ReportDialogFragment.java b/java/com/android/dialer/calldetails/ReportDialogFragment.java index d75fe51e2..e1c0e9d99 100644 --- a/java/com/android/dialer/calldetails/ReportDialogFragment.java +++ b/java/com/android/dialer/calldetails/ReportDialogFragment.java @@ -37,6 +37,7 @@ import com.android.dialer.logging.Logger; import com.android.dialer.phonenumbercache.CachedNumberLookupService; import com.android.dialer.phonenumbercache.CachedNumberLookupService.CachedContactInfo; import com.android.dialer.phonenumbercache.PhoneNumberCache; +import com.android.dialer.theme.base.ThemeComponent; /** Dialog for reporting an inaccurate caller id information. */ public class ReportDialogFragment extends DialogFragment { @@ -92,7 +93,7 @@ public class ReportDialogFragment extends DialogFragment { } private static void onShow(Context context, AlertDialog dialog) { - int buttonTextColor = context.getColor(R.color.dialer_theme_color); + int buttonTextColor = ThemeComponent.get(context).theme().getColorPrimary(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(buttonTextColor); dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(buttonTextColor); } diff --git a/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml b/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml index 40140971e..cb2faa762 100644 --- a/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml +++ b/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml @@ -36,12 +36,11 @@ android:layout_marginStart="@dimen/call_entry_text_left_margin" android:layout_marginEnd="16dp" android:layout_toStartOf="@+id/call_duration" - android:gravity="start" - android:maxLines="100"/> + android:gravity="start"/> <TextView android:id="@+id/call_time" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/call_entry_bottom_padding" @@ -50,7 +49,7 @@ <TextView android:id="@+id/call_duration" - style="@style/Dialer.TextAppearance.Primary" + style="@style/Dialer.TextAppearance.Primary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/call_entry_padding" @@ -66,7 +65,7 @@ <TextView android:id="@+id/post_call_note" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="match_parent" android:layout_height="@dimen/ec_container_height" android:layout_below="@+id/ec_container" @@ -77,7 +76,7 @@ android:visibility="gone"/> <TextView android:id="@+id/rtt_transcript" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/call_entry_bottom_padding" @@ -95,6 +94,6 @@ android:layout_marginBottom="@dimen/ec_divider_top_bottom_margin" android:layout_marginStart="@dimen/call_entry_text_left_margin" android:layout_below="@id/rtt_transcript" - android:background="#12000000" + android:background="@color/dialer_divider_line_color" android:visibility="gone"/> </RelativeLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/calldetails/res/layout/call_details_footer.xml b/java/com/android/dialer/calldetails/res/layout/call_details_footer.xml index dddb45156..002903803 100644 --- a/java/com/android/dialer/calldetails/res/layout/call_details_footer.xml +++ b/java/com/android/dialer/calldetails/res/layout/call_details_footer.xml @@ -24,7 +24,7 @@ android:layout_height="1dp" android:layout_marginTop="@dimen/ec_divider_top_bottom_margin" android:layout_marginBottom="@dimen/ec_divider_top_bottom_margin" - android:background="#12000000"/> + android:background="@color/dialer_divider_line_color"/> <TextView android:id="@+id/call_detail_action_copy" @@ -32,6 +32,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableStart="@drawable/quantum_ic_content_copy_grey600_24" + android:tint="?colorIcon" android:text="@string/call_details_copy_number"/> <TextView @@ -40,6 +41,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableStart="@drawable/quantum_ic_edit_grey600_24" + android:tint="?colorIcon" android:text="@string/call_details_edit_number"/> <TextView @@ -49,6 +51,7 @@ android:layout_height="wrap_content" android:drawableStart="@drawable/quantum_ic_report_grey600_24" android:text="@string/call_details_report_call_id" + android:tint="?colorIcon" android:visibility="gone"/> <TextView @@ -57,6 +60,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableStart="@drawable/quantum_ic_delete_vd_theme_24" - android:tint="@color/dialer_secondary_text_color" + android:tint="?colorIcon" android:text="@string/delete"/> </LinearLayout> diff --git a/java/com/android/dialer/calldetails/res/layout/caller_id_report_dialog.xml b/java/com/android/dialer/calldetails/res/layout/caller_id_report_dialog.xml index 09d3c2b43..0fd163f55 100644 --- a/java/com/android/dialer/calldetails/res/layout/caller_id_report_dialog.xml +++ b/java/com/android/dialer/calldetails/res/layout/caller_id_report_dialog.xml @@ -24,12 +24,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="24dp" - android:textAppearance="?android:attr/textAppearanceMedium"/> + android:textAppearance="@style/Dialer.TextAppearance.Header2"/> <TextView android:id="@+id/number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="24dp" - android:textAppearance="?android:attr/textAppearanceMedium"/> + android:textAppearance="@style/Dialer.TextAppearance.Header2"/> </LinearLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/calldetails/res/layout/contact_container.xml b/java/com/android/dialer/calldetails/res/layout/contact_container.xml index e0de8dc5f..e918feb69 100644 --- a/java/com/android/dialer/calldetails/res/layout/contact_container.xml +++ b/java/com/android/dialer/calldetails/res/layout/contact_container.xml @@ -53,14 +53,14 @@ <TextView android:id="@+id/phone_number" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/photo_text_margin"/> <TextView android:id="@+id/network" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/photo_text_margin" @@ -78,7 +78,7 @@ android:contentDescription="@string/call" android:scaleType="center" android:src="@drawable/quantum_ic_call_white_24" - android:tint="@color/secondary_text_color"/> + android:tint="?colorIcon"/> <RelativeLayout @@ -97,11 +97,11 @@ android:layout_marginStart="@dimen/ad_icon_margin_start_offset" android:scaleType="fitCenter" android:src="@drawable/quantum_ic_language_vd_theme_24" - android:tint="@color/secondary_text_color"/> + android:tint="?colorIcon"/> <TextView android:id="@+id/assisted_dialing_text" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/ad_text_margin_start" diff --git a/java/com/android/dialer/calldetails/res/layout/ec_data_container.xml b/java/com/android/dialer/calldetails/res/layout/ec_data_container.xml index 523191207..18a7c283c 100644 --- a/java/com/android/dialer/calldetails/res/layout/ec_data_container.xml +++ b/java/com/android/dialer/calldetails/res/layout/ec_data_container.xml @@ -29,7 +29,7 @@ android:layout_centerVertical="true" android:layout_marginStart="1dp" android:maxLines="2" - style="@style/Dialer.TextAppearance.Secondary"/> + style="@style/Dialer.TextAppearance.Secondary.Ellipsize"/> <FrameLayout android:id="@+id/multimedia_image_container" @@ -54,10 +54,9 @@ android:id="@+id/multimedia_attachments_number" android:layout_width="match_parent" android:layout_height="match_parent" - android:textColor="?android:attr/colorBackground" + android:textColor="?android:attr/textColorPrimaryInverse" android:textSize="20sp" - android:fontFamily="sans-serif-medium" - android:background="#80000000" + style="@style/Dialer.TextAppearance.Header2" android:gravity="center" android:visibility="gone"/> </FrameLayout> diff --git a/java/com/android/dialer/calldetails/res/values/styles.xml b/java/com/android/dialer/calldetails/res/values/styles.xml index 1b4329a23..4b861f55b 100644 --- a/java/com/android/dialer/calldetails/res/values/styles.xml +++ b/java/com/android/dialer/calldetails/res/values/styles.xml @@ -15,7 +15,7 @@ ~ limitations under the License --> <resources> - <style name="CallDetailsActionItemStyle"> + <style name="CallDetailsActionItemStyle" parent="Dialer.TextAppearance.Secondary.Ellipsize"> <item name="android:foreground">?android:attr/selectableItemBackground</item> <item name="android:clickable">true</item> <item name="android:drawablePadding">28dp</item> @@ -24,8 +24,6 @@ <item name="android:paddingEnd">28dp</item> <item name="android:paddingTop">16dp</item> <item name="android:paddingBottom">16dp</item> - <item name="android:textColor">#8A000000</item> - <item name="android:textSize">14sp</item> </style> <style name="RttTranscriptLink"> @@ -34,6 +32,7 @@ <item name="android:textAllCaps">true</item> <item name="textAllCaps">true</item> </style> + <style name="RttTranscriptMessage" parent="Dialer.TextAppearance.Secondary"> <item name="android:fontFamily">sans-serif</item> <item name="android:textAllCaps">false</item> diff --git a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java index ec6e8a0fd..4b3697017 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java @@ -238,7 +238,6 @@ public final class NewCallLogFragment extends Fragment implements LoaderCallback private void configureEmptyContentView() { emptyContentView.setImage(R.drawable.quantum_ic_query_builder_vd_theme_24); - emptyContentView.setImageTint(R.color.empty_call_log_icon_tint_color, null); emptyContentView.setDescription(R.string.new_call_log_permission_no_calllog); emptyContentView.setActionLabel(com.android.dialer.widget.R.string.permission_single_turn_on); emptyContentView.setActionClickedListener(new TurnOnPhonePermissions()); diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index 357c623da..cdc0858da 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -26,18 +26,21 @@ import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import android.view.View; +import android.view.View.AccessibilityDelegate; +import android.view.accessibility.AccessibilityNodeInfo; +import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.widget.ImageView; import android.widget.TextView; import com.android.dialer.calllog.database.Coalescer; import com.android.dialer.calllog.model.CoalescedRow; import com.android.dialer.calllog.ui.NewCallLogAdapter.PopCounts; import com.android.dialer.calllog.ui.menu.NewCallLogMenu; +import com.android.dialer.calllogutils.CallLogEntryDescriptions; import com.android.dialer.calllogutils.CallLogEntryText; import com.android.dialer.calllogutils.CallLogRowActions; import com.android.dialer.calllogutils.PhoneAccountUtils; import com.android.dialer.calllogutils.PhotoInfoBuilder; import com.android.dialer.common.concurrent.DialerExecutorComponent; -import com.android.dialer.compat.AppCompatConstants; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.oem.MotorolaUtils; import com.android.dialer.phonenumberutil.PhoneNumberHelper; @@ -63,6 +66,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private final ImageView assistedDialIcon; private final TextView phoneAccountView; private final ImageView menuButton; + private final View callLogEntryRootView; private final Clock clock; private final RealtimeRowProcessor realtimeRowProcessor; @@ -79,6 +83,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { PopCounts popCounts) { super(view); this.activity = activity; + callLogEntryRootView = view; contactPhotoView = view.findViewById(R.id.contact_photo_view); primaryTextView = view.findViewById(R.id.primary_text); callCountTextView = view.findViewById(R.id.call_count); @@ -108,6 +113,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { // what information we have, rather than an empty card. For example, if CP2 information needs to // be queried on the fly, we can still show the phone number until the contact name loads. displayRow(row); + configA11yForRow(row); // Note: This leaks the view holder via the callback (which is an inner class), but this is OK // because we only create ~10 of them (and they'll be collected assuming all jobs finish). @@ -143,6 +149,28 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { setOnClickListenerForMenuButon(row); } + private void configA11yForRow(CoalescedRow row) { + callLogEntryRootView.setContentDescription( + CallLogEntryDescriptions.buildDescriptionForEntry(activity, clock, row)); + + // Inform a11y users that double tapping an entry now makes a call. + // This will instruct TalkBack to say "double tap to call" instead of + // "double tap to activate". + callLogEntryRootView.setAccessibilityDelegate( + new AccessibilityDelegate() { + @Override + public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(host, info); + info.addAction( + new AccessibilityAction( + AccessibilityNodeInfo.ACTION_CLICK, + activity + .getResources() + .getString(R.string.a11y_new_call_log_entry_tap_action))); + } + }); + } + private void setNumberCalls(CoalescedRow row) { int numberCalls = row.getCoalescedIds().getCoalescedIdCount(); if (numberCalls > 1) { @@ -161,7 +189,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { } private void setPhoto(CoalescedRow row) { - contactPhotoView.setPhoto(PhotoInfoBuilder.fromCoalescedRow(row).build()); + contactPhotoView.setPhoto(PhotoInfoBuilder.fromCoalescedRow(activity, row).build()); } private void setFeatureIcons(CoalescedRow row) { @@ -201,19 +229,19 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private void setCallTypeIcon(CoalescedRow row) { @DrawableRes int resId; switch (row.getCallType()) { - case AppCompatConstants.CALLS_INCOMING_TYPE: - case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE: + case Calls.INCOMING_TYPE: + case Calls.ANSWERED_EXTERNALLY_TYPE: resId = R.drawable.quantum_ic_call_received_vd_theme_24; break; - case AppCompatConstants.CALLS_OUTGOING_TYPE: + case Calls.OUTGOING_TYPE: resId = R.drawable.quantum_ic_call_made_vd_theme_24; break; - case AppCompatConstants.CALLS_MISSED_TYPE: + case Calls.MISSED_TYPE: resId = R.drawable.quantum_ic_call_missed_vd_theme_24; break; - case AppCompatConstants.CALLS_VOICEMAIL_TYPE: + case Calls.VOICEMAIL_TYPE: throw new IllegalStateException("Voicemails not expected in call log"); - case AppCompatConstants.CALLS_BLOCKED_TYPE: + case Calls.BLOCKED_TYPE: resId = R.drawable.quantum_ic_block_vd_theme_24; break; default: @@ -275,6 +303,12 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private void setOnClickListenerForMenuButon(CoalescedRow row) { menuButton.setOnClickListener(NewCallLogMenu.createOnClickListener(activity, row)); + menuButton.setContentDescription( + activity + .getResources() + .getString( + R.string.a11y_new_call_log_entry_expand_menu, + CallLogEntryText.buildPrimaryText(activity, row))); } private class RealtimeRowFutureCallback implements FutureCallback<CoalescedRow> { diff --git a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java index 25ae47691..6d0b7951f 100644 --- a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java +++ b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java @@ -28,7 +28,7 @@ final class BottomSheetHeader { static HistoryItemBottomSheetHeaderInfo fromRow(Context context, CoalescedRow row) { return HistoryItemBottomSheetHeaderInfo.newBuilder() .setNumber(row.getNumber()) - .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(row)) + .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(context, row)) .setPrimaryText(CallLogEntryText.buildPrimaryText(context, row).toString()) .setSecondaryText( CallLogEntryText.buildSecondaryTextForBottomSheet(context, row).toString()) diff --git a/java/com/android/dialer/calllog/ui/menu/Modules.java b/java/com/android/dialer/calllog/ui/menu/Modules.java index ded495807..7c6c65ca9 100644 --- a/java/com/android/dialer/calllog/ui/menu/Modules.java +++ b/java/com/android/dialer/calllog/ui/menu/Modules.java @@ -88,7 +88,7 @@ final class Modules { Context context, CoalescedRow row) { return CallDetailsHeaderInfo.newBuilder() .setDialerPhoneNumber(row.getNumber()) - .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(row)) + .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(context, row)) .setPrimaryText(CallLogEntryText.buildPrimaryText(context, row).toString()) .setSecondaryText( CallLogEntryText.buildSecondaryTextForBottomSheet(context, row).toString()) diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml index 1bd71bb0f..726c53bc1 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml @@ -30,13 +30,19 @@ android:layout_marginEnd="8dp" android:layout_centerVertical="true"/> + <!-- + A vertical linear layout of three rows: primary info, secondary info, and phone account info. + It is marked as not important for a11y as we will set a more user-friendly content description + for the entire entry view in Java code. + --> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toEndOf="@+id/contact_photo_view" android:layout_toStartOf="@+id/menu_button" - android:orientation="vertical"> + android:orientation="vertical" + android:importantForAccessibility="noHideDescendants"> <!-- 1st row: primary info --> <LinearLayout @@ -60,14 +66,12 @@ --> <TextView android:id="@+id/primary_text" - style="@style/Dialer.TextAppearance.Primary" + style="@style/Dialer.TextAppearance.Primary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_marginEnd="6dp" - android:ellipsize="end" android:lineSpacingMultiplier="1.5" - android:singleLine="true" tools:ignore="InefficientWeight"/> <ImageView @@ -120,26 +124,26 @@ <TextView android:id="@+id/secondary_text" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:ellipsize="end" - android:lineSpacingMultiplier="1.4" - android:singleLine="true"/> + android:lineSpacingMultiplier="1.4"/> </LinearLayout> <!-- 3rd row: phone account info --> <TextView android:id="@+id/phone_account" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true"/> + android:layout_height="wrap_content"/> </LinearLayout> + <!-- + The button to expand the bottom sheet for an entry. + Its content description is set in Java code. + --> <ImageView android:id="@+id/menu_button" android:layout_width="56dp" @@ -147,8 +151,8 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:background="?android:attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/a11y_new_call_log_expand_menu_for_entry" android:scaleType="center" android:src="@drawable/quantum_ic_more_vert_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon" + tools:ignore="ContentDescription"/> </RelativeLayout> diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_header.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_header.xml index e86ece534..a6d1f61f1 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_header.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_header.xml @@ -21,7 +21,7 @@ android:layout_height="wrap_content"> <TextView android:id="@+id/new_call_log_header_text" - style="@style/SubHeader" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml index 0e6d551fb..fade6c7b9 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml @@ -49,17 +49,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="12dp" - android:fontFamily="sans-serif-medium" - android:textColor="@color/primary_material_dark" - android:textSize="@dimen/call_log_primary_text_size"/> + style="@style/Dialer.TextAppearance.Header2"/> <TextView android:id="@+id/new_call_log_promotion_card_details" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:lineSpacingExtra="8dp" - android:textColor="@color/primary_material_dark" - android:textSize="14sp"/> + style="@style/Dialer.TextAppearance.Secondary"/> <Button android:id="@+id/new_call_log_promotion_card_ok" android:layout_width="wrap_content" diff --git a/java/com/android/dialer/calllog/ui/res/values/colors.xml b/java/com/android/dialer/calllog/ui/res/values/colors.xml index 002aaf959..27a821e10 100644 --- a/java/com/android/dialer/calllog/ui/res/values/colors.xml +++ b/java/com/android/dialer/calllog/ui/res/values/colors.xml @@ -16,11 +16,10 @@ --> <resources> + <!-- TODO(a bug): remove these? --> <color name="feature_icon_read_color">#9E9E9E</color> <color name="feature_icon_unread_color">#474747</color> <color name="call_type_icon_read_color">#757575</color> <color name="call_type_icon_unread_color">#D32F2F</color> - - <color name="empty_call_log_icon_tint_color">#E1E1E1</color> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/calllog/ui/res/values/strings.xml b/java/com/android/dialer/calllog/ui/res/values/strings.xml index 3888eb90d..112044f6e 100644 --- a/java/com/android/dialer/calllog/ui/res/values/strings.xml +++ b/java/com/android/dialer/calllog/ui/res/values/strings.xml @@ -16,12 +16,21 @@ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- - A string to describe available action for accessibility user. - It will be read as "expand menu for this call log entry". + A string informing a11y users that activating a call log entry will place a call. + Note: the word "call" here is a verb. + [CHAR LIMIT=NONE] --> - <string name="a11y_new_call_log_expand_menu_for_entry"> - Expand menu for this call log entry + <string name="a11y_new_call_log_entry_tap_action">call</string> + + <!-- + A string describing the menu button of a call log entry for a11y users. + An example will be read as "expand call log menu for Jane Smith". + [CHAR LIMIT=NONE] + --> + <string name="a11y_new_call_log_entry_expand_menu"> + Expand call log menu for <xliff:g example="Jane Smith" id="primaryTextForEntry">%1$s</xliff:g> </string> <!-- Header in call log to group calls from the current day. [CHAR LIMIT=30] --> @@ -32,6 +41,7 @@ <!-- Header in call log to group calls from before yesterday. [CHAR LIMIT=30] --> <string name="new_call_log_header_older">Older</string> + <!-- Shown as a prompt to turn on the phone permission to enable the call log [CHAR LIMIT=NONE]--> <string name="new_call_log_permission_no_calllog">To see your call log, turn on the Phone permission.</string> diff --git a/java/com/android/dialer/calllog/ui/res/values/styles.xml b/java/com/android/dialer/calllog/ui/res/values/styles.xml index 047f1dace..3a02eb23f 100644 --- a/java/com/android/dialer/calllog/ui/res/values/styles.xml +++ b/java/com/android/dialer/calllog/ui/res/values/styles.xml @@ -16,32 +16,19 @@ --> <resources> - <style name="primary_textview"> - <item name="android:textColor">@color/primary_text_color</item> - <item name="android:fontFamily">sans-serif</item> - </style> + <style name="primary_textview" parent="Dialer.TextAppearance.Primary"/> - <style name="primary_textview_unread_call"> - <item name="android:textColor">@color/primary_text_color</item> - <item name="android:fontFamily">sans-serif-medium</item> - </style> + <style name="primary_textview_unread_call" parent="Dialer.TextAppearance.Header2"/> - <style name="secondary_textview"> - <item name="android:textColor">@color/secondary_text_color</item> - <item name="android:fontFamily">sans-serif</item> - </style> + <style name="secondary_textview" parent="Dialer.TextAppearance.Secondary"/> - <style name="phoneaccount_textview"> - <item name="android:fontFamily">sans-serif</item> - </style> + <style name="phoneaccount_textview"/> - <style name="secondary_textview_unread_call"> - <item name="android:textColor">@color/missed_call</item> - <item name="android:fontFamily">sans-serif-medium</item> + <style name="secondary_textview_unread_call" parent="Dialer.TextAppearance.Header2"> + <item name="android:textColor">@color/dialer_red</item> </style> <style name="phoneaccount_textview_unread_call"> <item name="android:fontFamily">sans-serif-medium</item> </style> - </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/calllogutils/CallLogDates.java b/java/com/android/dialer/calllogutils/CallLogDates.java index 2c332901c..9c04c05f7 100644 --- a/java/com/android/dialer/calllogutils/CallLogDates.java +++ b/java/com/android/dialer/calllogutils/CallLogDates.java @@ -36,13 +36,16 @@ public final class CallLogDates { * if < 1 minute ago: "Just now"; * else if < 1 hour ago: time relative to now (e.g., "8 min ago"); * else if today: time (e.g., "12:15 PM"); - * else if < 7 days: abbreviated day of week (e.g., "Wed"); - * else if < 1 year: date with abbreviated month, day, but no year (e.g., "Jan 15"); - * else: date with abbreviated month, day, and year (e.g., "Jan 15, 2018"). + * else if < 7 days: day of week (e.g., "Wed"); + * else if < 1 year: date with month, day, but no year (e.g., "Jan 15"); + * else: date with month, day, and year (e.g., "Jan 15, 2018"). * </pre> + * + * <p>Callers can decide whether to abbreviate date/time by specifying flag {@code + * abbreviateDateTime}. */ public static CharSequence newCallLogTimestampLabel( - Context context, long nowMillis, long timestampMillis) { + Context context, long nowMillis, long timestampMillis, boolean abbreviateDateTime) { // For calls logged less than 1 minute ago, display "Just now". if (nowMillis - timestampMillis < TimeUnit.MINUTES.toMillis(1)) { return context.getString(R.string.just_now); @@ -50,16 +53,19 @@ public final class CallLogDates { // For calls logged less than 1 hour ago, display time relative to now (e.g., "8 min ago"). if (nowMillis - timestampMillis < TimeUnit.HOURS.toMillis(1)) { - return DateUtils.getRelativeTimeSpanString( - timestampMillis, - nowMillis, - DateUtils.MINUTE_IN_MILLIS, - DateUtils.FORMAT_ABBREV_RELATIVE) - .toString() - // The platform method DateUtils#getRelativeTimeSpanString adds a dot ('.') after the - // abbreviated time unit for some languages (e.g., "8 min. ago") but we prefer not to have - // the dot. - .replace(".", ""); + return abbreviateDateTime + ? DateUtils.getRelativeTimeSpanString( + timestampMillis, + nowMillis, + DateUtils.MINUTE_IN_MILLIS, + DateUtils.FORMAT_ABBREV_RELATIVE) + .toString() + // The platform method DateUtils#getRelativeTimeSpanString adds a dot ('.') after the + // abbreviated time unit for some languages (e.g., "8 min. ago") but we prefer not to + // have the dot. + .replace(".", "") + : DateUtils.getRelativeTimeSpanString( + timestampMillis, nowMillis, DateUtils.MINUTE_IN_MILLIS); } int dayDifference = getDayDifference(nowMillis, timestampMillis); @@ -69,19 +75,19 @@ public final class CallLogDates { return DateUtils.formatDateTime(context, timestampMillis, DateUtils.FORMAT_SHOW_TIME); } - // For calls logged within a week, display the abbreviated day of week (e.g., "Wed"). + // For calls logged within a week, display the day of week (e.g., "Wed"). if (dayDifference < 7) { - return formatDayOfWeek(context, timestampMillis); + return formatDayOfWeek(context, timestampMillis, abbreviateDateTime); } - // For calls logged within a year, display abbreviated month, day, but no year (e.g., "Jan 15"). + // For calls logged within a year, display month, day, but no year (e.g., "Jan 15"). if (isWithinOneYear(nowMillis, timestampMillis)) { - return formatAbbreviatedDate(context, timestampMillis, /* showYear = */ false); + return formatDate(context, timestampMillis, /* showYear = */ false, abbreviateDateTime); } - // For calls logged no less than one year ago, display abbreviated month, day, and year + // For calls logged no less than one year ago, display month, day, and year // (e.g., "Jan 15, 2018"). - return formatAbbreviatedDate(context, timestampMillis, /* showYear = */ true); + return formatDate(context, timestampMillis, /* showYear = */ true, abbreviateDateTime); } /** @@ -106,36 +112,41 @@ public final class CallLogDates { } /** - * Formats the provided timestamp (in milliseconds) into abbreviated day of week. + * Formats the provided timestamp (in milliseconds) into the month, day, and optionally, year. * - * <p>For example, returns a string like "Wed" or "Chor". + * <p>For example, returns a string like "Jan 15" or "Jan 15, 2018". * * <p>For pre-N devices, the returned value may not start with a capital if the local convention * is to not capitalize day names. On N+ devices, the returned value is always capitalized. */ - private static CharSequence formatDayOfWeek(Context context, long timestamp) { - return toTitleCase( - DateUtils.formatDateTime( - context, timestamp, DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_ABBREV_WEEKDAY)); + private static CharSequence formatDate( + Context context, long timestamp, boolean showYear, boolean abbreviateDateTime) { + int formatFlags = 0; + if (abbreviateDateTime) { + formatFlags |= DateUtils.FORMAT_ABBREV_MONTH; + } + if (!showYear) { + formatFlags |= DateUtils.FORMAT_NO_YEAR; + } + + return toTitleCase(DateUtils.formatDateTime(context, timestamp, formatFlags)); } /** - * Formats the provided timestamp (in milliseconds) into the month abbreviation, day, and - * optionally, year. + * Formats the provided timestamp (in milliseconds) into day of week. * - * <p>For example, returns a string like "Jan 15" or "Jan 15, 2018". + * <p>For example, returns a string like "Wed" or "Chor". * * <p>For pre-N devices, the returned value may not start with a capital if the local convention * is to not capitalize day names. On N+ devices, the returned value is always capitalized. */ - private static CharSequence formatAbbreviatedDate( - Context context, long timestamp, boolean showYear) { - int flags = DateUtils.FORMAT_ABBREV_MONTH; - if (!showYear) { - flags |= DateUtils.FORMAT_NO_YEAR; - } - - return toTitleCase(DateUtils.formatDateTime(context, timestamp, flags)); + private static CharSequence formatDayOfWeek( + Context context, long timestamp, boolean abbreviateDateTime) { + int formatFlags = + abbreviateDateTime + ? (DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_ABBREV_WEEKDAY) + : DateUtils.FORMAT_SHOW_WEEKDAY; + return toTitleCase(DateUtils.formatDateTime(context, timestamp, formatFlags)); } private static CharSequence toTitleCase(CharSequence value) { diff --git a/java/com/android/dialer/calllogutils/CallLogEntryDescriptions.java b/java/com/android/dialer/calllogutils/CallLogEntryDescriptions.java new file mode 100644 index 000000000..244087989 --- /dev/null +++ b/java/com/android/dialer/calllogutils/CallLogEntryDescriptions.java @@ -0,0 +1,154 @@ +/* + * 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. + */ + +package com.android.dialer.calllogutils; + +import android.content.Context; +import android.provider.CallLog.Calls; +import android.support.annotation.PluralsRes; +import android.telecom.PhoneAccountHandle; +import android.text.TextUtils; +import com.android.dialer.calllog.model.CoalescedRow; +import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.time.Clock; +import com.google.common.collect.Collections2; +import java.util.List; + +/** Builds descriptions of call log entries for accessibility users. */ +public final class CallLogEntryDescriptions { + + private CallLogEntryDescriptions() {} + + /** + * Builds the content description for a call log entry. + * + * <p>The description is of format<br> + * {primary description}, {secondary description}, {phone account description}. + * + * <ul> + * <li>The primary description depends on the number of calls in the entry. For example:<br> + * "1 answered call from Jane Smith", or<br> + * "2 calls, the latest is an answered call from Jane Smith". + * <li>The secondary description is the same as the secondary text for the call log entry, + * except that date/time is not abbreviated. For example:<br> + * "mobile, 11 minutes ago". + * <li>The phone account description is of format "on {phone_account_label}, via {number}". For + * example:<br> + * "on SIM 1, via 6502531234".<br> + * Note that the phone account description will be empty if the device has only one SIM. + * </ul> + * + * <p>An example of the full description can be:<br> + * "2 calls, the latest is an answered call from Jane Smith, mobile, 11 minutes ago, on SIM 1, via + * 6502531234". + */ + public static CharSequence buildDescriptionForEntry( + Context context, Clock clock, CoalescedRow row) { + + // Build the primary description. + // Examples: + // (1) For an entry containing only 1 call: + // "1 missed call from James Smith". + // (2) For entries containing multiple calls: + // "2 calls, the latest is a missed call from Jame Smith". + CharSequence primaryDescription = + context + .getResources() + .getQuantityString( + getPrimaryDescriptionResIdForCallType(row), + row.getCoalescedIds().getCoalescedIdCount(), + row.getCoalescedIds().getCoalescedIdCount(), + CallLogEntryText.buildPrimaryText(context, row)); + + // Build the secondary description. + // An example: "mobile, 11 minutes ago". + CharSequence secondaryDescription = + joinSecondaryTextComponents( + CallLogEntryText.buildSecondaryTextListForEntries( + context, clock, row, /* abbreviateDateTime = */ false)); + + // Build the phone account description. + // Note that this description can be an empty string. + CharSequence phoneAccountDescription = buildPhoneAccountDescription(context, row); + + return TextUtils.isEmpty(phoneAccountDescription) + ? context + .getResources() + .getString( + R.string.a11y_new_call_log_entry_full_description_without_phone_account_info, + primaryDescription, + secondaryDescription) + : context + .getResources() + .getString( + R.string.a11y_new_call_log_entry_full_description_with_phone_account_info, + primaryDescription, + secondaryDescription, + phoneAccountDescription); + } + + private static @PluralsRes int getPrimaryDescriptionResIdForCallType(CoalescedRow row) { + switch (row.getCallType()) { + case Calls.INCOMING_TYPE: + case Calls.ANSWERED_EXTERNALLY_TYPE: + return R.plurals.a11y_new_call_log_entry_answered_call; + case Calls.OUTGOING_TYPE: + return R.plurals.a11y_new_call_log_entry_outgoing_call; + case Calls.MISSED_TYPE: + return R.plurals.a11y_new_call_log_entry_missed_call; + case Calls.VOICEMAIL_TYPE: + throw new IllegalStateException("Voicemails not expected in call log"); + case Calls.BLOCKED_TYPE: + return R.plurals.a11y_new_call_log_entry_blocked_call; + default: + // It is possible for users to end up with calls with unknown call types in their + // call history, possibly due to 3rd party call log implementations (e.g. to + // distinguish between rejected and missed calls). Instead of crashing, just + // assume that all unknown call types are missed calls. + return R.plurals.a11y_new_call_log_entry_missed_call; + } + } + + private static CharSequence buildPhoneAccountDescription(Context context, CoalescedRow row) { + PhoneAccountHandle phoneAccountHandle = + TelecomUtil.composePhoneAccountHandle( + row.getPhoneAccountComponentName(), row.getPhoneAccountId()); + if (phoneAccountHandle == null) { + return ""; + } + + String phoneAccountLabel = PhoneAccountUtils.getAccountLabel(context, phoneAccountHandle); + if (TextUtils.isEmpty(phoneAccountLabel)) { + return ""; + } + + if (TextUtils.isEmpty(row.getNumber().getNormalizedNumber())) { + return ""; + } + + return context + .getResources() + .getString( + R.string.a11y_new_call_log_entry_phone_account, + phoneAccountLabel, + row.getNumber().getNormalizedNumber()); + } + + private static CharSequence joinSecondaryTextComponents(List<CharSequence> components) { + return TextUtils.join( + ", ", Collections2.filter(components, (text) -> !TextUtils.isEmpty(text))); + } +} diff --git a/java/com/android/dialer/calllogutils/CallLogEntryText.java b/java/com/android/dialer/calllogutils/CallLogEntryText.java index acf8ef932..895497f0f 100644 --- a/java/com/android/dialer/calllogutils/CallLogEntryText.java +++ b/java/com/android/dialer/calllogutils/CallLogEntryText.java @@ -26,6 +26,7 @@ import com.android.dialer.time.Clock; import com.google.common.base.Optional; import com.google.common.collect.Collections2; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -76,45 +77,69 @@ public final class CallLogEntryText { } /** - * The secondary text to show in the main call log entry list. + * The secondary text to be shown in the main call log entry list. + * + * <p>This method first obtains a list of strings to be shown in order and then concatenates them + * with " • ". + * + * <p>Examples: + * + * <ul> + * <li>Mobile, Duo video • 10 min ago + * <li>Spam • Mobile • Now + * <li>Blocked • Spam • Mobile • Now + * </ul> + * + * @see #buildSecondaryTextListForEntries(Context, Clock, CoalescedRow, boolean) for details. + */ + public static CharSequence buildSecondaryTextForEntries( + Context context, Clock clock, CoalescedRow row) { + return joinSecondaryTextComponents( + buildSecondaryTextListForEntries(context, clock, row, /* abbreviateDateTime = */ true)); + } + + /** + * Returns a list of strings to be shown in order as the main call log entry's secondary text. * * <p>Rules: * * <ul> - * <li>An emergency number: Date + * <li>An emergency number: [{Date}] * <li>Number - not blocked, call - not spam: - * <p>$Label(, Duo video|Carrier video)?|$Location • Date + * <p>[{$Label(, Duo video|Carrier video)?|$Location}, {Date}] * <li>Number - blocked, call - not spam: - * <p>Blocked • $Label(, Duo video|Carrier video)?|$Location • Date + * <p>["Blocked", {$Label(, Duo video|Carrier video)?|$Location}, {Date}] * <li>Number - not blocked, call - spam: - * <p>Spam • $Label(, Duo video|Carrier video)? • Date + * <p>["Spam", {$Label(, Duo video|Carrier video)?}, {Date}] * <li>Number - blocked, call - spam: - * <p>Blocked • Spam • $Label(, Duo video|Carrier video)? • Date + * <p>["Blocked, Spam", {$Label(, Duo video|Carrier video)?}, {Date}] * </ul> * * <p>Examples: * * <ul> - * <li>Mobile, Duo video • Now - * <li>Duo video • 10 min ago - * <li>Mobile • 11:45 PM - * <li>Mobile • Sun - * <li>Blocked • Mobile, Duo video • Now - * <li>Blocked • Brooklyn, NJ • 10 min ago - * <li>Spam • Mobile • Now - * <li>Spam • Now - * <li>Blocked • Spam • Mobile • Now - * <li>Brooklyn, NJ • Jan 15 + * <li>["Mobile, Duo video", "Now"] + * <li>["Duo video", "10 min ago"] + * <li>["Mobile", "11:45 PM"] + * <li>["Mobile", "Sun"] + * <li>["Blocked", "Mobile, Duo video", "Now"] + * <li>["Blocked", "Brooklyn, NJ", "10 min ago"] + * <li>["Spam", "Mobile", "Now"] + * <li>["Spam", "Now"] + * <li>["Blocked", "Spam", "Mobile", "Now"] + * <li>["Brooklyn, NJ", "Jan 15"] * </ul> * - * <p>See {@link CallLogDates#newCallLogTimestampLabel(Context, long, long)} for date rules. + * <p>See {@link CallLogDates#newCallLogTimestampLabel(Context, long, long, boolean)} for date + * rules. */ - public static CharSequence buildSecondaryTextForEntries( - Context context, Clock clock, CoalescedRow row) { + static List<CharSequence> buildSecondaryTextListForEntries( + Context context, Clock clock, CoalescedRow row, boolean abbreviateDateTime) { // For emergency numbers, the secondary text should contain only the timestamp. if (row.getNumberAttributes().getIsEmergencyNumber()) { - return CallLogDates.newCallLogTimestampLabel( - context, clock.currentTimeMillis(), row.getTimestamp()); + return Collections.singletonList( + CallLogDates.newCallLogTimestampLabel( + context, clock.currentTimeMillis(), row.getTimestamp(), abbreviateDateTime)); } List<CharSequence> components = new ArrayList<>(); @@ -130,8 +155,8 @@ public final class CallLogEntryText { components.add( CallLogDates.newCallLogTimestampLabel( - context, clock.currentTimeMillis(), row.getTimestamp())); - return joinSecondaryTextComponents(components); + context, clock.currentTimeMillis(), row.getTimestamp(), abbreviateDateTime)); + return components; } /** diff --git a/java/com/android/dialer/calllogutils/CallTypeHelper.java b/java/com/android/dialer/calllogutils/CallTypeHelper.java index 6feaeb998..1bcaa317b 100644 --- a/java/com/android/dialer/calllogutils/CallTypeHelper.java +++ b/java/com/android/dialer/calllogutils/CallTypeHelper.java @@ -17,7 +17,7 @@ package com.android.dialer.calllogutils; import android.content.res.Resources; -import com.android.dialer.compat.AppCompatConstants; +import android.provider.CallLog.Calls; import com.android.dialer.duo.Duo; /** Helper class to perform operations related to call types. */ @@ -87,17 +87,17 @@ public class CallTypeHelper { } public static boolean isMissedCallType(int callType) { - return (callType != AppCompatConstants.CALLS_INCOMING_TYPE - && callType != AppCompatConstants.CALLS_OUTGOING_TYPE - && callType != AppCompatConstants.CALLS_VOICEMAIL_TYPE - && callType != AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE); + return (callType != Calls.INCOMING_TYPE + && callType != Calls.OUTGOING_TYPE + && callType != Calls.VOICEMAIL_TYPE + && callType != Calls.ANSWERED_EXTERNALLY_TYPE); } /** Returns the text used to represent the given call type. */ public CharSequence getCallTypeText( int callType, boolean isVideoCall, boolean isPulledCall, boolean isDuoCall) { switch (callType) { - case AppCompatConstants.CALLS_INCOMING_TYPE: + case Calls.INCOMING_TYPE: if (isVideoCall) { if (isPulledCall) { return incomingVideoPulledName; @@ -115,7 +115,7 @@ public class CallTypeHelper { } } - case AppCompatConstants.CALLS_OUTGOING_TYPE: + case Calls.OUTGOING_TYPE: if (isVideoCall) { if (isPulledCall) { return outgoingVideoPulledName; @@ -133,23 +133,23 @@ public class CallTypeHelper { } } - case AppCompatConstants.CALLS_MISSED_TYPE: + case Calls.MISSED_TYPE: if (isVideoCall) { return missedVideoName; } else { return missedName; } - case AppCompatConstants.CALLS_VOICEMAIL_TYPE: + case Calls.VOICEMAIL_TYPE: return voicemailName; - case AppCompatConstants.CALLS_REJECTED_TYPE: + case Calls.REJECTED_TYPE: return rejectedName; - case AppCompatConstants.CALLS_BLOCKED_TYPE: + case Calls.BLOCKED_TYPE: return blockedName; - case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE: + case Calls.ANSWERED_EXTERNALLY_TYPE: return answeredElsewhereName; default: diff --git a/java/com/android/dialer/calllogutils/CallTypeIconsView.java b/java/com/android/dialer/calllogutils/CallTypeIconsView.java index 30d9b6178..19c30c575 100644 --- a/java/com/android/dialer/calllogutils/CallTypeIconsView.java +++ b/java/com/android/dialer/calllogutils/CallTypeIconsView.java @@ -23,11 +23,12 @@ import android.graphics.Canvas; import android.graphics.PorterDuff; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.provider.CallLog.Calls; import android.support.annotation.VisibleForTesting; import android.util.AttributeSet; import android.view.View; -import com.android.dialer.compat.AppCompatConstants; -import com.android.dialer.theme.ThemeUtil; +import com.android.dialer.theme.base.Theme; +import com.android.dialer.theme.base.ThemeComponent; import java.util.ArrayList; import java.util.List; @@ -167,16 +168,16 @@ public class CallTypeIconsView extends View { private Drawable getCallTypeDrawable(int callType) { Resources resources = useLargeIcons ? largeResouces : CallTypeIconsView.resources; switch (callType) { - case AppCompatConstants.CALLS_INCOMING_TYPE: - case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE: + case Calls.INCOMING_TYPE: + case Calls.ANSWERED_EXTERNALLY_TYPE: return resources.incoming; - case AppCompatConstants.CALLS_OUTGOING_TYPE: + case Calls.OUTGOING_TYPE: return resources.outgoing; - case AppCompatConstants.CALLS_MISSED_TYPE: + case Calls.MISSED_TYPE: return resources.missed; - case AppCompatConstants.CALLS_VOICEMAIL_TYPE: + case Calls.VOICEMAIL_TYPE: return resources.voicemail; - case AppCompatConstants.CALLS_BLOCKED_TYPE: + case Calls.BLOCKED_TYPE: return resources.blocked; default: // It is possible for users to end up with calls with unknown call types in their @@ -289,55 +290,56 @@ public class CallTypeIconsView extends View { int iconId = R.drawable.quantum_ic_call_received_white_24; Drawable drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); incoming = drawable.mutate(); - incoming.setColorFilter(r.getColor(R.color.answered_call), PorterDuff.Mode.MULTIPLY); + incoming.setColorFilter(r.getColor(R.color.dialer_call_green), PorterDuff.Mode.MULTIPLY); // Create a rotated instance of the call arrow for outgoing calls. iconId = R.drawable.quantum_ic_call_made_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); outgoing = drawable.mutate(); - outgoing.setColorFilter(r.getColor(R.color.answered_call), PorterDuff.Mode.MULTIPLY); + outgoing.setColorFilter(r.getColor(R.color.dialer_call_green), PorterDuff.Mode.MULTIPLY); // Need to make a copy of the arrow drawable, otherwise the same instance colored // above will be recolored here. iconId = R.drawable.quantum_ic_call_missed_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); missed = drawable.mutate(); - missed.setColorFilter(r.getColor(R.color.missed_call), PorterDuff.Mode.MULTIPLY); + missed.setColorFilter(r.getColor(R.color.dialer_red), PorterDuff.Mode.MULTIPLY); + Theme theme = ThemeComponent.get(context).theme(); iconId = R.drawable.quantum_ic_voicemail_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); voicemail = drawable.mutate(); - voicemail.setColorFilter(ThemeUtil.getColorIcon(), PorterDuff.Mode.MULTIPLY); + voicemail.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_block_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); blocked = drawable.mutate(); - blocked.setColorFilter(ThemeUtil.getColorIcon(), PorterDuff.Mode.MULTIPLY); + blocked.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_videocam_vd_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); videoCall = drawable.mutate(); - videoCall.setColorFilter(ThemeUtil.getColorIcon(), PorterDuff.Mode.MULTIPLY); + videoCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_hd_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); hdCall = drawable.mutate(); - hdCall.setColorFilter(ThemeUtil.getColorIcon(), PorterDuff.Mode.MULTIPLY); + hdCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_signal_wifi_4_bar_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); wifiCall = drawable.mutate(); - wifiCall.setColorFilter(ThemeUtil.getColorIcon(), PorterDuff.Mode.MULTIPLY); + wifiCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_language_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); assistedDialedCall = drawable.mutate(); - assistedDialedCall.setColorFilter(ThemeUtil.getColorIcon(), PorterDuff.Mode.MULTIPLY); + assistedDialedCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_rtt_vd_theme_24; drawable = largeIcons ? r.getDrawable(iconId, null) : getScaledBitmap(context, iconId); rttCall = drawable.mutate(); - rttCall.setColorFilter(ThemeUtil.getColorIcon(), PorterDuff.Mode.MULTIPLY); + rttCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); iconMargin = largeIcons ? 0 : r.getDimensionPixelSize(R.dimen.call_log_icon_margin); } diff --git a/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java b/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java index 0677c9114..2e2e4abcb 100644 --- a/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java +++ b/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java @@ -16,6 +16,7 @@ package com.android.dialer.calllogutils; +import android.content.Context; import android.provider.CallLog.Calls; import android.support.v4.os.BuildCompat; import com.android.dialer.NumberAttributes; @@ -28,8 +29,9 @@ import com.android.dialer.voicemail.model.VoicemailEntry; public final class PhotoInfoBuilder { /** Returns a {@link PhotoInfo.Builder} with info from {@link CoalescedRow}. */ - public static PhotoInfo.Builder fromCoalescedRow(CoalescedRow coalescedRow) { + public static PhotoInfo.Builder fromCoalescedRow(Context context, CoalescedRow coalescedRow) { return fromNumberAttributes(coalescedRow.getNumberAttributes()) + .setName(CallLogEntryText.buildPrimaryText(context, coalescedRow).toString()) .setFormattedNumber(coalescedRow.getFormattedNumber()) .setIsVoicemail(coalescedRow.getIsVoicemailCall()) .setIsSpam( diff --git a/java/com/android/dialer/calllogutils/res/values/colors.xml b/java/com/android/dialer/calllogutils/res/values/colors.xml index 8662163c1..3a9e3ae8a 100644 --- a/java/com/android/dialer/calllogutils/res/values/colors.xml +++ b/java/com/android/dialer/calllogutils/res/values/colors.xml @@ -15,8 +15,4 @@ ~ limitations under the License --> <resources> - <!-- Color for missed call icons. --> - <color name="missed_call">#C53929</color> - <!-- Color for answered or outgoing call icons. --> - <color name="answered_call">#00c853</color> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/calllogutils/res/values/strings.xml b/java/com/android/dialer/calllogutils/res/values/strings.xml index e476bdd6c..52b6d3408 100644 --- a/java/com/android/dialer/calllogutils/res/values/strings.xml +++ b/java/com/android/dialer/calllogutils/res/values/strings.xml @@ -145,4 +145,67 @@ <!-- String used to display calls from spam numbers in the call log. [CHAR LIMIT=30] --> <string name="new_call_log_secondary_spam">Spam</string> + + <!-- + String introducing to a11y users a call log entry in which the latest call is a missed call. + [CHAR LIMIT=NONE] + --> + <plurals name="a11y_new_call_log_entry_missed_call"> + <item quantity="one"><xliff:g example="1" id="count">%1$d</xliff:g> missed call from <xliff:g example="Jane Smith" id="primaryInfoForEntry">%2$s</xliff:g></item> + <item quantity="other"><xliff:g example="2" id="count">%1$d</xliff:g> calls, the latest is a missed call from <xliff:g example="Jane Smith" id="primaryInfoForEntry">%2$s</xliff:g></item> + </plurals> + + <!-- + String introducing to a11y users a call log entry in which the latest call is an answered call. + [CHAR LIMIT=NONE] + --> + <plurals name="a11y_new_call_log_entry_answered_call"> + <item quantity="one"><xliff:g example="1" id="count">%1$d</xliff:g> answered call from <xliff:g example="Jane Smith" id="primaryInfoForEntry">%2$s</xliff:g></item> + <item quantity="other"><xliff:g example="2" id="count">%1$d</xliff:g> calls, the latest is an answered call from <xliff:g example="Jane Smith" id="primaryInfoForEntry">%2$s</xliff:g></item> + </plurals> + + <!-- + String introducing to a11y users a call log entry in which the latest call is an outgoing call. + [CHAR LIMIT=NONE] + --> + <plurals name="a11y_new_call_log_entry_outgoing_call"> + <item quantity="one"><xliff:g example="1" id="count">%1$d</xliff:g> outgoing call to <xliff:g example="Jane Smith" id="primaryInfoForEntry">%2$s</xliff:g></item> + <item quantity="other"><xliff:g example="2" id="count">%1$d</xliff:g> calls, the latest is an outgoing call to <xliff:g example="Jane Smith" id="primaryInfoForEntry">%2$s</xliff:g></item> + </plurals> + + <!-- + String introducing to a11y users a call log entry in which the latest call is a blocked call. + [CHAR LIMIT=NONE] + --> + <plurals name="a11y_new_call_log_entry_blocked_call"> + <item quantity="one"><xliff:g example="1" id="count">%1$d</xliff:g> blocked call from <xliff:g example="Jane Smith" id="primaryInfoForEntry">%2$s</xliff:g></item> + <item quantity="other"><xliff:g example="2" id="count">%1$d</xliff:g> calls, the latest is a blocked call from <xliff:g example="Jane Smith" id="primaryInfoForEntry">%2$s</xliff:g></item> + </plurals> + + + <!-- + String describing to a11y users the phone account used to make/receive the latest call in a call + log entry. + [CHAR LIMIT=NONE] + --> + <string name="a11y_new_call_log_entry_phone_account"> + on <xliff:g example="SIM 1" id="phoneAccount">%1$s</xliff:g>, + via <xliff:g example="(555) 555-5555" id="number">%2$s</xliff:g> + </string> + + <!-- + String template describing to a11y users a call log entry without phone account info. + [CHAR LIMIT=NONE] + --> + <string name="a11y_new_call_log_entry_full_description_without_phone_account_info"> + <xliff:g example="A missed call from Jane Smith" id="primaryDescriptionForEntry">%1$s</xliff:g>, <xliff:g example="mobile, 30 minutes ago" id="secondaryDescriptionForEntry">%2$s</xliff:g>. + </string> + + <!-- + String template describing to a11y users a call log entry with phone account info. + [CHAR LIMIT=NONE] + --> + <string name="a11y_new_call_log_entry_full_description_with_phone_account_info"> + <xliff:g example="A missed call from Jane Smith" id="primaryDescriptionForEntry">%1$s</xliff:g>, <xliff:g example="mobile, 30 minutes ago" id="secondaryDescriptionForEntry">%2$s</xliff:g>, <xliff:g example="on SIM 1, via (555) 555-5555">%3$s</xliff:g>. + </string> </resources> diff --git a/java/com/android/dialer/compat/AppCompatConstants.java b/java/com/android/dialer/compat/AppCompatConstants.java deleted file mode 100644 index 4a51d3f9e..000000000 --- a/java/com/android/dialer/compat/AppCompatConstants.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -package com.android.dialer.compat; - -import android.provider.CallLog.Calls; - -public final class AppCompatConstants { - - public static final int CALLS_INCOMING_TYPE = Calls.INCOMING_TYPE; - public static final int CALLS_OUTGOING_TYPE = Calls.OUTGOING_TYPE; - public static final int CALLS_MISSED_TYPE = Calls.MISSED_TYPE; - public static final int CALLS_VOICEMAIL_TYPE = Calls.VOICEMAIL_TYPE; - // Added to android.provider.CallLog.Calls in N+. - public static final int CALLS_REJECTED_TYPE = 5; - // Added to android.provider.CallLog.Calls in N+. - public static final int CALLS_BLOCKED_TYPE = 6; - // Added to android.provider.CallLog.Calls in N+. - public static final int CALLS_ANSWERED_EXTERNALLY_TYPE = Calls.ANSWERED_EXTERNALLY_TYPE; -} diff --git a/java/com/android/dialer/contactsfragment/res/drawable/fast_scroller_scroll_bar.xml b/java/com/android/dialer/contactsfragment/res/drawable/fast_scroller_scroll_bar.xml index 4683616e8..b4bc00a0d 100644 --- a/java/com/android/dialer/contactsfragment/res/drawable/fast_scroller_scroll_bar.xml +++ b/java/com/android/dialer/contactsfragment/res/drawable/fast_scroller_scroll_bar.xml @@ -24,7 +24,7 @@ </item> <item> <shape android:shape="rectangle"> - <solid android:color="@color/dialer_secondary_text_color"/> + <solid android:color="?android:attr/textColorSecondary"/> <size android:height="32dp" android:width="4dp"/> <corners android:radius="2dp"/> </shape> diff --git a/java/com/android/dialer/contactsfragment/res/layout/add_contact_row.xml b/java/com/android/dialer/contactsfragment/res/layout/add_contact_row.xml index bc5f712f0..be4ee0853 100644 --- a/java/com/android/dialer/contactsfragment/res/layout/add_contact_row.xml +++ b/java/com/android/dialer/contactsfragment/res/layout/add_contact_row.xml @@ -44,7 +44,6 @@ android:paddingStart="@dimen/text_padding_start" android:paddingEnd="@dimen/text_padding_end" android:gravity="center_vertical" - android:fontFamily="sans-serif" android:text="@string/all_contacts_empty_add_contact_action" style="@style/Dialer.TextAppearance.Primary"/> </LinearLayout> diff --git a/java/com/android/dialer/contactsfragment/res/layout/contact_row.xml b/java/com/android/dialer/contactsfragment/res/layout/contact_row.xml index b65a8c87f..3309ab474 100644 --- a/java/com/android/dialer/contactsfragment/res/layout/contact_row.xml +++ b/java/com/android/dialer/contactsfragment/res/layout/contact_row.xml @@ -51,7 +51,7 @@ android:ellipsize="end" android:gravity="center_vertical" android:textSize="@dimen/text_size" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:fontFamily="sans-serif"/> </LinearLayout> </FrameLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/contactsfragment/res/layout/fragment_contacts.xml b/java/com/android/dialer/contactsfragment/res/layout/fragment_contacts.xml index 8d04fe512..fa17bf9e7 100644 --- a/java/com/android/dialer/contactsfragment/res/layout/fragment_contacts.xml +++ b/java/com/android/dialer/contactsfragment/res/layout/fragment_contacts.xml @@ -23,7 +23,7 @@ android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:attr/colorBackgroundFloating" + android:background="?android:attr/colorBackground" android:paddingBottom="@dimen/floating_action_button_list_bottom_padding" android:clipToPadding="false"/> @@ -45,7 +45,7 @@ android:layout_toLeftOf="@+id/fast_scroller_scroll_bar" android:gravity="center" android:textSize="48sp" - android:textColor="?android:attr/colorBackground" + android:textColor="?android:attr/textColorPrimaryInverse" android:visibility="gone" android:background="@drawable/fast_scroller_container_background"/> diff --git a/java/com/android/dialer/contactsfragment/res/layout/header.xml b/java/com/android/dialer/contactsfragment/res/layout/header.xml index e75c7dc5a..c0ba9d7f1 100644 --- a/java/com/android/dialer/contactsfragment/res/layout/header.xml +++ b/java/com/android/dialer/contactsfragment/res/layout/header.xml @@ -21,6 +21,5 @@ android:layout_height="@dimen/row_height" android:textColor="?android:attr/colorPrimary" android:gravity="center" - android:textSize="@dimen/text_size" android:textStyle="bold" - android:fontFamily="sans-serif-medium"/>
\ No newline at end of file + style="@style/Dialer.TextAppearance.Header2"/>
\ No newline at end of file diff --git a/java/com/android/dialer/database/CallLogQueryHandler.java b/java/com/android/dialer/database/CallLogQueryHandler.java index a18023c4b..de4329ddd 100644 --- a/java/com/android/dialer/database/CallLogQueryHandler.java +++ b/java/com/android/dialer/database/CallLogQueryHandler.java @@ -34,7 +34,6 @@ import android.provider.VoicemailContract.Status; import android.provider.VoicemailContract.Voicemails; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; import com.android.dialer.common.LogUtil; -import com.android.dialer.compat.AppCompatConstants; import com.android.dialer.phonenumbercache.CallLogQuery; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.PermissionsUtil; @@ -157,7 +156,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler { // Always hide blocked calls. where.append("(").append(Calls.TYPE).append(" != ?)"); - selectionArgs.add(Integer.toString(AppCompatConstants.CALLS_BLOCKED_TYPE)); + selectionArgs.add(Integer.toString(Calls.BLOCKED_TYPE)); // Ignore voicemails marked as deleted where.append(" AND (").append(Voicemails.DELETED).append(" = 0)"); @@ -171,7 +170,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler { selectionArgs.add(Integer.toString(callType)); } else { where.append(" AND NOT "); - where.append("(" + Calls.TYPE + " = " + AppCompatConstants.CALLS_VOICEMAIL_TYPE + ")"); + where.append("(" + Calls.TYPE + " = " + Calls.VOICEMAIL_TYPE + ")"); } if (newerThan > 0) { diff --git a/java/com/android/dialer/database/DialerDatabaseHelper.java b/java/com/android/dialer/database/DialerDatabaseHelper.java index b172d7039..b61cc3958 100644 --- a/java/com/android/dialer/database/DialerDatabaseHelper.java +++ b/java/com/android/dialer/database/DialerDatabaseHelper.java @@ -966,6 +966,12 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { } /** Iterates the cursor to find top contact suggestions without duplication. */ while ((cursor.moveToNext()) && (counter < MAX_ENTRIES)) { + if (cursor.isNull(columnDataId)) { + LogUtil.i( + "DialerDatabaseHelper.getLooseMatches", + "_id column null. Row was deleted during iteration, skipping"); + continue; + } final long dataID = cursor.getLong(columnDataId); final String displayName = cursor.getString(columnDisplayNamePrimary); final String phoneNumber = cursor.getString(columnNumber); diff --git a/java/com/android/dialer/dialpadview/res/layout-land/dialpad_fragment.xml b/java/com/android/dialer/dialpadview/res/layout-land/dialpad_fragment.xml index 7f82d74fe..66013c64c 100644 --- a/java/com/android/dialer/dialpadview/res/layout-land/dialpad_fragment.xml +++ b/java/com/android/dialer/dialpadview/res/layout-land/dialpad_fragment.xml @@ -76,7 +76,7 @@ android:contentDescription="@string/description_dial_button" android:src="@drawable/quantum_ic_call_white_24" android:visibility="invisible" - app:backgroundTint="@color/dialpad_fab_green" + app:backgroundTint="@color/dialer_call_green" app:elevation="@dimen/floating_action_button_translation_z"/> </RelativeLayout> </LinearLayout> diff --git a/java/com/android/dialer/dialpadview/res/layout/dialpad_fragment.xml b/java/com/android/dialer/dialpadview/res/layout/dialpad_fragment.xml index d3ebeb06c..3497d2ab5 100644 --- a/java/com/android/dialer/dialpadview/res/layout/dialpad_fragment.xml +++ b/java/com/android/dialer/dialpadview/res/layout/dialpad_fragment.xml @@ -66,9 +66,9 @@ android:layout_centerHorizontal="true" android:contentDescription="@string/description_dial_button" android:src="@drawable/quantum_ic_call_vd_theme_24" - android:tint="#ffffff" + android:tint="?colorIconOnUnthemedDarkBackground" android:visibility="invisible" - app:backgroundTint="@color/dialpad_fab_green" - app:colorControlNormal="#ffffff" + app:backgroundTint="@color/dialer_call_green" + app:colorControlNormal="?colorIconOnUnthemedDarkBackground" app:elevation="@dimen/floating_action_button_translation_z"/> </view> diff --git a/java/com/android/dialer/dialpadview/res/layout/dialpad_view_unthemed.xml b/java/com/android/dialer/dialpadview/res/layout/dialpad_view_unthemed.xml index 69d23a9b6..9953fa3b4 100644 --- a/java/com/android/dialer/dialpadview/res/layout/dialpad_view_unthemed.xml +++ b/java/com/android/dialer/dialpadview/res/layout/dialpad_view_unthemed.xml @@ -81,7 +81,7 @@ android:contentDescription="@string/description_dialpad_back" android:gravity="center" android:src="@drawable/quantum_ic_close_white_24" - android:tint="?attr/dialpad_icon_tint" + android:tint="?colorIcon" android:tintMode="src_in" android:visibility="gone"/> @@ -96,7 +96,7 @@ android:contentDescription="@string/description_dialpad_overflow" android:gravity="center" android:src="@drawable/quantum_ic_more_vert_white_24" - android:tint="?attr/dialpad_icon_tint" + android:tint="?colorIcon" android:tintMode="src_in" android:visibility="gone"/> <FrameLayout android:layout_width="0dp" @@ -108,7 +108,7 @@ android:focusable="false" android:gravity="center" android:textSize="14sp" - android:textColor="@color/secondary_text_color" + android:textColor="?colorIcon" android:visibility="gone" /> <com.android.dialer.dialpadview.DigitsEditText @@ -142,7 +142,7 @@ android:contentDescription="@string/description_delete_button" android:src="@drawable/quantum_ic_backspace_white_24" android:state_enabled="false" - android:tint="?attr/dialpad_icon_tint" + android:tint="?colorIcon" android:tintMode="src_in"/> </LinearLayout> diff --git a/java/com/android/dialer/dialpadview/theme/res/values/attr.xml b/java/com/android/dialer/dialpadview/theme/res/values/attr.xml index 99707aa1d..9cd225ad2 100644 --- a/java/com/android/dialer/dialpadview/theme/res/values/attr.xml +++ b/java/com/android/dialer/dialpadview/theme/res/values/attr.xml @@ -32,8 +32,6 @@ <attr format="color" name="dialpad_text_color"/> <attr format="color" name="dialpad_text_color_primary"/> <attr format="color" name="dialpad_text_color_secondary"/> - <attr format="color" name="dialpad_icon_tint"/> - <attr format="color" name="dialpad_voicemail_tint"/> <attr format="color" name="dialpad_background"/> <attr format="dimension" name="dialpad_elevation"/> </declare-styleable> diff --git a/java/com/android/dialer/dialpadview/theme/res/values/styles.xml b/java/com/android/dialer/dialpadview/theme/res/values/styles.xml index 408a33dd1..04ebb1b13 100644 --- a/java/com/android/dialer/dialpadview/theme/res/values/styles.xml +++ b/java/com/android/dialer/dialpadview/theme/res/values/styles.xml @@ -36,16 +36,6 @@ <item name="dialpad_text_color">?android:attr/textColorSecondary</item> <item name="dialpad_text_color_primary">?android:attr/colorPrimary</item> <item name="dialpad_text_color_secondary">?android:attr/textColorSecondary</item> - <item name="dialpad_icon_tint">?colorIcon</item> - <item name="dialpad_voicemail_tint">?colorIcon</item> <item name="dialpad_background">?android:attr/colorBackgroundFloating</item> </style> - - <style name="Dialpad.Dark"> - <item name="dialpad_text_color">@android:color/white</item> - <item name="dialpad_text_color_primary">@android:color/white</item> - <item name="dialpad_text_color_secondary">#ffd4d6d7</item> - <item name="dialpad_icon_tint">@android:color/white</item> - <item name="dialpad_background">#00000000</item> - </style> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml b/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml index e5e5a42e9..35dc531d8 100644 --- a/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml +++ b/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml @@ -19,8 +19,7 @@ <application> <activity android:label="@string/enriched_call_simulator_activity" - android:name="com.android.dialer.enrichedcall.simulator.EnrichedCallSimulatorActivity" - android:theme="@style/Dialer.ThemeBase.NoActionBar"> + android:name="com.android.dialer.enrichedcall.simulator.EnrichedCallSimulatorActivity"> </activity> </application> </manifest> diff --git a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java index 515a3ccbb..eeeae13ae 100644 --- a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java +++ b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java @@ -20,6 +20,7 @@ import android.content.ContentUris; import android.content.Context; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.support.annotation.MainThread; import android.support.annotation.Nullable; @@ -35,10 +36,15 @@ import com.android.dialer.glidephotomanager.GlidePhotoManager; import com.android.dialer.glidephotomanager.PhotoInfo; import com.android.dialer.inject.ApplicationContext; import com.android.dialer.lettertile.LetterTileDrawable; +import java.util.List; import javax.inject.Inject; /** Implementation of {@link GlidePhotoManager} */ public class GlidePhotoManagerImpl implements GlidePhotoManager { + + private static final int LOOKUP_URI_PATH_SEGMENTS = + Contacts.CONTENT_LOOKUP_URI.getPathSegments().size(); + private final Context appContext; @Inject @@ -126,7 +132,7 @@ public class GlidePhotoManagerImpl implements GlidePhotoManager { : photoInfo.getName(); } else { displayName = photoInfo.getName(); - identifier = photoInfo.getLookupUri(); + identifier = getIdentifier(photoInfo.getLookupUri()); } letterTileDrawable.setCanonicalDialerLetterTileDetails( displayName, @@ -145,4 +151,27 @@ public class GlidePhotoManagerImpl implements GlidePhotoManager { private static Uri parseUri(@Nullable String uri) { return TextUtils.isEmpty(uri) ? null : Uri.parse(uri); } + + /** + * Return the "lookup key" inside the lookup URI. If the URI does not contain the key (i.e, JSON + * based prepopulated URIs for non-contact entries), the URI itself is returned. + * + * <p>The lookup URI has the format of Contacts.CONTENT_LOOKUP_URI/lookupKey/rowId. For JSON based + * URI, it would be Contacts.CONTENT_LOOKUP_URI/encoded#JSON + */ + private static String getIdentifier(String lookupUri) { + if (!lookupUri.startsWith(Contacts.CONTENT_LOOKUP_URI.toString())) { + return lookupUri; + } + + List<String> segments = Uri.parse(lookupUri).getPathSegments(); + if (segments.size() < LOOKUP_URI_PATH_SEGMENTS) { + return lookupUri; + } + String lookupKey = segments.get(LOOKUP_URI_PATH_SEGMENTS); + if ("encoded".equals(lookupKey)) { + return lookupUri; + } + return lookupKey; + } } diff --git a/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java b/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java index e3e9e7a64..f5cdc4d87 100644 --- a/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java +++ b/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java @@ -23,7 +23,6 @@ import android.support.annotation.NonNull; import android.support.design.widget.BottomSheetBehavior; import android.support.design.widget.BottomSheetBehavior.BottomSheetCallback; import android.support.design.widget.BottomSheetDialog; -import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -34,6 +33,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.android.dialer.common.Assert; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.widget.ContactPhotoView; import java.util.List; @@ -157,8 +157,7 @@ public class HistoryItemActionBottomSheet extends BottomSheetDialog implements O if (module.tintDrawable()) { ((ImageView) moduleView.findViewById(R.id.module_image)) .setImageTintList( - ColorStateList.valueOf( - ContextCompat.getColor(getContext(), R.color.secondary_text_color))); + ColorStateList.valueOf(ThemeComponent.get(getContext()).theme().getColorIcon())); } moduleView.setOnClickListener(this); moduleView.setTag(module); diff --git a/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml b/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml index 5fe40939e..5c1678330 100644 --- a/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml +++ b/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml @@ -24,7 +24,8 @@ android:paddingEnd="8dp" android:gravity="center_vertical" android:orientation="horizontal" - android:background="#FFFFFF"> + android:background="#FFFFFF" + android:focusable="true"> <com.android.dialer.widget.ContactPhotoView android:id="@+id/contact_photo_view" @@ -40,13 +41,13 @@ <TextView android:id="@+id/primary_text" - style="@style/Dialer.TextAppearance.Primary" + style="@style/Dialer.TextAppearance.Primary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/secondary_text" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp"/> diff --git a/java/com/android/dialer/historyitemactions/res/layout/module_layout.xml b/java/com/android/dialer/historyitemactions/res/layout/module_layout.xml index 6b54e5e8b..ec8cc4ebd 100644 --- a/java/com/android/dialer/historyitemactions/res/layout/module_layout.xml +++ b/java/com/android/dialer/historyitemactions/res/layout/module_layout.xml @@ -22,12 +22,14 @@ android:layout_height="wrap_content" android:background="?android:attr/selectableItemBackground"> + <!-- The icon is not important for a11y as it is not clickable. --> <ImageView android:id="@+id/module_image" android:layout_width="@dimen/contact_actions_image_size" android:layout_height="@dimen/contact_actions_image_size" android:layout_marginStart="@dimen/contact_actions_image_margin" android:layout_marginEnd="@dimen/contact_actions_image_margin" + android:importantForAccessibility="no" android:scaleType="center"/> <TextView @@ -35,5 +37,5 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - style="@style/Dialer.TextAppearance.Primary"/> + style="@style/Dialer.TextAppearance.Primary.Ellipsize"/> </LinearLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/historyitemactions/res/values/styles.xml b/java/com/android/dialer/historyitemactions/res/values/styles.xml index 98e2ec999..ed5c18638 100644 --- a/java/com/android/dialer/historyitemactions/res/values/styles.xml +++ b/java/com/android/dialer/historyitemactions/res/values/styles.xml @@ -19,7 +19,7 @@ <item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:windowTranslucentNavigation">false</item> <item name="android:windowTranslucentStatus">false</item> - <item name="android:navigationBarColor">?android:attr/colorBackground</item> + <item name="android:navigationBarColor">?android:attr/colorBackgroundFloating</item> </style> <style name="HistoryItemBottomSheet" parent="HistoryItemBottomSheet.Base"> diff --git a/java/com/android/dialer/inject/ContextModule.java b/java/com/android/dialer/inject/ContextModule.java index 12ba12b6c..72febbb62 100644 --- a/java/com/android/dialer/inject/ContextModule.java +++ b/java/com/android/dialer/inject/ContextModule.java @@ -18,7 +18,6 @@ package com.android.dialer.inject; import android.content.Context; import android.support.annotation.NonNull; -import com.android.dialer.theme.ThemeUtil; import dagger.Module; import dagger.Provides; @@ -30,8 +29,7 @@ public final class ContextModule { @NonNull private final Context context; public ContextModule(@NonNull Context appContext) { - ThemeUtil.initializeTheme(appContext); - this.context = ThemeUtil.getThemedContext(appContext); + this.context = appContext; } @Provides diff --git a/java/com/android/dialer/logging/contact_source.proto b/java/com/android/dialer/logging/contact_source.proto index 7b90730ab..fbff642b2 100644 --- a/java/com/android/dialer/logging/contact_source.proto +++ b/java/com/android/dialer/logging/contact_source.proto @@ -16,8 +16,6 @@ message ContactSource { // number's status at the time they made or received the call. // Type definitions are from the CachedContactInfo interface in // CachedNumberLookupService.java - // When adding new sources here, consider updating the isPeopleApiSource() and - // isBusiness() methods in LookupSourceUtils.java if needed. enum Type { UNKNOWN_SOURCE_TYPE = 0; diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index a0e92a8cb..e14c5b97f 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -116,6 +116,8 @@ import com.android.dialer.smartdial.util.SmartDialPrefix; import com.android.dialer.speeddial.SpeedDialFragment; import com.android.dialer.storage.StorageComponent; import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.theme.base.Theme; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.PermissionsUtil; import com.android.dialer.util.TransactionSafeActivity; @@ -229,12 +231,30 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void onActivityCreate(Bundle savedInstanceState) { LogUtil.enterBlock("OldMainActivityPeer.onActivityCreate"); + setTheme(); activity.setContentView(R.layout.main_activity); initUiListeners(); initLayout(savedInstanceState); SmartDialPrefix.initializeNanpSettings(activity); } + /** should be called before {@link AppCompatActivity#setContentView(int)}. */ + private void setTheme() { + @Theme.Type int theme = ThemeComponent.get(activity).theme().getTheme(); + switch (theme) { + case Theme.DARK: + activity.setTheme(R.style.MainActivityTheme_Dark); + break; + case Theme.LIGHT: + case Theme.LIGHT_M2: + activity.setTheme(R.style.MainActivityTheme); + break; + case Theme.UNKNOWN: + default: + throw new IllegalArgumentException("Invalid theme."); + } + } + private void initUiListeners() { getLastOutgoingCallListener = DialerExecutorComponent.get(activity) diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java index 4edb08e55..3a43f8460 100644 --- a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java +++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java @@ -30,7 +30,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.android.dialer.common.Assert; import com.android.dialer.configprovider.ConfigProviderBindings; -import com.android.dialer.theme.ThemeUtil; +import com.android.dialer.theme.base.ThemeComponent; /** Navigation item in a bottom nav. */ final class BottomNavItem extends LinearLayout { @@ -54,7 +54,10 @@ final class BottomNavItem extends LinearLayout { @Override public void setSelected(boolean selected) { super.setSelected(selected); - int colorId = selected ? ThemeUtil.getColorPrimary() : ThemeUtil.getTextColorSecondary(); + int colorId = + selected + ? ThemeComponent.get(getContext()).theme().getColorPrimary() + : ThemeComponent.get(getContext()).theme().getTextColorSecondary(); image.setImageTintList(ColorStateList.valueOf(colorId)); text.setTextColor(colorId); } diff --git a/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml b/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml index dad566b68..65bc8f9b4 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml @@ -19,5 +19,5 @@ android:shape="rectangle"> <solid android:color="?android:attr/colorPrimary"/> <corners android:radius="20dp"/> - <stroke android:color="?android:attr/colorBackground" android:width="2dp"/> + <stroke android:color="?android:attr/colorBackgroundFloating" android:width="2dp"/> </shape>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml index 2197b4d21..3fbd9ffc9 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml @@ -58,7 +58,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" - android:textSize="12sp" - android:textColor="?android:attr/colorPrimary" - android:gravity="center_horizontal"/> + android:gravity="center_horizontal" + style="@style/Dialer.TextAppearance.Secondary"/> </com.android.dialer.main.impl.bottomnav.BottomNavItem>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/res/layout/promotion_bottom_sheet.xml b/java/com/android/dialer/main/impl/res/layout/promotion_bottom_sheet.xml index 709de52b8..0edc03c3d 100644 --- a/java/com/android/dialer/main/impl/res/layout/promotion_bottom_sheet.xml +++ b/java/com/android/dialer/main/impl/res/layout/promotion_bottom_sheet.xml @@ -47,9 +47,7 @@ android:id="@+id/promotion_title" android:layout_width="match_parent" android:layout_height="wrap_content" - android:fontFamily="sans-serif-medium" - android:textColor="#DD000000" - android:textSize="16sp" + style="@style/Dialer.TextAppearance.Header2" /> <TextView android:id="@+id/promotion_details" @@ -58,8 +56,7 @@ android:layout_marginTop="8dp" android:layout_marginBottom="16dp" android:lineSpacingMultiplier="1.5" - android:textColor="#DD000000" - android:textSize="14sp"/> + style="@style/Dialer.TextAppearance.Secondary"/> <Button android:id="@+id/ok_got_it" android:layout_width="wrap_content" diff --git a/java/com/android/dialer/main/impl/res/values-v27/styles.xml b/java/com/android/dialer/main/impl/res/values-v27/styles.xml index 9462bbc25..261012ed5 100644 --- a/java/com/android/dialer/main/impl/res/values-v27/styles.xml +++ b/java/com/android/dialer/main/impl/res/values-v27/styles.xml @@ -24,4 +24,13 @@ <item name="android:navigationBarColor">?android:attr/colorBackgroundFloating</item> <item name="android:navigationBarDividerColor">#E0E0E0</item> </style> + + <!-- Used on sdk 27 and above --> + <!-- TODO(a bug): refactor into dialer/theme --> + <style name="MainActivityTheme.Dark" parent="MainActivityThemeBase.Dark"> + <!-- Used to change the navigation bar color --> + <item name="android:windowLightNavigationBar">true</item> + <item name="android:navigationBarColor">?android:attr/colorBackgroundFloating</item> + <item name="android:navigationBarDividerColor">#E0E0E0</item> + </style> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/res/values/styles.xml b/java/com/android/dialer/main/impl/res/values/styles.xml index 467cb5be0..7b36e78ef 100644 --- a/java/com/android/dialer/main/impl/res/values/styles.xml +++ b/java/com/android/dialer/main/impl/res/values/styles.xml @@ -19,12 +19,23 @@ <!-- Activities should use this theme as their style --> <style name="MainActivityTheme" parent="MainActivityThemeBase"/> + <style name="MainActivityTheme.Dark" parent="MainActivityTheme.Dark"/> + <!-- Used as a procy for values-v27/styles.xml --> <style name="MainActivityThemeBase" parent="Dialer.ThemeBase.NoActionBar"> <!-- Required for actionmode/multiselect to render properly. --> <!-- TODO(a bug): Check to see if we can remove this after NewVoicemailFragment launches --> <item name="actionModeStyle">@style/MainActionModeStyle</item> <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> + <item name="dialpad_style">@style/Dialpad.Light</item> + </style> + + <style name="MainActivityThemeBase.Dark" parent="Dialer.Dark.ThemeBase.NoActionBar"> + <!-- Required for actionmode/multiselect to render properly. --> + <!-- TODO(a bug): Check to see if we can remove this after NewVoicemailFragment launches --> + <item name="actionModeStyle">@style/MainActionModeStyle</item> + <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> + <item name="dialpad_style">@style/Dialpad.Light</item> </style> <!-- Colors our actionbar in action mode to dialer theme color. --> diff --git a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background.xml b/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background.xml index 8bc21c4a8..b797bd171 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background.xml @@ -16,5 +16,5 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="?android:attr/colorBackground"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> </shape> diff --git a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background_rounded_corners.xml b/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background_rounded_corners.xml index 2bbc8d106..88f5a04ca 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background_rounded_corners.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background_rounded_corners.xml @@ -16,6 +16,6 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="?android:attr/colorBackground"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> <corners android:radius="2dp"/> </shape> diff --git a/java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml b/java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml index 8a8730f78..e5b72f233 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml @@ -45,7 +45,7 @@ android:inputType="textFilter" android:maxLines="1" android:hint="@string/dialer_hint_find_contact" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorSecondary" android:textColorHint="?android:attr/textColorHint" android:textCursorDrawable="@drawable/custom_cursor" android:textSize="16sp"/> @@ -60,6 +60,6 @@ android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/description_clear_search" android:src="@drawable/quantum_ic_close_vd_theme_24" - android:tint="@color/dialer_secondary_text_color" + android:tint="?colorIcon" android:visibility="gone"/> </RelativeLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml b/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml index 98b856361..578684ef8 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml @@ -50,7 +50,7 @@ android:importantForAccessibility="no" android:scaleType="center" android:src="@drawable/quantum_ic_search_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> <TextView android:id="@+id/search_box_start_search" @@ -60,9 +60,8 @@ android:layout_centerVertical="true" android:layout_toEndOf="@+id/search_magnifying_glass" android:layout_toStartOf="@+id/voice_search_button" - android:fontFamily="sans-serif" android:text="@string/dialer_hint_find_contact" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorHint" android:textSize="16dp"/> <ImageView @@ -74,7 +73,7 @@ android:contentDescription="@string/description_start_voice_search" android:scaleType="center" android:src="@drawable/quantum_ic_mic_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> <ImageButton android:id="@+id/main_options_menu_button" @@ -85,7 +84,7 @@ android:contentDescription="@string/action_menu_overflow_description" android:scaleType="center" android:src="@drawable/quantum_ic_more_vert_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> </RelativeLayout> <include layout="@layout/expanded_search_bar"/> @@ -122,14 +121,14 @@ android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:src="@drawable/quantum_ic_close_vd_theme_24" - android:tint="?android:attr/textColorPrimaryInverse"/> + android:tint="?colorIconOnUnthemedDarkBackground"/> <TextView android:id="@+id/remove_view_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/main_remove_contact" - android:textColor="?android:attr/textColorPrimaryInverse" + android:textColor="?colorTextOnUnthemedDarkBackground" android:textSize="16sp"/> </LinearLayout> </com.android.dialer.app.list.RemoveView> diff --git a/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java b/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java index c398251e4..b2720d19d 100644 --- a/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java +++ b/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java @@ -43,8 +43,6 @@ public interface CachedNumberLookupService { void addContact(Context context, CachedContactInfo info); - boolean isCacheUri(String uri); - boolean isBusiness(ContactSource.Type sourceType); boolean canReportAsInvalid(ContactSource.Type sourceType, String objectId); @@ -71,8 +69,6 @@ public interface CachedNumberLookupService { void setDirectorySource(String name, long directoryId); - void setExtendedSource(String name, long directoryId); - void setLookupKey(String lookupKey); } } diff --git a/java/com/android/dialer/postcall/AndroidManifest.xml b/java/com/android/dialer/postcall/AndroidManifest.xml index 82101a0b3..247b6e6e7 100644 --- a/java/com/android/dialer/postcall/AndroidManifest.xml +++ b/java/com/android/dialer/postcall/AndroidManifest.xml @@ -21,7 +21,6 @@ <activity android:name="com.android.dialer.postcall.PostCallActivity" android:exported="false" - android:theme="@style/Dialer.ThemeBase.NoActionBar" android:windowSoftInputMode="adjustResize"/> </application> </manifest> diff --git a/java/com/android/dialer/rtt/AndroidManifest.xml b/java/com/android/dialer/rtt/AndroidManifest.xml index ecc4fe1bc..f8e8e0b49 100644 --- a/java/com/android/dialer/rtt/AndroidManifest.xml +++ b/java/com/android/dialer/rtt/AndroidManifest.xml @@ -16,7 +16,6 @@ <manifest package="com.android.dialer.rtt" xmlns:android="http://schemas.android.com/apk/res/android"> <application> - <!-- TODO(a bug): remove the theme here. Needed for espresso test. --> - <activity android:name=".RttTranscriptActivity" android:theme="@style/Dialer.ThemeBase"/> + <activity android:name=".RttTranscriptActivity"/> </application> </manifest>
\ No newline at end of file diff --git a/java/com/android/dialer/rtt/res/color/bubble_background.xml b/java/com/android/dialer/rtt/res/color/bubble_background.xml index fb29ab6c5..9a0840161 100644 --- a/java/com/android/dialer/rtt/res/color/bubble_background.xml +++ b/java/com/android/dialer/rtt/res/color/bubble_background.xml @@ -16,6 +16,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" - android:color="@android:color/white" /> + android:color="?android:attr/colorBackgroundFloating" /> <item android:color="@color/rtt_transcript_primary_color" /> </selector>
\ No newline at end of file diff --git a/java/com/android/dialer/rtt/res/drawable/message_bubble.xml b/java/com/android/dialer/rtt/res/drawable/message_bubble.xml index 2b01f62f9..31044b64e 100644 --- a/java/com/android/dialer/rtt/res/drawable/message_bubble.xml +++ b/java/com/android/dialer/rtt/res/drawable/message_bubble.xml @@ -16,6 +16,6 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="@android:color/white"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> <corners android:radius="20dp"/> </shape>
\ No newline at end of file diff --git a/java/com/android/dialer/searchfragment/common/res/layout/search_contact_row.xml b/java/com/android/dialer/searchfragment/common/res/layout/search_contact_row.xml index fb6f66c39..4f8e305fe 100644 --- a/java/com/android/dialer/searchfragment/common/res/layout/search_contact_row.xml +++ b/java/com/android/dialer/searchfragment/common/res/layout/search_contact_row.xml @@ -62,7 +62,7 @@ android:layout_height="@dimen/search_row_height" android:layout_alignParentEnd="true" android:padding="@dimen/call_to_action_padding" - android:tint="@color/dialer_secondary_text_color" + android:tint="?colorIcon" android:visibility="gone" android:scaleType="center"/> @@ -74,6 +74,7 @@ android:layout_centerVertical="true" android:padding="@dimen/call_to_action_padding" android:src="@drawable/ic_work_profile" + android:tint="?colorIcon" android:scaleType="centerInside" android:visibility="gone"/> </RelativeLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/searchfragment/list/res/layout/fragment_search.xml b/java/com/android/dialer/searchfragment/list/res/layout/fragment_search.xml index ad6151bbe..30370674c 100644 --- a/java/com/android/dialer/searchfragment/list/res/layout/fragment_search.xml +++ b/java/com/android/dialer/searchfragment/list/res/layout/fragment_search.xml @@ -23,12 +23,12 @@ android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:attr/colorBackgroundFloating"/> + android:background="?android:attr/colorBackground"/> <com.android.dialer.widget.EmptyContentView android:id="@+id/empty_view" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" - android:background="?android:attr/colorBackgroundFloating"/> + android:background="?android:attr/colorBackground"/> </FrameLayout> diff --git a/java/com/android/dialer/searchfragment/list/res/layout/header_layout.xml b/java/com/android/dialer/searchfragment/list/res/layout/header_layout.xml index b22ddd9a0..ff59206ad 100644 --- a/java/com/android/dialer/searchfragment/list/res/layout/header_layout.xml +++ b/java/com/android/dialer/searchfragment/list/res/layout/header_layout.xml @@ -27,5 +27,5 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - style="@style/Dialer.TextAppearance.Secondary"/> + style="@style/Dialer.TextAppearance.Secondary.Ellipsize"/> </FrameLayout> diff --git a/java/com/android/dialer/searchfragment/nearbyplaces/res/layout/location_permission_row.xml b/java/com/android/dialer/searchfragment/nearbyplaces/res/layout/location_permission_row.xml index a79e5883c..41ffb4517 100644 --- a/java/com/android/dialer/searchfragment/nearbyplaces/res/layout/location_permission_row.xml +++ b/java/com/android/dialer/searchfragment/nearbyplaces/res/layout/location_permission_row.xml @@ -47,8 +47,7 @@ android:minHeight="40dp" android:text="@string/search_location_permission" android:lineSpacingMultiplier="1.2" - android:textSize="16sp" - android:textColor="@color/dialer_secondary_text_color"/> + style="@style/Dialer.TextAppearance.Primary"/> <Button android:id="@+id/location_permission_allow" diff --git a/java/com/android/dialer/shortcuts/res/drawable/ic_add_contact_foreground.xml b/java/com/android/dialer/shortcuts/res/drawable/ic_add_contact_foreground.xml index 6bc172767..2baa051dd 100644 --- a/java/com/android/dialer/shortcuts/res/drawable/ic_add_contact_foreground.xml +++ b/java/com/android/dialer/shortcuts/res/drawable/ic_add_contact_foreground.xml @@ -18,6 +18,5 @@ <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center" android:src="@drawable/quantum_ic_person_add_white_24" - android:tint="@color/shortcut_add_contact_foreground_color"> - + android:tint="?android:attr/colorPrimary"> </bitmap> diff --git a/java/com/android/dialer/shortcuts/res/drawable/ic_shortcut_add_contact.xml b/java/com/android/dialer/shortcuts/res/drawable/ic_shortcut_add_contact.xml index c06aec82f..59dc466c1 100644 --- a/java/com/android/dialer/shortcuts/res/drawable/ic_shortcut_add_contact.xml +++ b/java/com/android/dialer/shortcuts/res/drawable/ic_shortcut_add_contact.xml @@ -24,7 +24,7 @@ <size android:height="44dp" android:width="44dp"/> - <solid android:color="@color/shortcut_add_contact_background_color"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> </shape> </item> @@ -34,6 +34,6 @@ android:right="14dp" android:top="12dp"> <bitmap android:src="@drawable/quantum_ic_person_add_white_24" - android:tint="@color/shortcut_add_contact_foreground_color"/> + android:tint="?android:attr/colorPrimary"/> </item> </layer-list> diff --git a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java index a24c238b4..34209cc54 100644 --- a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java +++ b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java @@ -36,6 +36,7 @@ import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.spam.SpamSettings; import com.android.dialer.spam.promo.SpamBlockingPromoDialogFragment.OnEnableListener; import com.android.dialer.storage.StorageComponent; +import com.android.dialer.theme.base.ThemeComponent; /** Helper class for showing spam blocking on-boarding promotions. */ public class SpamBlockingPromoHelper { @@ -178,7 +179,7 @@ public class SpamBlockingPromoHelper { .setContentIntent(contentIntent) .setCategory(Notification.CATEGORY_STATUS) .setPriority(Notification.PRIORITY_DEFAULT) - .setColor(context.getColor(R.color.dialer_theme_color)) + .setColor(ThemeComponent.get(context).theme().getColorPrimary()) .setSmallIcon(R.drawable.quantum_ic_call_vd_theme_24) .setLargeIcon(Icon.createWithResource(context, R.drawable.spam_blocking_promo_icon)) .setContentText(context.getString(R.string.spam_blocking_promo_text)) diff --git a/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml b/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml deleted file mode 100644 index 2b36457fc..000000000 --- a/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml +++ /dev/null @@ -1,26 +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 - --> - -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <corners - android:bottomRightRadius="@dimen/speed_dial_context_menu_corner_radius" - android:topRightRadius="@dimen/speed_dial_context_menu_corner_radius" - android:bottomLeftRadius="@dimen/speed_dial_context_menu_corner_radius" - android:topLeftRadius="@dimen/speed_dial_context_menu_corner_radius"/> - <solid android:color="?android:attr/colorBackground"/> - <stroke android:color="#0333" android:width="2dp"/> -</shape>
\ No newline at end of file diff --git a/java/com/android/dialer/speeddial/res/drawable/context_menu_contact_icon.xml b/java/com/android/dialer/speeddial/res/drawable/context_menu_contact_icon.xml index 73260b156..ee9cde1db 100644 --- a/java/com/android/dialer/speeddial/res/drawable/context_menu_contact_icon.xml +++ b/java/com/android/dialer/speeddial/res/drawable/context_menu_contact_icon.xml @@ -18,7 +18,7 @@ <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="oval"> - <solid android:color="@color/secondary_text_color"/> + <solid android:color="?colorIcon"/> <size android:width="24dp" android:height="24dp"/> </shape> </item> diff --git a/java/com/android/dialer/speeddial/res/layout/disambig_dialog_layout.xml b/java/com/android/dialer/speeddial/res/layout/disambig_dialog_layout.xml index e395d4bd6..0923c5267 100644 --- a/java/com/android/dialer/speeddial/res/layout/disambig_dialog_layout.xml +++ b/java/com/android/dialer/speeddial/res/layout/disambig_dialog_layout.xml @@ -32,7 +32,7 @@ android:elevation="1dp" android:text="@string/speed_dial_disambig_dialog_title" android:background="?android:attr/colorBackgroundFloating" - style="@style/Dialer.TextAppearance.Header"/> + style="@style/Dialer.TextAppearance.Header2"/> <com.android.dialer.widget.MaxHeightScrollView android:id="@+id/disambig_scrollview" diff --git a/java/com/android/dialer/speeddial/res/layout/fragment_speed_dial.xml b/java/com/android/dialer/speeddial/res/layout/fragment_speed_dial.xml index 57f8885ff..e289bb794 100644 --- a/java/com/android/dialer/speeddial/res/layout/fragment_speed_dial.xml +++ b/java/com/android/dialer/speeddial/res/layout/fragment_speed_dial.xml @@ -24,7 +24,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" - android:background="?android:attr/colorBackgroundFloating" + android:background="?android:attr/colorBackground" android:paddingBottom="@dimen/floating_action_button_list_bottom_padding"/> <com.android.dialer.widget.EmptyContentView diff --git a/java/com/android/dialer/speeddial/res/layout/suggestion_row_layout.xml b/java/com/android/dialer/speeddial/res/layout/suggestion_row_layout.xml index 96532fb82..4e010c279 100644 --- a/java/com/android/dialer/speeddial/res/layout/suggestion_row_layout.xml +++ b/java/com/android/dialer/speeddial/res/layout/suggestion_row_layout.xml @@ -57,7 +57,7 @@ android:layout_centerVertical="true" android:layout_alignParentEnd="true" android:scaleType="center" - android:tint="@color/secondary_text_color" + android:tint="?colorIcon" android:src="@drawable/quantum_ic_more_vert_white_24" android:background="?android:attr/selectableItemBackgroundBorderless" android:contentDescription="@string/content_description_overflow"/> diff --git a/java/com/android/dialer/speeddial/res/menu/starred_contact_context_menu.xml b/java/com/android/dialer/speeddial/res/menu/starred_contact_context_menu.xml index 0143498e1..2ff2524e6 100644 --- a/java/com/android/dialer/speeddial/res/menu/starred_contact_context_menu.xml +++ b/java/com/android/dialer/speeddial/res/menu/starred_contact_context_menu.xml @@ -24,25 +24,25 @@ android:id="@+id/voice_call_container" android:title="@string/contact_menu_voice_call" android:icon="@drawable/quantum_ic_phone_vd_theme_24" - android:iconTint="@color/secondary_text_color"/> + android:iconTint="?colorIcon"/> <item android:id="@+id/video_call_container" android:title="@string/contact_menu_video_call" android:icon="@drawable/quantum_ic_videocam_vd_theme_24" - android:iconTint="@color/secondary_text_color"/> + android:iconTint="?colorIcon"/> <item android:id="@+id/send_message_container" android:title="@string/contact_menu_message" android:icon="@drawable/quantum_ic_message_vd_theme_24" - android:iconTint="@color/secondary_text_color"/> + android:iconTint="?colorIcon"/> <item android:id="@+id/remove_container" android:title="@string/contact_menu_remove" android:icon="@drawable/quantum_ic_close_vd_theme_24" - android:iconTint="@color/secondary_text_color"/> + android:iconTint="?colorIcon"/> <item android:id="@+id/contact_info_container" diff --git a/java/com/android/dialer/speeddial/res/values/styles.xml b/java/com/android/dialer/speeddial/res/values/styles.xml index 38f31c3ed..99e6e3c73 100644 --- a/java/com/android/dialer/speeddial/res/values/styles.xml +++ b/java/com/android/dialer/speeddial/res/values/styles.xml @@ -16,7 +16,7 @@ --> <resources> <style name="SpeedDialContextMenuItem" parent="SpeedDialContextMenuItem.NoDrawableTint"> - <item name="android:drawableTint">@color/secondary_text_color</item> + <item name="android:drawableTint">?colorIcon</item> </style> <style name="SpeedDialContextMenuItem.NoDrawableTint" parent="Dialer.TextAppearance.Secondary"> diff --git a/java/com/android/dialer/theme/AndroidManifest.xml b/java/com/android/dialer/theme/AndroidManifest.xml deleted file mode 100644 index 7c1e4effd..000000000 --- a/java/com/android/dialer/theme/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ -<manifest - package="com.android.dialer.theme"> -</manifest> diff --git a/java/com/android/dialer/theme/README.md b/java/com/android/dialer/theme/README.md new file mode 100644 index 000000000..6fb8e4f07 --- /dev/null +++ b/java/com/android/dialer/theme/README.md @@ -0,0 +1,75 @@ +# How to use this directory + +First thing to note, it's imperative that the application and all activities +inherit from the styles outlined in theme/base. If an Activity doesn\'t specify +a style for it's theme, it automatically inherits one from the Application. And +this hierarchy continues: Application > Activity > Fragment > View > View > ... + +## theme/base + +This is where the base application themes, activity themes and application wide +style attributes live. + +What is an attribute? There are three types (depending on how you want to define +them): + +* Legacy Android attributes (android:colorPrimary). These are defined by the + Android framework and they exist to allow developers easily custom Android + provided widgets. + +* Appcompat Android attributes (colorPrimary). There are also defined by the + Android framework but they only exist to customize AppCompat widgets. After + the framework was more mature, the team realized that they needed to add + more customization to their widgets, so they created the AppCompat variant + with all of the same attributes plus some. *Note:* Unfortunately our app + uses both Legacy Widgets and AppCompat widgets, so when you define an + AppCompat attribute in a style, be sure to also define the Legacy version as + well if it exists. + +* Custom application attributes (colorIcon). It goes without saying that the + names can't collide with the framework attributes. These attributes server + to satisfy what the framework doesn't. For example, the framework doesn't + provide an attribute to tint all of your ImageViews (why would it?), so we + created the colorIcon attribute to apply to all ImageViews that show quantum + icons/assets that need to be tinted. + +Styles in this package follow a naming convention of inheritance: + +* Dialer. and Dialer.NoActionBar are the two root themes that should be used + to add sdk specific features (like coloring the Android nav bar). + +* Dialer.ThemeBase.ActionBar and Dialer.ThemeBase.NoActionBar are great + starting points for Activity style's to inherit from if they need specific + customizations. + +* Dialer.ThemeBase.ActionBar.* and Dialer.ThemeBase.NoActionBar.* are + specialized app themes intended to change the entire look of the app. For + example, Dialer.ThemeBase.NoActionBar.Dark is used for a dark mode theme. If + you create a custom theme for an activity, be sure your customization will + work for all themes. See dialer/dialpadview/theme for an example. + +## theme/common + +This is a dumping ground for shared resources. Some examples of what should live +here: + +* Colors that can't be theme'd (there aren't many of those, so you probably + won't do that). +* Drawables, images, animations, dimensions, styles, ect. that can be (or are) + used throughout the entire app without the need for customization. If you + want to customize a specific style for one use case, feel free to override + it and store it in your own resource directory. + +## theme/private + +This package is only visible to theme/base. Things you should never do: + +* Reference anything in here. +* Duplicate the resources from this directory into another. + +Things you should do: + +* Add colors that are common throughout the entire app and need be themed. For + example, text colors, background colors and app primary and accent colors. + Each color you add needs to exist in each color_*.xml file where * + represents an app theme like 'dark' or 'light'. diff --git a/java/com/android/dialer/theme/ThemeUtil.java b/java/com/android/dialer/theme/ThemeUtil.java deleted file mode 100644 index 227224448..000000000 --- a/java/com/android/dialer/theme/ThemeUtil.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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/base/AndroidManifest.xml index 1a50716d2..ff7891055 100644 --- a/java/com/android/dialer/theme/attributes/AndroidManifest.xml +++ b/java/com/android/dialer/theme/base/AndroidManifest.xml @@ -13,4 +13,4 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> -<manifest package="com.android.dialer.theme.attributes"/> +<manifest package="com.android.dialer.theme.base"/> diff --git a/java/com/android/dialer/theme/base/Theme.java b/java/com/android/dialer/theme/base/Theme.java new file mode 100644 index 000000000..6e0d20a7a --- /dev/null +++ b/java/com/android/dialer/theme/base/Theme.java @@ -0,0 +1,76 @@ +/* + * 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.base; + +import android.content.Context; +import android.support.annotation.ColorInt; +import android.support.annotation.IntDef; +import android.support.annotation.StyleRes; +import android.view.LayoutInflater; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** Interface for theme. */ +public interface Theme { + + /** IntDef for the different themes Dialer supports. */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({UNKNOWN, LIGHT, DARK, LIGHT_M2}) + @interface Type {} + + int UNKNOWN = 0; + int LIGHT = 1; + int DARK = 2; + int LIGHT_M2 = 3; + + @Type + int getTheme(); + + @StyleRes + int getApplicationThemeRes(); + + Context getThemedContext(Context context); + + LayoutInflater getThemedLayoutInflator(LayoutInflater inflater); + + @ColorInt + int getColorIcon(); + + @ColorInt + int getColorIconSecondary(); + + @ColorInt + int getColorPrimary(); + + @ColorInt + int getColorPrimaryDark(); + + @ColorInt + int getColorAccent(); + + @ColorInt + int getTextColorSecondary(); + + @ColorInt + int getTextColorPrimary(); + + @ColorInt + int getColorTextOnUnthemedDarkBackground(); + + @ColorInt + int getColorIconOnUnthemedDarkBackground(); +} diff --git a/java/com/android/dialer/theme/base/ThemeComponent.java b/java/com/android/dialer/theme/base/ThemeComponent.java new file mode 100644 index 000000000..d9067616f --- /dev/null +++ b/java/com/android/dialer/theme/base/ThemeComponent.java @@ -0,0 +1,40 @@ +/* + * 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.base; + +import android.content.Context; +import com.android.dialer.inject.HasRootComponent; +import com.android.dialer.inject.IncludeInDialerRoot; +import dagger.Subcomponent; + +/** Component for Theme. */ +@Subcomponent +public abstract class ThemeComponent { + + public abstract Theme theme(); + + public static ThemeComponent get(Context context) { + return ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component()) + .themeComponent(); + } + + /** Used to refer to the root application component. */ + @IncludeInDialerRoot + public interface HasComponent { + ThemeComponent themeComponent(); + } +} diff --git a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java new file mode 100644 index 000000000..b8c7e528f --- /dev/null +++ b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java @@ -0,0 +1,175 @@ +/* + * 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.base.impl; + +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; +import com.android.dialer.theme.base.R; +import com.android.dialer.theme.base.Theme; +import javax.inject.Singleton; + +/** Utility for fetching */ +@SuppressWarnings("unused") +@Singleton +public class AospThemeImpl implements Theme { + + private int colorIcon = -1; + private int colorIconSecondary = -1; + private int colorPrimary = -1; + private int colorPrimaryDark = -1; + private int colorAccent = -1; + private int textColorPrimary = -1; + private int textColorSecondary = -1; + private int textColorPrimaryInverse = -1; + private int textColorHint = -1; + private int colorBackground = -1; + private int colorBackgroundFloating = -1; + private int colorTextOnUnthemedDarkBackground = -1; + private int colorIconOnUnthemedDarkBackground = -1; + + public AospThemeImpl(Context context) { + + context = context.getApplicationContext(); + context.setTheme(getApplicationThemeRes()); + TypedArray array = + context + .getTheme() + .obtainStyledAttributes( + getApplicationThemeRes(), + 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, + R.attr.colorIconSecondary, + R.attr.colorTextOnUnthemedDarkBackground, + R.attr.colorIconOnUnthemedDarkBackground, + }); + 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); + colorIconSecondary = array.getColor(/* index= */ 10, /* defValue= */ -1); + colorTextOnUnthemedDarkBackground = array.getColor(/* index= */ 11, /* defValue= */ -1); + colorIconOnUnthemedDarkBackground = array.getColor(/* index= */ 12, /* defValue= */ -1); + array.recycle(); + } + + /** + * Returns the {@link Theme} that the application is using. Activities should check this value if + * their custom style needs to customize further based on the application theme. + */ + @Override + public @Type int getTheme() { + // TODO(a bug): add share prefs check to configure this + return LIGHT; + } + + @Override + public @StyleRes int getApplicationThemeRes() { + switch (getTheme()) { + case DARK: + return R.style.Dialer_Dark_ThemeBase_NoActionBar; + case LIGHT: + return R.style.Dialer_ThemeBase_NoActionBar; + case UNKNOWN: + default: + throw Assert.createIllegalStateFailException("Theme hasn't been set yet."); + } + } + + @Override + public Context getThemedContext(Context context) { + return new ContextThemeWrapper(context, getApplicationThemeRes()); + } + + @Override + public LayoutInflater getThemedLayoutInflator(LayoutInflater inflater) { + return inflater.cloneInContext(getThemedContext(inflater.getContext())); + } + + @Override + public @ColorInt int getColorIcon() { + Assert.checkArgument(colorIcon != -1); + return colorIcon; + } + + @Override + public @ColorInt int getColorIconSecondary() { + Assert.checkArgument(colorIconSecondary != -1); + return colorIconSecondary; + } + + @Override + public @ColorInt int getColorPrimary() { + Assert.checkArgument(colorPrimary != -1); + return colorPrimary; + } + + @Override + public int getColorPrimaryDark() { + Assert.checkArgument(colorPrimary != -1); + return 0; + } + + @Override + public @ColorInt int getColorAccent() { + Assert.checkArgument(colorAccent != -1); + return colorAccent; + } + + @Override + public @ColorInt int getTextColorSecondary() { + Assert.checkArgument(textColorSecondary != -1); + return textColorSecondary; + } + + @Override + public @ColorInt int getTextColorPrimary() { + Assert.checkArgument(textColorPrimary != -1); + return textColorPrimary; + } + + @Override + public @ColorInt int getColorTextOnUnthemedDarkBackground() { + Assert.checkArgument(colorTextOnUnthemedDarkBackground != -1); + return colorTextOnUnthemedDarkBackground; + } + + @Override + public @ColorInt int getColorIconOnUnthemedDarkBackground() { + Assert.checkArgument(colorIconOnUnthemedDarkBackground != -1); + return colorIconOnUnthemedDarkBackground; + } +} diff --git a/java/com/android/dialer/theme/base/impl/AospThemeModule.java b/java/com/android/dialer/theme/base/impl/AospThemeModule.java new file mode 100644 index 000000000..7cf52cadd --- /dev/null +++ b/java/com/android/dialer/theme/base/impl/AospThemeModule.java @@ -0,0 +1,36 @@ +/* + * 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.base.impl; + +import android.content.Context; +import com.android.dialer.inject.ApplicationContext; +import com.android.dialer.inject.DialerVariant; +import com.android.dialer.inject.InstallIn; +import com.android.dialer.theme.base.Theme; +import dagger.Module; +import dagger.Provides; + +/** Module which binds {@link AospThemeImpl}. */ +@InstallIn(variants = {DialerVariant.DIALER_TEST}) +@Module +public class AospThemeModule { + + @Provides + static Theme provideThemeModule(@ApplicationContext Context context) { + return new AospThemeImpl(context); + } +} diff --git a/java/com/android/dialer/theme/base/res/values/attr.xml b/java/com/android/dialer/theme/base/res/values/attr.xml new file mode 100644 index 000000000..41c6225ad --- /dev/null +++ b/java/com/android/dialer/theme/base/res/values/attr.xml @@ -0,0 +1,26 @@ +<?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="color"/> + <!-- Used to style some icons a little lighter in Dialer. --> + <attr name="colorIconSecondary" format="color"/> + <!-- Used to color text on dark backgrounds. White in Light Theme. --> + <attr name="colorTextOnUnthemedDarkBackground" format="color"/> + <!-- Used to color icons on dark backgrounds. White in Light Theme. --> + <attr name="colorIconOnUnthemedDarkBackground" format="color"/> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/base/res/values/styles_dialer_light.xml b/java/com/android/dialer/theme/base/res/values/styles_dialer_light.xml new file mode 100644 index 000000000..cfdee7801 --- /dev/null +++ b/java/com/android/dialer/theme/base/res/values/styles_dialer_light.xml @@ -0,0 +1,53 @@ +<!-- + ~ 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> + <!-- TODO(a bug): properly document this or delete it --> + <!-- We don't want to style this, need to discuss with Yen why this was used instead of a default theme --> + <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.ActionBar"> + <!-- 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> + + <!-- TODO(a bug): This is only actively used in empty_content_view.xml. Move it there. --> + <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> +</resources> 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 new file mode 100644 index 000000000..e01a3a282 --- /dev/null +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml @@ -0,0 +1,64 @@ +<?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> + <!-- Deprecated: ActionBars are clunky and Toolbar (along with Dialer.ThemeBase.NoActionBar) + should be used in favor--> + <style name="Dialer.Dark.ThemeBase.ActionBar"> + <!-- These are used to style all actionbars in Dialer. These aren't needed in Dialer.ThemeBase.NoActionBar --> + <item name="actionBarStyle">@style/DialerActionBarBaseStyle</item> + <item name="actionBarSize">@dimen/action_bar_height</item> + </style> + + <style name="Dialer.Dark.ThemeBase.NoActionBar"> + <!-- Copied from Theme.AppCompat.Light.NoActionBar. We can remove this and update the Dialer + base style once none of our activities depend on ActionBar anymore. --> + <item name="windowActionBar">false</item> + <item name="windowNoTitle">true</item> + </style> + + <!-- Activities and Applications should inherit from one of the themes above. --> + <style name="Dialer.Dark.ThemeBase"> + <!-- These values should be used to color all backgrounds. --> + <item name="android:colorBackground">@color/dialer_dark_background</item> + <item name="android:colorBackgroundFloating">@color/dialer_dark_background_floating</item> + + <!-- These values should be used to set text color. --> + <!-- 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> + <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> + + <!-- Dialer specific attributes. --> + <item name="colorIcon">?android:attr/textColorSecondary</item> + <item name="colorIconSecondary">?android:attr/textColorSecondary</item> + <item name="colorTextOnUnthemedDarkBackground">@color/dialer_primary_text_color_inverse</item> + <item name="colorIconOnUnthemedDarkBackground">@color/dialer_icon_color_white</item> + </style> +</resources>
\ No newline at end of file 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 new file mode 100644 index 000000000..667b9726d --- /dev/null +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml @@ -0,0 +1,81 @@ +<?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> + <!-- Deprecated: ActionBars are clunky and Toolbar (along with Dialer.ThemeBase.NoActionBar) + should be used in favor--> + <style name="Dialer.ThemeBase.ActionBar"> + <!-- These are used to style all actionbars in Dialer. These aren't needed in Dialer.ThemeBase.NoActionBar --> + <item name="actionBarStyle">@style/DialerActionBarBaseStyle</item> + <item name="actionBarSize">@dimen/action_bar_height</item> + </style> + + <style name="Dialer.ThemeBase.NoActionBar"> + <!-- Copied from Theme.AppCompat.Light.NoActionBar. We can remove this and update the Dialer + base style once none of our activities depend on ActionBar anymore. --> + <item name="windowActionBar">false</item> + <item name="windowNoTitle">true</item> + </style> + + <!-- Activities and Applications should inherit from one of the themes above. --> + <style name="Dialer.ThemeBase"> + <!-- 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> + + <!-- Dialer specific attributes. --> + <item name="colorIcon">@color/dialer_secondary_text_color</item> + <item name="colorIconSecondary">@color/dialer_icon_color_secondary</item> + <item name="colorTextOnUnthemedDarkBackground">@color/dialer_primary_text_color_inverse</item> + <item name="colorIconOnUnthemedDarkBackground">@color/dialer_icon_color_white</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> + + <!-- Deprecated: Use Toolbar instead of ActionBar. --> + <!-- Used to style all Dialer's action bars. Every actionbar is awarded this for free if the parent + activity's theme extends from Dialer.ThemeBase.ActionBar or doesn't specify a theme. --> + <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> +</resources> diff --git a/java/com/android/dialer/theme/attributes/res/values/attr.xml b/java/com/android/dialer/theme/common/AndroidManifest.xml index 6db0aa8d3..51e532e2a 100644 --- a/java/com/android/dialer/theme/attributes/res/values/attr.xml +++ b/java/com/android/dialer/theme/common/AndroidManifest.xml @@ -1,4 +1,3 @@ -<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ @@ -14,8 +13,4 @@ ~ 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 +<manifest package="com.android.dialer.theme.common"/> diff --git a/java/com/android/dialer/theme/common/res/anim/front_back_switch_button_animation.xml b/java/com/android/dialer/theme/common/res/anim/front_back_switch_button_animation.xml new file mode 100644 index 000000000..152497b9f --- /dev/null +++ b/java/com/android/dialer/theme/common/res/anim/front_back_switch_button_animation.xml @@ -0,0 +1,29 @@ +<?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 + --> +<set + xmlns:android="http://schemas.android.com/apk/res/android"> + <set + android:ordering="sequentially"> + <objectAnimator + android:duration="500" + android:propertyName="rotation" + android:valueFrom="0.0" + android:valueTo="-180.0" + android:valueType="floatType" + android:interpolator="@android:interpolator/fast_out_slow_in"/> + </set> +</set>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/common/res/animator/activated_button_elevation.xml b/java/com/android/dialer/theme/common/res/animator/activated_button_elevation.xml new file mode 100644 index 000000000..2b47f0d3c --- /dev/null +++ b/java/com/android/dialer/theme/common/res/animator/activated_button_elevation.xml @@ -0,0 +1,36 @@ +<?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 + --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:state_enabled="true" + android:state_activated="true"> + <objectAnimator + android:duration="@android:integer/config_shortAnimTime" + android:propertyName="translationZ" + android:valueFrom="0dp" + android:valueTo="4dp" + android:valueType="floatType"/> + </item> + <item> + <objectAnimator + android:duration="@android:integer/config_shortAnimTime" + android:propertyName="translationZ" + android:valueFrom="4dp" + android:valueTo="0dp" + android:valueType="floatType"/> + </item> +</selector> diff --git a/java/com/android/dialer/theme/res/drawable-hdpi/empty_speed_dial.png b/java/com/android/dialer/theme/common/res/drawable-hdpi/empty_speed_dial.png Binary files differindex 5a1829599..5a1829599 100644 --- a/java/com/android/dialer/theme/res/drawable-hdpi/empty_speed_dial.png +++ b/java/com/android/dialer/theme/common/res/drawable-hdpi/empty_speed_dial.png diff --git a/java/com/android/dialer/theme/res/drawable-mdpi/empty_speed_dial.png b/java/com/android/dialer/theme/common/res/drawable-mdpi/empty_speed_dial.png Binary files differindex 3c95eeb33..3c95eeb33 100644 --- a/java/com/android/dialer/theme/res/drawable-mdpi/empty_speed_dial.png +++ b/java/com/android/dialer/theme/common/res/drawable-mdpi/empty_speed_dial.png diff --git a/java/com/android/dialer/theme/res/drawable-xhdpi/empty_speed_dial.png b/java/com/android/dialer/theme/common/res/drawable-xhdpi/empty_speed_dial.png Binary files differindex 9335011fe..9335011fe 100644 --- a/java/com/android/dialer/theme/res/drawable-xhdpi/empty_speed_dial.png +++ b/java/com/android/dialer/theme/common/res/drawable-xhdpi/empty_speed_dial.png diff --git a/java/com/android/dialer/theme/res/drawable-xxhdpi/empty_speed_dial.png b/java/com/android/dialer/theme/common/res/drawable-xxhdpi/empty_speed_dial.png Binary files differindex 04ab7b4dc..04ab7b4dc 100644 --- a/java/com/android/dialer/theme/res/drawable-xxhdpi/empty_speed_dial.png +++ b/java/com/android/dialer/theme/common/res/drawable-xxhdpi/empty_speed_dial.png diff --git a/java/com/android/dialer/theme/res/drawable/front_back_switch_button.xml b/java/com/android/dialer/theme/common/res/drawable/front_back_switch_button.xml index 2dc3eb1fa..56fafcaa6 100644 --- a/java/com/android/dialer/theme/res/drawable/front_back_switch_button.xml +++ b/java/com/android/dialer/theme/common/res/drawable/front_back_switch_button.xml @@ -1,4 +1,19 @@ <?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 + --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:name="front_back_switch_button" diff --git a/java/com/android/dialer/widget/res/values/colors.xml b/java/com/android/dialer/theme/common/res/drawable/front_back_switch_button_animation.xml index 70c3197cf..687061639 100644 --- a/java/com/android/dialer/widget/res/values/colors.xml +++ b/java/com/android/dialer/theme/common/res/drawable/front_back_switch_button_animation.xml @@ -14,11 +14,10 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> -<resources> - - <!-- Color of ripples used for views with light backgrounds --> - <color name="dialer_ripple_material_light">#30000000</color> - - <color name="empty_list_text_color">#b2b2b2</color> - <color name="empty_voicemail_icon_tint_color">#E1E1E1</color> -</resources>
\ No newline at end of file +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/front_back_switch_button"> + <target + android:name="layer_10_outlines" + android:animation="@anim/front_back_switch_button_animation"/> +</animated-vector>
\ No newline at end of file diff --git a/java/com/android/contacts/common/res/drawable/item_background_material_borderless_dark.xml b/java/com/android/dialer/theme/common/res/drawable/item_background_material_borderless_dark.xml index 94e309507..e18300e1a 100644 --- a/java/com/android/contacts/common/res/drawable/item_background_material_borderless_dark.xml +++ b/java/com/android/dialer/theme/common/res/drawable/item_background_material_borderless_dark.xml @@ -16,4 +16,4 @@ <!-- Based on the Theme.Material's default selectableItemBackgroundBorderless --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="@color/dialer_ripple_material_dark"/>
\ No newline at end of file + android:color="#A0FFFFFF"/>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/values/colors.xml b/java/com/android/dialer/theme/common/res/values/colors.xml index 7c62a2103..8f5976703 100644 --- a/java/com/android/dialer/theme/res/values/colors.xml +++ b/java/com/android/dialer/theme/common/res/values/colors.xml @@ -16,7 +16,7 @@ --> <!-- The colors in this file aren't configured at the theme level. --> <resources> - <color name="dialpad_fab_green">#00C853</color> + <color name="dialer_call_green">#00C853</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> @@ -26,6 +26,8 @@ <color name="notification_action_dismiss">#A52714</color> <color name="notification_action_answer_video">#097138</color> + <color name="dialer_red">#C53929</color> + <!-- Legacy --> <color name="blue_grey_100">#CFD8DC</color> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/values/dimens.xml b/java/com/android/dialer/theme/common/res/values/dimens.xml index 4abe4b53a..88b8a0423 100644 --- a/java/com/android/dialer/theme/res/values/dimens.xml +++ b/java/com/android/dialer/theme/common/res/values/dimens.xml @@ -54,8 +54,4 @@ <!-- 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/strings.xml b/java/com/android/dialer/theme/common/res/values/strings.xml index 7d7209207..7d7209207 100644 --- a/java/com/android/dialer/theme/res/values/strings.xml +++ b/java/com/android/dialer/theme/common/res/values/strings.xml diff --git a/java/com/android/dialer/theme/common/res/values/styles.xml b/java/com/android/dialer/theme/common/res/values/styles.xml new file mode 100644 index 000000000..2c6446ca1 --- /dev/null +++ b/java/com/android/dialer/theme/common/res/values/styles.xml @@ -0,0 +1,34 @@ +<?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> + <!-- TODO(calderwoodra): Delete this once new call log and new voicemail ship. --> + <!-- Ideally we would make a callLogCardStyle attribute but we don't want to expand dialer/app --> + <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> + + <!-- 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>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/common/res/values/text_styles.xml b/java/com/android/dialer/theme/common/res/values/text_styles.xml new file mode 100644 index 000000000..def5862d4 --- /dev/null +++ b/java/com/android/dialer/theme/common/res/values/text_styles.xml @@ -0,0 +1,98 @@ +<?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> + <!-- + - These are official UX approved text styles and all TextViews should inherit from one of these. + - If you think you don't see the style you need, double check with your UX designer. + --> + <style name="Dialer.TextAppearance.Header1" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">18sp</item> + <item name="android:fontFamily">sans-serif-regular</item> + </style> + + <style name="Dialer.TextAppearance.Header2" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">16sp</item> + <item name="android:fontFamily">sans-serif-medium</item> + </style> + + <style name="Dialer.TextAppearance.SubHeader" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">16sp</item> + <item name="android:fontFamily">sans-serif-medium</item> + </style> + + <style name="Dialer.TextAppearance.Primary" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">16sp</item> + <item name="android:fontFamily">sans-serif-regular</item> + </style> + + <style name="Dialer.TextAppearance.Secondary" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorSecondary</item> + <item name="android:textSize">14sp</item> + <item name="android:fontFamily">sans-serif-regular</item> + </style> + + <style name="Dialer.TextAppearance.Secondary2" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorSecondary</item> + <item name="android:textSize">12sp</item> + <item name="android:fontFamily">sans-serif-regular</item> + </style> + + <style name="Dialer.TextAppearance.OVERLINE" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorSecondary</item> + <item name="android:textSize">14sp</item> + <item name="android:fontFamily">sans-serif-medium</item> + </style> + + <style name="Dialer.TextAppearance.Header1.Ellipsize"> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.Header2.Ellipsize"> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.SubHeader.Ellipsize"> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.Primary.Ellipsize"> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.Secondary.Ellipsize"> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.Secondary2.Ellipsize"> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.OVERLINE.Ellipsize"> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> +</resources>
\ No newline at end of file diff --git a/java/com/android/incallui/video/impl/res/values/colors.xml b/java/com/android/dialer/theme/hidden/AndroidManifest.xml index 874bf9404..ec46a3a95 100644 --- a/java/com/android/incallui/video/impl/res/values/colors.xml +++ b/java/com/android/dialer/theme/hidden/AndroidManifest.xml @@ -1,6 +1,5 @@ -<?xml version="1.0" encoding="utf-8"?> <!-- - ~ Copyright (C) 2017 The Android Open Source Project + ~ 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. @@ -14,7 +13,4 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - -<resources> - <color name="videocall_camera_off_tint">#89ffffff</color> -</resources> +<manifest package="com.android.dialer.theme.hidden"/> diff --git a/java/com/android/incallui/rtt/impl/res/color/submit_button_background_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml index 0da2c374a..82e79c631 100644 --- a/java/com/android/incallui/rtt/impl/res/color/submit_button_background_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml @@ -14,8 +14,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> +<!-- Primary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" - android:color="#BDBDBD" /> - <item android:color="#FFFFFF" /> -</selector>
\ No newline at end of file + <item android:state_enabled="false" android:color="@color/dialer_dark_text_color_disabled"/> + <item android:color="@color/dialer_dark_primary_text_color_enabled"/> +</selector> diff --git a/java/com/android/contacts/common/res/color/tab_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml index 71ef3e903..d057f9e65 100644 --- a/java/com/android/contacts/common/res/color/tab_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - ~ Copyright (C) 2014 The Android Open Source Project + ~ 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. @@ -14,8 +14,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - +<!-- Secondary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/actionbar_text_color" android:state_selected="true"/> - <item android:color="@color/actionbar_unselected_text_color"/> -</selector>
\ No newline at end of file + <item android:state_enabled="false" android:color="@color/dialer_dark_text_color_disabled"/> + <item android:color="@color/dialer_dark_secondary_text_color_enabled"/> +</selector> diff --git a/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_primary_text_color.xml index 6612b17ab..6612b17ab 100644 --- a/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_primary_text_color.xml diff --git a/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_secondary_text_color.xml index e1c000aef..e1c000aef 100644 --- a/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_secondary_text_color.xml diff --git a/java/com/android/dialer/theme/res/color/settings_text_color_primary.xml b/java/com/android/dialer/theme/hidden/res/color/settings_text_color_primary.xml index ba259088a..7a14d22fa 100644 --- a/java/com/android/dialer/theme/res/color/settings_text_color_primary.xml +++ b/java/com/android/dialer/theme/hidden/res/color/settings_text_color_primary.xml @@ -18,6 +18,6 @@ --> <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"/> + <item android:color="@color/dialer_text_color_disabled" android:state_enabled="false"/> + <item android:color="@color/dialer_primary_text_color_enabled"/> </selector> diff --git a/java/com/android/dialer/theme/res/color/settings_text_color_secondary.xml b/java/com/android/dialer/theme/hidden/res/color/settings_text_color_secondary.xml index 2f7899272..c4baefd33 100644 --- a/java/com/android/dialer/theme/res/color/settings_text_color_secondary.xml +++ b/java/com/android/dialer/theme/hidden/res/color/settings_text_color_secondary.xml @@ -18,6 +18,6 @@ --> <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"/> + <item android:color="@color/dialer_text_color_disabled" android:state_enabled="false"/> + <item android:color="@color/dialer_secondary_text_color_enabled"/> </selector> diff --git a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_dark.xml b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_dark.xml new file mode 100644 index 000000000..7dc894be9 --- /dev/null +++ b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_dark.xml @@ -0,0 +1,40 @@ +<!-- + ~ 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> + <!-- Essential theme colors --> + <color name="dialer_dark_theme_color">#2A56C6</color> + <color name="dialer_dark_theme_color_dark">#1C3AA9</color> + <color name="dialer_dark_secondary_color">#F50057</color> + <color name="dialer_dark_theme_color_20pct">#332A56C6</color> + + <!-- Text colors --> + <color name="dialer_dark_primary_text_color_enabled">#FFFFFF</color> + <color name="dialer_dark_secondary_text_color_enabled">#DDFFFFFF</color> + <color name="dialer_dark_text_color_disabled">#333333</color> + <color name="dialer_dark_text_hint_color">#DE78909C</color> + <color name="dialer_dark_primary_text_color_inverse">#212121</color> + <color name="dialer_dark_secondary_text_color_inverse">#636363</color> + <color name="dialer_dark_snackbar_action_text_color">#4285F4</color> + + <!-- Background colors --> + <color name="dialer_dark_background">#212121</color> + <color name="dialer_dark_background_floating">#000000</color> + + <!-- Other useful colors --> + <color name="dialer_dark_icon_color">#C4000000</color> + <color name="dialer_icon_color_secondary">#E1E1E1</color> + <color name="dialer_icon_color_white">#FFFFFF</color> +</resources> diff --git a/java/com/android/dialer/theme/res/values/colors_dialer_light.xml b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml index ea8247414..1d5a1e7ee 100644 --- a/java/com/android/dialer/theme/res/values/colors_dialer_light.xml +++ b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml @@ -40,16 +40,12 @@ <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> + <color name="dialer_icon_color_secondary">#E1E1E1</color> + <color name="dialer_icon_color_white">#FFFFFF</color> </resources> diff --git a/java/com/android/dialer/theme/hidden/res/values/styles.xml b/java/com/android/dialer/theme/hidden/res/values/styles.xml new file mode 100644 index 000000000..90e452993 --- /dev/null +++ b/java/com/android/dialer/theme/hidden/res/values/styles.xml @@ -0,0 +1,59 @@ +<?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> + <!-- Update to Theme.AppCompat.Light.NoActionBar once we no longer depend on ActionBars. --> + <style name="Dialer" parent="Theme.AppCompat.Light"> + <!-- Used to automatically style all buttons in Dialer --> + <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> + <item name="android:colorButtonNormal">?android:attr/colorPrimary</item> + + <!-- Used to style link text --> + <item name="android:textColorLink">@color/dialer_theme_color</item> + + <!-- Used to automatically style AlertDialogs --> + <item name="alertDialogTheme">@style/AlertDialogTheme</item> + <item name="android:alertDialogTheme">@style/AlertDialogTheme</item> + </style> + + <style name="Dialer.Dark" parent="Theme.AppCompat"> + <!-- Used to automatically style all buttons in Dialer --> + <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> + <item name="android:colorButtonNormal">?android:attr/colorPrimary</item> + + <!-- Used to style link text --> + <item name="android:textColorLink">@color/dialer_theme_color</item> + + <!-- Used to automatically style AlertDialogs --> + <item name="alertDialogTheme">@style/AlertDialogTheme</item> + <item name="android:alertDialogTheme">@style/AlertDialogTheme</item> + </style> + + <!-- Used to style all Dialer's button's text. Every button is awarded this for free if the parent + activity's theme extends from Dialer.ThemeBase(.NoActionBar) or doesn't specify a theme. --> + <style name="DialerButtonTextStyle" parent="@android:style/TextAppearance.Material.Widget.Button"> + <item name="android:textColor">?android:attr/textColorPrimaryInverse</item> + </style> + + <!-- Used to style all Dialer's AlertDialogs. Every button is awarded this for free if the parent + activity's theme extends from Dialer.ThemeBase(.NoActionBar) or doesn't specify a theme. --> + <style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert"> + <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> + <!-- TODO(a bug): figure out why ?android:attr/colorPrimary doesn't work here --> + <item name="android:colorAccent">@color/dialer_theme_color</item> + <item name="colorAccent">@color/dialer_theme_color</item> + </style> +</resources> diff --git a/java/com/android/dialer/theme/res/anim/front_back_switch_button_animation.xml b/java/com/android/dialer/theme/res/anim/front_back_switch_button_animation.xml deleted file mode 100644 index 30986457b..000000000 --- a/java/com/android/dialer/theme/res/anim/front_back_switch_button_animation.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<set - xmlns:android="http://schemas.android.com/apk/res/android"> - <set - android:ordering="sequentially"> - <objectAnimator - android:duration="500" - android:propertyName="rotation" - android:valueFrom="0.0" - android:valueTo="-180.0" - android:valueType="floatType" - android:interpolator="@android:interpolator/fast_out_slow_in"/> - </set> -</set>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/animator/activated_button_elevation.xml b/java/com/android/dialer/theme/res/animator/activated_button_elevation.xml deleted file mode 100644 index b8ea4e8e6..000000000 --- a/java/com/android/dialer/theme/res/animator/activated_button_elevation.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:state_enabled="true" - android:state_activated="true"> - <objectAnimator - android:duration="@android:integer/config_shortAnimTime" - android:propertyName="translationZ" - android:valueFrom="0dp" - android:valueTo="4dp" - android:valueType="floatType"/> - </item> - <item> - <objectAnimator - android:duration="@android:integer/config_shortAnimTime" - android:propertyName="translationZ" - android:valueFrom="4dp" - android:valueTo="0dp" - android:valueType="floatType"/> - </item> -</selector> diff --git a/java/com/android/dialer/theme/res/drawable/front_back_switch_button_animation.xml b/java/com/android/dialer/theme/res/drawable/front_back_switch_button_animation.xml deleted file mode 100644 index 14cda1ba8..000000000 --- a/java/com/android/dialer/theme/res/drawable/front_back_switch_button_animation.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<animated-vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/front_back_switch_button"> - <target - android:name="layer_10_outlines" - android:animation="@anim/front_back_switch_button_animation"/> -</animated-vector>
\ No newline at end of file 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 deleted file mode 100644 index 6ce3b1960..000000000 --- a/java/com/android/dialer/theme/res/values/styles_dialer_light.xml +++ /dev/null @@ -1,110 +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">?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 deleted file mode 100644 index ab4ae936d..000000000 --- a/java/com/android/dialer/theme/res/values/theme_dialer_light.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?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"> - <!-- 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> - <item name="android:textColorLink">@color/dialer_theme_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 for material buttons and widgets --> - <item name="android:colorButtonNormal">@color/dialer_theme_color</item> - <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</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/voicemail/listui/NewVoicemailFragment.java b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java index 243dc6a86..87b0a6343 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java @@ -207,7 +207,6 @@ public final class NewVoicemailFragment extends Fragment implements LoaderCallba emptyContentView.setDescription((R.string.empty_voicemail_tab_text)); emptyContentView.setImage(R.drawable.quantum_ic_voicemail_vd_theme_24); - emptyContentView.setImageTint(R.color.empty_voicemail_icon_tint_color, null); } private void showView(View view) { diff --git a/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java b/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java index 973f9b1a8..dd53dffc5 100644 --- a/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java +++ b/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java @@ -80,7 +80,10 @@ public class VoicemailEntryText { } secondaryText.append( CallLogDates.newCallLogTimestampLabel( - context, clock.currentTimeMillis(), voicemailEntry.getTimestamp())); + context, + clock.currentTimeMillis(), + voicemailEntry.getTimestamp(), + /* abbreviateDateTime = */ true)); long duration = voicemailEntry.getDuration(); if (duration >= 0) { diff --git a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml index 0a9b49c5d..dab2f2113 100644 --- a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml +++ b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml @@ -53,21 +53,18 @@ <TextView android:id="@+id/error_card_header" - android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/voicemail_promo_card_title_padding" android:layout_gravity="center_vertical" - android:singleLine="false" - android:textSize="@dimen/voicemail_promo_card_title_text_size"/> + style="@style/Dialer.TextAppearance.Header2"/> <TextView android:id="@+id/error_card_details" android:layout_width="wrap_content" android:layout_height="wrap_content" android:lineSpacingExtra="@dimen/voicemail_promo_card_line_spacing" - android:singleLine="false" - android:textSize="@dimen/voicemail_promo_card_message_size"/> + style="@style/Dialer.TextAppearance.Secondary"/> </LinearLayout> </LinearLayout> diff --git a/java/com/android/dialer/voicemail/listui/error/res/values/styles.xml b/java/com/android/dialer/voicemail/listui/error/res/values/styles.xml index 95866dfab..4267e8cd0 100644 --- a/java/com/android/dialer/voicemail/listui/error/res/values/styles.xml +++ b/java/com/android/dialer/voicemail/listui/error/res/values/styles.xml @@ -56,7 +56,7 @@ </style> <style name="TosTitleStyle"> - <item name="android:textColor">@color/primary_text_color</item> + <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textSize">20sp</item> <item name="android:fontFamily">"sans-serif-medium"</item> </style> @@ -75,7 +75,7 @@ <style name="TosDetailsTextStyle"> <item name="android:textSize">12sp</item> - <item name="android:textColor">@color/dialer_secondary_text_color</item> + <item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:fontFamily">"sans-serif-regular"</item> <item name="android:lineSpacingExtra">12sp</item> </style> diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml index b5e095ba4..95711e041 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml @@ -39,14 +39,12 @@ <TextView android:id="@+id/primary_text" - style="@style/Dialer.TextAppearance.Primary" + style="@style/Dialer.TextAppearance.Primary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="14dp" android:layout_marginEnd="6dp" - android:ellipsize="end" - android:lineSpacingMultiplier="1.5" - android:singleLine="true"/> + android:lineSpacingMultiplier="1.5"/> <LinearLayout android:layout_width="wrap_content" @@ -66,12 +64,10 @@ <TextView android:id="@+id/secondary_text" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:ellipsize="end" - android:lineSpacingMultiplier="1.4" - android:singleLine="true"/> + android:lineSpacingMultiplier="1.4"/> </LinearLayout> <!-- TODO(a bug): Make text selectable --> @@ -110,5 +106,5 @@ android:contentDescription="@string/a11y_voicemail_entry_expand_menu" android:scaleType="center" android:src="@drawable/quantum_ic_more_vert_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> </RelativeLayout> diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_alert.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_alert.xml index 109cecc2c..1df8b2cdb 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_alert.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_alert.xml @@ -50,23 +50,20 @@ <TextView android:id="@+id/voicemail_alert_header" - android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/voicemail_promo_card_title_padding" android:layout_gravity="center_vertical" - android:singleLine="false" android:text="Voicemail Alert" - android:textSize="@dimen/voicemail_promo_card_title_text_size"/> + style="@style/Dialer.TextAppearance.Header2"/> <TextView android:id="@+id/voicemail_alert_details" android:layout_width="wrap_content" android:layout_height="wrap_content" android:lineSpacingExtra="@dimen/voicemail_promo_card_line_spacing" - android:singleLine="false" android:text="This is a voicemail alert message." - android:textSize="@dimen/voicemail_promo_card_message_size"/> + style="@style/Dialer.TextAppearance.Secondary"/> </LinearLayout> </LinearLayout> diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_header.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_header.xml index 7e4fe62cf..70ca2ac40 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_header.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_header.xml @@ -21,7 +21,7 @@ android:layout_height="wrap_content"> <TextView android:id="@+id/new_voicemail_header_text" - style="@style/SubHeader" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" diff --git a/java/com/android/dialer/voicemail/listui/res/values/styles.xml b/java/com/android/dialer/voicemail/listui/res/values/styles.xml index 386992788..cbc010266 100644 --- a/java/com/android/dialer/voicemail/listui/res/values/styles.xml +++ b/java/com/android/dialer/voicemail/listui/res/values/styles.xml @@ -24,7 +24,7 @@ </style> <style name="TosTitleStyle"> - <item name="android:textColor">@color/primary_text_color</item> + <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textSize">20sp</item> <item name="android:fontFamily">"sans-serif-medium"</item> </style> diff --git a/java/com/android/dialer/widget/DialerToolbar.java b/java/com/android/dialer/widget/DialerToolbar.java index fe0e86110..02ec8c02c 100644 --- a/java/com/android/dialer/widget/DialerToolbar.java +++ b/java/com/android/dialer/widget/DialerToolbar.java @@ -23,6 +23,7 @@ import android.support.annotation.StringRes; import android.support.v7.widget.Toolbar; import android.util.AttributeSet; import android.widget.TextView; +import com.android.dialer.theme.base.ThemeComponent; /** Toolbar widget for Dialer. */ public class DialerToolbar extends Toolbar { @@ -37,7 +38,7 @@ public class DialerToolbar extends Toolbar { subtitle = (TextView) findViewById(R.id.subtitle); setElevation(getResources().getDimensionPixelSize(R.dimen.toolbar_elevation)); - setBackgroundColor(getResources().getColor(R.color.dialer_theme_color)); + setBackgroundColor(ThemeComponent.get(context).theme().getColorPrimary()); setNavigationIcon(R.drawable.quantum_ic_close_white_24); setNavigationContentDescription(R.string.toolbar_close); setNavigationOnClickListener(v -> ((Activity) context).finish()); diff --git a/java/com/android/dialer/widget/EmptyContentView.java b/java/com/android/dialer/widget/EmptyContentView.java index b99657a10..c0f9c9cac 100644 --- a/java/com/android/dialer/widget/EmptyContentView.java +++ b/java/com/android/dialer/widget/EmptyContentView.java @@ -18,9 +18,6 @@ package com.android.dialer.widget; import android.content.Context; import android.content.res.ColorStateList; -import android.content.res.Resources.Theme; -import android.support.annotation.ColorRes; -import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.util.AttributeSet; import android.view.LayoutInflater; @@ -28,6 +25,7 @@ import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import com.android.dialer.theme.base.ThemeComponent; public class EmptyContentView extends LinearLayout implements View.OnClickListener { @@ -68,6 +66,9 @@ public class EmptyContentView extends LinearLayout implements View.OnClickListen descriptionView = (TextView) findViewById(R.id.empty_list_view_message); actionView = (TextView) findViewById(R.id.empty_list_view_action); actionView.setOnClickListener(this); + + imageView.setImageTintList( + ColorStateList.valueOf(ThemeComponent.get(context).theme().getColorIconSecondary())); } public void setDescription(int resourceId) { @@ -90,11 +91,6 @@ public class EmptyContentView extends LinearLayout implements View.OnClickListen } } - public void setImageTint(@ColorRes int color, @Nullable Theme theme) { - imageView.setImageTintList( - (ColorStateList.valueOf(getContext().getResources().getColor(color, theme)))); - } - public void setActionLabel(@StringRes int resourceId) { actionLabel = resourceId; if (resourceId == NO_LABEL) { diff --git a/java/com/android/dialer/widget/res/drawable/ripple_material_light.xml b/java/com/android/dialer/widget/res/drawable/ripple_material_light.xml deleted file mode 100644 index 175624c8b..000000000 --- a/java/com/android/dialer/widget/res/drawable/ripple_material_light.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2014 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 - --> - -<ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="@color/dialer_ripple_material_light"> - <item android:id="@android:id/mask"> - <color android:color="@android:color/white"/> - </item> -</ripple> diff --git a/java/com/android/dialer/widget/res/layout-land/empty_content_view.xml b/java/com/android/dialer/widget/res/layout-land/empty_content_view.xml index 3a7574f53..84e6fc825 100644 --- a/java/com/android/dialer/widget/res/layout-land/empty_content_view.xml +++ b/java/com/android/dialer/widget/res/layout-land/empty_content_view.xml @@ -32,7 +32,7 @@ android:paddingLeft="16dp" android:paddingRight="16dp" android:gravity="center_horizontal|top" - android:textColor="@color/empty_list_text_color" + android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/empty_list_message_text_size"/> <TextView diff --git a/java/com/android/dialer/widget/res/layout/contact_photo_view.xml b/java/com/android/dialer/widget/res/layout/contact_photo_view.xml index 320d06b98..e13388649 100644 --- a/java/com/android/dialer/widget/res/layout/contact_photo_view.xml +++ b/java/com/android/dialer/widget/res/layout/contact_photo_view.xml @@ -68,7 +68,7 @@ android:layout_height="13dp" android:layout_gravity="center" android:src="@drawable/quantum_ic_rtt_vd_theme_24" - android:tint="@android:color/white" + android:tint="?android:attr/colorBackground" tools:ignore="ContentDescription"/> </FrameLayout> </FrameLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml b/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml index 0540a00bc..a75176a22 100644 --- a/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml +++ b/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml @@ -28,19 +28,15 @@ android:layout_height="wrap_content" android:gravity="top" android:textSize="@dimen/toolbar_title_text_size" - android:textColor="?android:attr/colorBackground" - android:fontFamily="sans-serif-medium" - android:maxLines="1" - android:ellipsize="end"/> + android:textColor="?android:attr/textColorPrimaryInverse" + style="@style/Dialer.TextAppearance.Header2"/> <TextView android:id="@+id/subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="@dimen/toolbar_subtitle_text_size" - android:textColor="?android:attr/colorBackground" + android:textColor="?android:attr/textColorPrimaryInverse" android:visibility="gone" - android:maxLines="1" - android:ellipsize="end"/> + style="@style/Dialer.TextAppearance.Secondary.Ellipsize"/> </LinearLayout> </merge>
\ No newline at end of file diff --git a/java/com/android/dialer/widget/res/layout/empty_content_view.xml b/java/com/android/dialer/widget/res/layout/empty_content_view.xml index 9aac6f48f..57bb2fd5c 100644 --- a/java/com/android/dialer/widget/res/layout/empty_content_view.xml +++ b/java/com/android/dialer/widget/res/layout/empty_content_view.xml @@ -30,7 +30,7 @@ android:paddingLeft="16dp" android:paddingRight="16dp" android:gravity="center_horizontal|top" - android:textColor="@color/empty_list_text_color" + android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/empty_list_message_text_size"/> <TextView diff --git a/java/com/android/dialer/widget/res/layout/fragment_message.xml b/java/com/android/dialer/widget/res/layout/fragment_message.xml index 388a8d55a..1004fa8f9 100644 --- a/java/com/android/dialer/widget/res/layout/fragment_message.xml +++ b/java/com/android/dialer/widget/res/layout/fragment_message.xml @@ -52,7 +52,7 @@ android:padding="@dimen/textview_item_padding" android:textSize="@dimen/message_item_text_size" android:hint="@string/custom_message_hint" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textColorHint="?android:attr/textColorHint" android:background="?android:attr/colorBackground" android:textCursorDrawable="@drawable/edittext_custom_cursor" diff --git a/java/com/android/dialer/widget/res/layout/selectable_text_view.xml b/java/com/android/dialer/widget/res/layout/selectable_text_view.xml index 9cdb162b6..5e13d9a5e 100644 --- a/java/com/android/dialer/widget/res/layout/selectable_text_view.xml +++ b/java/com/android/dialer/widget/res/layout/selectable_text_view.xml @@ -19,7 +19,6 @@ android:id="@+id/selectable_text_view" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="16sp" - android:textColor="@color/dialer_primary_text_color" + style="@style/Dialer.TextAppearance.Primary" android:padding="16dp" - android:background="@drawable/ripple_material_light"/>
\ No newline at end of file + android:background="?android:selectableItemBackground"/>
\ No newline at end of file diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index 83c1aff5e..6614e7c74 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -321,9 +321,7 @@ public class CallCardPresenter } this.primary.addListener(this); - primaryContactInfo = - ContactInfoCache.buildCacheEntryFromCall( - context, this.primary, this.primary.getState() == DialerCallState.INCOMING); + primaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(context, this.primary); updatePrimaryDisplayInfo(); maybeStartSearch(this.primary, true); } @@ -339,9 +337,7 @@ public class CallCardPresenter updateSecondaryDisplayInfo(); } else { // secondary call has changed - secondaryContactInfo = - ContactInfoCache.buildCacheEntryFromCall( - context, this.secondary, this.secondary.getState() == DialerCallState.INCOMING); + secondaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(context, this.secondary); updateSecondaryDisplayInfo(); maybeStartSearch(this.secondary, false); } @@ -726,6 +722,7 @@ public class CallCardPresenter : null) .setLabel(isChildNumberShown || isCallSubjectShown ? null : primaryContactInfo.label) .setPhoto(primaryContactInfo.photo) + .setPhotoUri(primaryContactInfo.displayPhotoUri) .setPhotoType(primaryContactInfo.photoType) .setIsSipCall(primaryContactInfo.isSipCall) .setIsContactPhotoShown(showContactPhoto) diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java index 5318fdb5f..c71bf59b2 100644 --- a/java/com/android/incallui/ConferenceParticipantListAdapter.java +++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java @@ -397,9 +397,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { newCallIds.add(callId); ContactCacheEntry contactCache = cache.getInfo(callId); if (contactCache == null) { - contactCache = - ContactInfoCache.buildCacheEntryFromCall( - getContext(), call, call.getState() == DialerCallState.INCOMING); + contactCache = ContactInfoCache.buildCacheEntryFromCall(getContext(), call); } if (participantsByCallId.containsKey(callId)) { diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java index 81c7b724d..f01bddd58 100644 --- a/java/com/android/incallui/ContactInfoCache.java +++ b/java/com/android/incallui/ContactInfoCache.java @@ -138,8 +138,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { return cache; } - static ContactCacheEntry buildCacheEntryFromCall( - Context context, DialerCall call, boolean isIncoming) { + static ContactCacheEntry buildCacheEntryFromCall(Context context, DialerCall call) { final ContactCacheEntry entry = new ContactCacheEntry(); // TODO: get rid of caller info. @@ -837,7 +836,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { final PhoneNumberServiceListener listener = new PhoneNumberServiceListener(callId, queryToken.queryId); cacheEntry.hasPendingQuery = true; - phoneNumberService.getPhoneNumberInfo(cacheEntry.number, listener, listener, isIncoming); + phoneNumberService.getPhoneNumberInfo(cacheEntry.number, listener); } sendInfoNotifications(callId, cacheEntry); if (!cacheEntry.hasPendingQuery) { @@ -855,8 +854,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { } } - class PhoneNumberServiceListener - implements PhoneNumberService.NumberLookupListener, PhoneNumberService.ImageLookupListener { + class PhoneNumberServiceListener implements PhoneNumberService.NumberLookupListener { private final String callId; private final int queryIdOfRemoteLookup; @@ -924,17 +922,6 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { clearCallbacks(callId); } } - - @Override - public void onImageFetchComplete(Bitmap bitmap) { - Log.d(TAG, "PhoneNumberServiceListener.onImageFetchComplete"); - if (!isWaitingForThisQuery(callId, queryIdOfRemoteLookup)) { - return; - } - CallerInfoQueryToken queryToken = new CallerInfoQueryToken(queryIdOfRemoteLookup, callId); - loadImage(null, bitmap, queryToken); - onImageLoadComplete(TOKEN_UPDATE_PHOTO_FOR_CALL_STATE, null, bitmap, queryToken); - } } private boolean needForceQuery(DialerCall call, ContactCacheEntry cacheEntry) { diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java index 8c882d2a3..10c4a6490 100644 --- a/java/com/android/incallui/ExternalCallNotifier.java +++ b/java/com/android/incallui/ExternalCallNotifier.java @@ -45,6 +45,7 @@ import com.android.dialer.contactphoto.BitmapUtil; import com.android.dialer.notification.DialerNotificationManager; import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.telecom.TelecomCallUtil; +import com.android.dialer.theme.base.ThemeComponent; import com.android.incallui.call.DialerCall; import com.android.incallui.call.DialerCallDelegate; import com.android.incallui.call.ExternalCallList; @@ -239,7 +240,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen builder.setSmallIcon(R.drawable.quantum_ic_call_white_24); builder.setContentTitle(info.getContentTitle()); builder.setLargeIcon(info.getLargeIcon()); - builder.setColor(context.getResources().getColor(R.color.dialer_theme_color)); + builder.setColor(ThemeComponent.get(context).theme().getColorPrimary()); builder.addPerson(info.getPersonReference()); if (BuildCompat.isAtLeastO()) { builder.setChannelId(NotificationChannelId.DEFAULT); @@ -275,7 +276,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen */ Notification.Builder publicBuilder = new Notification.Builder(context); publicBuilder.setSmallIcon(R.drawable.quantum_ic_call_white_24); - publicBuilder.setColor(context.getResources().getColor(R.color.dialer_theme_color)); + publicBuilder.setColor(ThemeComponent.get(context).theme().getColorPrimary()); if (BuildCompat.isAtLeastO()) { publicBuilder.setChannelId(NotificationChannelId.DEFAULT); } diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index da5d20fa3..5aabf0694 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -365,8 +365,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud addListener(this.proximitySensor); if (themeColorManager == null) { - themeColorManager = - new ThemeColorManager(new InCallUIMaterialColorMapUtils(this.context.getResources())); + themeColorManager = new ThemeColorManager(new InCallUIMaterialColorMapUtils(this.context)); } this.callList = callList; 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++) { diff --git a/java/com/android/incallui/ReturnToCallController.java b/java/com/android/incallui/ReturnToCallController.java index 7c4585ca1..09e1845aa 100644 --- a/java/com/android/incallui/ReturnToCallController.java +++ b/java/com/android/incallui/ReturnToCallController.java @@ -35,6 +35,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.theme.base.ThemeComponent; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback; import com.android.incallui.InCallPresenter.InCallState; @@ -288,7 +289,7 @@ public class ReturnToCallController implements InCallUiListener, Listener, Audio private BubbleInfo generateBubbleInfo() { return BubbleInfo.builder() - .setPrimaryColor(context.getResources().getColor(R.color.dialer_theme_color, null)) + .setPrimaryColor(ThemeComponent.get(context).theme().getColorPrimary()) .setPrimaryIcon(Icon.createWithResource(context, R.drawable.on_going_call)) .setStartingYPosition( InCallPresenter.getInstance().shouldStartInBubbleMode() @@ -302,7 +303,7 @@ public class ReturnToCallController implements InCallUiListener, Listener, Audio private BubbleInfo generateBubbleInfoForBackgroundCalling() { return BubbleInfo.builder() - .setPrimaryColor(context.getResources().getColor(R.color.dialer_theme_color, null)) + .setPrimaryColor(ThemeComponent.get(context).theme().getColorPrimary()) .setPrimaryIcon(Icon.createWithResource(context, R.drawable.on_going_call)) .setStartingYPosition(context.getResources().getDisplayMetrics().heightPixels / 2) .setActions(generateActions()) diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 32d202595..27d23c4ae 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -75,6 +75,7 @@ import com.android.dialer.lettertile.LetterTileDrawable.ContactType; import com.android.dialer.multimedia.MultimediaData; import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.oem.MotorolaUtils; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.DrawableConverter; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback; @@ -333,7 +334,7 @@ public class StatusBarNotifier Notification.Builder publicBuilder = new Notification.Builder(context); publicBuilder .setSmallIcon(iconResId) - .setColor(context.getResources().getColor(R.color.dialer_theme_color, context.getTheme())) + .setColor(ThemeComponent.get(context).theme().getColorPrimary()) // Hide work call state for the lock screen notification .setContentTitle(getContentString(call, ContactsUtils.USER_TYPE_CURRENT)); setNotificationWhen(call, callState, publicBuilder); diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java index d44a5daa2..18e0e9864 100644 --- a/java/com/android/incallui/answer/impl/AnswerFragment.java +++ b/java/com/android/incallui/answer/impl/AnswerFragment.java @@ -49,6 +49,8 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; import com.android.dialer.common.Assert; import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; @@ -82,6 +84,8 @@ import com.android.incallui.incalluilock.InCallUiLock; import com.android.incallui.maps.MapsComponent; import com.android.incallui.sessiondata.AvatarPresenter; import com.android.incallui.sessiondata.MultimediaFragment; +import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon; +import com.android.incallui.speakeasy.Annotations.SpeakEasyText; import com.android.incallui.speakeasy.SpeakEasyComponent; import com.android.incallui.util.AccessibilityUtil; import com.android.incallui.video.protocol.VideoCallScreen; @@ -144,6 +148,9 @@ public class AnswerFragment extends Fragment private View importanceBadge; private SwipeButtonView secondaryButton; private SwipeButtonView answerAndReleaseButton; + private LinearLayout chipLayout; + private ImageView chipIcon; + private TextView chipText; private AffordanceHolderLayout affordanceHolderLayout; // Use these flags to prevent user from clicking accept/reject buttons multiple times. // We use separate flags because in some rare cases accepting a call may fail to join the room, @@ -195,17 +202,6 @@ public class AnswerFragment extends Fragment public void performAction(AnswerFragment fragment) { fragment.performAnswerAndRelease(); } - }, - - SPEAKEASY( - R.drawable.quantum_ic_rtt_vd_theme_24, - R.string.speakeasy_secondary_button_hint, - R.string.speakeasy_secondary_button_hint, - R.string.speakeasy_secondary_button_hint) { - @Override - public void performAction(AnswerFragment fragment) { - fragment.performSpeakEasy(); - } }; @DrawableRes public int icon; @@ -232,8 +228,7 @@ public class AnswerFragment extends Fragment } } - private void performSpeakEasy() { - restoreAnswerAndReleaseButtonAnimation(); + private void performSpeakEasy(View unused) { answerScreenDelegate.onSpeakEasyCall(); buttonAcceptClicked = true; } @@ -457,16 +452,6 @@ public class AnswerFragment extends Fragment if (allowAnswerAndRelease()) { answerAndReleaseButton.setVisibility(View.VISIBLE); answerScreenDelegate.onAnswerAndReleaseButtonEnabled(); - } else if (allowSpeakEasy()) { - Optional<Integer> alternativeIcon = SpeakEasyComponent.get(getContext()).speakEasyIcon(); - if (alternativeIcon.isPresent()) { - // TODO(erfanian): Replace enum hack when we have a dedicated button. - SecondaryBehavior.SPEAKEASY.icon = alternativeIcon.get(); - } - answerAndReleaseBehavior = SecondaryBehavior.SPEAKEASY; - answerAndReleaseBehavior.applyToView(answerAndReleaseButton); - answerAndReleaseButton.setVisibility(View.VISIBLE); - answerScreenDelegate.onAnswerAndReleaseButtonEnabled(); } else { answerAndReleaseButton.setVisibility(View.INVISIBLE); answerScreenDelegate.onAnswerAndReleaseButtonDisabled(); @@ -480,6 +465,27 @@ public class AnswerFragment extends Fragment }); } + /** Initialize chip buttons */ + private void initChips() { + if (!allowSpeakEasy()) { + chipLayout.setVisibility(View.GONE); + return; + } + chipLayout.setVisibility(View.VISIBLE); + chipLayout.setOnClickListener(this::performSpeakEasy); + + @SpeakEasyIcon + Optional<Integer> alternativeIcon = SpeakEasyComponent.get(getContext()).speakEasyIcon(); + @SpeakEasyText + Optional<Integer> alternativeText = SpeakEasyComponent.get(getContext()).speakEasyText(); + if (alternativeIcon.isPresent() && alternativeText.isPresent()) { + chipIcon.setImageDrawable(getContext().getDrawable(alternativeIcon.get())); + chipText.setText(alternativeText.get()); + // The button needs to override normal swipe up/down behavior. + chipLayout.bringToFront(); + } + } + @Override public boolean allowAnswerAndRelease() { return getArguments().getBoolean(ARG_ALLOW_ANSWER_AND_RELEASE); @@ -715,6 +721,9 @@ public class AnswerFragment extends Fragment View view = inflater.inflate(R.layout.fragment_incoming_call, container, false); secondaryButton = (SwipeButtonView) view.findViewById(R.id.incoming_secondary_button); answerAndReleaseButton = (SwipeButtonView) view.findViewById(R.id.incoming_secondary_button2); + chipLayout = view.findViewById(R.id.incall_data_container_chip_container); + chipIcon = view.findViewById(R.id.incall_data_container_chip_icon); + chipText = view.findViewById(R.id.incall_data_container_chip_text); affordanceHolderLayout = (AffordanceHolderLayout) view.findViewById(R.id.incoming_container); affordanceHolderLayout.setAffordanceCallback(affordanceCallback); @@ -755,6 +764,7 @@ public class AnswerFragment extends Fragment .newAnswerScreenDelegate(this); initSecondaryButton(); + initChips(); int flags = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; if (!isInMultiWindowMode diff --git a/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml b/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml index 600115e27..2b3391dde 100644 --- a/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml +++ b/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml @@ -99,7 +99,7 @@ android:focusable="false" android:outlineProvider="none" android:src="@drawable/quantum_ic_call_white_24" - android:tint="@color/incoming_answer_icon" + android:tint="@color/dialer_call_green" android:tintMode="src_atop" tools:outlineProvider="background"/> diff --git a/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml b/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml new file mode 100644 index 000000000..3740f3d1b --- /dev/null +++ b/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml @@ -0,0 +1,44 @@ +<?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 + --> +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="#DADCE0"> + <item android:id="@android:id/mask"> + <shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="@color/dialer_background_light"/> + <padding + android:bottom="9dp" + android:left="8dp" + android:right="8dp" + android:top="9dp"/> + <corners android:radius="40dp"/> + </shape> + </item> + <item> + <shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="@color/dialer_background_floating_light"/> + <stroke + android:width="1dp" + android:color="#DADCE0"/> + <padding + android:bottom="9dp" + android:left="8dp" + android:right="8dp" + android:top="9dp"/> + <corners android:radius="40dp"/> + </shape> + </item> +</ripple>
\ No newline at end of file diff --git a/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml b/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml index 589a74325..944d290b1 100644 --- a/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml +++ b/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml @@ -53,6 +53,13 @@ android:layout_height="match_parent" android:fitsSystemWindows="true"> + <FrameLayout + android:id="@+id/answer_method_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipChildren="false" + android:clipToPadding="false"/> + <TextView android:id="@+id/videocall_video_off" android:layout_width="wrap_content" @@ -74,8 +81,8 @@ android:layout_marginTop="24dp" android:clipChildren="false" android:clipToPadding="false" - android:gravity="top|center_horizontal" android:focusable="true" + android:gravity="top|center_horizontal" android:orientation="vertical"> <include @@ -111,21 +118,22 @@ android:layout_marginStart="24dp" android:layout_marginEnd="24dp"/> + <!-- TODO(a bug): textColorPrimary or textColorPrimaryInverse? --> <TextView android:id="@+id/incall_important_call_badge" + android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="48dp" android:layout_marginTop="4dp" android:layout_marginBottom="@dimen/answer_importance_margin_bottom" - android:gravity="center" + android:background="@drawable/urgent_call_background" android:elevation="@dimen/answer_data_elevation" + android:gravity="center" android:maxLines="1" android:text="@string/call_incoming_important" android:textAllCaps="true" - android:textSize="14sp" - android:textStyle="bold" android:textColor="?android:attr/colorBackground" - android:background="@drawable/urgent_call_background"/> + android:textSize="14sp"/> <FrameLayout android:id="@+id/incall_location_holder" @@ -143,7 +151,34 @@ android:layout_height="0dp" android:layout_weight="1" android:clipChildren="false" - android:clipToPadding="false"/> + android:clipToPadding="false"> + <LinearLayout + android:id="@+id/incall_data_container_chip_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal|bottom" + android:background="@drawable/shape_chip_drawable" + android:clickable="true" + android:orientation="horizontal" + android:visibility="gone"> + <ImageView + android:id="@+id/incall_data_container_chip_icon" + android:layout_width="20dp" + android:layout_height="20dp" + android:src="@drawable/quantum_ic_rtt_vd_theme_24" + android:tint="#1A73E8"/> + <TextView + android:id="@+id/incall_data_container_chip_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:fontFamily="sans-serif-medium" + android:text="@string/speakeasy_secondary_button_hint" + android:textColor="@color/dialer_primary_text_color" + android:textSize="14sp"/> + </LinearLayout> + </FrameLayout> <!-- Space holder for answer method. This is used to get better scaling to make room for incall_data_container on different screen size. --> @@ -152,14 +187,6 @@ android:layout_height="220dp"/> </LinearLayout> - - <FrameLayout - android:id="@+id/answer_method_container" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:clipChildren="false" - android:clipToPadding="false"/> - </FrameLayout> <com.android.incallui.answer.impl.affordance.SwipeButtonView diff --git a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java index a561b5ee5..846834f63 100644 --- a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java +++ b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java @@ -39,6 +39,7 @@ import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.theme.base.ThemeComponent; import com.android.incallui.call.CallList; import com.android.incallui.call.DialerCall; import com.android.incallui.call.TelecomAdapter; @@ -154,7 +155,7 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment final int itemRoute, CallAudioState audioState, DialerImpression.Type impressionType) { - int selectedColor = getResources().getColor(R.color.dialer_theme_color); + int selectedColor = ThemeComponent.get(getContext()).theme().getColorPrimary(); if ((audioState.getSupportedRouteMask() & itemRoute) == 0) { item.setVisibility(View.GONE); } else if (audioState.getRoute() == itemRoute) { @@ -174,7 +175,7 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment } private TextView createBluetoothItem(BluetoothDevice bluetoothDevice, boolean selected) { - int selectedColor = getResources().getColor(R.color.dialer_theme_color); + int selectedColor = ThemeComponent.get(getContext()).theme().getColorPrimary(); TextView textView = (TextView) getLayoutInflater().inflate(R.layout.audioroute_item, null, false); textView.setText(getAliasName(bluetoothDevice)); diff --git a/java/com/android/incallui/audioroute/res/layout/audioroute_item.xml b/java/com/android/incallui/audioroute/res/layout/audioroute_item.xml index dfd795f04..3f3deb951 100644 --- a/java/com/android/incallui/audioroute/res/layout/audioroute_item.xml +++ b/java/com/android/incallui/audioroute/res/layout/audioroute_item.xml @@ -18,6 +18,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableStart="@drawable/quantum_ic_bluetooth_audio_vd_theme_24" - android:drawableTint="@color/material_grey_600" + android:drawableTint="?colorIcon" android:gravity="start" android:textAlignment="viewStart"/>
\ No newline at end of file diff --git a/java/com/android/incallui/bindings/PhoneNumberService.java b/java/com/android/incallui/bindings/PhoneNumberService.java index c40891a2c..2e1ae1f6c 100644 --- a/java/com/android/incallui/bindings/PhoneNumberService.java +++ b/java/com/android/incallui/bindings/PhoneNumberService.java @@ -16,7 +16,6 @@ package com.android.incallui.bindings; -import android.graphics.Bitmap; import com.android.dialer.logging.ContactLookupResult; /** Provides phone number lookup services. */ @@ -27,13 +26,8 @@ public interface PhoneNumberService { * * @param phoneNumber The phone number to lookup. * @param listener The listener to notify when the phone number lookup is complete. - * @param imageListener The listener to notify when the image lookup is complete. */ - void getPhoneNumberInfo( - String phoneNumber, - NumberLookupListener listener, - ImageLookupListener imageListener, - boolean isIncoming); + void getPhoneNumberInfo(String phoneNumber, NumberLookupListener listener); interface NumberLookupListener { @@ -45,16 +39,6 @@ public interface PhoneNumberService { void onPhoneNumberInfoComplete(PhoneNumberInfo info); } - interface ImageLookupListener { - - /** - * Callback when a image has been fetched. - * - * @param bitmap The fetched image. - */ - void onImageFetchComplete(Bitmap bitmap); - } - interface PhoneNumberInfo { String getDisplayName(); diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index da7c54d27..b2c8dcc67 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -80,7 +80,7 @@ import com.android.dialer.rtt.RttTranscriptUtil; import com.android.dialer.spam.status.SpamStatus; import com.android.dialer.telecom.TelecomCallUtil; import com.android.dialer.telecom.TelecomUtil; -import com.android.dialer.theme.R; +import com.android.dialer.theme.common.R; import com.android.dialer.time.Clock; import com.android.dialer.util.PermissionsUtil; import com.android.incallui.audiomode.AudioModeProvider; diff --git a/java/com/android/incallui/calllocation/impl/AndroidManifest.xml b/java/com/android/incallui/calllocation/impl/AndroidManifest.xml index fda940483..3e5a6d04e 100644 --- a/java/com/android/incallui/calllocation/impl/AndroidManifest.xml +++ b/java/com/android/incallui/calllocation/impl/AndroidManifest.xml @@ -19,6 +19,8 @@ package="com.android.incallui.calllocation.impl"> <application> + <!-- Fix for P --> + <uses-library android:name="org.apache.http.legacy" android:required="false" /> <meta-data android:name="com.google.android.gms.version" diff --git a/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java b/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java deleted file mode 100644 index c7249e0fa..000000000 --- a/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 - */ - -package com.android.incallui.calllocation.impl; - -import android.graphics.drawable.Drawable; -import android.location.Location; -import android.net.TrafficStats; -import android.os.AsyncTask; -import com.android.dialer.common.LogUtil; -import com.android.dialer.constants.TrafficStatsTags; -import com.android.incallui.calllocation.impl.LocationPresenter.LocationUi; -import java.io.InputStream; -import java.lang.ref.WeakReference; -import java.net.URL; - -class DownloadMapImageTask extends AsyncTask<Location, Void, Drawable> { - - private static final String STATIC_MAP_SRC_NAME = "src"; - - private final WeakReference<LocationUi> uiReference; - - public DownloadMapImageTask(WeakReference<LocationUi> uiReference) { - this.uiReference = uiReference; - } - - @Override - protected Drawable doInBackground(Location... locations) { - LocationUi ui = uiReference.get(); - if (ui == null) { - return null; - } - if (locations == null || locations.length == 0) { - LogUtil.e("DownloadMapImageTask.doInBackground", "No location provided"); - return null; - } - - try { - URL mapUrl = new URL(LocationUrlBuilder.getStaticMapUrl(ui.getContext(), locations[0])); - TrafficStats.setThreadStatsTag(TrafficStatsTags.DOWNLOAD_LOCATION_MAP_TAG); - InputStream content = (InputStream) mapUrl.getContent(); - - return Drawable.createFromStream(content, STATIC_MAP_SRC_NAME); - } catch (Exception ex) { - LogUtil.e("DownloadMapImageTask.doInBackground", "Exception!!!", ex); - return null; - } finally { - TrafficStats.clearThreadStatsTag(); - } - } - - @Override - protected void onPostExecute(Drawable mapImage) { - LocationUi ui = uiReference.get(); - if (ui == null) { - return; - } - - try { - ui.setMap(mapImage); - } catch (Exception ex) { - LogUtil.e("DownloadMapImageTask.onPostExecute", "Exception!!!", ex); - } - } -} diff --git a/java/com/android/incallui/calllocation/impl/LocationFragment.java b/java/com/android/incallui/calllocation/impl/LocationFragment.java index 6b2c876b0..760829da2 100644 --- a/java/com/android/incallui/calllocation/impl/LocationFragment.java +++ b/java/com/android/incallui/calllocation/impl/LocationFragment.java @@ -18,21 +18,26 @@ package com.android.incallui.calllocation.impl; import android.animation.LayoutTransition; import android.content.Context; -import android.graphics.drawable.Drawable; import android.location.Location; import android.os.Bundle; import android.os.Handler; +import android.support.annotation.NonNull; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.TextView; import android.widget.ViewAnimator; +import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.incallui.baseui.BaseFragment; +import com.google.android.gms.maps.CameraUpdateFactory; +import com.google.android.gms.maps.GoogleMap; +import com.google.android.gms.maps.MapView; +import com.google.android.gms.maps.model.LatLng; +import com.google.android.gms.maps.model.MarkerOptions; import java.util.Objects; import java.util.concurrent.TimeUnit; @@ -54,13 +59,16 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr private static final long FIND_LOCATION_SPINNING_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); private static final long LOAD_DATA_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); + private static final float MAP_ZOOM_LEVEL = 15f; + private ViewAnimator viewAnimator; - private ImageView locationMap; + private MapView locationMapView; private TextView addressLine1; private TextView addressLine2; private TextView latLongLine; private Location location; private ViewGroup locationLayout; + private GoogleMap savedGoogleMap; private boolean isMapSet; private boolean isAddressSet; @@ -101,11 +109,12 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr LogUtil.enterBlock("LocationFragment.onCreateView"); final View view = inflater.inflate(R.layout.location_fragment, container, false); viewAnimator = (ViewAnimator) view.findViewById(R.id.location_view_animator); - locationMap = (ImageView) view.findViewById(R.id.location_map); addressLine1 = (TextView) view.findViewById(R.id.address_line_one); addressLine2 = (TextView) view.findViewById(R.id.address_line_two); latLongLine = (TextView) view.findViewById(R.id.lat_long_line); locationLayout = (ViewGroup) view.findViewById(R.id.location_layout); + locationMapView = (MapView) view.findViewById(R.id.location_map_view); + locationMapView.onCreate(savedInstanceState); return view; } @@ -122,16 +131,46 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr handler.removeCallbacks(spinningTimeoutRunnable); } - @Override - public void setMap(Drawable mapImage) { + private void setMap(@NonNull Location location) { LogUtil.enterBlock("LocationFragment.setMap"); - isMapSet = true; - locationMap.setVisibility(View.VISIBLE); - locationMap.setImageDrawable(mapImage); + Assert.isNotNull(location); + + if (savedGoogleMap == null) { + locationMapView.getMapAsync( + (googleMap) -> { + LogUtil.enterBlock("LocationFragment.onMapReady"); + savedGoogleMap = googleMap; + savedGoogleMap.getUiSettings().setMapToolbarEnabled(false); + updateMap(location); + isMapSet = true; + locationMapView.setVisibility(View.VISIBLE); + + // Hide Google logo + View child = locationMapView.getChildAt(0); + if (child instanceof ViewGroup) { + // Only the first child (View) is useful. + // Google logo can be in any other child (ViewGroup). + for (int i = 1; i < ((ViewGroup) child).getChildCount(); ++i) { + ((ViewGroup) child).getChildAt(i).setVisibility(View.GONE); + } + } + }); + } else { + updateMap(location); + } displayWhenReady(); Logger.get(getContext()).logImpression(DialerImpression.Type.EMERGENCY_GOT_MAP); } + private void updateMap(@NonNull Location location) { + Assert.isNotNull(location); + Assert.isNotNull(savedGoogleMap); + LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); + savedGoogleMap.clear(); + savedGoogleMap.addMarker(new MarkerOptions().position(latLng).flat(true).draggable(false)); + savedGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, MAP_ZOOM_LEVEL)); + } + @Override public void setAddress(String address) { LogUtil.i("LocationFragment.setAddress", address); @@ -175,6 +214,7 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr R.string.lat_long_format, location.getLatitude(), location.getLongitude())); Logger.get(getContext()).logImpression(DialerImpression.Type.EMERGENCY_GOT_LOCATION); + setMap(location); } displayWhenReady(); } @@ -218,4 +258,16 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr view.setText(text); } } + + @Override + public void onResume() { + super.onResume(); + locationMapView.onResume(); + } + + @Override + public void onPause() { + locationMapView.onPause(); + super.onPause(); + } } diff --git a/java/com/android/incallui/calllocation/impl/LocationPresenter.java b/java/com/android/incallui/calllocation/impl/LocationPresenter.java index 83195baf8..94bd2357a 100644 --- a/java/com/android/incallui/calllocation/impl/LocationPresenter.java +++ b/java/com/android/incallui/calllocation/impl/LocationPresenter.java @@ -17,7 +17,6 @@ package com.android.incallui.calllocation.impl; import android.content.Context; -import android.graphics.drawable.Drawable; import android.location.Location; import android.os.AsyncTask; import com.android.dialer.common.LogUtil; @@ -38,7 +37,6 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi> implements LocationListener { private Location lastLocation; - private AsyncTask downloadMapTask; private AsyncTask reverseGeocodeTask; LocationPresenter() {} @@ -55,9 +53,6 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi> LogUtil.i("LocationPresenter.onUiUnready", ""); super.onUiUnready(ui); - if (downloadMapTask != null) { - downloadMapTask.cancel(true); - } if (reverseGeocodeTask != null) { reverseGeocodeTask.cancel(true); } @@ -76,7 +71,6 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi> int status = LocationHelper.checkLocation(location); LocationUi ui = getUi(); if (status == LocationHelper.LOCATION_STATUS_OK) { - downloadMapTask = new DownloadMapImageTask(new WeakReference<>(ui)).execute(location); reverseGeocodeTask = new ReverseGeocodeTask(new WeakReference<>(ui)).execute(location); if (ui != null) { ui.setLocation(location); @@ -103,8 +97,6 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi> void setAddress(String address); - void setMap(Drawable mapImage); - void setLocation(Location location); Context getContext(); diff --git a/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml b/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml deleted file mode 100644 index 5d1e2baf7..000000000 --- a/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml +++ /dev/null @@ -1,163 +0,0 @@ -<?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 ---> - -<ViewAnimator xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/location_view_animator" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="16dp" - android:background="@drawable/bg_location_card" - android:elevation="2dp" - android:inAnimation="@android:anim/fade_in" - android:measureAllChildren="true" - android:outAnimation="@android:anim/fade_out"> - - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/location_loading_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:orientation="vertical"> - - <ProgressBar - android:id="@+id/location_loading_spinner" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="28dp" - android:layout_marginBottom="12dp" - android:layout_gravity="center_horizontal"/> - - <TextView - android:id="@+id/location_loading_text" - style="@style/LocationLoadingTextStyle" - android:layout_width="match_parent" - android:layout_height="24sp" - android:layout_marginBottom="20dp" - android:layout_marginStart="24dp" - android:layout_marginEnd="24dp" - android:gravity="center" - android:text="@string/location_loading"/> - - </LinearLayout> - - <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/location_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:columnCount="2" - android:orientation="horizontal"> - - <TextView - android:id="@+id/location_address_title" - style="@style/LocationAddressTitleTextStyle" - android:layout_width="0dp" - android:layout_height="20sp" - android:layout_marginTop="16dp" - android:layout_marginBottom="4dp" - android:layout_marginStart="16dp" - android:layout_columnWeight="1" - android:text="@string/location_title"/> - - <ImageView - android:id="@+id/location_map" - android:layout_width="@dimen/location_map_width" - android:layout_height="@dimen/location_map_height" - android:layout_margin="16dp" - android:layout_gravity="end|center_vertical" - android:layout_rowSpan="4" - android:contentDescription="@string/location_map_description" - android:scaleType="centerCrop" - android:visibility="invisible" - tools:src="?android:attr/colorPrimaryDark" - tools:visibility="visible"/> - - <TextView - android:id="@+id/address_line_one" - style="@style/LocationAddressTextStyle" - android:layout_width="0dp" - android:layout_height="24sp" - android:layout_marginStart="16dp" - android:layout_columnWeight="1" - android:ellipsize="end" - android:lines="1" - android:visibility="invisible" - tools:text="1600 Amphitheatre Pkwy And a bit" - tools:visibility="visible"/> - - <TextView - android:id="@+id/address_line_two" - style="@style/LocationAddressTextStyle" - android:layout_width="0dp" - android:layout_height="24sp" - android:layout_marginStart="16dp" - android:layout_columnWeight="1" - android:ellipsize="end" - android:lines="1" - android:visibility="invisible" - tools:text="Mountain View, CA 94043" - tools:visibility="visible"/> - - <TextView - android:id="@+id/lat_long_line" - style="@style/LocationLatLongTextStyle" - android:layout_width="0dp" - android:layout_height="24sp" - android:layout_marginBottom="12dp" - android:layout_marginStart="16dp" - android:layout_columnWeight="1" - android:ellipsize="end" - android:lines="1" - android:visibility="invisible" - tools:text="Lat: 37.421719, Long: -122.085297" - tools:visibility="visible"/> - - </GridLayout> - - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/location_error_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:orientation="vertical"> - - <ImageView - android:id="@+id/location_error_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="32dp" - android:layout_marginBottom="12dp" - android:layout_gravity="center_horizontal" - android:src="@drawable/quantum_ic_error_outline_vd_theme_36" - android:tint="#C53929"/> - - <TextView - android:id="@+id/location_error_text" - style="@style/LocationErrorTextStyle" - android:layout_width="match_parent" - android:layout_height="24sp" - android:layout_marginBottom="20dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:gravity="center" - android:text="@string/location_error"/> - - </LinearLayout> - -</ViewAnimator> diff --git a/java/com/android/incallui/callpending/CallPendingActivity.java b/java/com/android/incallui/callpending/CallPendingActivity.java index 3c69f97b5..a686308c2 100644 --- a/java/com/android/incallui/callpending/CallPendingActivity.java +++ b/java/com/android/incallui/callpending/CallPendingActivity.java @@ -166,9 +166,9 @@ public class CallPendingActivity extends FragmentActivity } Drawable photo = null; + Uri photoUri = getPhotoUri(); try { // TODO(calderwoodra) move to background thread - Uri photoUri = getPhotoUri(); InputStream is = getContentResolver().openInputStream(photoUri); photo = Drawable.createFromStream(is, photoUri.toString()); } catch (FileNotFoundException e) { @@ -185,6 +185,7 @@ public class CallPendingActivity extends FragmentActivity .setNameIsNumber(name != null && name.equals(number)) .setLabel(getPhoneLabel()) .setPhoto(photo) + .setPhotoUri(photoUri) .setPhotoType(ContactPhotoType.CONTACT) .setIsSipCall(false) .setIsContactPhotoShown(true) diff --git a/java/com/android/incallui/commontheme/res/values/colors.xml b/java/com/android/incallui/commontheme/res/values/colors.xml index 27c1b6c20..50b06179f 100644 --- a/java/com/android/incallui/commontheme/res/values/colors.xml +++ b/java/com/android/incallui/commontheme/res/values/colors.xml @@ -21,6 +21,4 @@ <!-- 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="divider_line_color">#D8D8D8</color> </resources> diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index 85ae0bbb6..7f20b407f 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -148,6 +148,7 @@ public class InCallFragment extends Fragment @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) { LogUtil.i("InCallFragment.onCreateView", null); + getActivity().setTheme(R.style.Theme_InCallScreen); // Bypass to avoid StrictModeResourceMismatchViolation final View view = StrictModeUtils.bypass( 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 8e9120b09..68b34c89d 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="#FF1C3AA9" android:state_checked="true"/> - <item android:color="#FFFFFFFF"/> + <item android:color="?android:attr/colorPrimaryDark" android:state_checked="true"/> + <item android:color="?android:attr/colorBackgroundFloating"/> </selector> diff --git a/java/com/android/incallui/maps/impl/AndroidManifest.xml b/java/com/android/incallui/maps/impl/AndroidManifest.xml index bc921e906..4c17f33a4 100644 --- a/java/com/android/incallui/maps/impl/AndroidManifest.xml +++ b/java/com/android/incallui/maps/impl/AndroidManifest.xml @@ -19,6 +19,8 @@ package="com.android.incallui.maps.impl"> <application> + <!-- Fix for P --> + <uses-library android:name="org.apache.http.legacy" android:required="false" /> <meta-data android:name="com.google.android.gms.version" diff --git a/java/com/android/incallui/res/layout/frag_rtt_request_dialog.xml b/java/com/android/incallui/res/layout/frag_rtt_request_dialog.xml index 2e40cabd3..f0bd1531e 100644 --- a/java/com/android/incallui/res/layout/frag_rtt_request_dialog.xml +++ b/java/com/android/incallui/res/layout/frag_rtt_request_dialog.xml @@ -57,7 +57,7 @@ android:layout_gravity="end" android:paddingStart="16dp" android:paddingEnd="16dp" - android:backgroundTint="@android:color/white" + android:backgroundTint="?android:attr/colorBackgroundFloating" android:fontFamily="sans-serif-medium" android:stateListAnimator="@null" android:text="@string/rtt_button_decline_request" diff --git a/java/com/android/incallui/rtt/impl/res/drawable/message_bubble.xml b/java/com/android/incallui/rtt/impl/res/drawable/incallui_message_bubble.xml index 2b01f62f9..31044b64e 100644 --- a/java/com/android/incallui/rtt/impl/res/drawable/message_bubble.xml +++ b/java/com/android/incallui/rtt/impl/res/drawable/incallui_message_bubble.xml @@ -16,6 +16,6 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="@android:color/white"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> <corners android:radius="20dp"/> </shape>
\ No newline at end of file diff --git a/java/com/android/incallui/rtt/impl/res/layout/audio_route.xml b/java/com/android/incallui/rtt/impl/res/layout/audio_route.xml index f098316a1..6f22febdf 100644 --- a/java/com/android/incallui/rtt/impl/res/layout/audio_route.xml +++ b/java/com/android/incallui/rtt/impl/res/layout/audio_route.xml @@ -29,7 +29,7 @@ <View android:layout_width="match_parent" android:layout_height="1dp" - android:background="@color/divider_line_color"/> + android:background="@color/dialer_divider_line_color"/> <com.android.incallui.rtt.impl.RttCheckableButton android:id="@+id/audioroute_bluetooth" style="@style/RttButton" diff --git a/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml b/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml index cff2b3f38..21d00a3e3 100644 --- a/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml +++ b/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml @@ -62,11 +62,11 @@ android:layout_height="53dp" android:layout_gravity="bottom" android:background="@drawable/input_bubble_background" - android:backgroundTint="@color/submit_button_background_color" + android:backgroundTint="?colorIcon" android:backgroundTintMode="multiply" android:contentDescription="@string/content_description_rtt_check_button" android:src="@drawable/quantum_ic_done_vd_theme_24" - android:tint="@color/submit_button_color" + android:tint="?android:attr/colorPrimary" android:visibility="gone"/> </LinearLayout> diff --git a/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml b/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml index 8a5bba28d..065aa8c34 100644 --- a/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml +++ b/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml @@ -22,7 +22,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/rtt_banner_height" - android:background="#F305228F" + android:background="?android:attr/colorPrimaryDark" android:elevation="3dp" android:orientation="horizontal"> <ImageButton @@ -36,7 +36,7 @@ android:contentDescription="@string/incall_content_description_end_call" android:scaleType="fitXY" android:src="@drawable/quantum_ic_call_end_vd_theme_24" - android:tint="#FFDF0000"/> + android:tint="@color/dialer_end_call_button_color"/> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" @@ -75,7 +75,7 @@ android:contentDescription="@string/content_description_overflow" android:scaleType="fitXY" android:src="@drawable/quantum_ic_more_vert_vd_theme_24" - android:tint="#FFFFFF"/> + android:tint="?colorIconOnUnthemedDarkBackground"/> </LinearLayout> <FrameLayout diff --git a/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml b/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml index b7b358075..5da3cc46a 100644 --- a/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml +++ b/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml @@ -39,7 +39,7 @@ android:paddingEnd="32dp" android:minHeight="108dp" android:lineSpacingMultiplier="1.2" - android:textColor="?android:attr/colorBackground" + android:textColor="?android:attr/textColorPrimaryInverse" android:textAppearance="@style/Dialer.Incall.TextAppearance.Message" android:background="@drawable/answer_text_only_background" app:autoSizeTextType="uniform" diff --git a/java/com/android/incallui/sessiondata/res/layout/fragment_spam.xml b/java/com/android/incallui/sessiondata/res/layout/fragment_spam.xml index ccf69a50c..65535b1e6 100644 --- a/java/com/android/incallui/sessiondata/res/layout/fragment_spam.xml +++ b/java/com/android/incallui/sessiondata/res/layout/fragment_spam.xml @@ -38,14 +38,13 @@ android:layout_height="wrap_content" android:layout_marginBottom="18dp" android:src="@drawable/quantum_ic_image_white_24" - android:tint="#546e7a"/> + android:tint="?colorIcon"/> <TextView android:id="@+id/spam_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/spam_photo_text" - android:textColor="#546e7a" - android:textSize="12sp"/> + style="@style/Dialer.TextAppearance.Secondary2"/> </LinearLayout> </FrameLayout>
\ No newline at end of file diff --git a/java/com/android/incallui/spam/SpamCallListListener.java b/java/com/android/incallui/spam/SpamCallListListener.java index d03055568..3b2f1c519 100644 --- a/java/com/android/incallui/spam/SpamCallListListener.java +++ b/java/com/android/incallui/spam/SpamCallListListener.java @@ -49,6 +49,7 @@ import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.spam.SpamComponent; import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.PermissionsUtil; import com.android.incallui.call.CallList; import com.android.incallui.call.DialerCall; @@ -256,7 +257,7 @@ public class SpamCallListListener implements CallList.Listener { createActivityPendingIntent(call, SpamNotificationActivity.ACTION_SHOW_DIALOG)) .setCategory(Notification.CATEGORY_STATUS) .setPriority(Notification.PRIORITY_DEFAULT) - .setColor(context.getColor(R.color.dialer_theme_color)) + .setColor(ThemeComponent.get(context).theme().getColorPrimary()) .setSmallIcon(R.drawable.quantum_ic_call_end_vd_theme_24) .setGroup(GROUP_KEY); if (BuildCompat.isAtLeastO()) { diff --git a/java/com/android/incallui/speakeasy/Annotations.java b/java/com/android/incallui/speakeasy/Annotations.java new file mode 100644 index 000000000..f369ce441 --- /dev/null +++ b/java/com/android/incallui/speakeasy/Annotations.java @@ -0,0 +1,35 @@ +/* + * 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.incallui.speakeasy; + +import javax.inject.Qualifier; + +/** Annotations for Speakeasy providers. */ +public final class Annotations { + + /** A Speakeasy icon */ + @Qualifier + public @interface SpeakEasyIcon {} + + /** Speakeasy text */ + @Qualifier + public @interface SpeakEasyText {} + + /** A Speakeasy settings fragment */ + @Qualifier + public @interface SpeakEasySettingsFragment {} +} diff --git a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java index 6dae44128..6257cc0f9 100644 --- a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java +++ b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java @@ -19,6 +19,9 @@ package com.android.incallui.speakeasy; import android.content.Context; import android.support.v4.app.Fragment; import com.android.dialer.inject.HasRootComponent; +import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon; +import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsFragment; +import com.android.incallui.speakeasy.Annotations.SpeakEasyText; import com.google.common.base.Optional; import dagger.Subcomponent; @@ -28,9 +31,11 @@ public abstract class SpeakEasyComponent { public abstract SpeakEasyCallManager speakEasyCallManager(); - public abstract Optional<Fragment> speakEasySettingsFragment(); + public abstract @SpeakEasySettingsFragment Optional<Fragment> speakEasySettingsFragment(); - public abstract Optional<Integer> speakEasyIcon(); + public abstract @SpeakEasyIcon Optional<Integer> speakEasyIcon(); + + public abstract @SpeakEasyText Optional<Integer> speakEasyText(); public static SpeakEasyComponent get(Context context) { return ((SpeakEasyComponent.HasComponent) diff --git a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java index 67b564cb0..9f23ddd37 100644 --- a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java +++ b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java @@ -19,6 +19,9 @@ package com.android.incallui.speakeasy; import android.support.v4.app.Fragment; import com.android.dialer.inject.DialerVariant; import com.android.dialer.inject.InstallIn; +import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon; +import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsFragment; +import com.android.incallui.speakeasy.Annotations.SpeakEasyText; import com.google.common.base.Optional; import dagger.Binds; import dagger.Module; @@ -33,12 +36,17 @@ public abstract class StubSpeakEasyModule { abstract SpeakEasyCallManager bindsSpeakEasy(SpeakEasyCallManagerStub stub); @Provides - static Optional<Fragment> provideSpeakEasySettingsFragment() { + static @SpeakEasySettingsFragment Optional<Fragment> provideSpeakEasySettingsFragment() { return Optional.absent(); } @Provides - static Optional<Integer> provideSpeakEasyIcon() { + static @SpeakEasyIcon Optional<Integer> provideSpeakEasyIcon() { + return Optional.absent(); + } + + @Provides + static @SpeakEasyText Optional<Integer> provideSpeakEasyText() { return Optional.absent(); } } diff --git a/java/com/android/incallui/telecomeventui/res/layout/frag_international_call_on_wifi_dialog.xml b/java/com/android/incallui/telecomeventui/res/layout/frag_international_call_on_wifi_dialog.xml index 996bc75ba..5175b26ae 100644 --- a/java/com/android/incallui/telecomeventui/res/layout/frag_international_call_on_wifi_dialog.xml +++ b/java/com/android/incallui/telecomeventui/res/layout/frag_international_call_on_wifi_dialog.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:text="@string/details" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="16sp"/> <CheckBox @@ -37,7 +37,7 @@ android:layout_height="wrap_content" android:buttonTint="?android:attr/colorPrimary" android:text="@string/always_warn" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="14sp"/> </LinearLayout> diff --git a/java/com/android/incallui/theme/res/values/styles.xml b/java/com/android/incallui/theme/res/values/styles.xml index 086d12e19..3475e3548 100644 --- a/java/com/android/incallui/theme/res/values/styles.xml +++ b/java/com/android/incallui/theme/res/values/styles.xml @@ -20,7 +20,7 @@ circular reveal animation for a new outgoing call to work correctly. We don't just use Theme.Black.NoTitleBar directly, since we want any popups or dialogs from the InCallActivity to have the correct Material style. --> - <style name="Theme.InCallScreen" parent="@style/Dialer.ThemeBase.NoActionBar.Dark"> + <style name="Theme.InCallScreen.Light" parent="@style/Dialer.ThemeBase.NoActionBar"> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> @@ -33,7 +33,20 @@ <item name="android:windowShowWallpaper">true</item> </style> - <style name="Theme.InCallScreen.ManageConference" parent="Dialer.ThemeBase"> + <style name="Theme.InCallScreen" parent="@style/Dialer.Dark.ThemeBase.NoActionBar"> + <item name="android:statusBarColor">@android:color/transparent</item> + <item name="android:navigationBarColor">@android:color/transparent</item> + <item name="android:windowDrawsSystemBarBackgrounds">true</item> + + <item name="dialpad_key_button_touch_tint">@color/incall_dialpad_touch_tint</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:windowShowWallpaper">true</item> + </style> + + <style name="Theme.InCallScreen.ManageConference" parent="Dialer.ThemeBase.ActionBar"> </style> <style name="InCallDialpad" parent="Dialpad.Light"> @@ -59,6 +72,7 @@ @dimen/incall_end_call_spacing </item> <item name="dialpad_elevation">10dp</item> + <item name="dialpad_text_color">?android:attr/textColorPrimaryInverse</item> <item name="dialpad_text_color_secondary">?android:attr/textColorSecondaryInverse</item> </style> diff --git a/java/com/android/incallui/video/impl/res/layout/frag_video_charges_alert_dialog.xml b/java/com/android/incallui/video/impl/res/layout/frag_video_charges_alert_dialog.xml index 56e1d794a..c02791551 100644 --- a/java/com/android/incallui/video/impl/res/layout/frag_video_charges_alert_dialog.xml +++ b/java/com/android/incallui/video/impl/res/layout/frag_video_charges_alert_dialog.xml @@ -34,7 +34,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:text="@string/videocall_charges_alert_dialog_description" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="16sp"/> <CheckBox @@ -45,7 +45,7 @@ android:focusable="true" android:clickable="true" android:text="@string/do_not_show_again" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="14sp"/> </LinearLayout> </ScrollView>
\ No newline at end of file diff --git a/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml b/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml index ed32ae235..6349a2863 100644 --- a/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml +++ b/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml @@ -45,7 +45,7 @@ android:accessibilityTraversalBefore="@+id/videocall_speaker_button" android:drawablePadding="8dp" android:drawableTop="@drawable/quantum_ic_videocam_off_white_36" - android:drawableTint="@color/videocall_camera_off_tint" + android:drawableTint="?colorIcon" android:padding="64dp" android:text="@string/videocall_remote_video_off" android:textAppearance="@style/Dialer.Incall.TextAppearance" @@ -100,7 +100,7 @@ android:layout_alignTop="@+id/videocall_video_preview" android:scaleType="center" android:src="@drawable/quantum_ic_videocam_off_vd_theme_24" - android:tint="@color/videocall_camera_off_tint" + android:tint="?colorIcon" android:tintMode="src_in" android:visibility="gone" android:importantForAccessibility="no" diff --git a/java/com/android/incallui/video/impl/res/layout/frag_videocall_surfaceview.xml b/java/com/android/incallui/video/impl/res/layout/frag_videocall_surfaceview.xml index dd1bd61c2..51918982b 100644 --- a/java/com/android/incallui/video/impl/res/layout/frag_videocall_surfaceview.xml +++ b/java/com/android/incallui/video/impl/res/layout/frag_videocall_surfaceview.xml @@ -36,7 +36,7 @@ android:accessibilityTraversalBefore="@+id/videocall_speaker_button" android:drawablePadding="8dp" android:drawableTop="@drawable/quantum_ic_videocam_off_white_36" - android:drawableTint="@color/videocall_camera_off_tint" + android:drawableTint="?colorIcon" android:padding="64dp" android:text="@string/videocall_remote_video_off" android:textAppearance="@style/Dialer.Incall.TextAppearance" @@ -66,7 +66,7 @@ android:layout_gravity="center" android:scaleType="center" android:src="@drawable/quantum_ic_videocam_off_vd_theme_24" - android:tint="@color/videocall_camera_off_tint" + android:tint="?colorIcon" android:tintMode="src_in" android:visibility="gone" android:importantForAccessibility="no" diff --git a/java/com/android/incallui/video/impl/res/values/styles.xml b/java/com/android/incallui/video/impl/res/values/styles.xml index 03395d989..61360b6a4 100644 --- a/java/com/android/incallui/video/impl/res/values/styles.xml +++ b/java/com/android/incallui/video/impl/res/values/styles.xml @@ -19,7 +19,7 @@ <item name="android:layout_height">@dimen/videocall_button_size</item> <item name="android:layout_width">@dimen/videocall_button_size</item> <item name="android:background">@drawable/videocall_video_button_background</item> - <item name="android:tint">@color/videocall_button_icon_tint</item> + <item name="android:tint">?android:attr/colorBackgroundFloating</item> <item name="android:tintMode">src_atop</item> <item name="android:padding">@dimen/videocall_button_padding</item> <item name="android:scaleType">fitCenter</item> diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index d35c5ef61..5b733d612 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -61,29 +61,34 @@ public class ImsVideoTech implements VideoTech { @Override public boolean isAvailable(Context context, PhoneAccountHandle phoneAccountHandle) { if (call.getVideoCall() == null) { + LogUtil.i("ImsVideoCall.isAvailable", "null video call"); return false; } // We are already in an IMS video call if (VideoProfile.isVideo(call.getDetails().getVideoState())) { + LogUtil.i("ImsVideoCall.isAvailable", "already video call"); return true; } // The user has disabled IMS video calling in system settings if (!CallUtil.isVideoEnabled(context)) { + LogUtil.i("ImsVideoCall.isAvailable", "disabled in settings"); return false; } // The current call doesn't support transmitting video if (!call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL_TX)) { + LogUtil.i("ImsVideoCall.isAvailable", "no TX"); return false; } // The current call remote device doesn't support receiving video if (!call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE_RX)) { + LogUtil.i("ImsVideoCall.isAvailable", "no RX"); return false; } - + LogUtil.i("ImsVideoCall.isAvailable", "available"); return true; } diff --git a/packages.mk b/packages.mk index 6483346b8..9c0b43e2a 100644 --- a/packages.mk +++ b/packages.mk @@ -68,6 +68,10 @@ LOCAL_AAPT_FLAGS := \ com.android.dialer.speeddial \ com.android.dialer.spannable \ com.android.dialer.theme \ + com.android.dialer.theme.base \ + com.android.dialer.theme.base.impl \ + com.android.dialer.theme.common \ + com.android.dialer.theme.hidden \ com.android.dialer.util \ com.android.dialer.voicemail.listui \ com.android.dialer.voicemail.listui.error \ @@ -89,7 +93,6 @@ LOCAL_AAPT_FLAGS := \ com.android.incallui.disconnectdialog \ com.android.incallui.hold \ com.android.incallui.incall.impl \ - com.android.incallui.maps.impl \ com.android.incallui.rtt.impl \ com.android.incallui.rtt.protocol \ com.android.incallui.speakeasy \ |