diff options
Diffstat (limited to 'java')
31 files changed, 152 insertions, 112 deletions
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index 930edd186..5575cacc5 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -127,6 +127,12 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { public void onPause() { voicemailPlaybackPresenter.onPause(); voicemailErrorManager.onPause(); + // Necessary to reset the speaker when leaving otherwise the platform will still remain in + // speaker mode + AudioManager audioManager = getContext().getSystemService(AudioManager.class); + if (audioManager.isSpeakerphoneOn()) { + audioManager.setSpeakerphoneOn(false); + } super.onPause(); } diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java index 6d1728f34..6fc8d23e3 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java +++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.database.ContentObserver; import android.database.Cursor; +import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.AsyncTask; @@ -207,6 +208,8 @@ public class VoicemailPlaybackPresenter position = savedInstanceState.getInt(CLIP_POSITION_KEY, 0); isPlaying = savedInstanceState.getBoolean(IS_PLAYING_STATE_KEY, false); isSpeakerphoneOn = savedInstanceState.getBoolean(IS_SPEAKERPHONE_ON_KEY, false); + AudioManager audioManager = activity.getSystemService(AudioManager.class); + audioManager.setSpeakerphoneOn(isSpeakerphoneOn); } if (mediaPlayer == null) { diff --git a/java/com/android/dialer/calllog/config/CallLogConfigComponent.java b/java/com/android/dialer/calllog/config/CallLogConfigComponent.java index c325025f3..7aaf63848 100644 --- a/java/com/android/dialer/calllog/config/CallLogConfigComponent.java +++ b/java/com/android/dialer/calllog/config/CallLogConfigComponent.java @@ -17,6 +17,7 @@ package com.android.dialer.calllog.config; import android.content.Context; import com.android.dialer.inject.HasRootComponent; +import com.android.dialer.inject.IncludeInDialerRoot; import dagger.Subcomponent; /** Dagger component for the call log config. */ @@ -31,6 +32,7 @@ public abstract class CallLogConfigComponent { } /** Used to refer to the root application component. */ + @IncludeInDialerRoot public interface HasComponent { CallLogConfigComponent callLogConfigComponent(); } diff --git a/java/com/android/dialer/duo/stub/StubDuoModule.java b/java/com/android/dialer/duo/stub/StubDuoModule.java index 604406a94..57c357080 100644 --- a/java/com/android/dialer/duo/stub/StubDuoModule.java +++ b/java/com/android/dialer/duo/stub/StubDuoModule.java @@ -17,11 +17,14 @@ package com.android.dialer.duo.stub; import com.android.dialer.duo.Duo; +import com.android.dialer.inject.DialerVariant; +import com.android.dialer.inject.InstallIn; import dagger.Binds; import dagger.Module; import javax.inject.Singleton; @Module +@InstallIn(variants = DialerVariant.DIALER_TEST) public abstract class StubDuoModule { @Binds diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java index 945e8a948..364f5bc76 100644 --- a/java/com/android/dialer/main/impl/MainSearchController.java +++ b/java/com/android/dialer/main/impl/MainSearchController.java @@ -424,7 +424,10 @@ public class MainSearchController implements SearchBarListener { searchFragment.setQuery( query.isPresent() ? query.get() : "", CallInitiationType.Type.REGULAR_SEARCH); - transaction.commit(); + + if (activity.isSafeToCommitTransactions()) { + transaction.commit(); + } notifyListenersOnSearchOpen(); } diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java index 998793e6e..72f0a68c6 100644 --- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java +++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java @@ -16,14 +16,12 @@ package com.android.dialer.speeddial.loader; -import android.annotation.TargetApi; import android.content.ContentProviderOperation; import android.content.ContentValues; import android.content.Context; import android.content.OperationApplicationException; import android.database.Cursor; import android.net.Uri; -import android.os.Build.VERSION_CODES; import android.os.RemoteException; import android.os.Trace; import android.provider.ContactsContract; @@ -40,7 +38,6 @@ import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor; import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener; import com.android.dialer.common.concurrent.DialerFutureSerializer; import com.android.dialer.common.database.Selection; -import com.android.dialer.duo.Duo; import com.android.dialer.duo.DuoComponent; import com.android.dialer.inject.ApplicationContext; import com.android.dialer.speeddial.database.SpeedDialEntry; @@ -72,21 +69,17 @@ import javax.inject.Singleton; * <li>Remove any {@link SpeedDialEntry} that is no longer starred or whose contact was * deleted. * <li>Update each {@link SpeedDialEntry} contact id, lookup key and channel. - * <li>Build a list of {@link SpeedDialUiItem} from {@link Contacts#STREQUENT_PHONE_ONLY}. - * <li>If any starred contacts in that list aren't in the {@link - * SpeedDialEntryDatabaseHelper}, insert them now. + * <li>Build a list of {@link SpeedDialUiItem} from starred contacts. + * <li>If any contacts in that list aren't in the {@link SpeedDialEntryDatabaseHelper}, insert + * them now. * <li>Notify the {@link SuccessListener} of the complete list of {@link SpeedDialUiItem * SpeedDialContacts} composed from {@link SpeedDialEntry SpeedDialEntries} and * non-starred {@link Contacts#STREQUENT_PHONE_ONLY}. * </ol> */ -@SuppressWarnings("AndroidApiChecker") -@TargetApi(VERSION_CODES.N) @Singleton public final class SpeedDialUiItemMutator { - private static final int MAX_DUO_SUGGESTIONS = 3; - private final Context appContext; private final ListeningExecutorService backgroundExecutor; // Used to ensure that only one refresh flow runs at a time. @@ -104,8 +97,7 @@ public final class SpeedDialUiItemMutator { /** * Returns a {@link ListenableFuture} for a list of {@link SpeedDialUiItem SpeedDialUiItems}. This - * list is composed of starred contacts from {@link SpeedDialEntryDatabaseHelper} and suggestions - * from {@link Contacts#STREQUENT_PHONE_ONLY}. + * list is composed of starred contacts from {@link SpeedDialEntryDatabaseHelper}. */ public ListenableFuture<ImmutableList<SpeedDialUiItem>> loadSpeedDialUiItems() { return dialerFutureSerializer.submit(this::loadSpeedDialUiItemsInternal, backgroundExecutor); @@ -117,8 +109,7 @@ public final class SpeedDialUiItemMutator { * <p>If the item is starred, it's entry will be removed from the SpeedDialEntry database. * Additionally, if the contact only has one entry in the database, it will be unstarred. * - * <p>If the item isn't starred, it's usage data will be deleted but the suggestion can come back - * if the user calls that contact again. + * <p>If the item isn't starred, it's usage data will be deleted. * * @return the updated list of SpeedDialUiItems. */ @@ -281,27 +272,19 @@ public final class SpeedDialUiItemMutator { } Trace.endSection(); // updateOrDeleteEntries - // Get all Strequent Contacts - List<SpeedDialUiItem> strequentContacts = getStrequentContacts(); - - // For each contact, if it isn't starred, add it as a suggestion. + // Get all starred contacts + List<SpeedDialUiItem> starredContacts = getStarredContacts(); // If it is starred and not already accounted for above, then insert into the SpeedDialEntry DB. - Trace.beginSection("addSuggestions"); - for (SpeedDialUiItem contact : strequentContacts) { - if (!contact.isStarred()) { - // Add this contact as a suggestion - // TODO(77754534): improve suggestions beyond just first channel - speedDialUiItems.add( - contact.toBuilder().setDefaultChannel(contact.channels().get(0)).build()); - - } else if (speedDialUiItems.stream().noneMatch(c -> c.contactId() == contact.contactId())) { + Trace.beginSection("addStarredContact"); + for (SpeedDialUiItem contact : starredContacts) { + if (speedDialUiItems.stream().noneMatch(c -> c.contactId() == contact.contactId())) { entriesToInsert.add(contact.buildSpeedDialEntry()); // These are our newly starred contacts speedDialUiItems.add(contact); } } - Trace.endSection(); // addSuggestions + Trace.endSection(); // addStarredContact Trace.beginSection("insertUpdateAndDelete"); ImmutableMap<SpeedDialEntry, Long> insertedEntriesToIdsMap = @@ -339,7 +322,7 @@ public final class SpeedDialUiItemMutator { } // Starred contacts that aren't in the map, should already have speed dial entry ids. - // Non-starred contacts (suggestions) aren't in the speed dial entry database, so they + // Non-starred contacts aren't in the speed dial entry database, so they // shouldn't have speed dial entry ids. Assert.checkArgument( speedDialUiItem.isStarred() == (speedDialUiItem.speedDialEntryId() != null), @@ -485,23 +468,29 @@ public final class SpeedDialUiItemMutator { } @WorkerThread - private List<SpeedDialUiItem> getStrequentContacts() { + private List<SpeedDialUiItem> getStarredContacts() { Trace.beginSection("getStrequentContacts"); Assert.isWorkerThread(); Set<String> contactIds = new ArraySet<>(); - // Fetch the contact ids of all strequent contacts + // Fetch the contact ids of all starred contacts Uri strequentUri = Contacts.CONTENT_STREQUENT_URI .buildUpon() .appendQueryParameter(ContactsContract.STREQUENT_PHONE_ONLY, "true") .build(); + Selection selection = Selection.column(Phone.STARRED).is("=", 1); try (Cursor cursor = appContext .getContentResolver() - .query(strequentUri, new String[] {Phone.CONTACT_ID}, null, null, null)) { + .query( + strequentUri, + new String[] {Phone.CONTACT_ID}, + selection.getSelection(), + selection.getSelectionArgs(), + null)) { if (cursor == null) { - LogUtil.e("SpeedDialUiItemMutator.getStrequentContacts", "null cursor"); + LogUtil.e("SpeedDialUiItemMutator.getStarredContacts", "null cursor"); Trace.endSection(); return new ArrayList<>(); } @@ -515,8 +504,7 @@ public final class SpeedDialUiItemMutator { } // Build SpeedDialUiItems from those contact ids - Selection selection = - Selection.builder().and(Selection.column(Phone.CONTACT_ID).in(contactIds)).build(); + selection = Selection.builder().and(Selection.column(Phone.CONTACT_ID).in(contactIds)).build(); try (Cursor cursor = appContext .getContentResolver() @@ -624,24 +612,10 @@ public final class SpeedDialUiItemMutator { Context context, ImmutableList<SpeedDialUiItem> speedDialUiItems) { Assert.isMainThread(); - Duo duo = DuoComponent.get(context).getDuo(); - int maxDuoSuggestions = MAX_DUO_SUGGESTIONS; - ImmutableList.Builder<SpeedDialUiItem> newSpeedDialItemList = ImmutableList.builder(); // for each existing item for (SpeedDialUiItem item : speedDialUiItems) { - // If the item is a suggestion - if (!item.isStarred()) { - // And duo reachable, insert a duo suggestion - if (maxDuoSuggestions > 0 && duo.isReachable(context, item.defaultChannel().number())) { - maxDuoSuggestions--; - Channel defaultChannel = - item.defaultChannel().toBuilder().setTechnology(Channel.DUO).build(); - newSpeedDialItemList.add(item.toBuilder().setDefaultChannel(defaultChannel).build()); - } - // Insert the voice suggestion too - newSpeedDialItemList.add(item); - } else if (item.defaultChannel() == null) { + if (item.defaultChannel() == null) { // If the contact is starred and doesn't have a default channel, insert duo channels newSpeedDialItemList.add(insertDuoChannelsToStarredContact(context, item)); } else { diff --git a/java/com/android/dialer/theme/base/Theme.java b/java/com/android/dialer/theme/base/Theme.java index 6e0d20a7a..2a9975b4b 100644 --- a/java/com/android/dialer/theme/base/Theme.java +++ b/java/com/android/dialer/theme/base/Theme.java @@ -17,6 +17,7 @@ package com.android.dialer.theme.base; import android.content.Context; +import android.content.res.ColorStateList; import android.support.annotation.ColorInt; import android.support.annotation.IntDef; import android.support.annotation.StyleRes; @@ -50,6 +51,8 @@ public interface Theme { @ColorInt int getColorIcon(); + ColorStateList getColorIconStateList(); + @ColorInt int getColorIconSecondary(); diff --git a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java index c8f20c731..35dcef27c 100644 --- a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java +++ b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java @@ -17,6 +17,7 @@ package com.android.dialer.theme.base.impl; import android.content.Context; +import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.support.annotation.ColorInt; import android.support.annotation.StyleRes; @@ -33,6 +34,7 @@ import javax.inject.Singleton; public class AospThemeImpl implements Theme { private int colorIcon = -1; + private final ColorStateList colorIconStateList; private int colorIconSecondary = -1; private int colorPrimary = -1; private int colorPrimaryDark = -1; @@ -80,6 +82,7 @@ public class AospThemeImpl implements Theme { colorBackground = array.getColor(/* index= */ 7, /* defValue= */ -1); colorBackgroundFloating = array.getColor(/* index= */ 8, /* defValue= */ -1); colorIcon = array.getColor(/* index= */ 9, /* defValue= */ -1); + colorIconStateList = array.getColorStateList(/* index= */ 9); colorIconSecondary = array.getColor(/* index= */ 10, /* defValue= */ -1); colorTextOnUnthemedDarkBackground = array.getColor(/* index= */ 11, /* defValue= */ -1); colorIconOnUnthemedDarkBackground = array.getColor(/* index= */ 12, /* defValue= */ -1); @@ -126,6 +129,12 @@ public class AospThemeImpl implements Theme { } @Override + public ColorStateList getColorIconStateList() { + Assert.checkArgument(colorIconStateList != null); + return colorIconStateList; + } + + @Override public @ColorInt int getColorIconSecondary() { Assert.checkArgument(colorIconSecondary != -1); return colorIconSecondary; diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml index 4b5034023..142bb897b 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml @@ -56,7 +56,7 @@ <item name="colorControlActivated">?android:attr/colorPrimary</item> <!-- Dialer specific attributes. --> - <item name="colorIcon">@color/google_grey_400</item> + <item name="colorIcon">?android:attr/textColorSecondary</item> <item name="colorIconSecondary">?android:attr/textColorSecondary</item> <item name="colorTextOnUnthemedDarkBackground">@android:color/white</item> <item name="colorIconOnUnthemedDarkBackground">@android:color/white</item> diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml index db06df4bd..e3eefe69a 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml @@ -39,7 +39,7 @@ <!-- Activities and Applications should inherit from one of the themes above. --> <style name="Dialer.ThemeBase"> <!-- These values should be used to color all backgrounds. --> - <item name="android:colorBackground">@color/dialer_background_color</item> + <item name="android:colorBackground">@android:color/white</item> <item name="android:colorBackgroundFloating">@android:color/white</item> <!-- These values should be used to set text color. --> @@ -61,7 +61,7 @@ <item name="colorControlActivated">?android:attr/colorPrimary</item> <!-- Dialer specific attributes. --> - <item name="colorIcon">@color/google_grey_700</item> + <item name="colorIcon">@color/dialer_icon_color</item> <item name="colorIconSecondary">@color/google_grey_400</item> <item name="colorTextOnUnthemedDarkBackground">@android:color/white</item> <item name="colorIconOnUnthemedDarkBackground">@android:color/white</item> diff --git a/java/com/android/dialer/theme/common/res/values/colors.xml b/java/com/android/dialer/theme/common/res/values/colors.xml index 6fea43665..770aa8c15 100644 --- a/java/com/android/dialer/theme/common/res/values/colors.xml +++ b/java/com/android/dialer/theme/common/res/values/colors.xml @@ -17,7 +17,7 @@ <!-- The colors in this file aren't configured at the theme level. --> <resources> <color name="dialer_call_green">#34A853</color> - <color name="dialer_end_call_button_color">#BD2A2A</color> + <color name="dialer_end_call_button_color">#D93025</color> <color name="dialer_divider_line_color">#D8D8D8</color> <color name="dialer_link_color">#2A56C6</color> <color name="dialer_snackbar_action_text_color">#4285F4</color> diff --git a/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml index 703e40bed..f14537cd5 100644 --- a/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_primary_text_color.xml @@ -17,5 +17,5 @@ <!-- 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/google_grey_700"/> - <item android:color="@color/google_grey_400"/> + <item android:color="@color/google_grey_100"/> </selector> diff --git a/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml index 486669f91..b94388a75 100644 --- a/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_dark_secondary_text_color.xml @@ -17,5 +17,5 @@ <!-- 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/google_grey_700"/> - <item android:color="@color/google_grey_300"/> + <item android:color="@color/google_grey_400"/> </selector> diff --git a/java/com/android/dialer/theme/hidden/res/color/dialer_icon_color.xml b/java/com/android/dialer/theme/hidden/res/color/dialer_icon_color.xml new file mode 100644 index 000000000..594f82969 --- /dev/null +++ b/java/com/android/dialer/theme/hidden/res/color/dialer_icon_color.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@android:color/white" android:state_checked="true"/> + <item android:color="@color/google_grey_400" android:state_enabled="false"/> + <item android:color="@color/google_grey_700"/> +</selector> diff --git a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml index 988aad78f..0ed8e7566 100644 --- a/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml +++ b/java/com/android/dialer/theme/hidden/res/values/colors_dialer_light.xml @@ -19,5 +19,4 @@ <color name="dialer_theme_color_20pct">#332A56C6</color> <color name="dialer_theme_color_dark">#1C3AA9</color> <color name="dialer_secondary_color">#F50057</color> - <color name="dialer_background_color">#FAFAFA</color> </resources> diff --git a/java/com/android/dialer/theme/hidden/res/values/styles.xml b/java/com/android/dialer/theme/hidden/res/values/styles.xml index 44a35f8a2..454384892 100644 --- a/java/com/android/dialer/theme/hidden/res/values/styles.xml +++ b/java/com/android/dialer/theme/hidden/res/values/styles.xml @@ -51,7 +51,6 @@ <!-- Used to style all Dialer's AlertDialogs. Every button is awarded this for free if the parent activity's theme extends from Dialer.ThemeBase(.NoActionBar) or doesn't specify a theme. --> <style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert"> - <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> <!-- TODO(a bug): figure out why ?android:attr/colorPrimary doesn't work here --> <item name="android:colorAccent">@color/dialer_theme_color</item> <item name="colorAccent">@color/dialer_theme_color</item> diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java index a8b060daa..274071a19 100644 --- a/java/com/android/incallui/CallButtonPresenter.java +++ b/java/com/android/incallui/CallButtonPresenter.java @@ -429,11 +429,6 @@ public class CallButtonPresenter return; } - if (call != null) { - inCallButtonUi.updateInCallButtonUiColors( - InCallPresenter.getInstance().getThemeColorManager().getSecondaryColor()); - } - final boolean isEnabled = state.isConnectingOrConnected() && !state.isIncoming() && call != null; inCallButtonUi.setEnabled(isEnabled); diff --git a/java/com/android/incallui/commontheme/res/drawable/answer_answer_background.xml b/java/com/android/incallui/commontheme/res/drawable/answer_answer_background.xml index 090506aa6..bd5d5d389 100644 --- a/java/com/android/incallui/commontheme/res/drawable/answer_answer_background.xml +++ b/java/com/android/incallui/commontheme/res/drawable/answer_answer_background.xml @@ -1,10 +1,25 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#80FFFFFF"> <item> <shape android:shape="oval"> - <solid android:color="#09ad00"/> + <solid android:color="@color/dialer_call_green"/> </shape> </item> </ripple> diff --git a/java/com/android/incallui/commontheme/res/drawable/answer_decline_background.xml b/java/com/android/incallui/commontheme/res/drawable/answer_decline_background.xml index abfd56ecf..8854de658 100644 --- a/java/com/android/incallui/commontheme/res/drawable/answer_decline_background.xml +++ b/java/com/android/incallui/commontheme/res/drawable/answer_decline_background.xml @@ -1,10 +1,25 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#80FFFFFF"> <item> <shape android:shape="oval"> - <solid android:color="#DF0000"/> + <solid android:color="@color/dialer_end_call_button_color"/> </shape> </item> </ripple> diff --git a/java/com/android/incallui/commontheme/res/drawable/incall_end_call_background.xml b/java/com/android/incallui/commontheme/res/drawable/incall_end_call_background.xml index 3c9f4bc0b..8854de658 100644 --- a/java/com/android/incallui/commontheme/res/drawable/incall_end_call_background.xml +++ b/java/com/android/incallui/commontheme/res/drawable/incall_end_call_background.xml @@ -1,10 +1,25 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#80FFFFFF"> <item> <shape android:shape="oval"> - <solid android:color="#FFDF0000"/> + <solid android:color="@color/dialer_end_call_button_color"/> </shape> </item> </ripple> diff --git a/java/com/android/incallui/commontheme/res/values/styles.xml b/java/com/android/incallui/commontheme/res/values/styles.xml index f2ec2ccc3..0c4c092b9 100644 --- a/java/com/android/incallui/commontheme/res/values/styles.xml +++ b/java/com/android/incallui/commontheme/res/values/styles.xml @@ -26,7 +26,7 @@ </style> <style name="Dialer.Incall.TextAppearance.Label"> - <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:textSize">12sp</item> </style> diff --git a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java index bfc2781a9..4e8fa82c4 100644 --- a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java +++ b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java @@ -18,14 +18,11 @@ package com.android.incallui.incall.impl; import android.animation.AnimatorInflater; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.TypedArray; -import android.graphics.Color; import android.graphics.PorterDuff.Mode; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; import android.text.TextUtils.TruncateAt; @@ -36,6 +33,7 @@ import android.widget.Checkable; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import com.android.dialer.theme.base.ThemeComponent; /** A button to show on the incall screen */ public class CheckableLabeledButton extends LinearLayout implements Checkable { @@ -94,8 +92,7 @@ public class CheckableLabeledButton extends LinearLayout implements Checkable { iconView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding); iconView.setImageDrawable(icon); iconView.setImageTintMode(Mode.SRC_IN); - iconView.setImageTintList( - getResources().getColorStateList(R.color.incall_button_icon, context.getTheme())); + iconView.setImageTintList(ThemeComponent.get(context).theme().getColorIconStateList()); iconView.setBackground( getResources().getDrawable(R.drawable.incall_button_background, context.getTheme())); @@ -134,13 +131,6 @@ public class CheckableLabeledButton extends LinearLayout implements Checkable { labelView.setAlpha(isEnabled() ? 1f : DISABLED_STATE_OPACITY); } - public void setCheckedColor(@ColorInt int color) { - iconView.setImageTintList( - new ColorStateList( - new int[][] {new int[] {android.R.attr.state_checked}, new int[] {}}, - new int[] {color, Color.WHITE})); - } - public Drawable getIconDrawable() { return iconView.getDrawable(); } diff --git a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java index a0eead128..db0b5b9b8 100644 --- a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java +++ b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java @@ -17,7 +17,6 @@ package com.android.incallui.incall.impl; import android.os.Bundle; -import android.support.annotation.ColorInt; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.ArraySet; @@ -128,12 +127,6 @@ public class InCallButtonGridFragment extends Fragment { return numVisibleButtons; } - public void updateButtonColor(@ColorInt int color) { - for (CheckableLabeledButton button : buttons) { - button.setCheckedColor(color); - } - } - /** Interface to let the listener know the status of the button grid. */ public interface OnButtonGridCreatedListener { void onButtonGridCreated(InCallButtonGridFragment inCallButtonGridFragment); diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index 7f20b407f..6e57058f9 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; import android.os.Handler; -import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; @@ -496,11 +495,6 @@ public class InCallFragment extends Fragment } @Override - public void updateInCallButtonUiColors(@ColorInt int color) { - inCallButtonGridFragment.updateButtonColor(color); - } - - @Override public Fragment getInCallButtonUiFragment() { return this; } diff --git a/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml b/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml index 000525f5f..292d91f9b 100644 --- a/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml +++ b/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml @@ -16,6 +16,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?android:attr/colorPrimaryDark" android:state_checked="true"/> - <item android:color="?android:attr/textColorPrimary"/> + <item android:color="?android:attr/colorBackground" android:state_checked="true"/> + <item android:color="?colorIcon"/> </selector> diff --git a/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_checked.xml b/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_checked.xml index 73c6947e2..0d8732b4f 100644 --- a/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_checked.xml +++ b/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_checked.xml @@ -1,5 +1,20 @@ <?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 + --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> - <solid android:color="@color/incall_button_white"/> + <solid android:color="?android:attr/textColorSecondary"/> </shape> diff --git a/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml b/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml index 9cc599dc7..d200547b0 100644 --- a/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml +++ b/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml @@ -41,8 +41,7 @@ android:id="@id/contactgrid_avatar" android:layout_width="@dimen/incall_avatar_size" android:layout_height="@dimen/incall_avatar_size" - android:layout_marginBottom="8dp" - android:elevation="2dp"/> + android:layout_marginBottom="8dp"/> <include layout="@layout/incall_contactgrid_top_row" diff --git a/java/com/android/incallui/incall/protocol/InCallButtonUi.java b/java/com/android/incallui/incall/protocol/InCallButtonUi.java index 28dd84c42..17d50bf17 100644 --- a/java/com/android/incallui/incall/protocol/InCallButtonUi.java +++ b/java/com/android/incallui/incall/protocol/InCallButtonUi.java @@ -16,7 +16,6 @@ package com.android.incallui.incall.protocol; -import android.support.annotation.ColorInt; import android.support.v4.app.Fragment; import android.telecom.CallAudioState; @@ -43,8 +42,6 @@ public interface InCallButtonUi { */ void updateButtonStates(); - void updateInCallButtonUiColors(@ColorInt int color); - Fragment getInCallButtonUiFragment(); void showAudioRouteSelector(); diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java index e61ce3e19..36235df19 100644 --- a/java/com/android/incallui/rtt/impl/RttChatFragment.java +++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java @@ -569,9 +569,6 @@ public class RttChatFragment extends Fragment public void updateButtonStates() {} @Override - public void updateInCallButtonUiColors(int color) {} - - @Override public Fragment getInCallButtonUiFragment() { return this; } diff --git a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java index f270edab9..994363ab4 100644 --- a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java +++ b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java @@ -22,7 +22,6 @@ import android.content.pm.PackageManager; import android.graphics.Point; import android.graphics.drawable.Animatable; import android.os.Bundle; -import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; @@ -805,9 +804,6 @@ public class SurfaceViewVideoCallFragment extends Fragment } @Override - public void updateInCallButtonUiColors(@ColorInt int color) {} - - @Override public Fragment getInCallButtonUiFragment() { return this; } diff --git a/java/com/android/incallui/video/impl/VideoCallFragment.java b/java/com/android/incallui/video/impl/VideoCallFragment.java index 11b80ceb9..82226f375 100644 --- a/java/com/android/incallui/video/impl/VideoCallFragment.java +++ b/java/com/android/incallui/video/impl/VideoCallFragment.java @@ -30,7 +30,6 @@ import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.ScriptIntrinsicBlur; -import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; @@ -872,9 +871,6 @@ public class VideoCallFragment extends Fragment } @Override - public void updateInCallButtonUiColors(@ColorInt int color) {} - - @Override public Fragment getInCallButtonUiFragment() { return this; } |