diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-05-21 21:09:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-21 21:09:27 +0000 |
commit | 4791039e1e62ff6fc22f063dbf363fb6864c87ad (patch) | |
tree | d43592dc0b93433f7b7aa8c82888c9ad69ed8d40 | |
parent | ea7399a7c0c8a3832a6592aee0a0372c300b11f5 (diff) | |
parent | 71a22dc081e458706f07beb1684087dc4a6aedf5 (diff) |
Merge changes I511c3930,Ifc534793
* changes:
Add promotion module.
Implement a global theme to be easily configured in Dialer.
173 files changed, 1448 insertions, 995 deletions
diff --git a/java/com/android/contacts/common/list/ViewPagerTabStrip.java b/java/com/android/contacts/common/list/ViewPagerTabStrip.java index 969a6d342..8835631f5 100644 --- a/java/com/android/contacts/common/list/ViewPagerTabStrip.java +++ b/java/com/android/contacts/common/list/ViewPagerTabStrip.java @@ -24,6 +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; public class ViewPagerTabStrip extends LinearLayout { @@ -42,8 +43,8 @@ public class ViewPagerTabStrip extends LinearLayout { final Resources res = context.getResources(); mSelectedUnderlineThickness = res.getDimensionPixelSize(R.dimen.tab_selected_underline_height); - int underlineColor = res.getColor(R.color.tab_selected_underline_color); - int backgroundColor = res.getColor(R.color.contactscommon_actionbar_background_color); + int underlineColor = ThemeUtil.getColorAccent(); + int backgroundColor = ThemeUtil.getColorPrimary(); mSelectedUnderlinePaint = new Paint(); mSelectedUnderlinePaint.setColor(underlineColor); diff --git a/java/com/android/contacts/common/res/drawable/ic_scroll_handle_pressed.xml b/java/com/android/contacts/common/res/drawable/ic_scroll_handle_pressed.xml index 4838de58a..c9b93d925 100644 --- a/java/com/android/contacts/common/res/drawable/ic_scroll_handle_pressed.xml +++ b/java/com/android/contacts/common/res/drawable/ic_scroll_handle_pressed.xml @@ -17,4 +17,4 @@ <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/ic_scroll_handle" - android:tint="@color/dialtacts_theme_color"/>
\ No newline at end of file + android:tint="?android:attr/colorPrimary"/>
\ No newline at end of file diff --git a/java/com/android/contacts/common/res/drawable/searchedittext_custom_cursor.xml b/java/com/android/contacts/common/res/drawable/searchedittext_custom_cursor.xml index 27614a1ac..51e984ca0 100644 --- a/java/com/android/contacts/common/res/drawable/searchedittext_custom_cursor.xml +++ b/java/com/android/contacts/common/res/drawable/searchedittext_custom_cursor.xml @@ -1,7 +1,21 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2014 Google Inc. All Rights Reserved. --> +<!-- + ~ 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 + --> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <size android:width="2dp"/> - <solid android:color="@color/dialtacts_theme_color"/> + <solid android:color="?android:attr/colorPrimary"/> </shape>
\ No newline at end of file diff --git a/java/com/android/contacts/common/res/values/colors.xml b/java/com/android/contacts/common/res/values/colors.xml index 3044339fd..b05c19a83 100644 --- a/java/com/android/contacts/common/res/values/colors.xml +++ b/java/com/android/contacts/common/res/values/colors.xml @@ -51,7 +51,7 @@ <item>#424242</item> </array> - <color name="contactscommon_actionbar_background_color">@color/dialer_theme_color</color> + <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> @@ -75,7 +75,7 @@ <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">@color/dialtacts_theme_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> diff --git a/java/com/android/dialer/about/AndroidManifest.xml b/java/com/android/dialer/about/AndroidManifest.xml index 3d5067ade..6892674d1 100644 --- a/java/com/android/dialer/about/AndroidManifest.xml +++ b/java/com/android/dialer/about/AndroidManifest.xml @@ -14,7 +14,7 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.about"> - <application android:theme="@style/Theme.AppCompat"> + <application> <activity android:name="com.android.dialer.about.LicenseMenuActivity" android:label="@string/licenseActivityLabel" diff --git a/java/com/android/dialer/app/AndroidManifest.xml b/java/com/android/dialer/app/AndroidManifest.xml index 3536ecdc5..190f098a5 100644 --- a/java/com/android/dialer/app/AndroidManifest.xml +++ b/java/com/android/dialer/app/AndroidManifest.xml @@ -58,9 +58,9 @@ android:minSdkVersion="24" android:targetSdkVersion="28"/> - <application android:theme="@style/Theme.AppCompat"> + <application> - <activity + <activity android:exported="false" android:label="@string/manage_blocked_numbers_label" android:name="com.android.dialer.app.filterednumber.BlockedNumbersSettingsActivity" @@ -75,7 +75,7 @@ <activity android:label="@string/call_log_activity_title" android:name="com.android.dialer.app.calllog.CallLogActivity" - android:theme="@style/DialtactsThemeWithoutActionBarOverlay"> + android:theme="@style/DialtactsTheme"> </activity> <receiver android:name="com.android.dialer.app.calllog.CallLogReceiver"> diff --git a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java index 987615f5f..865cb81cf 100644 --- a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java +++ b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java @@ -16,9 +16,9 @@ package com.android.dialer.app.calllog; -import android.app.FragmentManager; import android.content.Context; import android.support.annotation.NonNull; +import android.support.v4.app.FragmentManager; import android.support.v7.widget.RecyclerView; import android.view.View; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index 450e5eaa7..143af367a 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -36,6 +36,7 @@ import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.annotation.WorkerThread; import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ViewHolder; import android.telecom.PhoneAccountHandle; @@ -223,7 +224,7 @@ public class CallLogAdapter extends GroupingListAdapter private void showDeleteSelectedItemsDialog() { SparseArray<String> voicemailsToDeleteOnConfirmation = selectedItems.clone(); - new AlertDialog.Builder(activity, R.style.AlertDialogCustom) + new AlertDialog.Builder(activity) .setCancelable(true) .setTitle( activity @@ -557,7 +558,7 @@ public class CallLogAdapter extends GroupingListAdapter new BlockReportSpamListener( this.activity, this.activity.findViewById(R.id.call_log_fragment_root), - ((Activity) this.activity).getFragmentManager(), + ((AppCompatActivity) this.activity).getSupportFragmentManager(), this, this.filteredNumberAsyncQueryHandler); setHasStableIds(true); diff --git a/java/com/android/dialer/app/manifests/activities/AndroidManifest.xml b/java/com/android/dialer/app/manifests/activities/AndroidManifest.xml index 31960c979..edf0f1c8c 100644 --- a/java/com/android/dialer/app/manifests/activities/AndroidManifest.xml +++ b/java/com/android/dialer/app/manifests/activities/AndroidManifest.xml @@ -19,7 +19,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.app"> - <application android:theme="@style/Theme.AppCompat"> + <application> <activity android:exported="false" @@ -101,7 +101,7 @@ <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.TAB"/> </intent-filter> - <intent-filter android:label="@string/main_call_history_tab_description"> + <intent-filter> <action android:name="com.android.phone.action.RECENT_CALLS"/> <category android:name="android.intent.category.DEFAULT"/> diff --git a/java/com/android/dialer/app/res/drawable/ic_voicemail_seek_handle.xml b/java/com/android/dialer/app/res/drawable/ic_voicemail_seek_handle.xml index ffdd64edc..00b23b84d 100644 --- a/java/com/android/dialer/app/res/drawable/ic_voicemail_seek_handle.xml +++ b/java/com/android/dialer/app/res/drawable/ic_voicemail_seek_handle.xml @@ -16,5 +16,5 @@ --> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/old_ic_handle" - android:tint="@color/actionbar_background_color"> + android:tint="?android:attr/colorPrimary"> </bitmap>
\ No newline at end of file diff --git a/java/com/android/dialer/app/res/drawable/selectable_primary_flat_button.xml b/java/com/android/dialer/app/res/drawable/selectable_primary_flat_button.xml index 47d1152db..2a393a570 100644 --- a/java/com/android/dialer/app/res/drawable/selectable_primary_flat_button.xml +++ b/java/com/android/dialer/app/res/drawable/selectable_primary_flat_button.xml @@ -25,7 +25,7 @@ </item> <item> <shape> - <solid android:color="@color/dialer_theme_color"/> + <solid android:color="?android:attr/colorPrimary"/> </shape> </item> </selector>
\ No newline at end of file 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 a5e532698..d9d40a1a0 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="@color/background_dialer_light" + android:background="?android:attr/colorBackgroundFloating" 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 f0563967c..2fb63606a 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 @@ -26,7 +26,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/tab_height" android:layout_gravity="start" - android:background="@color/actionbar_background_color" + android:background="?android:attr/colorPrimary" android:orientation="horizontal" android:visibility="gone"> 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 d1111103e..23aeda3da 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 @@ -143,7 +143,7 @@ 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:textColorSecondary" + android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/call_log_detail_text_size" android:visibility="gone" android:maxLines="1"/> 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 1627844d6..cf6591b63 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="@color/background_dialer_light" + android:background="?android:attr/colorBackgroundFloating" android:clipChildren="false" android:clipToPadding="false" android:focusable="true" diff --git a/java/com/android/dialer/app/res/layout/keyguard_preview.xml b/java/com/android/dialer/app/res/layout/keyguard_preview.xml index eab98d261..e5207ac8b 100644 --- a/java/com/android/dialer/app/res/layout/keyguard_preview.xml +++ b/java/com/android/dialer/app/res/layout/keyguard_preview.xml @@ -23,7 +23,7 @@ <View android:layout_width="match_parent" android:layout_height="25dp" - android:background="@color/dialer_theme_color_dark"/> + android:background="?android:attr/colorPrimaryDark"/> <View android:layout_width="match_parent" android:layout_height="0dp" 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 95961729d..1126b0e51 100644 --- a/java/com/android/dialer/app/res/layout/lists_fragment.xml +++ b/java/com/android/dialer/app/res/layout/lists_fragment.xml @@ -32,7 +32,7 @@ <FrameLayout android:layout_width="match_parent" android:layout_height="@dimen/action_bar_height_large" - android:background="@color/actionbar_background_color" + android:background="?android:attr/colorPrimary" android:elevation="@dimen/tab_elevation"/> <com.android.contacts.common.list.ViewPagerTabs @@ -69,7 +69,7 @@ android:id="@+id/remove_view_content" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/actionbar_background_color" + android:background="?android:attr/colorPrimary" android:gravity="center" android:orientation="horizontal" android:visibility="gone"> 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 5fc492d29..8a2cfd483 100644 --- a/java/com/android/dialer/app/res/layout/search_edittext.xml +++ b/java/com/android/dialer/app/res/layout/search_edittext.xml @@ -31,7 +31,7 @@ android:id="@+id/search_box_collapsed" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:selectableItemBackground" + android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical"> <ImageView 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 2589a67c6..a9b866e89 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 @@ -20,7 +20,7 @@ android:layout_height="wrap_content" android:layout_marginStart="64dp" android:layout_marginEnd="24dp" - android:background="@color/background_dialer_call_log_list_item" + android:background="?android:attr/colorBackgroundFloating" android:orientation="vertical"> <TextView 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 5a946b6a0..76ae4ba62 100644 --- a/java/com/android/dialer/app/res/values-v27/styles.xml +++ b/java/com/android/dialer/app/res/values-v27/styles.xml @@ -15,9 +15,9 @@ ~ limitations under the License --> <resources> - <style name="DialtactsTheme" parent="DialtactsThemeBase"> + <style name="DialtactsTheme" parent="Dialer.ThemeBase"> <item name="android:windowLightNavigationBar">true</item> - <item name="android:navigationBarColor">?android:windowBackground</item> + <item name="android:navigationBarColor">?android:attr/windowBackground</item> <item name="android:navigationBarDividerColor">#E0E0E0</item> </style> </resources> diff --git a/java/com/android/dialer/app/res/values/colors.xml b/java/com/android/dialer/app/res/values/colors.xml index e79c5c5ed..2b8d63ac0 100644 --- a/java/com/android/dialer/app/res/values/colors.xml +++ b/java/com/android/dialer/app/res/values/colors.xml @@ -15,13 +15,8 @@ --> <resources> - <color name="dialer_flat_button_text_color">@color/dialer_theme_color</color> + <color name="dialer_flat_button_text_color">?android:attr/colorPrimary</color> - <!-- Color for the setting text. --> - <color name="setting_primary_color">@color/dialer_primary_text_color</color> - <!-- Color for the setting description text. --> - <color name="setting_secondary_color">@color/dialer_secondary_text_color</color> - <color name="setting_disabled_color">#aaaaaa</color> <color name="setting_background_color">#ffffff</color> <!-- 54% black --> @@ -50,7 +45,7 @@ <!-- 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">@color/dialer_theme_color</color> + <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> @@ -76,7 +71,7 @@ <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">@color/dialer_theme_color</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> diff --git a/java/com/android/dialer/app/res/values/styles.xml b/java/com/android/dialer/app/res/values/styles.xml index 869f1276d..54d18f103 100644 --- a/java/com/android/dialer/app/res/values/styles.xml +++ b/java/com/android/dialer/app/res/values/styles.xml @@ -15,134 +15,18 @@ ~ limitations under the License --> <resources> - - <style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert"> - <item name="android:colorPrimary">@color/dialtacts_theme_color</item> - <item name="android:colorAccent">@color/dialtacts_theme_color</item> - </style> - - <style name="DialtactsThemeBase" parent="DialerThemeBase"> - - <!-- Styles that require AppCompat compatibility, remember to update both sets --> - <item name="android:windowActionBarOverlay">true</item> - <item name="windowActionBarOverlay">true</item> - <item name="android:windowActionModeOverlay">true</item> - <item name="windowActionModeOverlay">true</item> - <item name="android:actionBarStyle">@style/DialtactsActionBarStyle</item> - <item name="actionBarStyle">@style/DialtactsActionBarStyle</item> - <item name="actionModeStyle">@style/ActionModeStyle</item> - <item name="android:actionModeStyle">@style/ActionModeStyle</item> - - <item name="android:windowContentOverlay">@null</item> - <item name="android:overlapAnchor">true</item> - - <item name="android:listViewStyle">@style/ListViewStyle</item> - <item name="list_section_header_height">32dip</item> - <item name="list_item_padding_top">7dp</item> - <item name="list_item_padding_right">24dp</item> - <item name="list_item_padding_bottom">7dp</item> - <item name="list_item_padding_left">16dp</item> - <item name="list_item_gap_between_image_and_text"> - @dimen/contact_browser_list_item_gap_between_image_and_text - </item> - <item name="list_item_gap_between_label_and_data">8dip</item> - <item name="list_item_presence_icon_margin">4dip</item> - <item name="list_item_presence_icon_size">16dip</item> - <item name="list_item_photo_size">@dimen/contact_browser_list_item_photo_size</item> - <item name="list_item_profile_photo_size">70dip</item> - <item name="list_item_prefix_highlight_color">@color/people_app_theme_color</item> - <item name="list_item_background_color">@color/background_dialer_light</item> - <item name="list_item_header_text_indent">8dip</item> - <item name="list_item_header_text_color">@color/dialer_secondary_text_color</item> - <item name="list_item_header_text_size">14sp</item> - <item name="list_item_header_height">30dip</item> - <item name="list_item_data_width_weight">5</item> - <item name="list_item_label_width_weight">3</item> - <item name="contact_browser_list_padding_left">0dp</item> - <item name="contact_browser_list_padding_right">0dp</item> - <item name="contact_browser_background">@color/background_dialer_results</item> - <item name="list_item_name_text_color">@color/contact_list_name_text_color</item> - <item name="list_item_name_text_size">16sp</item> - <item name="list_item_text_indent">@dimen/contact_browser_list_item_text_indent</item> - <item name="list_item_text_offset_top">-2dp</item> - <!-- Favorites --> - <item name="favorites_padding_bottom">?android:attr/actionBarSize</item> - <item name="dialpad_key_button_touch_tint">@color/dialer_dialpad_touch_tint</item> - <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> - - <!-- Video call icon --> - <item name="list_item_video_call_icon_size">48dip</item> - <item name="list_item_video_call_icon_margin">8dip</item> - - <item name="dialpad_style">@style/Dialpad.Light</item> - </style> - - <style name="DialtactsTheme" parent="DialtactsThemeBase"> - </style> - - <!-- Action bar overflow menu icon. White with no shadow. --> - <style name="DialtactsActionBarOverflowWhite" - parent="@android:style/Widget.Material.Light.ActionButton.Overflow"> - <item name="android:src">@drawable/quantum_ic_more_vert_white_24</item> - </style> + <style name="DialtactsTheme" parent="Dialer.ThemeBase"/> <style name="DialpadTheme" parent="DialtactsTheme"> - <item name="android:textColorPrimary">#FFFFFF</item> - </style> - - <style name="DialtactsThemeWithoutActionBarOverlay" parent="DialtactsTheme"> - <!-- Styles that require AppCompat compatibility, remember to update both sets --> - <item name="android:windowActionBarOverlay">false</item> - <item name="windowActionBarOverlay">false</item> - <item name="android:actionOverflowButtonStyle">@style/DialtactsActionBarOverflowWhite</item> - <item name="actionOverflowButtonStyle">@style/DialtactsActionBarOverflowWhite</item> - </style> - - <!-- Hide the actionbar title during the activity preview --> - <style name="DialtactsActivityTheme" parent="DialtactsTheme"> - <!-- Styles that require AppCompat compatibility, remember to update both sets --> - <item name="android:actionBarStyle">@style/DialtactsActionBarWithoutTitleStyle</item> - <item name="actionBarStyle">@style/DialtactsActionBarWithoutTitleStyle</item> - - <item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb</item> - <item name="android:fastScrollTrackDrawable">@null</item> - </style> - - <style name="DialtactsActionBarStyle" parent="DialerActionBarBaseStyle"> - <!-- Styles that require AppCompat compatibility, remember to update both sets --> - <item name="android:background">@color/actionbar_background_color</item> - <item name="background">@color/actionbar_background_color</item> - <item name="android:titleTextStyle">@style/DialtactsActionBarTitleText</item> - <item name="titleTextStyle">@style/DialtactsActionBarTitleText</item> - <item name="android:elevation">@dimen/action_bar_elevation</item> - <item name="elevation">@dimen/action_bar_elevation</item> - <!-- Empty icon --> - <item name="android:icon">@android:color/transparent</item> - <item name="icon">@android:color/transparent</item> - <!-- Shift the title text to the right --> - <item name="android:contentInsetStart">@dimen/actionbar_contentInsetStart</item> - <item name="contentInsetStart">@dimen/actionbar_contentInsetStart</item> + <item name="android:textColorPrimary">?android:attr/textColorPrimaryInverse</item> </style> <style name="ActionModeStyle" parent="Widget.AppCompat.ActionMode"> - <item name="android:background">@color/actionbar_background_color</item> - <item name="background">@color/actionbar_background_color</item> + <item name="android:background">?android:attr/colorPrimary</item> + <item name="background">?android:attr/colorPrimary</item> <item name="closeItemLayout">@layout/action_mode_close_button</item> </style> - <style name="DialtactsActionBarWithoutTitleStyle" parent="DialtactsActionBarStyle"> - <!-- Styles that require AppCompat compatibility, remember to update both sets --> - <item name="android:displayOptions"></item> - <item name="displayOptions"></item> - <item name="android:height">@dimen/action_bar_height_large</item> - <item name="height">@dimen/action_bar_height_large</item> - <!-- Override ActionBar title offset to keep search box aligned left --> - <item name="android:contentInsetStart">0dp</item> - <item name="contentInsetStart">0dp</item> - <item name="android:contentInsetEnd">0dp</item> - <item name="contentInsetEnd">0dp</item> - </style> - <style name="DialtactsSearchBarThemeOverlay" parent="ThemeOverlay.AppCompat.Light"/> <!-- Text in the action bar at the top of the screen --> @@ -189,34 +73,42 @@ <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:textColorSecondary</item> + <item name="android:tint">?android:attr/textColorSecondary</item> <item name="android:importantForAccessibility">no</item> </style> - <!-- Style applied to the "Settings" screen. Keep in sync with SettingsLight in Telephony. --> - <style name="SettingsStyle" parent="DialtactsThemeWithoutActionBarOverlay"> - <!-- 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">@color/setting_background_color</item> - <item name="android:colorAccent">@color/dialtacts_theme_color</item> - <item name="android:textColorLink">@color/dialtacts_theme_color</item> - </style> - <style name="ManageBlockedNumbersStyle" parent="SettingsStyle"> <!-- Styles that require AppCompat compatibility, remember to update both sets --> <item name="android:windowActionBarOverlay">true</item> <item name="windowActionBarOverlay">true</item> <item name="android:actionBarStyle">@style/ManageBlockedNumbersActionBarStyle</item> - <item name="actionBarStyle">@style/ManageBlockedNumbersActionBarStyle</item> <item name="android:fastScrollTrackDrawable">@null</item> </style> - <style name="ManageBlockedNumbersActionBarStyle" parent="DialtactsActionBarWithoutTitleStyle"> + <style name="ManageBlockedNumbersActionBarStyle" parent="DialerActionBarBaseStyle"> <!-- Styles that require AppCompat compatibility, remember to update both sets --> <item name="android:height">@dimen/action_bar_height</item> <item name="height">@dimen/action_bar_height</item> + + <!-- Styles that require AppCompat compatibility, remember to update both sets --> + <item name="android:displayOptions"></item> + <item name="displayOptions"></item> + <!-- Override ActionBar title offset to keep search box aligned left --> + <item name="android:contentInsetStart">0dp</item> + <item name="contentInsetStart">0dp</item> + <item name="android:contentInsetEnd">0dp</item> + <item name="contentInsetEnd">0dp</item> + + <!-- Styles that require AppCompat compatibility, remember to update both sets --> + <item name="android:background">?android:attr/colorPrimary</item> + <item name="background">?android:attr/colorPrimary</item> + <item name="android:titleTextStyle">@style/DialtactsActionBarTitleText</item> + <item name="titleTextStyle">@style/DialtactsActionBarTitleText</item> + <item name="android:elevation">@dimen/action_bar_elevation</item> + <item name="elevation">@dimen/action_bar_elevation</item> + <!-- Empty icon --> + <item name="android:icon">@android:color/transparent</item> + <item name="icon">@android:color/transparent</item> </style> <style name="VoicemailPlaybackLayoutButtonStyle"> @@ -272,7 +164,7 @@ </style> <style name="PromoLinkStyle"> - <item name="android:textColor">@color/dialer_theme_color</item> + <item name="android:textColor">?android:attr/colorPrimary</item> <item name="android:fontFamily">"sans-serif-medium"</item> </style> diff --git a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java index 8746b2bf1..e650e77f8 100644 --- a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java +++ b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java @@ -35,6 +35,7 @@ import com.android.dialer.phonenumbergeoutil.impl.PhoneNumberGeoUtilModule; import com.android.dialer.precall.impl.PreCallModule; import com.android.dialer.preferredsim.PreferredSimModule; import com.android.dialer.preferredsim.suggestion.stub.StubSimSuggestionModule; +import com.android.dialer.promotion.impl.PromotionModule; import com.android.dialer.simulator.impl.SimulatorModule; import com.android.dialer.simulator.stub.StubSimulatorEnrichedCallModule; import com.android.dialer.spam.stub.StubSpamModule; @@ -50,34 +51,34 @@ import javax.inject.Singleton; /** Root component for the AOSP Dialer application. */ @Singleton @Component( - modules = { - ActiveCallsModule.class, - CallLogModule.class, - CallLogConfigModule.class, - CommandLineModule.class, - ContextModule.class, - DialerExecutorModule.class, - GlidePhotoManagerModule.class, - PhoneLookupModule.class, - PhoneNumberGeoUtilModule.class, - PreCallModule.class, - PreferredSimModule.class, - SharedPrefConfigProviderModule.class, - SimulatorModule.class, - StubSimulatorEnrichedCallModule.class, - StorageModule.class, - StubCallLocationModule.class, - StubDuoModule.class, - StubEnrichedCallModule.class, - StubBubbleModule.class, - StubMetricsModule.class, - StubFeedbackModule.class, - StubMapsModule.class, - StubSimSuggestionModule.class, - StubSpamModule.class, - StubSpeakEasyModule.class, - SystemStrictModeModule.class, - VoicemailModule.class, - } -) + modules = { + ActiveCallsModule.class, + CallLogModule.class, + CallLogConfigModule.class, + CommandLineModule.class, + ContextModule.class, + DialerExecutorModule.class, + GlidePhotoManagerModule.class, + PhoneLookupModule.class, + PhoneNumberGeoUtilModule.class, + PreCallModule.class, + PreferredSimModule.class, + PromotionModule.class, + SharedPrefConfigProviderModule.class, + SimulatorModule.class, + StubSimulatorEnrichedCallModule.class, + StorageModule.class, + StubCallLocationModule.class, + StubDuoModule.class, + StubEnrichedCallModule.class, + StubBubbleModule.class, + StubMetricsModule.class, + StubFeedbackModule.class, + StubMapsModule.class, + StubSimSuggestionModule.class, + StubSpamModule.class, + StubSpeakEasyModule.class, + SystemStrictModeModule.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 cad2eb7e0..1d346accf 100644 --- a/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java +++ b/java/com/android/dialer/binary/basecomponent/BaseDialerRootComponent.java @@ -36,6 +36,7 @@ import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtilComponent; import com.android.dialer.precall.PreCallComponent; import com.android.dialer.preferredsim.PreferredSimComponent; import com.android.dialer.preferredsim.suggestion.SimSuggestionComponent; +import com.android.dialer.promotion.PromotionComponent; import com.android.dialer.simulator.SimulatorComponent; import com.android.dialer.spam.SpamComponent; import com.android.dialer.speeddial.loader.UiItemLoaderComponent; @@ -72,6 +73,7 @@ public interface BaseDialerRootComponent PhoneNumberGeoUtilComponent.HasComponent, PreCallComponent.HasComponent, PreferredSimComponent.HasComponent, + PromotionComponent.HasComponent, UiItemLoaderComponent.HasComponent, SimSuggestionComponent.HasComponent, SimulatorComponent.HasComponent, diff --git a/java/com/android/dialer/binary/common/DialerApplication.java b/java/com/android/dialer/binary/common/DialerApplication.java index 3247c7053..31d4d828e 100644 --- a/java/com/android/dialer/binary/common/DialerApplication.java +++ b/java/com/android/dialer/binary/common/DialerApplication.java @@ -42,7 +42,6 @@ public abstract class DialerApplication extends Application implements HasRootCo public void onCreate() { Trace.beginSection("DialerApplication.onCreate"); StrictModeComponent.get(this).getDialerStrictMode().onApplicationCreate(this); - super.onCreate(); new BlockedNumbersAutoMigrator( this.getApplicationContext(), diff --git a/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java index 62b8ca251..8c0ac56a2 100644 --- a/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java +++ b/java/com/android/dialer/binary/google/GoogleStubDialerRootComponent.java @@ -35,6 +35,7 @@ import com.android.dialer.phonenumbergeoutil.impl.PhoneNumberGeoUtilModule; import com.android.dialer.precall.impl.PreCallModule; import com.android.dialer.preferredsim.PreferredSimModule; import com.android.dialer.preferredsim.suggestion.stub.StubSimSuggestionModule; +import com.android.dialer.promotion.impl.PromotionModule; import com.android.dialer.simulator.impl.SimulatorModule; import com.android.dialer.simulator.stub.StubSimulatorEnrichedCallModule; import com.android.dialer.spam.stub.StubSpamModule; @@ -53,34 +54,34 @@ import javax.inject.Singleton; */ @Singleton @Component( - modules = { - ActiveCallsModule.class, - CallLocationModule.class, - CallLogModule.class, - CallLogConfigModule.class, - CommandLineModule.class, - ContextModule.class, - DialerExecutorModule.class, - GlidePhotoManagerModule.class, - MapsModule.class, - PhoneLookupModule.class, // TODO(zachh): Module which uses APDL? - PhoneNumberGeoUtilModule.class, - PreCallModule.class, - PreferredSimModule.class, - SharedPrefConfigProviderModule.class, - SimulatorModule.class, - StorageModule.class, - StubSimulatorEnrichedCallModule.class, - StubDuoModule.class, - StubEnrichedCallModule.class, - StubFeedbackModule.class, - StubMetricsModule.class, - StubBubbleModule.class, - StubSimSuggestionModule.class, - StubSpamModule.class, - StubSpeakEasyModule.class, - SystemStrictModeModule.class, - VoicemailModule.class, - } -) + modules = { + ActiveCallsModule.class, + CallLocationModule.class, + CallLogModule.class, + CallLogConfigModule.class, + CommandLineModule.class, + ContextModule.class, + DialerExecutorModule.class, + GlidePhotoManagerModule.class, + MapsModule.class, + PhoneLookupModule.class, // TODO(zachh): Module which uses APDL? + PhoneNumberGeoUtilModule.class, + PreCallModule.class, + PreferredSimModule.class, + PromotionModule.class, + SharedPrefConfigProviderModule.class, + SimulatorModule.class, + StorageModule.class, + StubSimulatorEnrichedCallModule.class, + StubDuoModule.class, + StubEnrichedCallModule.class, + StubFeedbackModule.class, + StubMetricsModule.class, + StubBubbleModule.class, + StubSimSuggestionModule.class, + StubSpamModule.class, + StubSpeakEasyModule.class, + SystemStrictModeModule.class, + VoicemailModule.class, + }) public interface GoogleStubDialerRootComponent extends BaseDialerRootComponent {} diff --git a/java/com/android/dialer/blocking/AndroidManifest.xml b/java/com/android/dialer/blocking/AndroidManifest.xml index 08d243988..fb811ea03 100644 --- a/java/com/android/dialer/blocking/AndroidManifest.xml +++ b/java/com/android/dialer/blocking/AndroidManifest.xml @@ -1,9 +1,23 @@ +<!-- Copyright (C) 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.blocking"> - <application android:theme="@style/Theme.AppCompat"> + <application> - <provider + <provider android:authorities="com.android.dialer.blocking.filterednumberprovider" android:exported="false" android:multiprocess="false" diff --git a/java/com/android/dialer/blockreportspam/BlockReportSpamDialogs.java b/java/com/android/dialer/blockreportspam/BlockReportSpamDialogs.java index db5fe2134..ff2a5888a 100644 --- a/java/com/android/dialer/blockreportspam/BlockReportSpamDialogs.java +++ b/java/com/android/dialer/blockreportspam/BlockReportSpamDialogs.java @@ -17,13 +17,13 @@ package com.android.dialer.blockreportspam; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; -import android.app.DialogFragment; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.Nullable; +import android.support.v4.app.DialogFragment; +import android.support.v7.app.AlertDialog; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; @@ -40,7 +40,7 @@ public final class BlockReportSpamDialogs { /** Creates a dialog with the default cancel button listener (which dismisses the dialog). */ private static AlertDialog.Builder createDialogBuilder( Activity activity, final DialogFragment fragment) { - return new AlertDialog.Builder(activity, R.style.AlertDialogTheme) + return new AlertDialog.Builder(activity) .setCancelable(true) .setNegativeButton(android.R.string.cancel, (dialog, which) -> fragment.dismiss()); } diff --git a/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java b/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java index fd26ab537..fb0399d9a 100644 --- a/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java +++ b/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java @@ -16,11 +16,11 @@ package com.android.dialer.blockreportspam; -import android.app.FragmentManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.support.v4.app.FragmentManager; import android.widget.Toast; import com.android.dialer.blocking.Blocking; import com.android.dialer.blocking.Blocking.BlockingFailedException; diff --git a/java/com/android/dialer/callcomposer/AndroidManifest.xml b/java/com/android/dialer/callcomposer/AndroidManifest.xml index cce71105f..369db6f4a 100644 --- a/java/com/android/dialer/callcomposer/AndroidManifest.xml +++ b/java/com/android/dialer/callcomposer/AndroidManifest.xml @@ -17,7 +17,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.callcomposer"> - <application android:theme="@style/Theme.AppCompat"> + <application> <activity android:name="com.android.dialer.callcomposer.CallComposerActivity" android:exported="true" diff --git a/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml b/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml index 8169a3ded..d5885115e 100644 --- a/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml +++ b/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml @@ -71,7 +71,7 @@ android:layout_marginEnd="@dimen/camera_view_button_margin" android:layout_marginBottom="@dimen/camera_view_button_margin" android:src="@drawable/quantum_ic_fullscreen_white_48" - android:background="?android:selectableItemBackgroundBorderless" + android:background="?android:attr/selectableItemBackgroundBorderless" android:contentDescription="@string/description_camera_switch_full_screen"/> <ImageButton @@ -83,7 +83,7 @@ android:layout_marginBottom="@dimen/camera_view_button_margin" android:src="@drawable/quantum_ic_fullscreen_exit_white_48" android:visibility="gone" - android:background="?android:selectableItemBackgroundBorderless" + android:background="?android:attr/selectableItemBackgroundBorderless" android:contentDescription="@string/description_camera_switch_preview_screen"/> <ImageButton @@ -92,7 +92,7 @@ android:layout_height="@dimen/capture_button_size" android:layout_gravity="bottom|center_horizontal" android:layout_marginBottom="@dimen/capture_button_bottom_margin" - android:background="?android:selectableItemBackgroundBorderless" + android:background="?android:attr/selectableItemBackgroundBorderless" android:src="@drawable/ic_capture" android:scaleType="fitXY" android:contentDescription="@string/description_camera_take_picture"/> diff --git a/java/com/android/dialer/callcomposer/res/drawable/call_composer_contact_border.xml b/java/com/android/dialer/callcomposer/res/drawable/call_composer_contact_border.xml index b3c36e9e0..16afed495 100644 --- a/java/com/android/dialer/callcomposer/res/drawable/call_composer_contact_border.xml +++ b/java/com/android/dialer/callcomposer/res/drawable/call_composer_contact_border.xml @@ -20,7 +20,7 @@ <stroke android:width="@dimen/call_composer_contact_photo_border_thickness" - android:color="@color/background_dialer_white"/> + android:color="?android:attr/colorBackground"/> <padding android:bottom="@dimen/call_composer_contact_photo_border_thickness" diff --git a/java/com/android/dialer/callcomposer/res/drawable/gallery_grid_item_view_background.xml b/java/com/android/dialer/callcomposer/res/drawable/gallery_grid_item_view_background.xml index bbae1a821..f57160890 100644 --- a/java/com/android/dialer/callcomposer/res/drawable/gallery_grid_item_view_background.xml +++ b/java/com/android/dialer/callcomposer/res/drawable/gallery_grid_item_view_background.xml @@ -18,5 +18,5 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="@dimen/gallery_item_corner_radius"/> - <solid android:color="@color/background_dialer_white"/> + <solid android:color="?android:attr/colorBackground"/> </shape> diff --git a/java/com/android/dialer/callcomposer/res/drawable/gallery_item_selected_drawable.xml b/java/com/android/dialer/callcomposer/res/drawable/gallery_item_selected_drawable.xml index 5050407c5..6e726c889 100644 --- a/java/com/android/dialer/callcomposer/res/drawable/gallery_item_selected_drawable.xml +++ b/java/com/android/dialer/callcomposer/res/drawable/gallery_item_selected_drawable.xml @@ -20,9 +20,9 @@ android:shape="oval"> <stroke android:width="1dp" - android:color="@color/dialer_theme_color"/> + android:color="?android:attr/colorPrimary"/> <solid - android:color="@color/background_dialer_white"/> + android:color="?android:attr/colorBackground"/> <size android:height="@dimen/gallery_check_size" android:width="@dimen/gallery_check_size"/> @@ -32,6 +32,6 @@ <bitmap android:gravity="center" android:src="@drawable/quantum_ic_check_black_24" - android:tint="@color/dialer_theme_color"/> + android:tint="?android:attr/colorPrimary"/> </item> </layer-list>
\ No newline at end of file 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 48d6368c2..4d3769b6d 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 @@ -45,7 +45,7 @@ android:paddingBottom="@dimen/call_composer_contact_container_padding_bottom" android:paddingStart="16dp" android:paddingEnd="16dp" - android:background="@color/dialer_theme_color"> + android:background="?android:attr/colorPrimary"> <TextView android:id="@+id/contact_name" @@ -54,7 +54,7 @@ android:gravity="center" android:maxLines="1" android:ellipsize="end" - android:textColor="@color/background_dialer_white" + android:textColor="?android:attr/colorBackground" android:textSize="@dimen/call_composer_name_text_size"/> <TextView @@ -64,7 +64,7 @@ android:gravity="center" android:maxLines="1" android:ellipsize="end" - android:textColor="@color/background_dialer_white" + android:textColor="?android:attr/colorBackground" android:textSize="@dimen/call_composer_number_text_size"/> </LinearLayout> @@ -105,7 +105,7 @@ android:layout_height="@dimen/call_composer_media_bar_height" android:orientation="horizontal" android:gravity="center_horizontal" - android:background="@color/dialer_theme_color_dark" + android:background="?android:attr/colorPrimaryDark" android:clickable="true"> <ImageView @@ -153,7 +153,7 @@ android:text="@string/share_and_call" android:textSize="@dimen/send_and_call_text_size" android:fontFamily="sans-serif-medium" - android:textColor="@color/background_dialer_white"/> + android:textColor="?android:attr/colorBackground"/> </FrameLayout> </FrameLayout> diff --git a/java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml b/java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml index 6cd6418a4..72b9fa685 100644 --- a/java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml +++ b/java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml @@ -18,7 +18,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_dialer_white" + android:background="?android:attr/colorBackground" android:paddingBottom="@dimen/call_composer_media_bar_height"> <GridView 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 39c2d0d47..49df9e679 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 @@ -20,7 +20,7 @@ android:layout_height="@dimen/call_composer_view_pager_height" android:orientation="vertical" android:gravity="bottom" - android:background="@color/background_dialer_white"> + android:background="?android:attr/colorBackground"> <TextView android:id="@+id/message_urgent" @@ -65,8 +65,8 @@ android:textSize="@dimen/message_compose_item_text_size" android:hint="@string/message_composer_custom_message_hint" android:textColor="@color/dialer_primary_text_color" - android:textColorHint="@color/dialer_edit_text_hint_color" - android:background="@color/background_dialer_white" + android:textColorHint="?android:attr/textColorHint" + android:background="?android:attr/colorBackground" android:textCursorDrawable="@drawable/searchedittext_custom_cursor" android:layout_toStartOf="@+id/remaining_characters" android:inputType="textShortMessage|textCapSentences" @@ -81,6 +81,6 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:textSize="@dimen/message_compose_remaining_char_text_size" - android:textColor="@color/dialer_edit_text_hint_color"/> + android:textColor="?android:attr/textColorHint"/> </RelativeLayout> </LinearLayout>
\ No newline at end of file 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 4daa11d62..783ba9867 100644 --- a/java/com/android/dialer/callcomposer/res/layout/permission_view.xml +++ b/java/com/android/dialer/callcomposer/res/layout/permission_view.xml @@ -20,7 +20,7 @@ android:layout_height="match_parent" android:gravity="center" android:clickable="true" - android:background="@color/background_dialer_white"> + android:background="?android:attr/colorBackground"> <ImageView android:id="@+id/permission_icon" @@ -45,7 +45,7 @@ android:text="@string/allow" android:textAllCaps="true" android:textSize="@dimen/allow_permission_text_size" - android:textColor="@color/dialer_theme_color" + android:textColor="?android:attr/colorPrimary" android:background="?android:attr/selectableItemBackground" android:padding="@dimen/permission_allow_padding" android:theme="@style/Theme.AppCompat.Light"/> diff --git a/java/com/android/dialer/callcomposer/res/values/styles.xml b/java/com/android/dialer/callcomposer/res/values/styles.xml index a03ee4894..aeec2a369 100644 --- a/java/com/android/dialer/callcomposer/res/values/styles.xml +++ b/java/com/android/dialer/callcomposer/res/values/styles.xml @@ -15,8 +15,7 @@ ~ limitations under the License --> <resources> - <style name="Theme.AppCompat.CallComposer" parent="DialerThemeBase.NoActionBar"> - <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> + <style name="Theme.AppCompat.CallComposer" parent="Dialer.ThemeBase.NoActionBar"> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:colorBackgroundCacheHint">@null</item> <item name="android:windowFrame">@null</item> diff --git a/java/com/android/dialer/calldetails/AndroidManifest.xml b/java/com/android/dialer/calldetails/AndroidManifest.xml index 9ef05a380..54d9f2fad 100644 --- a/java/com/android/dialer/calldetails/AndroidManifest.xml +++ b/java/com/android/dialer/calldetails/AndroidManifest.xml @@ -16,18 +16,18 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.calldetails"> - <application android:theme="@style/Theme.AppCompat"> + <application> <activity android:label="@string/call_details" android:exported="false" android:name="com.android.dialer.calldetails.OldCallDetailsActivity" - android:theme="@style/DialerThemeBase.NoActionBar"> + android:theme="@style/Dialer.ThemeBase.NoActionBar"> </activity> <activity android:label="@string/call_details" android:exported="false" android:name="com.android.dialer.calldetails.CallDetailsActivity" - android:theme="@style/DialerThemeBase.NoActionBar"> + android:theme="@style/Dialer.ThemeBase.NoActionBar"> </activity> </application> </manifest> diff --git a/java/com/android/dialer/calldetails/res/layout/call_details_activity.xml b/java/com/android/dialer/calldetails/res/layout/call_details_activity.xml index 10927af73..950867dc4 100644 --- a/java/com/android/dialer/calldetails/res/layout/call_details_activity.xml +++ b/java/com/android/dialer/calldetails/res/layout/call_details_activity.xml @@ -29,5 +29,5 @@ android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_dialer_white"/> + android:background="?android:attr/colorBackground"/> </LinearLayout>
\ No newline at end of file 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 1e989966a..40140971e 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 @@ -30,7 +30,7 @@ <TextView android:id="@+id/call_type" - style="@style/PrimaryText" + style="@style/Dialer.TextAppearance.Primary" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/call_entry_text_left_margin" @@ -41,7 +41,7 @@ <TextView android:id="@+id/call_time" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/call_entry_bottom_padding" @@ -50,7 +50,7 @@ <TextView android:id="@+id/call_duration" - style="@style/PrimaryText" + style="@style/Dialer.TextAppearance.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/call_entry_padding" @@ -66,7 +66,7 @@ <TextView android:id="@+id/post_call_note" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="match_parent" android:layout_height="@dimen/ec_container_height" android:layout_below="@+id/ec_container" @@ -77,7 +77,7 @@ android:visibility="gone"/> <TextView android:id="@+id/rtt_transcript" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/call_entry_bottom_padding" 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 9506183a0..e0de8dc5f 100644 --- a/java/com/android/dialer/calldetails/res/layout/contact_container.xml +++ b/java/com/android/dialer/calldetails/res/layout/contact_container.xml @@ -46,21 +46,21 @@ <com.android.dialer.widget.BidiTextView android:id="@+id/contact_name" - style="@style/PrimaryText" + style="@style/Dialer.TextAppearance.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/photo_text_margin"/> <TextView android:id="@+id/phone_number" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/photo_text_margin"/> <TextView android:id="@+id/network" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/photo_text_margin" @@ -101,7 +101,7 @@ <TextView android:id="@+id/assisted_dialing_text" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" 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 fec3126a5..523191207 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 @@ -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 + --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" @@ -14,7 +29,7 @@ android:layout_centerVertical="true" android:layout_marginStart="1dp" android:maxLines="2" - style="@style/SecondaryText"/> + style="@style/Dialer.TextAppearance.Secondary"/> <FrameLayout android:id="@+id/multimedia_image_container" @@ -39,7 +54,7 @@ android:id="@+id/multimedia_attachments_number" android:layout_width="match_parent" android:layout_height="match_parent" - android:textColor="@color/background_dialer_white" + android:textColor="?android:attr/colorBackground" android:textSize="20sp" android:fontFamily="sans-serif-medium" android:background="#80000000" diff --git a/java/com/android/dialer/calldetails/res/values/styles.xml b/java/com/android/dialer/calldetails/res/values/styles.xml index 93567ef73..1b4329a23 100644 --- a/java/com/android/dialer/calldetails/res/values/styles.xml +++ b/java/com/android/dialer/calldetails/res/values/styles.xml @@ -34,7 +34,7 @@ <item name="android:textAllCaps">true</item> <item name="textAllCaps">true</item> </style> - <style name="RttTranscriptMessage" parent="SecondaryText"> + <style name="RttTranscriptMessage" parent="Dialer.TextAppearance.Secondary"> <item name="android:fontFamily">sans-serif</item> <item name="android:textAllCaps">false</item> <item name="textAllCaps">false</item> diff --git a/java/com/android/dialer/calllog/ui/DuoDisclosureCardViewHolder.java b/java/com/android/dialer/calllog/ui/DuoDisclosureCardViewHolder.java deleted file mode 100644 index 6b9112789..000000000 --- a/java/com/android/dialer/calllog/ui/DuoDisclosureCardViewHolder.java +++ /dev/null @@ -1,64 +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.calllog.ui; - -import android.content.Context; -import android.support.v7.widget.RecyclerView.ViewHolder; -import android.text.method.LinkMovementMethod; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.TextView; -import com.android.dialer.configprovider.ConfigProviderBindings; -import com.android.dialer.duo.DuoComponent; -import com.android.dialer.spannable.ContentWithLearnMoreSpanner; - -/** ViewHolder for {@link NewCallLogAdapter} to display the Duo disclosure card. */ -public class DuoDisclosureCardViewHolder extends ViewHolder { - - private final Button okButton; - - DuoDisclosureCardViewHolder(View itemView) { - super(itemView); - - Context context = itemView.getContext(); - - // Set the Duo logo. - ImageView duoLogoView = itemView.findViewById(R.id.new_call_log_duo_disclosure_card_logo); - duoLogoView.setImageResource(DuoComponent.get(context).getDuo().getLogo()); - - // Set detailed text with a "learn more" link. - TextView cardDetailsView = itemView.findViewById(R.id.new_call_log_duo_disclosure_card_details); - cardDetailsView.setText( - new ContentWithLearnMoreSpanner(context) - .create( - context.getResources().getString(R.string.new_call_log_duo_disclosure_card_details), - ConfigProviderBindings.get(context) - .getString( - "duo_disclosure_link_full_url", - "http://support.google.com/pixelphone/?p=dialer_duo"))); - cardDetailsView.setMovementMethod(LinkMovementMethod.getInstance()); // make the link clickable - - // Obtain a reference to the "OK, got it" button. - okButton = itemView.findViewById(R.id.new_call_log_duo_disclosure_card_ok); - } - - void setDismissListener(OnClickListener listener) { - okButton.setOnClickListener(listener); - } -} diff --git a/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java b/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java index 501cf1657..58bf8c061 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java @@ -17,11 +17,9 @@ package com.android.dialer.calllog.ui; import android.app.Activity; import android.content.Context; -import android.content.SharedPreferences; import android.database.Cursor; import android.support.annotation.IntDef; import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ViewHolder; import android.view.LayoutInflater; @@ -29,37 +27,27 @@ import android.view.ViewGroup; import com.android.dialer.calllog.database.Coalescer; import com.android.dialer.calllogutils.CallLogDates; import com.android.dialer.common.Assert; -import com.android.dialer.duo.Duo; -import com.android.dialer.duo.DuoComponent; import com.android.dialer.logging.Logger; -import com.android.dialer.promotion.RttPromotion; -import com.android.dialer.storage.StorageComponent; +import com.android.dialer.promotion.Promotion; import com.android.dialer.time.Clock; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.concurrent.TimeUnit; /** {@link RecyclerView.Adapter} for the new call log fragment. */ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { - @VisibleForTesting - static final String SHARED_PREF_KEY_DUO_DISCLOSURE_DISMISSED = "duo_disclosure_dismissed"; - - private static final String SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS = - "duo_disclosure_first_viewed_time_ms"; - /** IntDef for the different types of rows that can be shown in the call log. */ @Retention(RetentionPolicy.SOURCE) @IntDef({ - RowType.DUO_DISCLOSURE_CARD, + RowType.PROMOTION_CARD, RowType.HEADER_TODAY, RowType.HEADER_YESTERDAY, RowType.HEADER_OLDER, RowType.CALL_LOG_ENTRY }) @interface RowType { - /** The Duo disclosure card. */ - int DUO_DISCLOSURE_CARD = 1; + /** The promotion card. */ + int PROMOTION_CARD = 1; /** Header that displays "Today". */ int HEADER_TODAY = 2; @@ -78,14 +66,12 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { private final Activity activity; private final RealtimeRowProcessor realtimeRowProcessor; private final PopCounts popCounts = new PopCounts(); - private final SharedPreferences sharedPref; - private final OnScrollListenerForRecordingDuoDisclosureFirstViewTime - onScrollListenerForRecordingDuoDisclosureFirstViewTime; + @Nullable private final Promotion promotion; private Cursor cursor; - /** Position of the Duo disclosure card. Null when it should not be displayed. */ - @Nullable private Integer duoDisclosureCardPosition; + /** Position of the promotion card. Null when it should not be displayed. */ + @Nullable private Integer promotionCardPosition; /** Position of the "Today" header. Null when it should not be displayed. */ @Nullable private Integer todayHeaderPosition; @@ -96,14 +82,12 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { /** Position of the "Older" header. Null when it should not be displayed. */ @Nullable private Integer olderHeaderPosition; - NewCallLogAdapter(Activity activity, Cursor cursor, Clock clock) { + NewCallLogAdapter(Activity activity, Cursor cursor, Clock clock, @Nullable Promotion promotion) { this.activity = activity; this.cursor = cursor; this.clock = clock; this.realtimeRowProcessor = CallLogUiComponent.get(activity).realtimeRowProcessor(); - this.sharedPref = StorageComponent.get(activity).unencryptedSharedPrefs(); - this.onScrollListenerForRecordingDuoDisclosureFirstViewTime = - new OnScrollListenerForRecordingDuoDisclosureFirstViewTime(sharedPref, clock); + this.promotion = promotion; setCardAndHeaderPositions(); } @@ -126,11 +110,11 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { } private void setCardAndHeaderPositions() { - // Set the position for the Duo disclosure card if it should be shown. - duoDisclosureCardPosition = null; + // Set the position for the promotion card if it should be shown. + promotionCardPosition = null; int numCards = 0; - if (shouldShowDuoDisclosureCard()) { - duoDisclosureCardPosition = 0; + if (promotion != null && promotion.isEligibleToBeShown()) { + promotionCardPosition = 0; numCards++; } @@ -174,61 +158,26 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { !cursor.isAfterLast() ? numItemsInToday + numItemsInYesterday + numCards : null; } - private boolean shouldShowDuoDisclosureCard() { - if (new RttPromotion(activity).shouldShow()) { - return false; - } - // Don't show the Duo disclosure card if - // (1) Duo integration is not enabled on the device, or - // (2) Duo is not activated. - Duo duo = DuoComponent.get(activity).getDuo(); - if (!duo.isEnabled(activity) || !duo.isActivated(activity)) { - return false; - } - - // Don't show the Duo disclosure card if it has been dismissed. - if (sharedPref.getBoolean(SHARED_PREF_KEY_DUO_DISCLOSURE_DISMISSED, false)) { - return false; - } - - // At this point, Duo is activated and the disclosure card hasn't been dismissed. - // We should show the card if it has never been viewed by the user. - if (!sharedPref.contains(SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS)) { - return true; - } - - // At this point, the card has been viewed but not dismissed. - // We should not show the card if it has been viewed for more than 1 day. - long duoDisclosureFirstViewTimeMillis = - sharedPref.getLong(SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS, 0); - return clock.currentTimeMillis() - duoDisclosureFirstViewTimeMillis - <= TimeUnit.DAYS.toMillis(1); - } - @Override public void onAttachedToRecyclerView(RecyclerView recyclerView) { super.onAttachedToRecyclerView(recyclerView); - // Register a OnScrollListener that records the timestamp at which the Duo disclosure is first - // viewed if - // (1) the Duo disclosure card should be shown, and - // (2) it hasn't been viewed yet. - if (shouldShowDuoDisclosureCard() - && !sharedPref.contains(SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS)) { - recyclerView.addOnScrollListener(onScrollListenerForRecordingDuoDisclosureFirstViewTime); + // Register a OnScrollListener that records when the promotion is viewed. + if (promotion != null && promotion.isEligibleToBeShown()) { + recyclerView.addOnScrollListener( + new OnScrollListenerForRecordingPromotionCardFirstViewTime(promotion)); } } @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, @RowType int viewType) { switch (viewType) { - case RowType.DUO_DISCLOSURE_CARD: - return new DuoDisclosureCardViewHolder( + case RowType.PROMOTION_CARD: + return new PromotionCardViewHolder( LayoutInflater.from(activity) .inflate( - R.layout.new_call_log_duo_disclosure_card, - viewGroup, - /* attachToRoot = */ false)); + R.layout.new_call_log_promotion_card, viewGroup, /* attachToRoot = */ false), + promotion); case RowType.HEADER_TODAY: case RowType.HEADER_YESTERDAY: case RowType.HEADER_OLDER: @@ -252,16 +201,11 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { public void onBindViewHolder(ViewHolder viewHolder, int position) { @RowType int viewType = getItemViewType(position); switch (viewType) { - case RowType.DUO_DISCLOSURE_CARD: - ((DuoDisclosureCardViewHolder) viewHolder) + case RowType.PROMOTION_CARD: + ((PromotionCardViewHolder) viewHolder) .setDismissListener( - unused -> { - StorageComponent.get(activity) - .unencryptedSharedPrefs() - .edit() - .putBoolean(SHARED_PREF_KEY_DUO_DISCLOSURE_DISMISSED, true) - .apply(); - notifyItemRemoved(duoDisclosureCardPosition); + () -> { + notifyItemRemoved(promotionCardPosition); setCardAndHeaderPositions(); }); break; @@ -277,7 +221,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { case RowType.CALL_LOG_ENTRY: NewCallLogViewHolder newCallLogViewHolder = (NewCallLogViewHolder) viewHolder; int previousCardAndHeaders = 0; - if (duoDisclosureCardPosition != null && position > duoDisclosureCardPosition) { + if (promotionCardPosition != null && position > promotionCardPosition) { previousCardAndHeaders++; } if (todayHeaderPosition != null && position > todayHeaderPosition) { @@ -301,8 +245,8 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { @Override @RowType public int getItemViewType(int position) { - if (duoDisclosureCardPosition != null && position == duoDisclosureCardPosition) { - return RowType.DUO_DISCLOSURE_CARD; + if (promotionCardPosition != null && position == promotionCardPosition) { + return RowType.PROMOTION_CARD; } if (todayHeaderPosition != null && position == todayHeaderPosition) { return RowType.HEADER_TODAY; @@ -321,7 +265,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { int numberOfCards = 0; int numberOfHeaders = 0; - if (duoDisclosureCardPosition != null) { + if (promotionCardPosition != null) { numberOfCards++; } if (todayHeaderPosition != null) { @@ -337,35 +281,27 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> { } /** - * A {@link RecyclerView.OnScrollListener} that records the timestamp at which the Duo disclosure - * card is first viewed. + * A {@link RecyclerView.OnScrollListener} that records the timestamp at which the promotion card + * is first viewed. * * <p>We consider the card as viewed if the user scrolls the containing RecyclerView since such * action is a strong proof. */ - private static final class OnScrollListenerForRecordingDuoDisclosureFirstViewTime + private static final class OnScrollListenerForRecordingPromotionCardFirstViewTime extends RecyclerView.OnScrollListener { - private final SharedPreferences sharedPref; - private final Clock clock; + private final Promotion promotion; - OnScrollListenerForRecordingDuoDisclosureFirstViewTime( - SharedPreferences sharedPref, Clock clock) { - this.sharedPref = sharedPref; - this.clock = clock; + OnScrollListenerForRecordingPromotionCardFirstViewTime(Promotion promotion) { + this.promotion = promotion; } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { - if (!sharedPref.contains(SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS) - && newState == RecyclerView.SCROLL_STATE_SETTLING) { - sharedPref - .edit() - .putLong( - SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS, clock.currentTimeMillis()) - .apply(); - - // Recording the timestamp is this listener's sole responsibility. + if (newState == RecyclerView.SCROLL_STATE_SETTLING) { + promotion.onViewed(); + + // Recording promotion is viewed is this listener's sole responsibility. // We can remove it from the containing RecyclerView after the job is done. recyclerView.removeOnScrollListener(this); } diff --git a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java index 2feed4068..ec6e8a0fd 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java @@ -42,6 +42,8 @@ import com.android.dialer.common.concurrent.ThreadUtil; import com.android.dialer.metrics.Metrics; import com.android.dialer.metrics.MetricsComponent; import com.android.dialer.metrics.jank.RecyclerViewJankLogger; +import com.android.dialer.promotion.Promotion.PromotionType; +import com.android.dialer.promotion.PromotionComponent; import com.android.dialer.util.PermissionsUtil; import com.android.dialer.widget.EmptyContentView; import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClickedListener; @@ -289,6 +291,7 @@ public final class NewCallLogFragment extends Fragment implements LoaderCallback return new AnnotatedCallLogCursorLoader(Assert.isNotNull(getContext())); } + @SuppressWarnings("AndroidApiChecker") // Use of optional @Override public void onLoadFinished(Loader<Cursor> loader, Cursor newCursor) { LogUtil.enterBlock("NewCallLogFragment.onLoadFinished"); @@ -319,7 +322,14 @@ public final class NewCallLogFragment extends Fragment implements LoaderCallback // instead. Activity activity = Assert.isNotNull(getActivity()); recyclerView.setAdapter( - new NewCallLogAdapter(activity, coalescedCursor, System::currentTimeMillis)); + new NewCallLogAdapter( + activity, + coalescedCursor, + System::currentTimeMillis, + PromotionComponent.get(getContext()) + .promotionManager() + .getHighestPriorityPromotion(PromotionType.CARD) + .orElse(null))); } else { ((NewCallLogAdapter) recyclerView.getAdapter()).updateCursor(coalescedCursor); } diff --git a/java/com/android/dialer/calllog/ui/PromotionCardViewHolder.java b/java/com/android/dialer/calllog/ui/PromotionCardViewHolder.java new file mode 100644 index 000000000..c7d62ba16 --- /dev/null +++ b/java/com/android/dialer/calllog/ui/PromotionCardViewHolder.java @@ -0,0 +1,63 @@ +/* + * 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.calllog.ui; + +import android.support.v7.widget.RecyclerView.ViewHolder; +import android.text.method.LinkMovementMethod; +import android.view.View; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; +import com.android.dialer.promotion.Promotion; + +/** ViewHolder for {@link NewCallLogAdapter} to display the Duo disclosure card. */ +public class PromotionCardViewHolder extends ViewHolder { + + /** Listener to be called when promotion card is dismissed. */ + interface DismissListener { + void onDismiss(); + } + + private final Button okButton; + private final Promotion promotion; + + PromotionCardViewHolder(View itemView, Promotion promotion) { + super(itemView); + this.promotion = promotion; + + ImageView iconView = itemView.findViewById(R.id.new_call_log_promotion_card_icon); + iconView.setImageResource(promotion.getIconRes()); + + TextView cardTitleView = itemView.findViewById(R.id.new_call_log_promotion_card_title); + cardTitleView.setText(promotion.getTitle()); + + TextView cardDetailsView = itemView.findViewById(R.id.new_call_log_promotion_card_details); + cardDetailsView.setText(promotion.getDetails()); + cardDetailsView.setMovementMethod(LinkMovementMethod.getInstance()); // make the link clickable + + // Obtain a reference to the "OK, got it" button. + okButton = itemView.findViewById(R.id.new_call_log_promotion_card_ok); + } + + void setDismissListener(DismissListener listener) { + okButton.setOnClickListener( + v -> { + promotion.dismiss(); + listener.onDismiss(); + }); + } +} 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 b022abbda..1bd71bb0f 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 @@ -60,7 +60,7 @@ --> <TextView android:id="@+id/primary_text" - style="@style/PrimaryText" + style="@style/Dialer.TextAppearance.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" @@ -96,7 +96,7 @@ <TextView android:id="@+id/call_count" - style="@style/PrimaryText" + style="@style/Dialer.TextAppearance.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="6dp" @@ -120,7 +120,7 @@ <TextView android:id="@+id/secondary_text" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" @@ -132,7 +132,7 @@ <!-- 3rd row: phone account info --> <TextView android:id="@+id/phone_account" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_fragment.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_fragment.xml index 1a2ec22d6..3275cc0a6 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_fragment.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_fragment.xml @@ -25,13 +25,13 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/floating_action_button_list_bottom_padding" - android:background="@color/background_dialer_white" + android:background="?android:attr/colorBackground" android:clipToPadding="false"/> <com.android.dialer.widget.EmptyContentView android:gravity="center_vertical" android:id="@+id/new_call_log_empty_content_view" - android:background="@color/background_dialer_white" + android:background="?android:attr/colorBackground" android:layout_gravity="center" android:layout_height="match_parent" android:layout_width="match_parent" diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_duo_disclosure_card.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml index 8084635d8..0e6d551fb 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_duo_disclosure_card.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml @@ -18,7 +18,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/background_dialer_light" + android:background="?android:attr/colorBackground" android:orientation="vertical"> <LinearLayout @@ -32,7 +32,7 @@ android:orientation="horizontal"> <ImageView - android:id="@+id/new_call_log_duo_disclosure_card_logo" + android:id="@+id/new_call_log_promotion_card_icon" android:layout_width="40dp" android:layout_height="40dp" android:layout_marginEnd="16dp" @@ -45,15 +45,15 @@ android:orientation="vertical"> <TextView + android:id="@+id/new_call_log_promotion_card_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:fontFamily="sans-serif-medium" - android:text="@string/new_call_log_duo_disclosure_card_header" android:textColor="@color/primary_material_dark" android:textSize="@dimen/call_log_primary_text_size"/> <TextView - android:id="@+id/new_call_log_duo_disclosure_card_details" + android:id="@+id/new_call_log_promotion_card_details" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" @@ -61,7 +61,7 @@ android:textColor="@color/primary_material_dark" android:textSize="14sp"/> <Button - android:id="@+id/new_call_log_duo_disclosure_card_ok" + android:id="@+id/new_call_log_promotion_card_ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dp" 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 e78b227ab..3888eb90d 100644 --- a/java/com/android/dialer/calllog/ui/res/values/strings.xml +++ b/java/com/android/dialer/calllog/ui/res/values/strings.xml @@ -32,17 +32,6 @@ <!-- Header in call log to group calls from before yesterday. [CHAR LIMIT=30] --> <string name="new_call_log_header_older">Older</string> - - <!-- Header on the Duo disclosure card. [CHAR_LIMIT=60] --> - <string name="new_call_log_duo_disclosure_card_header"> - Make video calls with Duo - </string> - - <!-- Details on the Duo disclosure card. [CHAR_LIMIT=200] --> - <string name="new_call_log_duo_disclosure_card_details"> - Google Duo video calling lets you chat with friends and family face-to-face. Data charges may apply. <xliff:g example="Learn More">%1$s</xliff:g> - </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/calllogutils/CallTypeIconsView.java b/java/com/android/dialer/calllogutils/CallTypeIconsView.java index d8c7889ee..30d9b6178 100644 --- a/java/com/android/dialer/calllogutils/CallTypeIconsView.java +++ b/java/com/android/dialer/calllogutils/CallTypeIconsView.java @@ -27,6 +27,7 @@ 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 java.util.ArrayList; import java.util.List; @@ -306,38 +307,37 @@ public class CallTypeIconsView extends View { iconId = R.drawable.quantum_ic_voicemail_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); voicemail = drawable.mutate(); - voicemail.setColorFilter(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + voicemail.setColorFilter(ThemeUtil.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(r.getColor(R.color.blocked_call), PorterDuff.Mode.MULTIPLY); + blocked.setColorFilter(ThemeUtil.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(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + videoCall.setColorFilter(ThemeUtil.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(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + hdCall.setColorFilter(ThemeUtil.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(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + wifiCall.setColorFilter(ThemeUtil.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( - r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + assistedDialedCall.setColorFilter(ThemeUtil.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(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + rttCall.setColorFilter(ThemeUtil.getColorIcon(), PorterDuff.Mode.MULTIPLY); iconMargin = largeIcons ? 0 : r.getDimensionPixelSize(R.dimen.call_log_icon_margin); } diff --git a/java/com/android/dialer/calllogutils/res/values/colors.xml b/java/com/android/dialer/calllogutils/res/values/colors.xml index e0e6fb2a5..8662163c1 100644 --- a/java/com/android/dialer/calllogutils/res/values/colors.xml +++ b/java/com/android/dialer/calllogutils/res/values/colors.xml @@ -19,6 +19,4 @@ <color name="missed_call">#C53929</color> <!-- Color for answered or outgoing call icons. --> <color name="answered_call">#00c853</color> - <!-- Color for blocked call icons. --> - <color name="blocked_call">@color/dialer_secondary_text_color</color> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/contactsfragment/res/drawable/fast_scroller_container_background.xml b/java/com/android/dialer/contactsfragment/res/drawable/fast_scroller_container_background.xml index a7b227799..87d123ad0 100644 --- a/java/com/android/dialer/contactsfragment/res/drawable/fast_scroller_container_background.xml +++ b/java/com/android/dialer/contactsfragment/res/drawable/fast_scroller_container_background.xml @@ -16,7 +16,7 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="@color/dialer_theme_color"/> + <solid android:color="?android:attr/colorPrimary"/> <size android:height="@dimen/fast_scroller_container_size" android:width="@dimen/fast_scroller_container_size"/> 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 a3e0c25c7..4683616e8 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 @@ -17,7 +17,7 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true"> <shape android:shape="rectangle"> - <solid android:color="@color/dialer_theme_color"/> + <solid android:color="?android:attr/colorPrimary"/> <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 dbc7cafb8..bc5f712f0 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 @@ -34,7 +34,7 @@ android:layout_width="@dimen/photo_size" android:layout_height="@dimen/photo_size" android:src="@drawable/quantum_ic_person_add_white_24" - android:tint="@color/dialer_theme_color" + android:tint="?android:attr/colorPrimary" android:scaleType="center"/> <TextView @@ -46,5 +46,5 @@ android:gravity="center_vertical" android:fontFamily="sans-serif" android:text="@string/all_contacts_empty_add_contact_action" - style="@style/PrimaryText"/> + style="@style/Dialer.TextAppearance.Primary"/> </LinearLayout> 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 7bc3b34a5..8d04fe512 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="@color/background_dialer_light" + android:background="?android:attr/colorBackgroundFloating" 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="@color/background_dialer_white" + android:textColor="?android:attr/colorBackground" 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 cb5e78a57..e75c7dc5a 100644 --- a/java/com/android/dialer/contactsfragment/res/layout/header.xml +++ b/java/com/android/dialer/contactsfragment/res/layout/header.xml @@ -19,7 +19,7 @@ android:id="@+id/header" android:layout_width="@dimen/header_width" android:layout_height="@dimen/row_height" - android:textColor="@color/dialer_theme_color" + android:textColor="?android:attr/colorPrimary" android:gravity="center" android:textSize="@dimen/text_size" android:textStyle="bold" 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 a2fbbab18..7f82d74fe 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 @@ -57,7 +57,7 @@ android:id="@+id/dialpadChooser" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/background_dialer_light" + android:background="?android:attr/colorBackgroundFloating" android:visibility="gone"/> <!-- Margin bottom and alignParentBottom don't work well together, so use a Space instead. --> diff --git a/java/com/android/dialer/dialpadview/res/layout-land/dialpad_key_one.xml b/java/com/android/dialer/dialpadview/res/layout-land/dialpad_key_one.xml index 0a770c24a..55bf09273 100644 --- a/java/com/android/dialer/dialpadview/res/layout-land/dialpad_key_one.xml +++ b/java/com/android/dialer/dialpadview/res/layout-land/dialpad_key_one.xml @@ -46,7 +46,7 @@ android:layout_height="@dimen/dialpad_voicemail_icon_size" android:scaleType="fitCenter" android:src="@drawable/quantum_ic_voicemail_white_24" - android:tint="@color/dialpad_voicemail_tint"/> + android:tint="?colorIcon"/> </LinearLayout> <!-- A placeholder to make the width the same as other dialpad keys. --> diff --git a/java/com/android/dialer/dialpadview/res/layout/dialpad_chooser_list_item.xml b/java/com/android/dialer/dialpadview/res/layout/dialpad_chooser_list_item.xml index e00529614..43df76fe8 100644 --- a/java/com/android/dialer/dialpadview/res/layout/dialpad_chooser_list_item.xml +++ b/java/com/android/dialer/dialpadview/res/layout/dialpad_chooser_list_item.xml @@ -33,6 +33,5 @@ android:layout_weight="1" android:layout_gravity="center_vertical" android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="@color/dialpad_primary_text_color"/> - + android:textColor="?android:attr/colorPrimary"/> </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 4a8ac0786..d3ebeb06c 100644 --- a/java/com/android/dialer/dialpadview/res/layout/dialpad_fragment.xml +++ b/java/com/android/dialer/dialpadview/res/layout/dialpad_fragment.xml @@ -46,7 +46,7 @@ android:id="@+id/dialpadChooser" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/background_dialer_light" + android:background="?android:attr/colorBackgroundFloating" android:visibility="gone"/> </LinearLayout> diff --git a/java/com/android/dialer/dialpadview/res/layout/dialpad_key_one.xml b/java/com/android/dialer/dialpadview/res/layout/dialpad_key_one.xml index 599c2d8e6..0d8a0f098 100644 --- a/java/com/android/dialer/dialpadview/res/layout/dialpad_key_one.xml +++ b/java/com/android/dialer/dialpadview/res/layout/dialpad_key_one.xml @@ -46,7 +46,7 @@ android:layout_height="@dimen/dialpad_voicemail_icon_size" android:scaleType="fitCenter" android:src="@drawable/quantum_ic_voicemail_white_24" - android:tint="?attr/dialpad_voicemail_tint"/> + android:tint="?colorIcon"/> </LinearLayout> </LinearLayout> </com.android.dialer.dialpadview.DialpadKeyButton> diff --git a/java/com/android/dialer/dialpadview/res/values/dimens.xml b/java/com/android/dialer/dialpadview/res/values/dimens.xml index 6892fcf30..f77c9ab7a 100644 --- a/java/com/android/dialer/dialpadview/res/values/dimens.xml +++ b/java/com/android/dialer/dialpadview/res/values/dimens.xml @@ -16,17 +16,11 @@ <resources> <!-- Text dimensions for dialpad keys --> - <dimen name="dialpad_key_numbers_default_size">36dp</dimen> - <dimen name="dialpad_key_letters_default_size_for_single_alphabet">12sp</dimen> - <dimen name="dialpad_key_letters_default_size_for_dual_alphabets">10sp</dimen> <dimen name="dialpad_key_pound_size">23sp</dimen> <dimen name="dialpad_key_star_size">36sp</dimen> <dimen name="dialpad_key_height">64dp</dimen> - <dimen name="dialpad_key_number_default_margin_bottom">3dp</dimen> <dimen name="dialpad_symbol_margin_bottom">13dp</dimen> - <dimen name="dialpad_digits_text_size">34sp</dimen> <dimen name="dialpad_digits_text_min_size">24sp</dimen> - <dimen name="dialpad_digits_height">60dp</dimen> <dimen name="dialpad_digits_padding">16dp</dimen> <dimen name="dialpad_digits_menu_left_padding">8dp</dimen> <dimen name="dialpad_digits_menu_right_padding">10dp</dimen> @@ -35,8 +29,6 @@ <dimen name="dialpad_overflow_margin">8dp</dimen> <dimen name="dialpad_space_above_keys">14dp</dimen> <dimen name="dialpad_space_below_keys">8dp</dimen> - <!-- The bottom space of the dialpad to account for the dial button --> - <dimen name="dialpad_bottom_space_height">80dp</dimen> <!-- Top/Bottom padding around the ILD rate display box. --> <dimen name="ild_margin_height">10dp</dimen> diff --git a/java/com/android/dialer/dialpadview/res/values/styles.xml b/java/com/android/dialer/dialpadview/res/values/styles.xml index 75a54a305..071c4bd44 100644 --- a/java/com/android/dialer/dialpadview/res/values/styles.xml +++ b/java/com/android/dialer/dialpadview/res/values/styles.xml @@ -82,43 +82,8 @@ <item name="android:orientation">vertical</item> </style> - <style name="Dialpad"> - <item name="dialpad_digits_adjustable_height">@dimen/dialpad_digits_height</item> - <item name="dialpad_digits_adjustable_text_size">@dimen/dialpad_digits_text_size</item> - <item name="dialpad_key_letters_size_for_dual_alphabets"> - @dimen/dialpad_key_letters_default_size_for_dual_alphabets - </item> - <item name="dialpad_key_letters_size_for_single_alphabet"> - @dimen/dialpad_key_letters_default_size_for_single_alphabet - </item> - <item name="dialpad_key_numbers_size">@dimen/dialpad_key_numbers_default_size</item> - <item name="dialpad_key_number_margin_bottom"> - @dimen/dialpad_key_number_default_margin_bottom - </item> - <item name="dialpad_end_key_spacing">@dimen/dialpad_bottom_space_height</item> - <item name="dialpad_elevation">0dp</item> - </style> - - <style name="Dialpad.Light"> - <item name="dialpad_text_color">@color/dialpad_digits_text_color</item> - <item name="dialpad_text_color_primary">@color/dialpad_primary_text_color</item> - <item name="dialpad_text_color_secondary">@color/dialpad_secondary_text_color</item> - <item name="dialpad_icon_tint">@color/dialpad_icon_tint</item> - <item name="dialpad_voicemail_tint">@color/dialpad_voicemail_tint</item> - <item name="dialpad_background">@color/background_dialpad</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_voicemail_tint">?attr/dialpad_text_color_secondary</item> - <item name="dialpad_background">#00000000</item> - </style> - <style name="DeviceIdBody"> - <item name="android:textColor">?android:textColorPrimary</item> + <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textSize">16sp</item> </style> </resources> diff --git a/java/com/android/dialer/dialpadview/theme/AndroidManifest.xml b/java/com/android/dialer/dialpadview/theme/AndroidManifest.xml new file mode 100644 index 000000000..f0726d0a7 --- /dev/null +++ b/java/com/android/dialer/dialpadview/theme/AndroidManifest.xml @@ -0,0 +1,16 @@ +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<manifest package="com.android.dialer.dialpadview.theme"/> diff --git a/java/com/android/dialer/dialpadview/res/values/attrs.xml b/java/com/android/dialer/dialpadview/theme/res/values/attr.xml index 61c9c208e..99707aa1d 100644 --- a/java/com/android/dialer/dialpadview/res/values/attrs.xml +++ b/java/com/android/dialer/dialpadview/theme/res/values/attr.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- - ~ Copyright (C) 2012 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. @@ -11,11 +12,9 @@ ~ 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. + ~ limitations under the License --> - <resources> - <attr format="reference" name="dialpad_style"/> <attr format="dimension" name="dialpad_end_key_spacing"/> diff --git a/java/com/android/dialer/dialpadview/theme/res/values/dimens.xml b/java/com/android/dialer/dialpadview/theme/res/values/dimens.xml new file mode 100644 index 000000000..e90ee1c92 --- /dev/null +++ b/java/com/android/dialer/dialpadview/theme/res/values/dimens.xml @@ -0,0 +1,27 @@ +<?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> + <!-- Text dimensions for dialpad keys --> + <dimen name="dialpad_key_numbers_default_size">36dp</dimen> + <dimen name="dialpad_key_letters_default_size_for_single_alphabet">12sp</dimen> + <dimen name="dialpad_key_letters_default_size_for_dual_alphabets">10sp</dimen> + <dimen name="dialpad_key_number_default_margin_bottom">3dp</dimen> + <dimen name="dialpad_digits_text_size">34sp</dimen> + <dimen name="dialpad_digits_height">60dp</dimen> + <!-- The bottom space of the dialpad to account for the dial button --> + <dimen name="dialpad_bottom_space_height">80dp</dimen> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/dialpadview/theme/res/values/styles.xml b/java/com/android/dialer/dialpadview/theme/res/values/styles.xml new file mode 100644 index 000000000..408a33dd1 --- /dev/null +++ b/java/com/android/dialer/dialpadview/theme/res/values/styles.xml @@ -0,0 +1,51 @@ +<?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="Dialpad"> + <item name="dialpad_digits_adjustable_height">@dimen/dialpad_digits_height</item> + <item name="dialpad_digits_adjustable_text_size">@dimen/dialpad_digits_text_size</item> + <item name="dialpad_key_letters_size_for_dual_alphabets"> + @dimen/dialpad_key_letters_default_size_for_dual_alphabets + </item> + <item name="dialpad_key_letters_size_for_single_alphabet"> + @dimen/dialpad_key_letters_default_size_for_single_alphabet + </item> + <item name="dialpad_key_numbers_size">@dimen/dialpad_key_numbers_default_size</item> + <item name="dialpad_key_number_margin_bottom"> + @dimen/dialpad_key_number_default_margin_bottom + </item> + <item name="dialpad_end_key_spacing">@dimen/dialpad_bottom_space_height</item> + <item name="dialpad_elevation">0dp</item> + </style> + + <style name="Dialpad.Light"> + <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 003ff19d5..e5e5a42e9 100644 --- a/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml +++ b/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml @@ -16,11 +16,11 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.calldetails"> - <application android:theme="@style/Theme.AppCompat"> - <activity + <application> + <activity android:label="@string/enriched_call_simulator_activity" android:name="com.android.dialer.enrichedcall.simulator.EnrichedCallSimulatorActivity" - android:theme="@style/DialerThemeBase.NoActionBar"> + android:theme="@style/Dialer.ThemeBase.NoActionBar"> </activity> </application> </manifest> 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 89cb91435..5fe40939e 100644 --- a/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml +++ b/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml @@ -40,13 +40,13 @@ <TextView android:id="@+id/primary_text" - style="@style/PrimaryText" + style="@style/Dialer.TextAppearance.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/secondary_text" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" 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 063051947..6b54e5e8b 100644 --- a/java/com/android/dialer/historyitemactions/res/layout/module_layout.xml +++ b/java/com/android/dialer/historyitemactions/res/layout/module_layout.xml @@ -35,5 +35,5 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - style="@style/PrimaryText"/> + style="@style/Dialer.TextAppearance.Primary"/> </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 ed3cf115a..98e2ec999 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">@color/background_dialer_white</item> + <item name="android:navigationBarColor">?android:attr/colorBackground</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 828f97830..12ba12b6c 100644 --- a/java/com/android/dialer/inject/ContextModule.java +++ b/java/com/android/dialer/inject/ContextModule.java @@ -18,7 +18,7 @@ package com.android.dialer.inject; import android.content.Context; import android.support.annotation.NonNull; -import com.android.dialer.common.Assert; +import com.android.dialer.theme.ThemeUtil; import dagger.Module; import dagger.Provides; @@ -30,7 +30,8 @@ public final class ContextModule { @NonNull private final Context context; public ContextModule(@NonNull Context appContext) { - this.context = Assert.isNotNull(appContext); + ThemeUtil.initializeTheme(appContext); + this.context = ThemeUtil.getThemedContext(appContext); } @Provides diff --git a/java/com/android/dialer/main/impl/AndroidManifest.xml b/java/com/android/dialer/main/impl/AndroidManifest.xml index d14077377..f0f338a1b 100644 --- a/java/com/android/dialer/main/impl/AndroidManifest.xml +++ b/java/com/android/dialer/main/impl/AndroidManifest.xml @@ -19,6 +19,7 @@ <application> + <!-- TODO(a bug): remove activity themes and only have application wide themes --> <activity android:clearTaskOnLaunch="true" android:exported="true" @@ -27,7 +28,7 @@ android:launchMode="singleTask" android:name="com.android.dialer.main.impl.MainActivity" android:resizeableActivity="true" - android:theme="@style/NuiActivityTheme" + android:theme="@style/MainActivityTheme" android:windowSoftInputMode="stateAlwaysHidden|adjustNothing"> <meta-data diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java index 2046b048f..1129609ed 100644 --- a/java/com/android/dialer/main/impl/MainActivity.java +++ b/java/com/android/dialer/main/impl/MainActivity.java @@ -78,7 +78,8 @@ public class MainActivity extends TransactionSafeActivity activePeer = getNewPeer(); activePeer.onActivityCreate(savedInstanceState); - showBlockReportSpamDialogReceiver = new ShowBlockReportSpamDialogReceiver(getFragmentManager()); + showBlockReportSpamDialogReceiver = + new ShowBlockReportSpamDialogReceiver(getSupportFragmentManager()); } protected MainActivityPeer getNewPeer() { diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index 16f46c10f..402edb3d5 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -109,7 +109,8 @@ import com.android.dialer.metrics.MetricsComponent; import com.android.dialer.postcall.PostCall; import com.android.dialer.precall.PreCall; import com.android.dialer.promotion.Promotion; -import com.android.dialer.promotion.RttPromotion; +import com.android.dialer.promotion.Promotion.PromotionType; +import com.android.dialer.promotion.PromotionComponent; import com.android.dialer.searchfragment.list.NewSearchFragment.SearchFragmentListener; import com.android.dialer.smartdial.util.SmartDialPrefix; import com.android.dialer.speeddial.SpeedDialFragment; @@ -128,6 +129,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import java.util.Locale; +import java.util.Optional; import java.util.concurrent.TimeUnit; /** @@ -1326,15 +1328,19 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen showPromotionBottomSheet(activity, bottomSheet); } + @SuppressWarnings("AndroidApiChecker") // Use of optional private static void showPromotionBottomSheet(Context context, View view) { - // TODO(a bug): Use a promotion manager to get promotion to show. - Promotion promotion = new RttPromotion(context); BottomSheetBehavior<View> bottomSheetBehavior = BottomSheetBehavior.from(view); - - if (!promotion.shouldShow()) { + Optional<Promotion> promotionOptional = + PromotionComponent.get(context) + .promotionManager() + .getHighestPriorityPromotion(PromotionType.BOTTOM_SHEET); + if (!promotionOptional.isPresent()) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); return; } + + Promotion promotion = promotionOptional.get(); ImageView icon = view.findViewById(R.id.promotion_icon); icon.setImageResource(promotion.getIconRes()); TextView details = view.findViewById(R.id.promotion_details); diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java index 2519d23cb..4edb08e55 100644 --- a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java +++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java @@ -30,6 +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; /** Navigation item in a bottom nav. */ final class BottomNavItem extends LinearLayout { @@ -53,10 +54,9 @@ final class BottomNavItem extends LinearLayout { @Override public void setSelected(boolean selected) { super.setSelected(selected); - int colorId = selected ? R.color.bottom_nav_icon_selected : R.color.bottom_nav_icon_deselected; - int color = getContext().getColor(colorId); - image.setImageTintList(ColorStateList.valueOf(color)); - text.setTextColor(color); + int colorId = selected ? ThemeUtil.getColorPrimary() : ThemeUtil.getTextColorSecondary(); + image.setImageTintList(ColorStateList.valueOf(colorId)); + text.setTextColor(colorId); } void setup(@StringRes int stringRes, @DrawableRes int drawableRes) { 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 59a967a10..dad566b68 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 @@ -17,7 +17,7 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="@color/dialer_theme_color"/> + <solid android:color="?android:attr/colorPrimary"/> <corners android:radius="20dp"/> - <stroke android:color="@color/background_dialer_white" android:width="2dp"/> + <stroke android:color="?android:attr/colorBackground" android:width="2dp"/> </shape>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml index 02ba3abd5..1dd60d8db 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml @@ -19,7 +19,7 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/background_dialer_white" + android:background="?android:attr/colorBackgroundFloating" android:elevation="8dp"> <include 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 cb4c6b628..2197b4d21 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 @@ -22,7 +22,7 @@ android:minWidth="80dp" android:minHeight="56dp" android:gravity="center" - android:background="?android:selectableItemBackgroundBorderless"> + android:background="?android:attr/selectableItemBackgroundBorderless"> <FrameLayout android:layout_width="wrap_content" @@ -47,7 +47,7 @@ android:minWidth="20dp" android:gravity="center" android:textSize="12sp" - android:textColor="@color/dialer_primary_text_color_white" + android:textColor="?android:attr/textColorPrimaryInverse" android:background="@drawable/notification_badge" android:fontFamily="sans-serif-medium" android:visibility="invisible"/> @@ -59,6 +59,6 @@ android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:textSize="12sp" - android:textColor="@color/dialer_theme_color" + android:textColor="?android:attr/colorPrimary" android:gravity="center_horizontal"/> </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 3f1e709fb..709de52b8 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 @@ -37,7 +37,7 @@ android:id="@+id/promotion_icon" android:layout_width="36dp" android:layout_height="36dp" - android:tint="@color/dialer_theme_color"/> + android:tint="?android:attr/colorPrimary"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" @@ -62,7 +62,6 @@ android:textSize="14sp"/> <Button android:id="@+id/ok_got_it" - style="@style/Widget.AppCompat.Button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dp" @@ -70,7 +69,6 @@ android:layout_gravity="end" android:paddingStart="16dp" android:paddingEnd="16dp" - android:backgroundTint="@color/dialer_theme_color" android:fontFamily="sans-serif-medium" android:stateListAnimator="@null" android:text="@string/ok_got_it" 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 86e6f28a6..9462bbc25 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 @@ -17,10 +17,11 @@ <resources> <!-- Used on sdk 27 and above --> - <style name="NuiActivityTheme" parent="NuiActivityThemeBase"> + <!-- TODO(a bug): refactor into dialer/theme --> + <style name="MainActivityTheme" parent="MainActivityThemeBase"> <!-- Used to change the navigation bar color --> <item name="android:windowLightNavigationBar">true</item> - <item name="android:navigationBarColor">@color/background_dialer_white</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/strings.xml b/java/com/android/dialer/main/impl/res/values/strings.xml index 121820383..cde78e66d 100644 --- a/java/com/android/dialer/main/impl/res/values/strings.xml +++ b/java/com/android/dialer/main/impl/res/values/strings.xml @@ -21,9 +21,6 @@ <!-- Title for the activity that dials the phone, when launched directly into the dialpad --> <string name="dialpad_activity_title">Phone Keypad</string> - <!-- The description text for the call log tab. --> - <string name="main_call_history_tab_description" tools:ignore="UnusedResources">Call history</string> - <!-- Text for a toolbar button that shows the user their contacts [CHAR LIMIT=NONE] --> <string name="search">@android:string/search_go</string> <!-- A11y announcement to let users know a button will let them search for contacts and places [CHAR LIMIT=NONE] --> 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 387b1d79e..467cb5be0 100644 --- a/java/com/android/dialer/main/impl/res/values/styles.xml +++ b/java/com/android/dialer/main/impl/res/values/styles.xml @@ -17,47 +17,24 @@ <resources> <!-- Activities should use this theme as their style --> - <style name="NuiActivityTheme" parent="NuiActivityThemeBase"/> + <style name="MainActivityTheme" parent="MainActivityThemeBase"/> <!-- Used as a procy for values-v27/styles.xml --> - <style name="NuiActivityThemeBase" parent="Theme.AppCompat.Light.NoActionBar"> - <!-- App colors --> - <item name="android:colorPrimary">@color/dialtacts_theme_color</item> - <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> - <item name="android:colorAccent">@color/dialer_secondary_color</item> - - <!-- TODO(calderwoodra): figure out what this is used for, but I think it's for checkboxes --> - <item name="android:colorControlActivated">@color/dialer_theme_color</item> - - <!-- Text colors --> - <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> - <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> - <item name="android:textColorLink">@color/dialer_theme_color</item> - - <!-- Themeing for material buttons and widgets --> - <item name="android:colorButtonNormal">@color/dialer_theme_color</item> - <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> - - <!-- Theme needed for DialpadFragment --> - <item name="dialpad_style">@style/Dialpad.Light</item> - - <!-- Custom theme for Alert Dialogs--> - <item name="android:alertDialogTheme">@style/AlertDialogTheme</item> - + <style name="MainActivityThemeBase" parent="Dialer.ThemeBase.NoActionBar"> <!-- Required for actionmode/multiselect to render properly. --> - <!-- TODO(calderwoodra): Check to see if we can remove this after NewVoicemailFragment launches --> - <item name="actionModeStyle">@style/NuiActionModeStyle</item> + <!-- 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> </style> <!-- Colors our actionbar in action mode to dialer theme color. --> - <style name="NuiActionModeStyle" parent="@style/Widget.AppCompat.ActionMode"> - <item name="background">@color/dialer_theme_color</item> + <style name="MainActionModeStyle" parent="@style/Widget.AppCompat.ActionMode"> + <item name="background">?android:attr/colorPrimary</item> <item name="titleTextStyle">@style/ActionModeTitleTextStyle</item> </style> <!-- Colors our actionbar text in action mode to dialer white text color. --> <style name="ActionModeTitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionMode.Title"> - <item name="android:textColor">@color/dialer_primary_text_color_white</item> + <item name="android:textColor">?android:attr/textColorPrimaryInverse</item> </style> </resources> diff --git a/java/com/android/dialer/main/impl/toolbar/res/drawable/custom_cursor.xml b/java/com/android/dialer/main/impl/toolbar/res/drawable/custom_cursor.xml index 008b0a3cc..f352901de 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/drawable/custom_cursor.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/drawable/custom_cursor.xml @@ -16,5 +16,5 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <size android:width="2dp"/> - <solid android:color="@color/dialtacts_theme_color"/> + <solid android:color="?android:attr/colorPrimary"/> </shape>
\ No newline at end of file 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 8767057a5..8bc21c4a8 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="@color/background_dialer_white"/> + <solid android:color="?android:attr/colorBackground"/> </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 58cdabe8b..2bbc8d106 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="@color/background_dialer_white"/> + <solid android:color="?android:attr/colorBackground"/> <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 3bd71b63a..8a8730f78 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 @@ -29,7 +29,7 @@ android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/action_menu_back_from_search" android:src="@drawable/quantum_ic_arrow_back_vd_theme_24" - android:tint="@color/dialer_theme_color"/> + android:tint="?android:attr/colorPrimary"/> <EditText android:id="@+id/search_view" @@ -46,7 +46,7 @@ android:maxLines="1" android:hint="@string/dialer_hint_find_contact" android:textColor="@color/dialer_secondary_text_color" - android:textColorHint="@color/dialer_edit_text_hint_color" + android:textColorHint="?android:attr/textColorHint" android:textCursorDrawable="@drawable/custom_cursor" android:textSize="16sp"/> 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 d63fdfe2f..98b856361 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 @@ -18,7 +18,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="@dimen/expanded_search_bar_height" - android:background="@color/dialer_theme_color" + android:background="?android:attr/colorPrimary" app:contentInsetEnd="0dp" app:contentInsetStart="0dp"> <FrameLayout @@ -38,7 +38,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:background="?android:selectableItemBackground" + android:background="?android:attr/selectableItemBackground" android:gravity="center_vertical"> <ImageView @@ -110,7 +110,7 @@ android:id="@+id/remove_view_content" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/dialer_theme_color" + android:background="?android:attr/colorPrimary" android:gravity="center" android:orientation="horizontal" android:visibility="gone"> @@ -122,14 +122,14 @@ android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:src="@drawable/quantum_ic_close_vd_theme_24" - android:tint="@color/dialer_primary_text_color_white"/> + android:tint="?android:attr/textColorPrimaryInverse"/> <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="@color/dialer_primary_text_color_white" + android:textColor="?android:attr/textColorPrimaryInverse" android:textSize="16sp"/> </LinearLayout> </com.android.dialer.app.list.RemoveView> diff --git a/java/com/android/dialer/postcall/AndroidManifest.xml b/java/com/android/dialer/postcall/AndroidManifest.xml index a09750564..82101a0b3 100644 --- a/java/com/android/dialer/postcall/AndroidManifest.xml +++ b/java/com/android/dialer/postcall/AndroidManifest.xml @@ -17,11 +17,11 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.postcall"> - <application android:theme="@style/Theme.AppCompat"> - <activity + <application> + <activity android:name="com.android.dialer.postcall.PostCallActivity" android:exported="false" - android:theme="@style/DialerThemeBase.NoActionBar" + android:theme="@style/Dialer.ThemeBase.NoActionBar" android:windowSoftInputMode="adjustResize"/> </application> </manifest> diff --git a/java/com/android/dialer/postcall/res/layout/post_call_activity.xml b/java/com/android/dialer/postcall/res/layout/post_call_activity.xml index c42764e5b..94df3242c 100644 --- a/java/com/android/dialer/postcall/res/layout/post_call_activity.xml +++ b/java/com/android/dialer/postcall/res/layout/post_call_activity.xml @@ -19,7 +19,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_dialer_white"> + android:background="?android:attr/colorBackground"> <com.android.dialer.widget.DialerToolbar android:id="@+id/toolbar" @@ -30,5 +30,5 @@ android:id="@+id/message_container" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_dialer_white"/> + android:background="?android:attr/colorBackground"/> </LinearLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/promotion/Promotion.java b/java/com/android/dialer/promotion/Promotion.java index 3cd16d4a6..176606ff4 100644 --- a/java/com/android/dialer/promotion/Promotion.java +++ b/java/com/android/dialer/promotion/Promotion.java @@ -17,23 +17,51 @@ package com.android.dialer.promotion; import android.support.annotation.DrawableRes; +import android.support.annotation.IntDef; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; /** Interface for promotion bottom sheet. */ public interface Promotion { - /** Returns if this promotion should be shown. */ - boolean shouldShow(); + /** + * Type of promotion, which means promotion should be shown as a card in {@link + * android.support.v7.widget.RecyclerView} or {@link + * android.support.design.bottomsheet.BottomSheetBehavior}. + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({PromotionType.CARD, PromotionType.BOTTOM_SHEET}) + @interface PromotionType { + /** Shown as card in call log or voicemail tab. */ + int CARD = 1; - /** Sets to show this promotion. */ - void setShouldShow(boolean shouldShow); + /** Shown as bottom sheet. */ + int BOTTOM_SHEET = 2; + } + + /** Returns {@link PromotionType} for this promotion. */ + @PromotionType + int getType(); + + /** + * Returns if this promotion should be shown. This usually means the promotion is enabled and not + * dismissed yet. + */ + boolean isEligibleToBeShown(); + + /** Called when this promotion is first time viewed by user. */ + default void onViewed() {} /** Dismisses this promotion. This is called when user acknowledged the promotion. */ void dismiss(); + /** Returns title text of the promotion. */ CharSequence getTitle(); + /** Returns details text of the promotion. */ CharSequence getDetails(); + /** Returns resource id of the icon for the promotion. */ @DrawableRes int getIconRes(); } diff --git a/java/com/android/dialer/promotion/PromotionComponent.java b/java/com/android/dialer/promotion/PromotionComponent.java new file mode 100644 index 000000000..caf10dbb0 --- /dev/null +++ b/java/com/android/dialer/promotion/PromotionComponent.java @@ -0,0 +1,43 @@ +/* + * 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.promotion; + +import android.content.Context; +import com.android.dialer.inject.HasRootComponent; +import com.android.dialer.inject.IncludeInDialerRoot; +import com.google.common.collect.ImmutableList; +import dagger.Subcomponent; + +/** Component for promotion. */ +@Subcomponent +public abstract class PromotionComponent { + + public abstract PromotionManager promotionManager(); + + public abstract ImmutableList<Promotion> priorityPromotionList(); + + public static PromotionComponent get(Context context) { + return ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component()) + .promotionComponent(); + } + + /** Used to refer to the root application component. */ + @IncludeInDialerRoot + public interface HasComponent { + PromotionComponent promotionComponent(); + } +} diff --git a/java/com/android/dialer/promotion/PromotionManager.java b/java/com/android/dialer/promotion/PromotionManager.java new file mode 100644 index 000000000..a86a745ad --- /dev/null +++ b/java/com/android/dialer/promotion/PromotionManager.java @@ -0,0 +1,67 @@ +/* + * 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.promotion; + +import com.android.dialer.promotion.Promotion.PromotionType; +import com.google.common.collect.ImmutableList; +import java.util.Optional; +import javax.inject.Inject; + +/** + * A class to manage all promotion cards/bottom sheet. + * + * <p>Only one promotion with highest priority will be shown at a time no matter type. So if there + * are one card and one bottom sheet promotion, either one will be shown instead of both. + */ +public final class PromotionManager { + + /** Promotion priority order list. Promotions with higher priority must be added first. */ + private ImmutableList<Promotion> priorityPromotionList; + + @Inject + public PromotionManager(ImmutableList<Promotion> priorityPromotionList) { + this.priorityPromotionList = priorityPromotionList; + } + + /** + * Returns promotion should show with highest priority. {@link Optional#empty()} if no promotion + * should be shown with given {@link PromotionType}. + * + * <p>e.g. if FooPromotion(card, high priority) and BarPromotion(bottom sheet, low priority) are + * both enabled, getHighestPriorityPromotion(CARD) returns Optional.of(FooPromotion) but + * getHighestPriorityPromotion(BOTTOM_SHEET) returns {@link Optional#empty()}. + * + * <p>Currently it only supports promotion in call log tab. + * + * <p>TODO(wangqi): add support for other tabs. + */ + @SuppressWarnings("AndroidApiChecker") // Use of optional + public Optional<Promotion> getHighestPriorityPromotion(@PromotionType int type) { + for (Promotion promotion : priorityPromotionList) { + if (promotion.isEligibleToBeShown()) { + if (promotion.getType() == type) { + return Optional.of(promotion); + } else { + // Returns empty promotion since it's not the type looking for and only one promotion + // should be shown at a time. + return Optional.empty(); + } + } + } + return Optional.empty(); + } +} diff --git a/java/com/android/dialer/promotion/AndroidManifest.xml b/java/com/android/dialer/promotion/impl/AndroidManifest.xml index bd85b104f..c938b9a37 100644 --- a/java/com/android/dialer/promotion/AndroidManifest.xml +++ b/java/com/android/dialer/promotion/impl/AndroidManifest.xml @@ -13,4 +13,11 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> -<manifest package="com.android.dialer.promotion"/> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.dialer.promotion"> + + <uses-sdk + android:minSdkVersion="24" + android:targetSdkVersion="28"/> + +</manifest> diff --git a/java/com/android/dialer/promotion/impl/DuoPromotion.java b/java/com/android/dialer/promotion/impl/DuoPromotion.java new file mode 100644 index 000000000..750e4a196 --- /dev/null +++ b/java/com/android/dialer/promotion/impl/DuoPromotion.java @@ -0,0 +1,132 @@ +/* + * 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.promotion.impl; + +import android.content.Context; +import android.content.SharedPreferences; +import android.support.annotation.VisibleForTesting; +import com.android.dialer.configprovider.ConfigProvider; +import com.android.dialer.duo.Duo; +import com.android.dialer.inject.ApplicationContext; +import com.android.dialer.promotion.Promotion; +import com.android.dialer.spannable.ContentWithLearnMoreSpanner; +import com.android.dialer.storage.Unencrypted; +import java.util.concurrent.TimeUnit; +import javax.inject.Inject; + +/** Duo promotion. */ +final class DuoPromotion implements Promotion { + private static final String SHARED_PREF_KEY_DUO_DISCLOSURE_DISMISSED = "duo_disclosure_dismissed"; + + private static final String SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS = + "duo_disclosure_first_viewed_time_ms"; + @VisibleForTesting static final String FLAG_SHOW_DUO_DISCLOSURE = "show_duo_disclosure"; + + @VisibleForTesting + static final String FLAG_DUO_DISCLOSURE_AUTO_DISMISS_AFTER_VIEWED_TIME_MILLIS = + "show_duo_disclosure_auto_dismiss_after_viewed_time_millis"; + + private final Context appContext; + private final ConfigProvider configProvider; + private final Duo duo; + private final SharedPreferences sharedPreferences; + + @Inject + DuoPromotion( + @ApplicationContext Context context, + ConfigProvider configProvider, + Duo duo, + @Unencrypted SharedPreferences sharedPreferences) { + this.appContext = context; + this.configProvider = configProvider; + this.duo = duo; + this.sharedPreferences = sharedPreferences; + } + + @Override + public int getType() { + return PromotionType.CARD; + } + + @Override + public boolean isEligibleToBeShown() { + if (!configProvider.getBoolean(FLAG_SHOW_DUO_DISCLOSURE, false)) { + return false; + } + // Don't show the Duo disclosure card if + // (1) Duo integration is not enabled on the device, or + // (2) Duo is not activated. + if (!duo.isEnabled(appContext) || !duo.isActivated(appContext)) { + return false; + } + + // Don't show the Duo disclosure card if it has been dismissed. + if (sharedPreferences.getBoolean(SHARED_PREF_KEY_DUO_DISCLOSURE_DISMISSED, false)) { + return false; + } + + // At this point, Duo is activated and the disclosure card hasn't been dismissed. + // We should show the card if it has never been viewed by the user. + if (!sharedPreferences.contains(SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS)) { + return true; + } + + // At this point, the card has been viewed but not dismissed. + // We should not show the card if it has been viewed for more than 1 day. + long duoDisclosureFirstViewTimeMillis = + sharedPreferences.getLong(SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS, 0); + return System.currentTimeMillis() - duoDisclosureFirstViewTimeMillis + <= configProvider.getLong( + FLAG_DUO_DISCLOSURE_AUTO_DISMISS_AFTER_VIEWED_TIME_MILLIS, TimeUnit.DAYS.toMillis(1)); + } + + @Override + public void onViewed() { + if (!sharedPreferences.contains(SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS)) { + sharedPreferences + .edit() + .putLong( + SHARED_PREF_KEY_DUO_DISCLOSURE_FIRST_VIEW_TIME_MILLIS, System.currentTimeMillis()) + .apply(); + } + } + + @Override + public void dismiss() { + sharedPreferences.edit().putBoolean(SHARED_PREF_KEY_DUO_DISCLOSURE_DISMISSED, true).apply(); + } + + @Override + public CharSequence getTitle() { + return appContext.getString(R.string.duo_disclosure_title); + } + + @Override + public CharSequence getDetails() { + return new ContentWithLearnMoreSpanner(appContext) + .create( + appContext.getString(R.string.duo_disclosure_details), + configProvider.getString( + "duo_disclosure_link_full_url", + "http://support.google.com/pixelphone/?p=dialer_duo")); + } + + @Override + public int getIconRes() { + return duo.getLogo(); + } +} diff --git a/java/com/android/dialer/promotion/impl/PromotionModule.java b/java/com/android/dialer/promotion/impl/PromotionModule.java new file mode 100644 index 000000000..f0908780c --- /dev/null +++ b/java/com/android/dialer/promotion/impl/PromotionModule.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.promotion.impl; + +import com.android.dialer.inject.DialerVariant; +import com.android.dialer.inject.InstallIn; +import com.android.dialer.promotion.Promotion; +import com.google.common.collect.ImmutableList; +import dagger.Module; +import dagger.Provides; + +/** Module for Promotion. */ +@InstallIn(variants = {DialerVariant.DIALER_TEST}) +@Module +public abstract class PromotionModule { + + @Provides + static ImmutableList<Promotion> providePriorityPromotionList( + RttPromotion rttPromotion, DuoPromotion duoPromotion) { + return ImmutableList.of(rttPromotion, duoPromotion); + } +} diff --git a/java/com/android/dialer/promotion/RttPromotion.java b/java/com/android/dialer/promotion/impl/RttPromotion.java index feb6e4734..f0f7f546b 100644 --- a/java/com/android/dialer/promotion/RttPromotion.java +++ b/java/com/android/dialer/promotion/impl/RttPromotion.java @@ -14,29 +14,45 @@ * limitations under the License */ -package com.android.dialer.promotion; +package com.android.dialer.promotion.impl; import android.content.Context; import android.content.SharedPreferences; import android.support.annotation.DrawableRes; import com.android.dialer.common.LogUtil; -import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProvider; +import com.android.dialer.inject.ApplicationContext; +import com.android.dialer.promotion.Promotion; import com.android.dialer.spannable.ContentWithLearnMoreSpanner; import com.android.dialer.storage.StorageComponent; +import com.android.dialer.storage.Unencrypted; +import javax.inject.Inject; /** RTT promotion. */ public final class RttPromotion implements Promotion { private static final String SHARED_PREFERENCE_KEY_ENABLED = "rtt_promotion_enabled"; private static final String SHARED_PREFERENCE_KEY_DISMISSED = "rtt_promotion_dismissed"; private final Context appContext; + private final SharedPreferences sharedPreferences; + private final ConfigProvider configProvider; - public RttPromotion(Context context) { - appContext = context.getApplicationContext(); + @Override + public int getType() { + return PromotionType.BOTTOM_SHEET; + } + + @Inject + RttPromotion( + @ApplicationContext Context context, + @Unencrypted SharedPreferences sharedPreferences, + ConfigProvider configProvider) { + appContext = context; + this.sharedPreferences = sharedPreferences; + this.configProvider = configProvider; } @Override - public boolean shouldShow() { - SharedPreferences sharedPreferences = StorageComponent.get(appContext).unencryptedSharedPrefs(); + public boolean isEligibleToBeShown() { return sharedPreferences.getBoolean(SHARED_PREFERENCE_KEY_ENABLED, false) && !sharedPreferences.getBoolean(SHARED_PREFERENCE_KEY_DISMISSED, false); } @@ -51,10 +67,9 @@ public final class RttPromotion implements Promotion { return new ContentWithLearnMoreSpanner(appContext) .create( appContext.getString(R.string.rtt_promotion_details), - ConfigProviderBindings.get(appContext) - .getString( - "rtt_promo_learn_more_link_full_url", - "http://support.google.com/pixelphone/?p=dialer_rtt")); + configProvider.getString( + "rtt_promo_learn_more_link_full_url", + "http://support.google.com/pixelphone/?p=dialer_rtt")); } @Override @@ -63,22 +78,17 @@ public final class RttPromotion implements Promotion { return R.drawable.quantum_ic_rtt_vd_theme_24; } - @Override - public void setShouldShow(boolean shouldShow) { - LogUtil.i("RttPromotion.setShouldShow", "shouldShow: %b", shouldShow); - StorageComponent.get(appContext) + public static void setEnabled(Context context) { + LogUtil.enterBlock("RttPromotion.setEnabled"); + StorageComponent.get(context) .unencryptedSharedPrefs() .edit() - .putBoolean(SHARED_PREFERENCE_KEY_ENABLED, shouldShow) + .putBoolean(SHARED_PREFERENCE_KEY_ENABLED, true) .apply(); } @Override public void dismiss() { - StorageComponent.get(appContext) - .unencryptedSharedPrefs() - .edit() - .putBoolean(SHARED_PREFERENCE_KEY_DISMISSED, true) - .apply(); + sharedPreferences.edit().putBoolean(SHARED_PREFERENCE_KEY_DISMISSED, true).apply(); } } diff --git a/java/com/android/dialer/promotion/res/values/strings.xml b/java/com/android/dialer/promotion/impl/res/values/strings.xml index 633671546..899074932 100644 --- a/java/com/android/dialer/promotion/res/values/strings.xml +++ b/java/com/android/dialer/promotion/impl/res/values/strings.xml @@ -23,4 +23,13 @@ disability, or need more than voice alone. RTT messaging transcripts are stored on your device in the call history. <xliff:g exmaple="Learn More">%1$s</xliff:g></string> + <!-- Header on the Duo disclosure card. [CHAR_LIMIT=60] --> + <string name="duo_disclosure_title"> + Make video calls with Duo + </string> + + <!-- Details on the Duo disclosure card. [CHAR_LIMIT=200] --> + <string name="duo_disclosure_details"> + Google Duo video calling lets you chat with friends and family face-to-face. Data charges may apply. <xliff:g example="Learn More">%1$s</xliff:g> + </string> </resources> diff --git a/java/com/android/dialer/rtt/AndroidManifest.xml b/java/com/android/dialer/rtt/AndroidManifest.xml index c92fb1ceb..ecc4fe1bc 100644 --- a/java/com/android/dialer/rtt/AndroidManifest.xml +++ b/java/com/android/dialer/rtt/AndroidManifest.xml @@ -16,6 +16,7 @@ <manifest package="com.android.dialer.rtt" xmlns:android="http://schemas.android.com/apk/res/android"> <application> - <activity android:name=".RttTranscriptActivity" /> + <!-- TODO(a bug): remove the theme here. Needed for espresso test. --> + <activity android:name=".RttTranscriptActivity" android:theme="@style/Dialer.ThemeBase"/> </application> </manifest>
\ 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 a0d9dd274..fb6f66c39 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 @@ -45,7 +45,7 @@ android:layout_height="wrap_content" android:gravity="center_vertical|start" android:fontFamily="sans-serif" - style="@style/PrimaryText"/> + style="@style/Dialer.TextAppearance.Primary"/> <com.android.dialer.widget.BidiTextView android:id="@+id/secondary" @@ -53,7 +53,7 @@ android:layout_height="wrap_content" android:gravity="center_vertical|start" android:fontFamily="sans-serif" - style="@style/SecondaryText"/> + style="@style/Dialer.TextAppearance.Secondary"/> </LinearLayout> <ImageView 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 cde9cb6a5..ad6151bbe 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="@color/background_dialer_light"/> + android:background="?android:attr/colorBackgroundFloating"/> <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="@color/background_dialer_light"/> + android:background="?android:attr/colorBackgroundFloating"/> </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 6eb1d2e40..b22ddd9a0 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/SecondaryText"/> + style="@style/Dialer.TextAppearance.Secondary"/> </FrameLayout> diff --git a/java/com/android/dialer/searchfragment/list/res/layout/search_action_layout.xml b/java/com/android/dialer/searchfragment/list/res/layout/search_action_layout.xml index 8b366fe8a..b6e304807 100644 --- a/java/com/android/dialer/searchfragment/list/res/layout/search_action_layout.xml +++ b/java/com/android/dialer/searchfragment/list/res/layout/search_action_layout.xml @@ -26,7 +26,7 @@ android:layout_marginStart="8dp" android:layout_gravity="center_vertical|start" android:padding="12dp" - android:tint="@color/dialer_theme_color"/> + android:tint="?android:attr/colorPrimary"/> <TextView android:id="@+id/search_action_text" @@ -35,5 +35,5 @@ android:layout_marginStart="72dp" android:layout_marginEnd="16dp" android:layout_gravity="center_vertical" - style="@style/PrimaryText"/> + style="@style/Dialer.TextAppearance.Primary"/> </FrameLayout>
\ No newline at end of file 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 4373252bd..a79e5883c 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 @@ -72,7 +72,7 @@ android:paddingTop="8dp" android:paddingBottom="8dp" android:text="@string/nearby_places_dismiss" - android:textColor="@color/dialer_theme_color" + android:textColor="?android:attr/colorPrimary" style="@style/Widget.AppCompat.Button.Borderless"/> </RelativeLayout> </android.support.v7.widget.CardView>
\ No newline at end of file diff --git a/java/com/android/dialer/shortcuts/AndroidManifest.xml b/java/com/android/dialer/shortcuts/AndroidManifest.xml index f0d19af7c..c0f07bf01 100644 --- a/java/com/android/dialer/shortcuts/AndroidManifest.xml +++ b/java/com/android/dialer/shortcuts/AndroidManifest.xml @@ -20,9 +20,9 @@ android:minSdkVersion="24" android:targetSdkVersion="28"/> - <application android:theme="@style/Theme.AppCompat"> + <application> - <service + <service android:exported="false" android:name=".PeriodicJobService" android:permission="android.permission.BIND_JOB_SERVICE"/> diff --git a/java/com/android/dialer/spam/promo/SpamBlockingPromoDialogFragment.java b/java/com/android/dialer/spam/promo/SpamBlockingPromoDialogFragment.java index ea54728a6..dbefc52c9 100644 --- a/java/com/android/dialer/spam/promo/SpamBlockingPromoDialogFragment.java +++ b/java/com/android/dialer/spam/promo/SpamBlockingPromoDialogFragment.java @@ -16,12 +16,12 @@ package com.android.dialer.spam.promo; -import android.app.AlertDialog; import android.app.Dialog; -import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.Nullable; +import android.support.v4.app.DialogFragment; +import android.support.v7.app.AlertDialog; /** Dialog for spam blocking on-boarding promotion. */ public class SpamBlockingPromoDialogFragment extends DialogFragment { @@ -64,7 +64,7 @@ public class SpamBlockingPromoDialogFragment extends DialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); // Return the newly created dialog - return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) + return new AlertDialog.Builder(getActivity()) .setCancelable(true) .setTitle(R.string.spam_blocking_promo_title) .setMessage(R.string.spam_blocking_promo_text) diff --git a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java index c7bf53696..a24c238b4 100644 --- a/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java +++ b/java/com/android/dialer/spam/promo/SpamBlockingPromoHelper.java @@ -17,7 +17,6 @@ package com.android.dialer.spam.promo; import android.annotation.SuppressLint; -import android.app.FragmentManager; import android.app.Notification; import android.app.Notification.Builder; import android.app.PendingIntent; @@ -25,6 +24,7 @@ import android.content.Context; import android.content.DialogInterface.OnDismissListener; import android.graphics.drawable.Icon; import android.support.design.widget.Snackbar; +import android.support.v4.app.FragmentManager; import android.support.v4.os.BuildCompat; import android.view.View; import android.widget.Toast; 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 index c828860b2..2b36457fc 100644 --- a/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml +++ b/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml @@ -21,6 +21,6 @@ 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="@color/background_dialer_white"/> + <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/favorite_icon.xml b/java/com/android/dialer/speeddial/res/drawable/favorite_icon.xml index 81b018ff1..565877d30 100644 --- a/java/com/android/dialer/speeddial/res/drawable/favorite_icon.xml +++ b/java/com/android/dialer/speeddial/res/drawable/favorite_icon.xml @@ -18,6 +18,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> - <solid android:color="@color/dialer_theme_color"/> - <stroke android:color="@color/background_dialer_light" android:width="3dp"/> + <solid android:color="?android:attr/colorPrimary"/> + <stroke android:color="?android:attr/colorBackground" android:width="3dp"/> </shape>
\ No newline at end of file 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 aec081385..e395d4bd6 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 @@ -31,10 +31,8 @@ android:paddingEnd="24dp" android:elevation="1dp" android:text="@string/speed_dial_disambig_dialog_title" - android:textSize="20sp" - android:textColor="@color/dialer_primary_text_color" - android:fontFamily="sans-serif-medium" - android:background="@android:color/white"/> + android:background="?android:attr/colorBackgroundFloating" + style="@style/Dialer.TextAppearance.Header"/> <com.android.dialer.widget.MaxHeightScrollView android:id="@+id/disambig_scrollview" @@ -57,7 +55,7 @@ android:layout_gravity="bottom" android:minHeight="64dp" android:elevation="4dp" - android:background="@android:color/white"> + android:background="?android:attr/colorBackgroundFloating"> <CheckBox android:id="@+id/remember_this_choice_checkbox" diff --git a/java/com/android/dialer/speeddial/res/layout/disambig_option_header_layout.xml b/java/com/android/dialer/speeddial/res/layout/disambig_option_header_layout.xml index 22a5d1b52..ffda3675e 100644 --- a/java/com/android/dialer/speeddial/res/layout/disambig_option_header_layout.xml +++ b/java/com/android/dialer/speeddial/res/layout/disambig_option_header_layout.xml @@ -23,6 +23,4 @@ android:minHeight="48dp" android:paddingStart="24dp" android:paddingEnd="24dp" - android:textSize="14sp" - android:textColor="#757575" - style="@style/PrimaryText"/> + style="@style/Dialer.TextAppearance.Secondary"/> diff --git a/java/com/android/dialer/speeddial/res/layout/disambig_option_layout.xml b/java/com/android/dialer/speeddial/res/layout/disambig_option_layout.xml index a1a5b2941..038800548 100644 --- a/java/com/android/dialer/speeddial/res/layout/disambig_option_layout.xml +++ b/java/com/android/dialer/speeddial/res/layout/disambig_option_layout.xml @@ -29,7 +29,7 @@ android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center_vertical" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> <TextView android:id="@+id/disambig_option_text" @@ -37,5 +37,5 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_gravity="center_vertical" - style="@style/PrimaryText"/> + style="@style/Dialer.TextAppearance.Primary"/> </LinearLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml b/java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml index a0bbfbd36..a8bc55bb7 100644 --- a/java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml +++ b/java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml @@ -68,7 +68,7 @@ android:layout_marginBottom="1dp" android:fontFamily="sans-serif-medium" android:textSize="14sp" - style="@style/PrimaryText"/> + style="@style/Dialer.TextAppearance.Primary"/> <TextView android:id="@+id/phone_type" @@ -78,5 +78,5 @@ android:layout_marginStart="4dp" android:layout_marginEnd="4dp" android:layout_marginBottom="17dp" - style="@style/SecondaryText"/> + style="@style/Dialer.TextAppearance.Secondary"/> </LinearLayout>
\ No newline at end of file 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 1e35091c9..57f8885ff 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="@color/background_dialer_light" + android:background="?android:attr/colorBackgroundFloating" android:paddingBottom="@dimen/floating_action_button_list_bottom_padding"/> <com.android.dialer.widget.EmptyContentView diff --git a/java/com/android/dialer/speeddial/res/layout/speed_dial_header_layout.xml b/java/com/android/dialer/speeddial/res/layout/speed_dial_header_layout.xml index 1605e8c98..1a9d09297 100644 --- a/java/com/android/dialer/speeddial/res/layout/speed_dial_header_layout.xml +++ b/java/com/android/dialer/speeddial/res/layout/speed_dial_header_layout.xml @@ -27,7 +27,7 @@ android:layout_height="wrap_content" android:layout_centerVertical="true" android:textSize="16sp" - style="@style/SecondaryText"/> + style="@style/Dialer.TextAppearance.Secondary"/> <Button android:id="@+id/speed_dial_add_button" @@ -40,6 +40,6 @@ android:paddingStart="8dp" android:paddingEnd="8dp" android:text="@string/speed_dial_add_button_text" - android:textColor="@color/dialer_theme_color" + android:textColor="?android:attr/colorPrimary" style="@style/Widget.AppCompat.Button.Borderless"/> </RelativeLayout>
\ No newline at end of file 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 f072c69e2..96532fb82 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 @@ -41,13 +41,13 @@ android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" - style="@style/PrimaryText"/> + style="@style/Dialer.TextAppearance.Primary"/> <TextView android:id="@+id/number" android:layout_width="wrap_content" android:layout_height="wrap_content" - style="@style/SecondaryText"/> + style="@style/Dialer.TextAppearance.Secondary"/> </LinearLayout> <ImageView @@ -59,6 +59,6 @@ android:scaleType="center" android:tint="@color/secondary_text_color" android:src="@drawable/quantum_ic_more_vert_white_24" - android:background="?android:selectableItemBackgroundBorderless" + android:background="?android:attr/selectableItemBackgroundBorderless" android:contentDescription="@string/content_description_overflow"/> </RelativeLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/speeddial/res/values/styles.xml b/java/com/android/dialer/speeddial/res/values/styles.xml index 46dbc359a..38f31c3ed 100644 --- a/java/com/android/dialer/speeddial/res/values/styles.xml +++ b/java/com/android/dialer/speeddial/res/values/styles.xml @@ -19,7 +19,7 @@ <item name="android:drawableTint">@color/secondary_text_color</item> </style> - <style name="SpeedDialContextMenuItem.NoDrawableTint" parent="SecondaryText"> + <style name="SpeedDialContextMenuItem.NoDrawableTint" parent="Dialer.TextAppearance.Secondary"> <item name="android:paddingStart">12dp</item> <item name="android:minHeight">48dp</item> <item name="android:gravity">center_vertical</item> diff --git a/java/com/android/dialer/theme/ThemeUtil.java b/java/com/android/dialer/theme/ThemeUtil.java new file mode 100644 index 000000000..227224448 --- /dev/null +++ b/java/com/android/dialer/theme/ThemeUtil.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.dialer.theme; + +import android.content.Context; +import android.content.res.TypedArray; +import android.support.annotation.ColorInt; +import android.support.annotation.StyleRes; +import android.view.ContextThemeWrapper; +import android.view.LayoutInflater; +import com.android.dialer.common.Assert; + +/** Utility for fetching */ +@SuppressWarnings("unused") +public class ThemeUtil { + + private static int theme = -1; + private static int colorIcon = -1; + private static int colorPrimary = -1; + private static int colorPrimaryDark = -1; + private static int colorAccent = -1; + private static int textColorPrimary = -1; + private static int textColorSecondary = -1; + private static int textColorPrimaryInverse = -1; + private static int textColorHint = -1; + private static int colorBackground = -1; + private static int colorBackgroundFloating = -1; + + public static void initializeTheme(Context context) { + // TODO(a bug): add share prefs check to configure this + theme = R.style.Dialer_ThemeBase_NoActionBar; + context = context.getApplicationContext(); + context.setTheme(theme); + TypedArray array = + context + .getTheme() + .obtainStyledAttributes( + theme, + new int[] { + android.R.attr.colorPrimary, + android.R.attr.colorPrimaryDark, + android.R.attr.colorAccent, + android.R.attr.textColorPrimary, + android.R.attr.textColorSecondary, + android.R.attr.textColorPrimaryInverse, + android.R.attr.textColorHint, + android.R.attr.colorBackground, + android.R.attr.colorBackgroundFloating, + R.attr.colorIcon, + }); + colorPrimary = array.getColor(/* index= */ 0, /* defValue= */ -1); + colorPrimaryDark = array.getColor(/* index= */ 1, /* defValue= */ -1); + colorAccent = array.getColor(/* index= */ 2, /* defValue= */ -1); + textColorPrimary = array.getColor(/* index= */ 3, /* defValue= */ -1); + textColorSecondary = array.getColor(/* index= */ 4, /* defValue= */ -1); + textColorPrimaryInverse = array.getColor(/* index= */ 5, /* defValue= */ -1); + textColorHint = array.getColor(/* index= */ 6, /* defValue= */ -1); + colorBackground = array.getColor(/* index= */ 7, /* defValue= */ -1); + colorBackgroundFloating = array.getColor(/* index= */ 8, /* defValue= */ -1); + colorIcon = array.getColor(/* index= */ 9, /* defValue= */ -1); + array.recycle(); + } + + public static @ColorInt int getColorIcon() { + Assert.checkArgument(colorIcon != -1); + return colorIcon; + } + + public static @ColorInt int getColorPrimary() { + Assert.checkArgument(colorPrimary != -1); + return colorPrimary; + } + + public static @ColorInt int getColorAccent() { + Assert.checkArgument(colorAccent != -1); + return colorAccent; + } + + public static @ColorInt int getTextColorSecondary() { + Assert.checkArgument(textColorSecondary != -1); + return textColorSecondary; + } + + public static @StyleRes int getTheme() { + Assert.checkArgument(theme != -1); + return theme; + } + + public static Context getThemedContext(Context context) { + return new ContextThemeWrapper(context, getTheme()); + } + + public static LayoutInflater getThemedLayoutInflator(LayoutInflater inflater) { + return inflater.cloneInContext(getThemedContext(inflater.getContext())); + } +} diff --git a/java/com/android/dialer/theme/attributes/AndroidManifest.xml b/java/com/android/dialer/theme/attributes/AndroidManifest.xml new file mode 100644 index 000000000..1a50716d2 --- /dev/null +++ b/java/com/android/dialer/theme/attributes/AndroidManifest.xml @@ -0,0 +1,16 @@ +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<manifest package="com.android.dialer.theme.attributes"/> diff --git a/java/com/android/dialer/main/impl/bottomnav/res/values/colors.xml b/java/com/android/dialer/theme/attributes/res/values/attr.xml index b858b4f8c..6db0aa8d3 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/values/colors.xml +++ b/java/com/android/dialer/theme/attributes/res/values/attr.xml @@ -15,6 +15,7 @@ ~ limitations under the License --> <resources> - <color name="bottom_nav_icon_selected">@color/dialer_theme_color</color> - <color name="bottom_nav_icon_deselected">@color/dialer_secondary_text_color</color> -</resources> + + <!-- Used to style all icons in Dialer. --> + <attr name="colorIcon" format="reference"/> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml b/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml index 347db41bc..6612b17ab 100644 --- a/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml +++ b/java/com/android/dialer/theme/res/color/dialer_primary_text_color.xml @@ -16,6 +16,6 @@ --> <!-- Primary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" android:color="@color/dialer_disabled_text_color"/> - <item android:color="#212121"/> + <item android:state_enabled="false" android:color="@color/dialer_text_color_disabled"/> + <item android:color="@color/dialer_primary_text_color_enabled"/> </selector>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml b/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml index 920b46792..e1c000aef 100644 --- a/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml +++ b/java/com/android/dialer/theme/res/color/dialer_secondary_text_color.xml @@ -16,6 +16,6 @@ --> <!-- Secondary text color in the Phone app --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" android:color="@color/dialer_disabled_text_color"/> - <item android:color="#636363"/> + <item android:state_enabled="false" android:color="@color/dialer_text_color_disabled"/> + <item android:color="@color/dialer_secondary_text_color_enabled"/> </selector>
\ No newline at end of file diff --git a/java/com/android/dialer/app/res/color/settings_text_color_primary.xml b/java/com/android/dialer/theme/res/color/settings_text_color_primary.xml index ba259088a..ba259088a 100644 --- a/java/com/android/dialer/app/res/color/settings_text_color_primary.xml +++ b/java/com/android/dialer/theme/res/color/settings_text_color_primary.xml diff --git a/java/com/android/dialer/app/res/color/settings_text_color_secondary.xml b/java/com/android/dialer/theme/res/color/settings_text_color_secondary.xml index 2f7899272..2f7899272 100644 --- a/java/com/android/dialer/app/res/color/settings_text_color_secondary.xml +++ b/java/com/android/dialer/theme/res/color/settings_text_color_secondary.xml diff --git a/java/com/android/dialer/theme/res/values/colors.xml b/java/com/android/dialer/theme/res/values/colors.xml index 2185d861c..7c62a2103 100644 --- a/java/com/android/dialer/theme/res/values/colors.xml +++ b/java/com/android/dialer/theme/res/values/colors.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2012 The Android Open Source Project ~ @@ -13,65 +14,18 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - +<!-- The colors in this file aren't configured at the theme level. --> <resources> - <!-- Note: The following colors are used in the Dialer settings screens. Since Dialer's settings - link into the Telephony settings as well, changes to these colors should be mirrored in - Telephony: - - Android source path: packages/apps/PhoneCommon/res/values/colors.xml - - Local: dialer_theme_color Android Source: dialer_theme_color - - Local: dialer_theme_color_dark Android Source: dialer_theme_color_dark - Android source path: packages/services/Telecomm/res/values/colors.xml - - Local: dialer_theme_color Android Source: theme_color - - Local: dialer_theme_color_dark Android Source: dialer_settings_color_dark - --> - <color name="dialer_theme_color">#2A56C6</color> - <color name="dialer_theme_color_dark">#1C3AA9</color> - - <color name="dialer_snackbar_action_text_color">#4285F4</color> - <color name="dialer_theme_color_20pct">#332A56C6</color> - <color name="dialpad_fab_green">#00C853</color> - - <color name="dialer_secondary_color">#F50057</color> - - <color name="dialer_primary_text_color_white">#ffffff</color> - <color name="dialer_edit_text_hint_color">#DE78909C</color> - - <!-- 38% opacity --> - <color name="dialer_disabled_text_color">#9E9E9E</color> - + <color name="dialer_end_call_button_color">#BD2A2A</color> + <color name="dialer_divider_line_color">#D8D8D8</color> <color name="dialer_link_color">#2A56C6</color> - <!-- Color of the theme of the Dialer app --> - <color name="dialtacts_theme_color">@color/dialer_theme_color</color> - - <!-- Background color of new dialer activity --> - <color name="background_dialer_light">#fafafa</color> - <!-- White background for dialer --> - <color name="background_dialer_white">#ffffff</color> - <color name="background_dialer_call_log_list_item">@color/background_dialer_white</color> - <!-- Colors for the notification actions --> <color name="notification_action_accept">#097138</color> <color name="notification_action_dismiss">#A52714</color> <color name="notification_action_answer_video">#097138</color> - <!-- Background color of action bars --> - <color name="actionbar_background_color">@color/dialer_theme_color</color> - - <!-- Background color of title bars in recents --> - <color name="titlebar_in_recents_background_color">@color/dialer_theme_color_dark</color> - + <!-- Legacy --> <color name="blue_grey_100">#CFD8DC</color> - - <!-- 54% opacity --> - <color name="icon_color_grey">#89000000</color> - - <!-- Color for bubble --> - <color name="dialer_end_call_button_color">#BD2A2A</color> - - <!-- Color for list dividers --> - <color name="divider_line_color">#D8D8D8</color> -</resources> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/res/values/colors_dialer_light.xml b/java/com/android/dialer/theme/res/values/colors_dialer_light.xml new file mode 100644 index 000000000..ea8247414 --- /dev/null +++ b/java/com/android/dialer/theme/res/values/colors_dialer_light.xml @@ -0,0 +1,55 @@ +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<resources> + <!-- Note: The following colors are used in the Dialer settings screens. Since Dialer's settings + link into the Telephony settings as well, changes to these colors should be mirrored in + Telephony: + + Android source path: packages/apps/PhoneCommon/res/values/colors.xml + - Local: dialer_theme_color Android Source: dialer_theme_color + - Local: dialer_theme_color_dark Android Source: dialer_theme_color_dark + Android source path: packages/services/Telecomm/res/values/colors.xml + - Local: dialer_theme_color Android Source: theme_color + - Local: dialer_theme_color_dark Android Source: dialer_settings_color_dark + --> + <!-- Essential theme colors --> + <color name="dialer_theme_color">#2A56C6</color> + <color name="dialer_theme_color_dark">#1C3AA9</color> + <color name="dialer_secondary_color">#F50057</color> + <color name="dialer_theme_color_20pct">#332A56C6</color> + + <!-- Text colors --> + <color name="dialer_primary_text_color_enabled">#212121</color> + <color name="dialer_secondary_text_color_enabled">#636363</color> + <color name="dialer_text_color_disabled">#9E9E9E</color> + <color name="dialer_text_hint_color">#DE78909C</color> + <color name="dialer_primary_text_color_inverse">#FFFFFF</color> + <color name="dialer_secondary_text_color_inverse">#DDFFFFFF</color> + <color name="dialer_snackbar_action_text_color">#4285F4</color> + + <!-- Colors for the setting text. --> + <!-- TODO(a bug): investigate if these should be removed. --> + <color name="setting_primary_color">@color/dialer_primary_text_color</color> + <color name="setting_secondary_color">@color/dialer_secondary_text_color</color> + <color name="setting_disabled_color">#AAAAAA</color> + + <!-- Background colors --> + <color name="dialer_background_light">#FAFAFA</color> + <color name="dialer_background_floating_light">#FFFFFF</color> + + <!-- Other useful colors --> + <color name="dialer_icon_color">#89000000</color> +</resources> diff --git a/java/com/android/dialer/theme/res/values/dimens.xml b/java/com/android/dialer/theme/res/values/dimens.xml index 88b8a0423..4abe4b53a 100644 --- a/java/com/android/dialer/theme/res/values/dimens.xml +++ b/java/com/android/dialer/theme/res/values/dimens.xml @@ -54,4 +54,8 @@ <!-- Padding to be applied to the bottom of lists to make space for the floating action button --> <dimen name="floating_action_button_list_bottom_padding">88dp</dimen> + + <!-- TODO(a bug): add a comment here --> + <dimen name="primary_text_size">16sp</dimen> + <dimen name="secondary_text_size">14sp</dimen> </resources> diff --git a/java/com/android/dialer/theme/res/values/styles.xml b/java/com/android/dialer/theme/res/values/styles.xml deleted file mode 100644 index 8412aaadf..000000000 --- a/java/com/android/dialer/theme/res/values/styles.xml +++ /dev/null @@ -1,62 +0,0 @@ -<!-- - ~ Copyright (C) 2012 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> - -<resources> - - <style name="CallLogCardStyle" parent="CardView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_margin">4dp</item> - <item name="android:baselineAligned">false</item> - <item name="cardCornerRadius">2dp</item> - <item name="cardBackgroundColor">@color/background_dialer_call_log_list_item</item> - </style> - - <!-- Inherit from Theme.Material.Light.Dialog instead of Theme.Material.Light.Dialog.Alert - since the Alert dialog is private. They are identical anyway. --> - <style name="AlertDialogTheme" parent="@android:style/Theme.Material.Light.Dialog"> - <item name="android:colorAccent">@color/dialtacts_theme_color</item> - </style> - - <style name="TextActionStyle"> - <item name="android:layout_width">wrap_content</item> - <item name="android:layout_height">@dimen/call_log_action_height</item> - <item name="android:gravity">end|center_vertical</item> - <item name="android:paddingStart">@dimen/call_log_action_horizontal_padding</item> - <item name="android:paddingEnd">@dimen/call_log_action_horizontal_padding</item> - <item name="android:textColor">@color/dialtacts_theme_color</item> - <item name="android:fontFamily">"sans-serif-medium"</item> - <item name="android:focusable">true</item> - <item name="android:singleLine">true</item> - <item name="android:textAllCaps">true</item> - </style> - - <style name="DialerButtonTextStyle" parent="@android:style/TextAppearance.Material.Widget.Button"> - <item name="android:textColor">@color/dialer_primary_text_color_white</item> - </style> - - <style name="DialerActionBarBaseStyle" - parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> - <item name="android:background">@color/actionbar_background_color</item> - <item name="background">@color/actionbar_background_color</item> - </style> - - <!-- This Checkbox style helps align checkboxes with the common list element layout(Image + text) --> - <style name="DialerCheckboxStyle" parent="Widget.AppCompat.CompoundButton.CheckBox"> - <item name="android:layout_marginStart">20dp</item> - <item name="android:paddingLeft">12dp</item> - </style> -</resources> diff --git a/java/com/android/dialer/theme/res/values/styles_dialer_light.xml b/java/com/android/dialer/theme/res/values/styles_dialer_light.xml new file mode 100644 index 000000000..6ce3b1960 --- /dev/null +++ b/java/com/android/dialer/theme/res/values/styles_dialer_light.xml @@ -0,0 +1,110 @@ +<!-- + ~ Copyright (C) 2012 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<resources> + + <style name="CallLogCardStyle" parent="CardView"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:layout_margin">4dp</item> + <item name="android:baselineAligned">false</item> + <item name="cardCornerRadius">2dp</item> + <item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item> + </style> + + <!-- TODO(a bug): properly document this or delete it --> + <style name="Theme.PreCall.DialogHolder" parent="Dialer.ThemeBase.NoActionBar"> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:windowActivityTransitions">false</item> + <item name="android:windowIsTranslucent">true</item> + + <item name="android:statusBarColor">@android:color/transparent</item> + <item name="android:navigationBarColor">@android:color/transparent</item> + <item name="android:windowDrawsSystemBarBackgrounds">true</item> + </style> + + <!-- Style applied to the "Settings" screen. Keep in sync with SettingsLight in Telephony. --> + <style name="SettingsStyle" parent="Dialer.ThemeBase"> + <!-- Setting text. --> + <item name="android:textColorPrimary">@color/settings_text_color_primary</item> + <!-- Setting description. --> + <item name="android:textColorSecondary">@color/settings_text_color_secondary</item> + <item name="android:windowBackground">?android:attr/colorBackground</item> + <item name="android:colorAccent">?android:attr/colorPrimary</item> + <item name="android:textColorLink">?android:attr/colorPrimary</item> + </style> + + <style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert"> + <!-- TODO(a bug): figure out why ?android:attr/colorPrimary doesn't work here --> + <item name="colorAccent">@color/dialer_theme_color</item> + </style> + + <style name="TextActionStyle"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">@dimen/call_log_action_height</item> + <item name="android:gravity">end|center_vertical</item> + <item name="android:paddingStart">@dimen/call_log_action_horizontal_padding</item> + <item name="android:paddingEnd">@dimen/call_log_action_horizontal_padding</item> + <item name="android:textColor">?android:attr/colorPrimary</item> + <item name="android:fontFamily">"sans-serif-medium"</item> + <item name="android:focusable">true</item> + <item name="android:singleLine">true</item> + <item name="android:textAllCaps">true</item> + </style> + + <style name="DialerButtonTextStyle" parent="@android:style/TextAppearance.Material.Widget.Button"> + <item name="android:textColor">?android:attr/textColorPrimaryInverse</item> + </style> + + <style name="DialerActionBarBaseStyle" + parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> + <item name="android:background">?android:attr/colorPrimary</item> + <item name="background">?android:attr/colorPrimary</item> + </style> + + <!-- This Checkbox style helps align checkboxes with the common list element layout(Image + text) --> + <style name="DialerCheckboxStyle" parent="Widget.AppCompat.CompoundButton.CheckBox"> + <item name="android:layout_marginStart">20dp</item> + <item name="android:paddingLeft">12dp</item> + </style> + + <style name="Dialer.TextAppearance.Header" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">20sp</item> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.Primary" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">@dimen/primary_text_size</item> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="Dialer.TextAppearance.Secondary" parent="TextAppearance.AppCompat"> + <item name="android:textColor">?android:attr/textColorSecondary</item> + <item name="android:textSize">@dimen/secondary_text_size</item> + <item name="android:ellipsize">end</item> + <item name="android:maxLines">1</item> + </style> + + <style name="SubHeader" parent="TextAppearance.AppCompat"> + <item name="android:textColor">#212121</item> + <item name="android:textSize">14sp</item> + <item name="android:lineSpacingMultiplier">1.1</item> + </style> +</resources> diff --git a/java/com/android/dialer/theme/res/values/theme_dialer_light.xml b/java/com/android/dialer/theme/res/values/theme_dialer_light.xml new file mode 100644 index 000000000..ab4ae936d --- /dev/null +++ b/java/com/android/dialer/theme/res/values/theme_dialer_light.xml @@ -0,0 +1,117 @@ +<?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/theme/res/values/themes.xml b/java/com/android/dialer/theme/res/values/themes.xml deleted file mode 100644 index 1c5706623..000000000 --- a/java/com/android/dialer/theme/res/values/themes.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> -<resources> - - <style name="DialerThemeBase" parent="@style/Theme.AppCompat.Light.DarkActionBar"> - <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> - <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> - <!-- This is used for title bar color in recents --> - <item name="android:colorPrimary">@color/titlebar_in_recents_background_color</item> - <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> - <item name="android:colorControlActivated">@color/dialer_theme_color</item> - <item name="android:colorButtonNormal">@color/dialer_theme_color</item> - <item name="android:colorAccent">@color/dialtacts_theme_color</item> - <item name="android:alertDialogTheme">@style/AlertDialogTheme</item> - <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> - - <item name="android:actionBarStyle">@style/DialerActionBarBaseStyle</item> - <item name="actionBarStyle">@style/DialerActionBarBaseStyle</item> - <item name="android:actionBarSize">@dimen/action_bar_height</item> - <item name="actionBarSize">@dimen/action_bar_height</item> - </style> - - <!-- Should be kept in sync with the theme above (minus anything related to actionbars --> - <style name="DialerThemeBase.NoActionBar" parent="@style/Theme.AppCompat.Light.NoActionBar"> - <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> - <item name="android:textColorSecondary">@color/dialer_secondary_text_color</item> - <!-- This is used for title bar color in recents --> - <item name="android:colorPrimary">@color/titlebar_in_recents_background_color</item> - <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> - <item name="android:colorControlActivated">@color/dialer_theme_color</item> - <item name="android:colorButtonNormal">@color/dialer_theme_color</item> - <item name="android:colorAccent">@color/dialtacts_theme_color</item> - <item name="android:alertDialogTheme">@style/AlertDialogTheme</item> - <item name="android:textAppearanceButton">@style/DialerButtonTextStyle</item> - </style> - - <style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar"> - <item name="android:windowNoTitle">true</item> - <item name="android:windowBackground">@android:color/transparent</item> - <item name="android:colorBackgroundCacheHint">@null</item> - <item name="android:windowIsTranslucent">true</item> - <item name="android:windowAnimationStyle">@android:style/Animation</item> - </style> - - <style name="PrimaryText" parent="TextAppearance.AppCompat"> - <item name="android:textColor">#DE000000</item> - <item name="android:textSize">16sp</item> - <item name="android:ellipsize">end</item> - <item name="android:maxLines">1</item> - </style> - - <style name="SecondaryText" parent="TextAppearance.AppCompat"> - <item name="android:textColor">#8A000000</item> - <item name="android:textSize">14sp</item> - <item name="android:ellipsize">end</item> - <item name="android:maxLines">1</item> - </style> - - <style name="SubHeader" parent="TextAppearance.AppCompat"> - <item name="android:textColor">#212121</item> - <item name="android:textSize">14sp</item> - <item name="android:lineSpacingMultiplier">1.1</item> - </style> - -</resources> 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 bf70240b6..95866dfab 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 @@ -23,7 +23,7 @@ <item name="android:layout_marginStart">8dp</item> <item name="android:layout_marginEnd">8dp</item> <item name="android:padding">8dp</item> - <item name="android:textColor">@color/dialer_theme_color</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> @@ -50,7 +50,7 @@ <style name="RaisedErrorActionStyle" parent="Widget.AppCompat.Button.Colored"> <item name="android:layout_width">wrap_content</item> - <item name="android:colorButtonNormal">@color/dialer_theme_color</item> + <item name="android:colorButtonNormal">?android:attr/colorPrimary</item> <item name="android:textSize">14sp</item> <item name="android:layout_height">@dimen/call_log_action_height</item> </style> @@ -62,7 +62,7 @@ </style> <style name="TosLinkStyle"> - <item name="android:textColor">@color/dialer_theme_color</item> + <item name="android:textColor">?android:attr/colorPrimary</item> <item name="android:fontFamily">"sans-serif-medium"</item> </style> diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_call_log_fragment.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_call_log_fragment.xml index 1bd36fa23..a001bd620 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_call_log_fragment.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_call_log_fragment.xml @@ -19,7 +19,7 @@ android:id="@+id/new_voicemail_frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_dialer_white" + android:background="?android:attr/colorBackground" android:orientation="vertical"> <android.support.v7.widget.RecyclerView 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 9a9e9ee0e..b5e095ba4 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,7 +39,7 @@ <TextView android:id="@+id/primary_text" - style="@style/PrimaryText" + style="@style/Dialer.TextAppearance.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="14dp" @@ -60,12 +60,13 @@ android:layout_gravity="center_vertical" android:importantForAccessibility="no" android:src="@drawable/quantum_ic_voicemail_vd_theme_24" - android:tint="@color/dialtacts_theme_color" - android:tintMode="multiply"/> + android:tint="?android:attr/colorPrimary" + android:tintMode="multiply" + tools:ignore="ContentDescription"/> <TextView android:id="@+id/secondary_text" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" @@ -76,7 +77,7 @@ <!-- TODO(a bug): Make text selectable --> <TextView android:id="@+id/transcription_text" - style="@style/PrimaryText" + style="@style/Dialer.TextAppearance.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dp" @@ -86,7 +87,7 @@ <TextView android:id="@+id/transcription_branding" - style="@style/SecondaryText" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" 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 fba39f1c7..109cecc2c 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 @@ -87,14 +87,14 @@ style="@style/TosButtonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/dialer_theme_color"/> + android:textColor="?android:attr/colorPrimary"/> <Button android:id="@+id/voicemail_alert_primary_button" style="@style/TosButtonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/dialer_theme_color"/> + android:textColor="?android:attr/colorPrimary"/> </LinearLayout> <View diff --git a/java/com/android/dialer/widget/res/color/dialer_tint_state.xml b/java/com/android/dialer/widget/res/color/dialer_tint_state.xml index c29f334ac..84b2bc03b 100644 --- a/java/com/android/dialer/widget/res/color/dialer_tint_state.xml +++ b/java/com/android/dialer/widget/res/color/dialer_tint_state.xml @@ -18,6 +18,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/dialer_edit_text_hint_color" android:state_enabled="false"/> - <item android:color="@color/dialer_theme_color"/> + <item android:color="?android:attr/textColorHint" android:state_enabled="false"/> + <item android:color="?android:attr/colorPrimary"/> </selector>
\ No newline at end of file diff --git a/java/com/android/dialer/widget/res/drawable/contact_photo_badge_background.xml b/java/com/android/dialer/widget/res/drawable/contact_photo_badge_background.xml index 4dcc7057e..76af60066 100644 --- a/java/com/android/dialer/widget/res/drawable/contact_photo_badge_background.xml +++ b/java/com/android/dialer/widget/res/drawable/contact_photo_badge_background.xml @@ -18,6 +18,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> - <solid android:color="@color/dialer_theme_color"/> - <stroke android:color="@color/background_dialer_white" android:width="2dp"/> + <solid android:color="?android:attr/colorPrimary"/> + <stroke android:color="?android:attr/colorBackground" android:width="2dp"/> </shape>
\ No newline at end of file diff --git a/java/com/android/dialer/widget/res/drawable/edittext_custom_cursor.xml b/java/com/android/dialer/widget/res/drawable/edittext_custom_cursor.xml index 2f01628aa..62cd9abb6 100644 --- a/java/com/android/dialer/widget/res/drawable/edittext_custom_cursor.xml +++ b/java/com/android/dialer/widget/res/drawable/edittext_custom_cursor.xml @@ -17,5 +17,5 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android"> <size android:width="2dp"/> - <solid android:color="@color/dialtacts_theme_color"/> + <solid android:color="?android:attr/colorPrimary"/> </shape>
\ 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 023b0ffe2..0540a00bc 100644 --- a/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml +++ b/java/com/android/dialer/widget/res/layout/dialer_toolbar.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:gravity="top" android:textSize="@dimen/toolbar_title_text_size" - android:textColor="@color/background_dialer_white" + android:textColor="?android:attr/colorBackground" android:fontFamily="sans-serif-medium" android:maxLines="1" android:ellipsize="end"/> @@ -38,7 +38,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/toolbar_subtitle_text_size" - android:textColor="@color/background_dialer_white" + android:textColor="?android:attr/colorBackground" android:visibility="gone" android:maxLines="1" android:ellipsize="end"/> 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 ac62dd91b..388a8d55a 100644 --- a/java/com/android/dialer/widget/res/layout/fragment_message.xml +++ b/java/com/android/dialer/widget/res/layout/fragment_message.xml @@ -18,7 +18,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_dialer_white"> + android:background="?android:attr/colorBackground"> <ScrollView android:layout_width="match_parent" @@ -53,8 +53,8 @@ android:textSize="@dimen/message_item_text_size" android:hint="@string/custom_message_hint" android:textColor="@color/dialer_primary_text_color" - android:textColorHint="@color/dialer_edit_text_hint_color" - android:background="@color/background_dialer_white" + android:textColorHint="?android:attr/textColorHint" + android:background="?android:attr/colorBackground" android:textCursorDrawable="@drawable/edittext_custom_cursor" android:layout_toStartOf="@+id/count_and_send_container" android:inputType="textShortMessage|textCapSentences" @@ -85,7 +85,7 @@ android:layout_height="wrap_content" android:visibility="gone" android:textSize="@dimen/message_remaining_char_text_size" - android:textColor="@color/dialer_edit_text_hint_color"/> + android:textColor="?android:attr/textColorHint"/> </LinearLayout> </RelativeLayout> </RelativeLayout>
\ No newline at end of file diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java index 597702b2a..5318fdb5f 100644 --- a/java/com/android/incallui/ConferenceParticipantListAdapter.java +++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java @@ -357,9 +357,8 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { statusTextView.setText(onHoldText); statusTextView.setVisibility(View.VISIBLE); - int onHoldColor = getContext().getColor(R.color.dialer_disabled_text_color); - nameTextView.setTextColor(onHoldColor); - numberTextView.setTextColor(onHoldColor); + nameTextView.setEnabled(false); + numberTextView.setEnabled(false); TypedValue alpha = new TypedValue(); getContext().getResources().getValue(R.dimen.alpha_hiden, alpha, true); @@ -373,10 +372,8 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { TextView numberTextView) { statusTextView.setVisibility(View.GONE); - nameTextView.setTextColor( - getContext().getColor(R.color.conference_call_manager_caller_name_text_color)); - numberTextView.setTextColor( - getContext().getColor(R.color.conference_call_manager_secondary_text_color)); + nameTextView.setEnabled(true); + numberTextView.setEnabled(true); TypedValue alpha = new TypedValue(); getContext().getResources().getValue(R.dimen.alpha_enabled, alpha, true); diff --git a/java/com/android/incallui/PostCharDialogFragment.java b/java/com/android/incallui/PostCharDialogFragment.java index 1d06fd487..4bcc68e33 100644 --- a/java/com/android/incallui/PostCharDialogFragment.java +++ b/java/com/android/incallui/PostCharDialogFragment.java @@ -55,8 +55,7 @@ public class PostCharDialogFragment extends DialogFragment { buf.append(getResources().getText(R.string.wait_prompt_str)); buf.append(postDialStr); - final AlertDialog.Builder builder = - new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(buf.toString()); builder.setPositiveButton( diff --git a/java/com/android/incallui/RttRequestDialogFragment.java b/java/com/android/incallui/RttRequestDialogFragment.java index fa9b0e5db..5437cc699 100644 --- a/java/com/android/incallui/RttRequestDialogFragment.java +++ b/java/com/android/incallui/RttRequestDialogFragment.java @@ -83,7 +83,7 @@ public class RttRequestDialogFragment extends DialogFragment { .setOnClickListener(v -> onPositiveButtonClick()); AlertDialog alertDialog = - new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) + new AlertDialog.Builder(getActivity()) .setCancelable(false) .setView(dialogView) .setTitle(R.string.rtt_request_dialog_title) 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 1c8cbfdbd..589a74325 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 @@ -124,7 +124,7 @@ android:textAllCaps="true" android:textSize="14sp" android:textStyle="bold" - android:textColor="@color/background_dialer_white" + android:textColor="?android:attr/colorBackground" android:background="@drawable/urgent_call_background"/> <FrameLayout diff --git a/java/com/android/incallui/audioroute/res/values/styles.xml b/java/com/android/incallui/audioroute/res/values/styles.xml index 4484b7092..6bf9b4772 100644 --- a/java/com/android/incallui/audioroute/res/values/styles.xml +++ b/java/com/android/incallui/audioroute/res/values/styles.xml @@ -1,14 +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 + --> <resources> <style name="AudioRouteItem"> <item name="android:padding">16dp</item> - <item name="android:background">?android:selectableItemBackground</item> + <item name="android:background">?android:attr/selectableItemBackground</item> <item name="android:drawablePadding">24dp</item> <item name="android:gravity">center_vertical</item> <item name="android:textAppearance"> @style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Large </item> - <item name="android:textColor">?android:textColorSecondary</item> + <item name="android:textColor">?android:attr/textColorSecondary</item> </style> </resources> diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java index 6940f7d6c..634a302a2 100644 --- a/java/com/android/incallui/call/CallList.java +++ b/java/com/android/incallui/call/CallList.java @@ -37,7 +37,7 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.metrics.Metrics; import com.android.dialer.metrics.MetricsComponent; -import com.android.dialer.promotion.RttPromotion; +import com.android.dialer.promotion.impl.RttPromotion; import com.android.dialer.shortcuts.ShortcutUsageReporter; import com.android.dialer.spam.SpamComponent; import com.android.dialer.spam.status.SpamStatus; @@ -210,7 +210,7 @@ public class CallList implements DialerCallDelegate { || call.getState() == DialerCallState.CALL_WAITING) { if (call.isActiveRttCall()) { if (!call.isPhoneAccountRttCapable()) { - new RttPromotion(context).setShouldShow(true); + RttPromotion.setEnabled(context); } Logger.get(context) .logCallImpression( 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 index d20e32b3f..5d1e2baf7 100644 --- a/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml +++ b/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml @@ -85,7 +85,7 @@ android:contentDescription="@string/location_map_description" android:scaleType="centerCrop" android:visibility="invisible" - tools:src="?android:colorPrimaryDark" + tools:src="?android:attr/colorPrimaryDark" tools:visibility="visible"/> <TextView diff --git a/java/com/android/incallui/callpending/AndroidManifest.xml b/java/com/android/incallui/callpending/AndroidManifest.xml index 231553e6c..aa316a301 100644 --- a/java/com/android/incallui/callpending/AndroidManifest.xml +++ b/java/com/android/incallui/callpending/AndroidManifest.xml @@ -16,8 +16,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.incallui.callpending"> - <application android:theme="@style/Theme.AppCompat"> - <!-- Identical to .InCallActivity except orientation is locked to portrait --> + <application> + <!-- Identical to .InCallActivity except orientation is locked to portrait --> <activity android:directBootAware="true" android:excludeFromRecents="true" diff --git a/java/com/android/incallui/commontheme/res/values/styles.xml b/java/com/android/incallui/commontheme/res/values/styles.xml index a979cc3fc..464eda5bb 100644 --- a/java/com/android/incallui/commontheme/res/values/styles.xml +++ b/java/com/android/incallui/commontheme/res/values/styles.xml @@ -18,18 +18,18 @@ <resources> <style name="Dialer.Incall.TextAppearance" parent="android:TextAppearance.Material"> - <item name="android:textColor">?android:textColorSecondary</item> + <item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:textSize">18sp</item> </style> <style name="Dialer.Incall.TextAppearance.Large"> - <item name="android:textColor">?android:textColorPrimary</item> + <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textSize">36sp</item> <item name="android:fontFamily">sans-serif-light</item> </style> <style name="Dialer.Incall.TextAppearance.Label"> - <item name="android:textColor">?android:textColorPrimary</item> + <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textSize">12sp</item> </style> @@ -38,7 +38,7 @@ <item name="android:layout_width">24dp</item> <item name="android:layout_marginEnd">8dp</item> <item name="android:scaleType">fitCenter</item> - <item name="colorControlNormal">?android:textColorSecondary</item> + <item name="colorControlNormal">?android:attr/textColorSecondary</item> </style> <style name="Incall.Button.End" parent="android:Widget.Material.Button"> diff --git a/java/com/android/incallui/incall/impl/res/values/dimens.xml b/java/com/android/incallui/incall/impl/res/values/dimens.xml index 439dc1d33..c4a7be6c3 100644 --- a/java/com/android/incallui/incall/impl/res/values/dimens.xml +++ b/java/com/android/incallui/incall/impl/res/values/dimens.xml @@ -18,7 +18,6 @@ <resources> <dimen name="incall_button_label_margin">8dp</dimen> <dimen name="incall_button_elevation">0dp</dimen> - <dimen name="incall_end_call_spacing">116dp</dimen> <dimen name="incall_button_padding">4dp</dimen> <dimen name="incall_button_vertical_padding">8dp</dimen> <dimen name="incall_avatar_size">0dp</dimen> diff --git a/java/com/android/incallui/res/drawable/incall_background_gradient.xml b/java/com/android/incallui/res/drawable/incall_background_gradient.xml deleted file mode 100644 index 5dd927f0f..000000000 --- a/java/com/android/incallui/res/drawable/incall_background_gradient.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <gradient - android:angle="270" - android:startColor="@color/incall_background_gradient_top" - android:centerColor="@color/incall_background_gradient_middle" - android:endColor="@color/incall_background_gradient_bottom"/> -</shape> diff --git a/java/com/android/incallui/res/layout/caller_in_conference.xml b/java/com/android/incallui/res/layout/caller_in_conference.xml index 23bb28512..3f660c5b5 100644 --- a/java/com/android/incallui/res/layout/caller_in_conference.xml +++ b/java/com/android/incallui/res/layout/caller_in_conference.xml @@ -67,8 +67,8 @@ android:id="@+id/conferenceCallerStatus" android:layout_width="wrap_content" android:layout_height="wrap_content" - style="@style/SecondaryText" - android:textColor="@color/dialer_disabled_text_color" + style="@style/Dialer.TextAppearance.Secondary" + android:enabled="false" android:visibility="gone"/> <!-- Number --> @@ -93,12 +93,12 @@ android:id="@+id/conferenceCallerSeparate" android:layout_width="@dimen/conference_call_manager_button_dimension" android:layout_height="@dimen/conference_call_manager_button_dimension" - android:background="?android:selectableItemBackgroundBorderless" + android:background="?android:attr/selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/goPrivate" android:scaleType="center" android:src="@drawable/ic_call_split_white_24dp" - android:tint="@color/icon_color_grey"/> + android:tint="?colorIcon"/> <!-- "Disconnect" button which terminates the connection with this caller. --> <ImageButton @@ -106,11 +106,11 @@ android:layout_width="@dimen/conference_call_manager_button_dimension" android:layout_height="@dimen/conference_call_manager_button_dimension" android:layout_marginStart="8dp" - android:background="?android:selectableItemBackgroundBorderless" + android:background="?android:attr/selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/conference_caller_disconnect_content_description" android:scaleType="center" android:src="@drawable/quantum_ic_call_end_white_24" - android:tint="@color/icon_color_grey"/> + android:tint="?colorIcon"/> </LinearLayout> <!-- End of single list element --> 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 ab743eb89..2e40cabd3 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 @@ -70,7 +70,7 @@ android:layout_gravity="end" android:paddingStart="16dp" android:paddingEnd="16dp" - android:backgroundTint="@color/dialer_theme_color" + android:backgroundTint="?android:attr/colorPrimary" android:fontFamily="sans-serif-medium" android:stateListAnimator="@null" android:text="@string/rtt_button_accept_request" diff --git a/java/com/android/incallui/res/values/strings.xml b/java/com/android/incallui/res/values/strings.xml index c7e5677c7..c18ee495e 100644 --- a/java/com/android/incallui/res/values/strings.xml +++ b/java/com/android/incallui/res/values/strings.xml @@ -16,11 +16,6 @@ --> <resources xmlns:tools="http://schemas.android.com/tools" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <!-- Official label of the phone app, as seen in "Manage Applications" - and other settings UIs. --> - <string name="phoneAppLabel" product="default">Phone</string> - <!-- MMI dialog strings --> <!-- Dialog label when an MMI code starts running --> diff --git a/java/com/android/incallui/sessiondata/res/drawable/answer_data_background.xml b/java/com/android/incallui/sessiondata/res/drawable/answer_data_background.xml index 1d481f3f8..cb7663369 100644 --- a/java/com/android/incallui/sessiondata/res/drawable/answer_data_background.xml +++ b/java/com/android/incallui/sessiondata/res/drawable/answer_data_background.xml @@ -19,5 +19,5 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="16dp"/> - <solid android:color="@color/background_dialer_white"/> + <solid android:color="?android:attr/colorBackground"/> </shape> diff --git a/java/com/android/incallui/sessiondata/res/drawable/spam_container_background.xml b/java/com/android/incallui/sessiondata/res/drawable/spam_container_background.xml index f01fe514a..023012bb2 100644 --- a/java/com/android/incallui/sessiondata/res/drawable/spam_container_background.xml +++ b/java/com/android/incallui/sessiondata/res/drawable/spam_container_background.xml @@ -18,5 +18,5 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="16dp"/> - <solid android:color="@color/background_dialer_light"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> </shape>
\ No newline at end of file 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 b93db63ad..b7b358075 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="@color/background_dialer_white" + android:textColor="?android:attr/colorBackground" android:textAppearance="@style/Dialer.Incall.TextAppearance.Message" android:background="@drawable/answer_text_only_background" app:autoSizeTextType="uniform" diff --git a/java/com/android/incallui/spam/SpamNotificationActivity.java b/java/com/android/incallui/spam/SpamNotificationActivity.java index 2cf486874..37755fc53 100644 --- a/java/com/android/incallui/spam/SpamNotificationActivity.java +++ b/java/com/android/incallui/spam/SpamNotificationActivity.java @@ -16,7 +16,6 @@ package com.android.incallui.spam; -import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.Context; @@ -27,6 +26,7 @@ import android.provider.CallLog; import android.provider.ContactsContract; import android.support.annotation.Nullable; import android.support.v4.app.FragmentActivity; +import android.support.v7.app.AlertDialog; import android.telephony.PhoneNumberUtils; import com.android.dialer.blocking.BlockedNumbersMigrator; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; @@ -230,7 +230,7 @@ public class SpamNotificationActivity extends FragmentActivity { } }, dismissListener) - .show(getFragmentManager(), BlockReportSpamDialogs.NOT_SPAM_DIALOG_TAG); + .show(getSupportFragmentManager(), BlockReportSpamDialogs.NOT_SPAM_DIALOG_TAG); } else { reportNotSpamAndFinish(number, contactLookupResultType); } @@ -257,7 +257,9 @@ public class SpamNotificationActivity extends FragmentActivity { } }, dismissListener) - .show(getFragmentManager(), BlockReportSpamDialogs.BLOCK_REPORT_SPAM_DIALOG_TAG); + .show( + getSupportFragmentManager(), + BlockReportSpamDialogs.BLOCK_REPORT_SPAM_DIALOG_TAG); } }); } else { @@ -539,7 +541,7 @@ public class SpamNotificationActivity extends FragmentActivity { private void showSpamBlockingPromoDialog() { spamBlockingPromoHelper.showSpamBlockingPromoDialog( - getFragmentManager(), + getSupportFragmentManager(), () -> { Logger.get(this) .logImpression( diff --git a/java/com/android/incallui/telecomeventui/InternationalCallOnWifiDialogFragment.java b/java/com/android/incallui/telecomeventui/InternationalCallOnWifiDialogFragment.java index 71a8be483..cd53f26c0 100644 --- a/java/com/android/incallui/telecomeventui/InternationalCallOnWifiDialogFragment.java +++ b/java/com/android/incallui/telecomeventui/InternationalCallOnWifiDialogFragment.java @@ -109,7 +109,7 @@ public class InternationalCallOnWifiDialogFragment extends DialogFragment { alwaysWarn.setChecked(preferences.getBoolean(ALWAYS_SHOW_WARNING_PREFERENCE_KEY, false)); AlertDialog alertDialog = - new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) + new AlertDialog.Builder(getActivity()) .setCancelable(false) .setView(dialogView) .setPositiveButton( 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 3d8adcb0d..996bc75ba 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 @@ -35,7 +35,7 @@ android:id="@+id/always_warn" android:layout_width="match_parent" android:layout_height="wrap_content" - android:buttonTint="@color/dialer_theme_color" + android:buttonTint="?android:attr/colorPrimary" android:text="@string/always_warn" android:textColor="@color/dialer_primary_text_color" android:textSize="14sp"/> diff --git a/java/com/android/incallui/theme/AndroidManifest.xml b/java/com/android/incallui/theme/AndroidManifest.xml new file mode 100644 index 000000000..3b1a459cb --- /dev/null +++ b/java/com/android/incallui/theme/AndroidManifest.xml @@ -0,0 +1,16 @@ +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<manifest package="com.android.incallui.theme"/> diff --git a/java/com/android/dialer/precall/impl/res/values/styles.xml b/java/com/android/incallui/theme/res/drawable/incall_background_gradient.xml index dd41265a4..996f17245 100644 --- a/java/com/android/dialer/precall/impl/res/values/styles.xml +++ b/java/com/android/incallui/theme/res/drawable/incall_background_gradient.xml @@ -1,6 +1,6 @@ <?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,16 +14,10 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - -<resources> - <style name="Theme.PreCall.DialogHolder" parent="DialerThemeBase.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> - -</resources> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient + android:angle="270" + android:startColor="@color/incall_background_gradient_top" + android:centerColor="@color/incall_background_gradient_middle" + android:endColor="@color/incall_background_gradient_bottom"/> +</shape> diff --git a/java/com/android/incallui/res/values/colors.xml b/java/com/android/incallui/theme/res/values/colors.xml index 32da57b84..cb894bbb7 100644 --- a/java/com/android/incallui/res/values/colors.xml +++ b/java/com/android/incallui/theme/res/values/colors.xml @@ -23,7 +23,7 @@ <color name="incall_dialpad_background">#ffffff</color> <!-- Background color for status bar. For portrait this will be ignored. --> - <color name="statusbar_background_color">@color/dialer_theme_color</color> + <color name="statusbar_background_color">?android:attr/colorPrimary</color> <!-- 20% opacity, theme color. --> <color name="incall_dialpad_touch_tint">@color/dialer_theme_color_20pct</color> diff --git a/java/com/android/incallui/res/values/dimens.xml b/java/com/android/incallui/theme/res/values/dimens.xml index 5688169ef..a84d8192a 100644 --- a/java/com/android/incallui/res/values/dimens.xml +++ b/java/com/android/incallui/theme/res/values/dimens.xml @@ -27,6 +27,7 @@ @dimen/dialpad_key_letters_default_size_for_single_alphabet </dimen> <dimen name="incall_dialpad_key_numbers_size">36dp</dimen> + <dimen name="incall_end_call_spacing">116dp</dimen> <!-- Dimension used to possibly down-scale high-res photo into what is suitable for notification's large icon. --> diff --git a/java/com/android/dialer/dialpadview/res/values/colors.xml b/java/com/android/incallui/theme/res/values/strings.xml index 8bea35710..c61290565 100644 --- a/java/com/android/dialer/dialpadview/res/values/colors.xml +++ b/java/com/android/incallui/theme/res/values/strings.xml @@ -1,5 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- - ~ Copyright (C) 2012 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. @@ -13,13 +14,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - <resources> - <!-- Colors for the dialpad --> - <color name="background_dialpad">#fcfcfc</color> - <color name="dialpad_primary_text_color">@color/dialer_theme_color</color> - <color name="dialpad_secondary_text_color">#737373</color> - <color name="dialpad_digits_text_color">#333</color> - <color name="dialpad_icon_tint">#89000000</color> - <color name="dialpad_voicemail_tint">#919191</color> -</resources> + <!-- Official label of the phone app, as seen in "Manage Applications" + and other settings UIs. --> + <string name="phoneAppLabel" product="default">Phone</string> +</resources>
\ No newline at end of file diff --git a/java/com/android/incallui/res/values/styles.xml b/java/com/android/incallui/theme/res/values/styles.xml index 269b72111..6bbad4e87 100644 --- a/java/com/android/incallui/res/values/styles.xml +++ b/java/com/android/incallui/theme/res/values/styles.xml @@ -20,12 +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/Theme.AppCompat.NoActionBar"> - <item name="android:textColorPrimary">#ffffff</item> - <item name="android:textColorSecondary">#DDFFFFFF</item> - <item name="android:colorPrimary">@color/dialer_theme_color</item> - <item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item> - + <style name="Theme.InCallScreen" parent="@style/Dialer.ThemeBase.NoActionBar.Dark"> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> @@ -33,13 +28,12 @@ <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:alertDialogTheme">@style/AlertDialogTheme</item> <item name="android:windowBackground">@drawable/incall_background_gradient</item> <item name="android:windowShowWallpaper">true</item> </style> - <style name="Theme.InCallScreen.ManageConference" parent="DialerThemeBase"> + <style name="Theme.InCallScreen.ManageConference" parent="Dialer.ThemeBase"> </style> <style name="InCallDialpad" parent="Dialpad.Light"> @@ -65,18 +59,17 @@ @dimen/incall_end_call_spacing </item> <item name="dialpad_elevation">10dp</item> + <item name="dialpad_text_color_secondary">?android:attr/textColorSecondaryInverse</item> </style> <style name="AfterCallNotificationTheme" parent="@android:style/Theme.Material.Light.Dialog"> <!-- This colorAccent is to style checkboxes in the dialogs --> - <item name="colorAccent">@color/dialer_theme_color</item> - <!-- This is needed to make any alert dialogs in this activity take up minimum space --> - <item name="android:alertDialogTheme">@style/AfterCallDialogStyle</item> + <item name="colorAccent">?android:attr/colorPrimary</item> </style> <style name="AfterCallDialogStyle" parent="@android:style/Theme.Material.Light.Dialog"> <!-- This colorAccent is to style text in the dialogs --> - <item name="android:colorAccent">@color/dialer_theme_color</item> + <item name="android:colorAccent">?android:attr/colorPrimary</item> </style> <style name="Theme.Incall.DialogHolder" parent="Theme.AppCompat.Translucent"> diff --git a/java/com/android/incallui/video/impl/VideoChargesAlertDialogFragment.java b/java/com/android/incallui/video/impl/VideoChargesAlertDialogFragment.java index 6762a9d22..799345243 100644 --- a/java/com/android/incallui/video/impl/VideoChargesAlertDialogFragment.java +++ b/java/com/android/incallui/video/impl/VideoChargesAlertDialogFragment.java @@ -117,7 +117,7 @@ public class VideoChargesAlertDialogFragment extends DialogFragment { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); AlertDialog alertDialog = - new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) + new AlertDialog.Builder(getActivity()) .setView(dialogView) .setPositiveButton( android.R.string.ok, 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 a547c7d69..56e1d794a 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 @@ -41,7 +41,7 @@ android:id="@+id/do_not_show" android:layout_width="match_parent" android:layout_height="wrap_content" - android:buttonTint="@color/dialer_theme_color" + android:buttonTint="?android:attr/colorPrimary" android:focusable="true" android:clickable="true" android:text="@string/do_not_show_again" diff --git a/packages.mk b/packages.mk index 3f94af240..6483346b8 100644 --- a/packages.mk +++ b/packages.mk @@ -34,6 +34,7 @@ LOCAL_AAPT_FLAGS := \ com.android.dialer.contactsfragment \ com.android.dialer.databasepopulator \ com.android.dialer.dialpadview \ + com.android.dialer.dialpadview.theme \ com.android.dialer.enrichedcall.simulator \ com.android.dialer.feedback \ com.android.dialer.glidephotomanager.impl \ @@ -53,7 +54,7 @@ LOCAL_AAPT_FLAGS := \ com.android.dialer.precall.externalreceiver \ com.android.dialer.preferredsim.impl \ com.android.dialer.preferredsim.suggestion \ - com.android.dialer.promotion \ + com.android.dialer.promotion.impl \ com.android.dialer.rtt \ com.android.dialer.searchfragment.common \ com.android.dialer.searchfragment.cp2 \ |