diff options
author | Eric Erfanian <erfanian@google.com> | 2018-05-30 16:17:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-30 16:17:27 +0000 |
commit | 2c3d81eeac82472d06027bc65d661e16735c8608 (patch) | |
tree | 293aeb0012d8db8f3f4606a75a422cf4da328477 /java/com/android/incallui | |
parent | 4efd0ebf003e985e7cbe40d8ffd9f7ff227a9611 (diff) | |
parent | 152c3fd58f83a1882bcdc8bc55f46bbb8f3173c9 (diff) |
Merge changes Ica13ee39,I5e0fedc8,I8e7efad0,I0ecc1f91,Iee1e658a, ...
* changes:
Drop maps.impl from packages.mk
Check if ID column is null before retrieving data from the smart dial database.
Rename theme/private to theme/hidden.
Some improvements to the answer fragment layouts.
Better a11y for the bottom sheet.
Fix a few UI bugs.
Log IMS video call available state
Better a11y for contact badge in the new call log.
Use lookup key to determine the letter tile color
Use Dialer Light Theme for SpeakEasyFragment
Better a11y for new call log entries.
Use Maps SDK lite mode instead of static API for emergency call.
Updating locations where PrimaryInfo#setPhoto is used to also PrimaryInfo#setPhotoUri for new GlidePhotoManager implementation. As part of this addition, we also are cleaning the setPhoto(null) because this is not explicitly needed.
Converted ThemeUtil into a DaggerModule.
Delete AppCompatConstants
Remove photo support in PhoneNumberService
Began implementation of Dialer dark theme.
Diffstat (limited to 'java/com/android/incallui')
46 files changed, 318 insertions, 431 deletions
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index 83c1aff5e..6614e7c74 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -321,9 +321,7 @@ public class CallCardPresenter } this.primary.addListener(this); - primaryContactInfo = - ContactInfoCache.buildCacheEntryFromCall( - context, this.primary, this.primary.getState() == DialerCallState.INCOMING); + primaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(context, this.primary); updatePrimaryDisplayInfo(); maybeStartSearch(this.primary, true); } @@ -339,9 +337,7 @@ public class CallCardPresenter updateSecondaryDisplayInfo(); } else { // secondary call has changed - secondaryContactInfo = - ContactInfoCache.buildCacheEntryFromCall( - context, this.secondary, this.secondary.getState() == DialerCallState.INCOMING); + secondaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(context, this.secondary); updateSecondaryDisplayInfo(); maybeStartSearch(this.secondary, false); } @@ -726,6 +722,7 @@ public class CallCardPresenter : null) .setLabel(isChildNumberShown || isCallSubjectShown ? null : primaryContactInfo.label) .setPhoto(primaryContactInfo.photo) + .setPhotoUri(primaryContactInfo.displayPhotoUri) .setPhotoType(primaryContactInfo.photoType) .setIsSipCall(primaryContactInfo.isSipCall) .setIsContactPhotoShown(showContactPhoto) diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java index 5318fdb5f..c71bf59b2 100644 --- a/java/com/android/incallui/ConferenceParticipantListAdapter.java +++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java @@ -397,9 +397,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { newCallIds.add(callId); ContactCacheEntry contactCache = cache.getInfo(callId); if (contactCache == null) { - contactCache = - ContactInfoCache.buildCacheEntryFromCall( - getContext(), call, call.getState() == DialerCallState.INCOMING); + contactCache = ContactInfoCache.buildCacheEntryFromCall(getContext(), call); } if (participantsByCallId.containsKey(callId)) { diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java index 81c7b724d..f01bddd58 100644 --- a/java/com/android/incallui/ContactInfoCache.java +++ b/java/com/android/incallui/ContactInfoCache.java @@ -138,8 +138,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { return cache; } - static ContactCacheEntry buildCacheEntryFromCall( - Context context, DialerCall call, boolean isIncoming) { + static ContactCacheEntry buildCacheEntryFromCall(Context context, DialerCall call) { final ContactCacheEntry entry = new ContactCacheEntry(); // TODO: get rid of caller info. @@ -837,7 +836,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { final PhoneNumberServiceListener listener = new PhoneNumberServiceListener(callId, queryToken.queryId); cacheEntry.hasPendingQuery = true; - phoneNumberService.getPhoneNumberInfo(cacheEntry.number, listener, listener, isIncoming); + phoneNumberService.getPhoneNumberInfo(cacheEntry.number, listener); } sendInfoNotifications(callId, cacheEntry); if (!cacheEntry.hasPendingQuery) { @@ -855,8 +854,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { } } - class PhoneNumberServiceListener - implements PhoneNumberService.NumberLookupListener, PhoneNumberService.ImageLookupListener { + class PhoneNumberServiceListener implements PhoneNumberService.NumberLookupListener { private final String callId; private final int queryIdOfRemoteLookup; @@ -924,17 +922,6 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { clearCallbacks(callId); } } - - @Override - public void onImageFetchComplete(Bitmap bitmap) { - Log.d(TAG, "PhoneNumberServiceListener.onImageFetchComplete"); - if (!isWaitingForThisQuery(callId, queryIdOfRemoteLookup)) { - return; - } - CallerInfoQueryToken queryToken = new CallerInfoQueryToken(queryIdOfRemoteLookup, callId); - loadImage(null, bitmap, queryToken); - onImageLoadComplete(TOKEN_UPDATE_PHOTO_FOR_CALL_STATE, null, bitmap, queryToken); - } } private boolean needForceQuery(DialerCall call, ContactCacheEntry cacheEntry) { diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java index 8c882d2a3..10c4a6490 100644 --- a/java/com/android/incallui/ExternalCallNotifier.java +++ b/java/com/android/incallui/ExternalCallNotifier.java @@ -45,6 +45,7 @@ import com.android.dialer.contactphoto.BitmapUtil; import com.android.dialer.notification.DialerNotificationManager; import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.telecom.TelecomCallUtil; +import com.android.dialer.theme.base.ThemeComponent; import com.android.incallui.call.DialerCall; import com.android.incallui.call.DialerCallDelegate; import com.android.incallui.call.ExternalCallList; @@ -239,7 +240,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen builder.setSmallIcon(R.drawable.quantum_ic_call_white_24); builder.setContentTitle(info.getContentTitle()); builder.setLargeIcon(info.getLargeIcon()); - builder.setColor(context.getResources().getColor(R.color.dialer_theme_color)); + builder.setColor(ThemeComponent.get(context).theme().getColorPrimary()); builder.addPerson(info.getPersonReference()); if (BuildCompat.isAtLeastO()) { builder.setChannelId(NotificationChannelId.DEFAULT); @@ -275,7 +276,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen */ Notification.Builder publicBuilder = new Notification.Builder(context); publicBuilder.setSmallIcon(R.drawable.quantum_ic_call_white_24); - publicBuilder.setColor(context.getResources().getColor(R.color.dialer_theme_color)); + publicBuilder.setColor(ThemeComponent.get(context).theme().getColorPrimary()); if (BuildCompat.isAtLeastO()) { publicBuilder.setChannelId(NotificationChannelId.DEFAULT); } diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index da5d20fa3..5aabf0694 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -365,8 +365,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud addListener(this.proximitySensor); if (themeColorManager == null) { - themeColorManager = - new ThemeColorManager(new InCallUIMaterialColorMapUtils(this.context.getResources())); + themeColorManager = new ThemeColorManager(new InCallUIMaterialColorMapUtils(this.context)); } this.callList = callList; diff --git a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java index 945e9fb5a..c566f7987 100644 --- a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java +++ b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java @@ -16,31 +16,35 @@ package com.android.incallui; +import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.telecom.PhoneAccount; import com.android.contacts.common.util.MaterialColorMapUtils; +import com.android.dialer.theme.base.ThemeComponent; public class InCallUIMaterialColorMapUtils extends MaterialColorMapUtils { private final TypedArray primaryColors; private final TypedArray secondaryColors; private final Resources resources; + private final Context context; - public InCallUIMaterialColorMapUtils(Resources resources) { - super(resources); + public InCallUIMaterialColorMapUtils(Context context) { + super(context.getResources()); + this.resources = context.getResources(); + this.context = context; primaryColors = resources.obtainTypedArray(R.array.background_colors); secondaryColors = resources.obtainTypedArray(R.array.background_colors_dark); - this.resources = resources; } /** * {@link Resources#getColor(int) used for compatibility */ @SuppressWarnings("deprecation") - public static MaterialPalette getDefaultPrimaryAndSecondaryColors(Resources resources) { - final int primaryColor = resources.getColor(R.color.dialer_theme_color); - final int secondaryColor = resources.getColor(R.color.dialer_theme_color_dark); + public static MaterialPalette getDefaultPrimaryAndSecondaryColors(Context context) { + final int primaryColor = ThemeComponent.get(context).theme().getColorPrimary(); + final int secondaryColor = ThemeComponent.get(context).theme().getColorPrimaryDark(); return new MaterialPalette(primaryColor, secondaryColor); } @@ -52,7 +56,7 @@ public class InCallUIMaterialColorMapUtils extends MaterialColorMapUtils { @Override public MaterialPalette calculatePrimaryAndSecondaryColor(int color) { if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) { - return getDefaultPrimaryAndSecondaryColors(resources); + return getDefaultPrimaryAndSecondaryColors(context); } for (int i = 0; i < primaryColors.length(); i++) { diff --git a/java/com/android/incallui/ReturnToCallController.java b/java/com/android/incallui/ReturnToCallController.java index 7c4585ca1..09e1845aa 100644 --- a/java/com/android/incallui/ReturnToCallController.java +++ b/java/com/android/incallui/ReturnToCallController.java @@ -35,6 +35,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.theme.base.ThemeComponent; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback; import com.android.incallui.InCallPresenter.InCallState; @@ -288,7 +289,7 @@ public class ReturnToCallController implements InCallUiListener, Listener, Audio private BubbleInfo generateBubbleInfo() { return BubbleInfo.builder() - .setPrimaryColor(context.getResources().getColor(R.color.dialer_theme_color, null)) + .setPrimaryColor(ThemeComponent.get(context).theme().getColorPrimary()) .setPrimaryIcon(Icon.createWithResource(context, R.drawable.on_going_call)) .setStartingYPosition( InCallPresenter.getInstance().shouldStartInBubbleMode() @@ -302,7 +303,7 @@ public class ReturnToCallController implements InCallUiListener, Listener, Audio private BubbleInfo generateBubbleInfoForBackgroundCalling() { return BubbleInfo.builder() - .setPrimaryColor(context.getResources().getColor(R.color.dialer_theme_color, null)) + .setPrimaryColor(ThemeComponent.get(context).theme().getColorPrimary()) .setPrimaryIcon(Icon.createWithResource(context, R.drawable.on_going_call)) .setStartingYPosition(context.getResources().getDisplayMetrics().heightPixels / 2) .setActions(generateActions()) diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 32d202595..27d23c4ae 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -75,6 +75,7 @@ import com.android.dialer.lettertile.LetterTileDrawable.ContactType; import com.android.dialer.multimedia.MultimediaData; import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.oem.MotorolaUtils; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.DrawableConverter; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback; @@ -333,7 +334,7 @@ public class StatusBarNotifier Notification.Builder publicBuilder = new Notification.Builder(context); publicBuilder .setSmallIcon(iconResId) - .setColor(context.getResources().getColor(R.color.dialer_theme_color, context.getTheme())) + .setColor(ThemeComponent.get(context).theme().getColorPrimary()) // Hide work call state for the lock screen notification .setContentTitle(getContentString(call, ContactsUtils.USER_TYPE_CURRENT)); setNotificationWhen(call, callState, publicBuilder); diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java index d44a5daa2..18e0e9864 100644 --- a/java/com/android/incallui/answer/impl/AnswerFragment.java +++ b/java/com/android/incallui/answer/impl/AnswerFragment.java @@ -49,6 +49,8 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; import com.android.dialer.common.Assert; import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; @@ -82,6 +84,8 @@ import com.android.incallui.incalluilock.InCallUiLock; import com.android.incallui.maps.MapsComponent; import com.android.incallui.sessiondata.AvatarPresenter; import com.android.incallui.sessiondata.MultimediaFragment; +import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon; +import com.android.incallui.speakeasy.Annotations.SpeakEasyText; import com.android.incallui.speakeasy.SpeakEasyComponent; import com.android.incallui.util.AccessibilityUtil; import com.android.incallui.video.protocol.VideoCallScreen; @@ -144,6 +148,9 @@ public class AnswerFragment extends Fragment private View importanceBadge; private SwipeButtonView secondaryButton; private SwipeButtonView answerAndReleaseButton; + private LinearLayout chipLayout; + private ImageView chipIcon; + private TextView chipText; private AffordanceHolderLayout affordanceHolderLayout; // Use these flags to prevent user from clicking accept/reject buttons multiple times. // We use separate flags because in some rare cases accepting a call may fail to join the room, @@ -195,17 +202,6 @@ public class AnswerFragment extends Fragment public void performAction(AnswerFragment fragment) { fragment.performAnswerAndRelease(); } - }, - - SPEAKEASY( - R.drawable.quantum_ic_rtt_vd_theme_24, - R.string.speakeasy_secondary_button_hint, - R.string.speakeasy_secondary_button_hint, - R.string.speakeasy_secondary_button_hint) { - @Override - public void performAction(AnswerFragment fragment) { - fragment.performSpeakEasy(); - } }; @DrawableRes public int icon; @@ -232,8 +228,7 @@ public class AnswerFragment extends Fragment } } - private void performSpeakEasy() { - restoreAnswerAndReleaseButtonAnimation(); + private void performSpeakEasy(View unused) { answerScreenDelegate.onSpeakEasyCall(); buttonAcceptClicked = true; } @@ -457,16 +452,6 @@ public class AnswerFragment extends Fragment if (allowAnswerAndRelease()) { answerAndReleaseButton.setVisibility(View.VISIBLE); answerScreenDelegate.onAnswerAndReleaseButtonEnabled(); - } else if (allowSpeakEasy()) { - Optional<Integer> alternativeIcon = SpeakEasyComponent.get(getContext()).speakEasyIcon(); - if (alternativeIcon.isPresent()) { - // TODO(erfanian): Replace enum hack when we have a dedicated button. - SecondaryBehavior.SPEAKEASY.icon = alternativeIcon.get(); - } - answerAndReleaseBehavior = SecondaryBehavior.SPEAKEASY; - answerAndReleaseBehavior.applyToView(answerAndReleaseButton); - answerAndReleaseButton.setVisibility(View.VISIBLE); - answerScreenDelegate.onAnswerAndReleaseButtonEnabled(); } else { answerAndReleaseButton.setVisibility(View.INVISIBLE); answerScreenDelegate.onAnswerAndReleaseButtonDisabled(); @@ -480,6 +465,27 @@ public class AnswerFragment extends Fragment }); } + /** Initialize chip buttons */ + private void initChips() { + if (!allowSpeakEasy()) { + chipLayout.setVisibility(View.GONE); + return; + } + chipLayout.setVisibility(View.VISIBLE); + chipLayout.setOnClickListener(this::performSpeakEasy); + + @SpeakEasyIcon + Optional<Integer> alternativeIcon = SpeakEasyComponent.get(getContext()).speakEasyIcon(); + @SpeakEasyText + Optional<Integer> alternativeText = SpeakEasyComponent.get(getContext()).speakEasyText(); + if (alternativeIcon.isPresent() && alternativeText.isPresent()) { + chipIcon.setImageDrawable(getContext().getDrawable(alternativeIcon.get())); + chipText.setText(alternativeText.get()); + // The button needs to override normal swipe up/down behavior. + chipLayout.bringToFront(); + } + } + @Override public boolean allowAnswerAndRelease() { return getArguments().getBoolean(ARG_ALLOW_ANSWER_AND_RELEASE); @@ -715,6 +721,9 @@ public class AnswerFragment extends Fragment View view = inflater.inflate(R.layout.fragment_incoming_call, container, false); secondaryButton = (SwipeButtonView) view.findViewById(R.id.incoming_secondary_button); answerAndReleaseButton = (SwipeButtonView) view.findViewById(R.id.incoming_secondary_button2); + chipLayout = view.findViewById(R.id.incall_data_container_chip_container); + chipIcon = view.findViewById(R.id.incall_data_container_chip_icon); + chipText = view.findViewById(R.id.incall_data_container_chip_text); affordanceHolderLayout = (AffordanceHolderLayout) view.findViewById(R.id.incoming_container); affordanceHolderLayout.setAffordanceCallback(affordanceCallback); @@ -755,6 +764,7 @@ public class AnswerFragment extends Fragment .newAnswerScreenDelegate(this); initSecondaryButton(); + initChips(); int flags = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; if (!isInMultiWindowMode diff --git a/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml b/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml index 600115e27..2b3391dde 100644 --- a/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml +++ b/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml @@ -99,7 +99,7 @@ android:focusable="false" android:outlineProvider="none" android:src="@drawable/quantum_ic_call_white_24" - android:tint="@color/incoming_answer_icon" + android:tint="@color/dialer_call_green" android:tintMode="src_atop" tools:outlineProvider="background"/> diff --git a/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml b/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml new file mode 100644 index 000000000..3740f3d1b --- /dev/null +++ b/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="#DADCE0"> + <item android:id="@android:id/mask"> + <shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="@color/dialer_background_light"/> + <padding + android:bottom="9dp" + android:left="8dp" + android:right="8dp" + android:top="9dp"/> + <corners android:radius="40dp"/> + </shape> + </item> + <item> + <shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="@color/dialer_background_floating_light"/> + <stroke + android:width="1dp" + android:color="#DADCE0"/> + <padding + android:bottom="9dp" + android:left="8dp" + android:right="8dp" + android:top="9dp"/> + <corners android:radius="40dp"/> + </shape> + </item> +</ripple>
\ No newline at end of file diff --git a/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml b/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml index 589a74325..944d290b1 100644 --- a/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml +++ b/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml @@ -53,6 +53,13 @@ android:layout_height="match_parent" android:fitsSystemWindows="true"> + <FrameLayout + android:id="@+id/answer_method_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipChildren="false" + android:clipToPadding="false"/> + <TextView android:id="@+id/videocall_video_off" android:layout_width="wrap_content" @@ -74,8 +81,8 @@ android:layout_marginTop="24dp" android:clipChildren="false" android:clipToPadding="false" - android:gravity="top|center_horizontal" android:focusable="true" + android:gravity="top|center_horizontal" android:orientation="vertical"> <include @@ -111,21 +118,22 @@ android:layout_marginStart="24dp" android:layout_marginEnd="24dp"/> + <!-- TODO(a bug): textColorPrimary or textColorPrimaryInverse? --> <TextView android:id="@+id/incall_important_call_badge" + android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="48dp" android:layout_marginTop="4dp" android:layout_marginBottom="@dimen/answer_importance_margin_bottom" - android:gravity="center" + android:background="@drawable/urgent_call_background" android:elevation="@dimen/answer_data_elevation" + android:gravity="center" android:maxLines="1" android:text="@string/call_incoming_important" android:textAllCaps="true" - android:textSize="14sp" - android:textStyle="bold" android:textColor="?android:attr/colorBackground" - android:background="@drawable/urgent_call_background"/> + android:textSize="14sp"/> <FrameLayout android:id="@+id/incall_location_holder" @@ -143,7 +151,34 @@ android:layout_height="0dp" android:layout_weight="1" android:clipChildren="false" - android:clipToPadding="false"/> + android:clipToPadding="false"> + <LinearLayout + android:id="@+id/incall_data_container_chip_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal|bottom" + android:background="@drawable/shape_chip_drawable" + android:clickable="true" + android:orientation="horizontal" + android:visibility="gone"> + <ImageView + android:id="@+id/incall_data_container_chip_icon" + android:layout_width="20dp" + android:layout_height="20dp" + android:src="@drawable/quantum_ic_rtt_vd_theme_24" + android:tint="#1A73E8"/> + <TextView + android:id="@+id/incall_data_container_chip_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:fontFamily="sans-serif-medium" + android:text="@string/speakeasy_secondary_button_hint" + android:textColor="@color/dialer_primary_text_color" + android:textSize="14sp"/> + </LinearLayout> + </FrameLayout> <!-- Space holder for answer method. This is used to get better scaling to make room for incall_data_container on different screen size. --> @@ -152,14 +187,6 @@ android:layout_height="220dp"/> </LinearLayout> - - <FrameLayout - android:id="@+id/answer_method_container" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:clipChildren="false" - android:clipToPadding="false"/> - </FrameLayout> <com.android.incallui.answer.impl.affordance.SwipeButtonView diff --git a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java index a561b5ee5..846834f63 100644 --- a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java +++ b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java @@ -39,6 +39,7 @@ import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.theme.base.ThemeComponent; import com.android.incallui.call.CallList; import com.android.incallui.call.DialerCall; import com.android.incallui.call.TelecomAdapter; @@ -154,7 +155,7 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment final int itemRoute, CallAudioState audioState, DialerImpression.Type impressionType) { - int selectedColor = getResources().getColor(R.color.dialer_theme_color); + int selectedColor = ThemeComponent.get(getContext()).theme().getColorPrimary(); if ((audioState.getSupportedRouteMask() & itemRoute) == 0) { item.setVisibility(View.GONE); } else if (audioState.getRoute() == itemRoute) { @@ -174,7 +175,7 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment } private TextView createBluetoothItem(BluetoothDevice bluetoothDevice, boolean selected) { - int selectedColor = getResources().getColor(R.color.dialer_theme_color); + int selectedColor = ThemeComponent.get(getContext()).theme().getColorPrimary(); TextView textView = (TextView) getLayoutInflater().inflate(R.layout.audioroute_item, null, false); textView.setText(getAliasName(bluetoothDevice)); diff --git a/java/com/android/incallui/audioroute/res/layout/audioroute_item.xml b/java/com/android/incallui/audioroute/res/layout/audioroute_item.xml index dfd795f04..3f3deb951 100644 --- a/java/com/android/incallui/audioroute/res/layout/audioroute_item.xml +++ b/java/com/android/incallui/audioroute/res/layout/audioroute_item.xml @@ -18,6 +18,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableStart="@drawable/quantum_ic_bluetooth_audio_vd_theme_24" - android:drawableTint="@color/material_grey_600" + android:drawableTint="?colorIcon" android:gravity="start" android:textAlignment="viewStart"/>
\ No newline at end of file diff --git a/java/com/android/incallui/bindings/PhoneNumberService.java b/java/com/android/incallui/bindings/PhoneNumberService.java index c40891a2c..2e1ae1f6c 100644 --- a/java/com/android/incallui/bindings/PhoneNumberService.java +++ b/java/com/android/incallui/bindings/PhoneNumberService.java @@ -16,7 +16,6 @@ package com.android.incallui.bindings; -import android.graphics.Bitmap; import com.android.dialer.logging.ContactLookupResult; /** Provides phone number lookup services. */ @@ -27,13 +26,8 @@ public interface PhoneNumberService { * * @param phoneNumber The phone number to lookup. * @param listener The listener to notify when the phone number lookup is complete. - * @param imageListener The listener to notify when the image lookup is complete. */ - void getPhoneNumberInfo( - String phoneNumber, - NumberLookupListener listener, - ImageLookupListener imageListener, - boolean isIncoming); + void getPhoneNumberInfo(String phoneNumber, NumberLookupListener listener); interface NumberLookupListener { @@ -45,16 +39,6 @@ public interface PhoneNumberService { void onPhoneNumberInfoComplete(PhoneNumberInfo info); } - interface ImageLookupListener { - - /** - * Callback when a image has been fetched. - * - * @param bitmap The fetched image. - */ - void onImageFetchComplete(Bitmap bitmap); - } - interface PhoneNumberInfo { String getDisplayName(); diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index da7c54d27..b2c8dcc67 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -80,7 +80,7 @@ import com.android.dialer.rtt.RttTranscriptUtil; import com.android.dialer.spam.status.SpamStatus; import com.android.dialer.telecom.TelecomCallUtil; import com.android.dialer.telecom.TelecomUtil; -import com.android.dialer.theme.R; +import com.android.dialer.theme.common.R; import com.android.dialer.time.Clock; import com.android.dialer.util.PermissionsUtil; import com.android.incallui.audiomode.AudioModeProvider; diff --git a/java/com/android/incallui/calllocation/impl/AndroidManifest.xml b/java/com/android/incallui/calllocation/impl/AndroidManifest.xml index fda940483..3e5a6d04e 100644 --- a/java/com/android/incallui/calllocation/impl/AndroidManifest.xml +++ b/java/com/android/incallui/calllocation/impl/AndroidManifest.xml @@ -19,6 +19,8 @@ package="com.android.incallui.calllocation.impl"> <application> + <!-- Fix for P --> + <uses-library android:name="org.apache.http.legacy" android:required="false" /> <meta-data android:name="com.google.android.gms.version" diff --git a/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java b/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java deleted file mode 100644 index c7249e0fa..000000000 --- a/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.incallui.calllocation.impl; - -import android.graphics.drawable.Drawable; -import android.location.Location; -import android.net.TrafficStats; -import android.os.AsyncTask; -import com.android.dialer.common.LogUtil; -import com.android.dialer.constants.TrafficStatsTags; -import com.android.incallui.calllocation.impl.LocationPresenter.LocationUi; -import java.io.InputStream; -import java.lang.ref.WeakReference; -import java.net.URL; - -class DownloadMapImageTask extends AsyncTask<Location, Void, Drawable> { - - private static final String STATIC_MAP_SRC_NAME = "src"; - - private final WeakReference<LocationUi> uiReference; - - public DownloadMapImageTask(WeakReference<LocationUi> uiReference) { - this.uiReference = uiReference; - } - - @Override - protected Drawable doInBackground(Location... locations) { - LocationUi ui = uiReference.get(); - if (ui == null) { - return null; - } - if (locations == null || locations.length == 0) { - LogUtil.e("DownloadMapImageTask.doInBackground", "No location provided"); - return null; - } - - try { - URL mapUrl = new URL(LocationUrlBuilder.getStaticMapUrl(ui.getContext(), locations[0])); - TrafficStats.setThreadStatsTag(TrafficStatsTags.DOWNLOAD_LOCATION_MAP_TAG); - InputStream content = (InputStream) mapUrl.getContent(); - - return Drawable.createFromStream(content, STATIC_MAP_SRC_NAME); - } catch (Exception ex) { - LogUtil.e("DownloadMapImageTask.doInBackground", "Exception!!!", ex); - return null; - } finally { - TrafficStats.clearThreadStatsTag(); - } - } - - @Override - protected void onPostExecute(Drawable mapImage) { - LocationUi ui = uiReference.get(); - if (ui == null) { - return; - } - - try { - ui.setMap(mapImage); - } catch (Exception ex) { - LogUtil.e("DownloadMapImageTask.onPostExecute", "Exception!!!", ex); - } - } -} diff --git a/java/com/android/incallui/calllocation/impl/LocationFragment.java b/java/com/android/incallui/calllocation/impl/LocationFragment.java index 6b2c876b0..760829da2 100644 --- a/java/com/android/incallui/calllocation/impl/LocationFragment.java +++ b/java/com/android/incallui/calllocation/impl/LocationFragment.java @@ -18,21 +18,26 @@ package com.android.incallui.calllocation.impl; import android.animation.LayoutTransition; import android.content.Context; -import android.graphics.drawable.Drawable; import android.location.Location; import android.os.Bundle; import android.os.Handler; +import android.support.annotation.NonNull; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.TextView; import android.widget.ViewAnimator; +import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.incallui.baseui.BaseFragment; +import com.google.android.gms.maps.CameraUpdateFactory; +import com.google.android.gms.maps.GoogleMap; +import com.google.android.gms.maps.MapView; +import com.google.android.gms.maps.model.LatLng; +import com.google.android.gms.maps.model.MarkerOptions; import java.util.Objects; import java.util.concurrent.TimeUnit; @@ -54,13 +59,16 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr private static final long FIND_LOCATION_SPINNING_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); private static final long LOAD_DATA_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); + private static final float MAP_ZOOM_LEVEL = 15f; + private ViewAnimator viewAnimator; - private ImageView locationMap; + private MapView locationMapView; private TextView addressLine1; private TextView addressLine2; private TextView latLongLine; private Location location; private ViewGroup locationLayout; + private GoogleMap savedGoogleMap; private boolean isMapSet; private boolean isAddressSet; @@ -101,11 +109,12 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr LogUtil.enterBlock("LocationFragment.onCreateView"); final View view = inflater.inflate(R.layout.location_fragment, container, false); viewAnimator = (ViewAnimator) view.findViewById(R.id.location_view_animator); - locationMap = (ImageView) view.findViewById(R.id.location_map); addressLine1 = (TextView) view.findViewById(R.id.address_line_one); addressLine2 = (TextView) view.findViewById(R.id.address_line_two); latLongLine = (TextView) view.findViewById(R.id.lat_long_line); locationLayout = (ViewGroup) view.findViewById(R.id.location_layout); + locationMapView = (MapView) view.findViewById(R.id.location_map_view); + locationMapView.onCreate(savedInstanceState); return view; } @@ -122,16 +131,46 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr handler.removeCallbacks(spinningTimeoutRunnable); } - @Override - public void setMap(Drawable mapImage) { + private void setMap(@NonNull Location location) { LogUtil.enterBlock("LocationFragment.setMap"); - isMapSet = true; - locationMap.setVisibility(View.VISIBLE); - locationMap.setImageDrawable(mapImage); + Assert.isNotNull(location); + + if (savedGoogleMap == null) { + locationMapView.getMapAsync( + (googleMap) -> { + LogUtil.enterBlock("LocationFragment.onMapReady"); + savedGoogleMap = googleMap; + savedGoogleMap.getUiSettings().setMapToolbarEnabled(false); + updateMap(location); + isMapSet = true; + locationMapView.setVisibility(View.VISIBLE); + + // Hide Google logo + View child = locationMapView.getChildAt(0); + if (child instanceof ViewGroup) { + // Only the first child (View) is useful. + // Google logo can be in any other child (ViewGroup). + for (int i = 1; i < ((ViewGroup) child).getChildCount(); ++i) { + ((ViewGroup) child).getChildAt(i).setVisibility(View.GONE); + } + } + }); + } else { + updateMap(location); + } displayWhenReady(); Logger.get(getContext()).logImpression(DialerImpression.Type.EMERGENCY_GOT_MAP); } + private void updateMap(@NonNull Location location) { + Assert.isNotNull(location); + Assert.isNotNull(savedGoogleMap); + LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); + savedGoogleMap.clear(); + savedGoogleMap.addMarker(new MarkerOptions().position(latLng).flat(true).draggable(false)); + savedGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, MAP_ZOOM_LEVEL)); + } + @Override public void setAddress(String address) { LogUtil.i("LocationFragment.setAddress", address); @@ -175,6 +214,7 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr R.string.lat_long_format, location.getLatitude(), location.getLongitude())); Logger.get(getContext()).logImpression(DialerImpression.Type.EMERGENCY_GOT_LOCATION); + setMap(location); } displayWhenReady(); } @@ -218,4 +258,16 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr view.setText(text); } } + + @Override + public void onResume() { + super.onResume(); + locationMapView.onResume(); + } + + @Override + public void onPause() { + locationMapView.onPause(); + super.onPause(); + } } diff --git a/java/com/android/incallui/calllocation/impl/LocationPresenter.java b/java/com/android/incallui/calllocation/impl/LocationPresenter.java index 83195baf8..94bd2357a 100644 --- a/java/com/android/incallui/calllocation/impl/LocationPresenter.java +++ b/java/com/android/incallui/calllocation/impl/LocationPresenter.java @@ -17,7 +17,6 @@ package com.android.incallui.calllocation.impl; import android.content.Context; -import android.graphics.drawable.Drawable; import android.location.Location; import android.os.AsyncTask; import com.android.dialer.common.LogUtil; @@ -38,7 +37,6 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi> implements LocationListener { private Location lastLocation; - private AsyncTask downloadMapTask; private AsyncTask reverseGeocodeTask; LocationPresenter() {} @@ -55,9 +53,6 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi> LogUtil.i("LocationPresenter.onUiUnready", ""); super.onUiUnready(ui); - if (downloadMapTask != null) { - downloadMapTask.cancel(true); - } if (reverseGeocodeTask != null) { reverseGeocodeTask.cancel(true); } @@ -76,7 +71,6 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi> int status = LocationHelper.checkLocation(location); LocationUi ui = getUi(); if (status == LocationHelper.LOCATION_STATUS_OK) { - downloadMapTask = new DownloadMapImageTask(new WeakReference<>(ui)).execute(location); reverseGeocodeTask = new ReverseGeocodeTask(new WeakReference<>(ui)).execute(location); if (ui != null) { ui.setLocation(location); @@ -103,8 +97,6 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi> void setAddress(String address); - void setMap(Drawable mapImage); - void setLocation(Location location); Context getContext(); diff --git a/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml b/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml deleted file mode 100644 index 5d1e2baf7..000000000 --- a/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml +++ /dev/null @@ -1,163 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- -~ Copyright (C) 2015 The Android Open Source Project -~ -~ Licensed under the Apache License, Version 2.0 (the "License"); -~ you may not use this file except in compliance with the License. -~ You may obtain a copy of the License at -~ -~ http://www.apache.org/licenses/LICENSE-2.0 -~ -~ Unless required by applicable law or agreed to in writing, software -~ distributed under the License is distributed on an "AS IS" BASIS, -~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -~ See the License for the specific language governing permissions and -~ limitations under the License ---> - -<ViewAnimator xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/location_view_animator" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="16dp" - android:background="@drawable/bg_location_card" - android:elevation="2dp" - android:inAnimation="@android:anim/fade_in" - android:measureAllChildren="true" - android:outAnimation="@android:anim/fade_out"> - - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/location_loading_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:orientation="vertical"> - - <ProgressBar - android:id="@+id/location_loading_spinner" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="28dp" - android:layout_marginBottom="12dp" - android:layout_gravity="center_horizontal"/> - - <TextView - android:id="@+id/location_loading_text" - style="@style/LocationLoadingTextStyle" - android:layout_width="match_parent" - android:layout_height="24sp" - android:layout_marginBottom="20dp" - android:layout_marginStart="24dp" - android:layout_marginEnd="24dp" - android:gravity="center" - android:text="@string/location_loading"/> - - </LinearLayout> - - <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/location_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:columnCount="2" - android:orientation="horizontal"> - - <TextView - android:id="@+id/location_address_title" - style="@style/LocationAddressTitleTextStyle" - android:layout_width="0dp" - android:layout_height="20sp" - android:layout_marginTop="16dp" - android:layout_marginBottom="4dp" - android:layout_marginStart="16dp" - android:layout_columnWeight="1" - android:text="@string/location_title"/> - - <ImageView - android:id="@+id/location_map" - android:layout_width="@dimen/location_map_width" - android:layout_height="@dimen/location_map_height" - android:layout_margin="16dp" - android:layout_gravity="end|center_vertical" - android:layout_rowSpan="4" - android:contentDescription="@string/location_map_description" - android:scaleType="centerCrop" - android:visibility="invisible" - tools:src="?android:attr/colorPrimaryDark" - tools:visibility="visible"/> - - <TextView - android:id="@+id/address_line_one" - style="@style/LocationAddressTextStyle" - android:layout_width="0dp" - android:layout_height="24sp" - android:layout_marginStart="16dp" - android:layout_columnWeight="1" - android:ellipsize="end" - android:lines="1" - android:visibility="invisible" - tools:text="1600 Amphitheatre Pkwy And a bit" - tools:visibility="visible"/> - - <TextView - android:id="@+id/address_line_two" - style="@style/LocationAddressTextStyle" - android:layout_width="0dp" - android:layout_height="24sp" - android:layout_marginStart="16dp" - android:layout_columnWeight="1" - android:ellipsize="end" - android:lines="1" - android:visibility="invisible" - tools:text="Mountain View, CA 94043" - tools:visibility="visible"/> - - <TextView - android:id="@+id/lat_long_line" - style="@style/LocationLatLongTextStyle" - android:layout_width="0dp" - android:layout_height="24sp" - android:layout_marginBottom="12dp" - android:layout_marginStart="16dp" - android:layout_columnWeight="1" - android:ellipsize="end" - android:lines="1" - android:visibility="invisible" - tools:text="Lat: 37.421719, Long: -122.085297" - tools:visibility="visible"/> - - </GridLayout> - - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/location_error_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:orientation="vertical"> - - <ImageView - android:id="@+id/location_error_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="32dp" - android:layout_marginBottom="12dp" - android:layout_gravity="center_horizontal" - android:src="@drawable/quantum_ic_error_outline_vd_theme_36" - android:tint="#C53929"/> - - <TextView - android:id="@+id/location_error_text" - style="@style/LocationErrorTextStyle" - android:layout_width="match_parent" - android:layout_height="24sp" - android:layout_marginBottom="20dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:gravity="center" - android:text="@string/location_error"/> - - </LinearLayout> - -</ViewAnimator> diff --git a/java/com/android/incallui/callpending/CallPendingActivity.java b/java/com/android/incallui/callpending/CallPendingActivity.java index 3c69f97b5..a686308c2 100644 --- a/java/com/android/incallui/callpending/CallPendingActivity.java +++ b/java/com/android/incallui/callpending/CallPendingActivity.java @@ -166,9 +166,9 @@ public class CallPendingActivity extends FragmentActivity } Drawable photo = null; + Uri photoUri = getPhotoUri(); try { // TODO(calderwoodra) move to background thread - Uri photoUri = getPhotoUri(); InputStream is = getContentResolver().openInputStream(photoUri); photo = Drawable.createFromStream(is, photoUri.toString()); } catch (FileNotFoundException e) { @@ -185,6 +185,7 @@ public class CallPendingActivity extends FragmentActivity .setNameIsNumber(name != null && name.equals(number)) .setLabel(getPhoneLabel()) .setPhoto(photo) + .setPhotoUri(photoUri) .setPhotoType(ContactPhotoType.CONTACT) .setIsSipCall(false) .setIsContactPhotoShown(true) diff --git a/java/com/android/incallui/commontheme/res/values/colors.xml b/java/com/android/incallui/commontheme/res/values/colors.xml index 27c1b6c20..50b06179f 100644 --- a/java/com/android/incallui/commontheme/res/values/colors.xml +++ b/java/com/android/incallui/commontheme/res/values/colors.xml @@ -21,6 +21,4 @@ <!-- Background color for spam. This color must match one of background_colors_dark in call UI. --> <color name="incall_call_spam_background_color">@color/blocked_contact_background</color> - - <color name="divider_line_color">#D8D8D8</color> </resources> diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index 85ae0bbb6..7f20b407f 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -148,6 +148,7 @@ public class InCallFragment extends Fragment @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) { LogUtil.i("InCallFragment.onCreateView", null); + getActivity().setTheme(R.style.Theme_InCallScreen); // Bypass to avoid StrictModeResourceMismatchViolation final View view = StrictModeUtils.bypass( diff --git a/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml b/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml index 8e9120b09..68b34c89d 100644 --- a/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml +++ b/java/com/android/incallui/incall/impl/res/color/incall_button_icon.xml @@ -16,6 +16,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="#FF1C3AA9" android:state_checked="true"/> - <item android:color="#FFFFFFFF"/> + <item android:color="?android:attr/colorPrimaryDark" android:state_checked="true"/> + <item android:color="?android:attr/colorBackgroundFloating"/> </selector> diff --git a/java/com/android/incallui/maps/impl/AndroidManifest.xml b/java/com/android/incallui/maps/impl/AndroidManifest.xml index bc921e906..4c17f33a4 100644 --- a/java/com/android/incallui/maps/impl/AndroidManifest.xml +++ b/java/com/android/incallui/maps/impl/AndroidManifest.xml @@ -19,6 +19,8 @@ package="com.android.incallui.maps.impl"> <application> + <!-- Fix for P --> + <uses-library android:name="org.apache.http.legacy" android:required="false" /> <meta-data android:name="com.google.android.gms.version" diff --git a/java/com/android/incallui/res/layout/frag_rtt_request_dialog.xml b/java/com/android/incallui/res/layout/frag_rtt_request_dialog.xml index 2e40cabd3..f0bd1531e 100644 --- a/java/com/android/incallui/res/layout/frag_rtt_request_dialog.xml +++ b/java/com/android/incallui/res/layout/frag_rtt_request_dialog.xml @@ -57,7 +57,7 @@ android:layout_gravity="end" android:paddingStart="16dp" android:paddingEnd="16dp" - android:backgroundTint="@android:color/white" + android:backgroundTint="?android:attr/colorBackgroundFloating" android:fontFamily="sans-serif-medium" android:stateListAnimator="@null" android:text="@string/rtt_button_decline_request" diff --git a/java/com/android/incallui/rtt/impl/res/color/submit_button_background_color.xml b/java/com/android/incallui/rtt/impl/res/color/submit_button_background_color.xml deleted file mode 100644 index 0da2c374a..000000000 --- a/java/com/android/incallui/rtt/impl/res/color/submit_button_background_color.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false" - android:color="#BDBDBD" /> - <item android:color="#FFFFFF" /> -</selector>
\ No newline at end of file diff --git a/java/com/android/incallui/rtt/impl/res/drawable/message_bubble.xml b/java/com/android/incallui/rtt/impl/res/drawable/incallui_message_bubble.xml index 2b01f62f9..31044b64e 100644 --- a/java/com/android/incallui/rtt/impl/res/drawable/message_bubble.xml +++ b/java/com/android/incallui/rtt/impl/res/drawable/incallui_message_bubble.xml @@ -16,6 +16,6 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="@android:color/white"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> <corners android:radius="20dp"/> </shape>
\ No newline at end of file diff --git a/java/com/android/incallui/rtt/impl/res/layout/audio_route.xml b/java/com/android/incallui/rtt/impl/res/layout/audio_route.xml index f098316a1..6f22febdf 100644 --- a/java/com/android/incallui/rtt/impl/res/layout/audio_route.xml +++ b/java/com/android/incallui/rtt/impl/res/layout/audio_route.xml @@ -29,7 +29,7 @@ <View android:layout_width="match_parent" android:layout_height="1dp" - android:background="@color/divider_line_color"/> + android:background="@color/dialer_divider_line_color"/> <com.android.incallui.rtt.impl.RttCheckableButton android:id="@+id/audioroute_bluetooth" style="@style/RttButton" diff --git a/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml b/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml index cff2b3f38..21d00a3e3 100644 --- a/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml +++ b/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml @@ -62,11 +62,11 @@ android:layout_height="53dp" android:layout_gravity="bottom" android:background="@drawable/input_bubble_background" - android:backgroundTint="@color/submit_button_background_color" + android:backgroundTint="?colorIcon" android:backgroundTintMode="multiply" android:contentDescription="@string/content_description_rtt_check_button" android:src="@drawable/quantum_ic_done_vd_theme_24" - android:tint="@color/submit_button_color" + android:tint="?android:attr/colorPrimary" android:visibility="gone"/> </LinearLayout> diff --git a/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml b/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml index 8a5bba28d..065aa8c34 100644 --- a/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml +++ b/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml @@ -22,7 +22,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/rtt_banner_height" - android:background="#F305228F" + android:background="?android:attr/colorPrimaryDark" android:elevation="3dp" android:orientation="horizontal"> <ImageButton @@ -36,7 +36,7 @@ android:contentDescription="@string/incall_content_description_end_call" android:scaleType="fitXY" android:src="@drawable/quantum_ic_call_end_vd_theme_24" - android:tint="#FFDF0000"/> + android:tint="@color/dialer_end_call_button_color"/> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" @@ -75,7 +75,7 @@ android:contentDescription="@string/content_description_overflow" android:scaleType="fitXY" android:src="@drawable/quantum_ic_more_vert_vd_theme_24" - android:tint="#FFFFFF"/> + android:tint="?colorIconOnUnthemedDarkBackground"/> </LinearLayout> <FrameLayout diff --git a/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml b/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml index b7b358075..5da3cc46a 100644 --- a/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml +++ b/java/com/android/incallui/sessiondata/res/layout/fragment_composer_text.xml @@ -39,7 +39,7 @@ android:paddingEnd="32dp" android:minHeight="108dp" android:lineSpacingMultiplier="1.2" - android:textColor="?android:attr/colorBackground" + android:textColor="?android:attr/textColorPrimaryInverse" android:textAppearance="@style/Dialer.Incall.TextAppearance.Message" android:background="@drawable/answer_text_only_background" app:autoSizeTextType="uniform" diff --git a/java/com/android/incallui/sessiondata/res/layout/fragment_spam.xml b/java/com/android/incallui/sessiondata/res/layout/fragment_spam.xml index ccf69a50c..65535b1e6 100644 --- a/java/com/android/incallui/sessiondata/res/layout/fragment_spam.xml +++ b/java/com/android/incallui/sessiondata/res/layout/fragment_spam.xml @@ -38,14 +38,13 @@ android:layout_height="wrap_content" android:layout_marginBottom="18dp" android:src="@drawable/quantum_ic_image_white_24" - android:tint="#546e7a"/> + android:tint="?colorIcon"/> <TextView android:id="@+id/spam_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/spam_photo_text" - android:textColor="#546e7a" - android:textSize="12sp"/> + style="@style/Dialer.TextAppearance.Secondary2"/> </LinearLayout> </FrameLayout>
\ No newline at end of file diff --git a/java/com/android/incallui/spam/SpamCallListListener.java b/java/com/android/incallui/spam/SpamCallListListener.java index d03055568..3b2f1c519 100644 --- a/java/com/android/incallui/spam/SpamCallListListener.java +++ b/java/com/android/incallui/spam/SpamCallListListener.java @@ -49,6 +49,7 @@ import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.spam.SpamComponent; import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.PermissionsUtil; import com.android.incallui.call.CallList; import com.android.incallui.call.DialerCall; @@ -256,7 +257,7 @@ public class SpamCallListListener implements CallList.Listener { createActivityPendingIntent(call, SpamNotificationActivity.ACTION_SHOW_DIALOG)) .setCategory(Notification.CATEGORY_STATUS) .setPriority(Notification.PRIORITY_DEFAULT) - .setColor(context.getColor(R.color.dialer_theme_color)) + .setColor(ThemeComponent.get(context).theme().getColorPrimary()) .setSmallIcon(R.drawable.quantum_ic_call_end_vd_theme_24) .setGroup(GROUP_KEY); if (BuildCompat.isAtLeastO()) { diff --git a/java/com/android/incallui/speakeasy/Annotations.java b/java/com/android/incallui/speakeasy/Annotations.java new file mode 100644 index 000000000..f369ce441 --- /dev/null +++ b/java/com/android/incallui/speakeasy/Annotations.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.incallui.speakeasy; + +import javax.inject.Qualifier; + +/** Annotations for Speakeasy providers. */ +public final class Annotations { + + /** A Speakeasy icon */ + @Qualifier + public @interface SpeakEasyIcon {} + + /** Speakeasy text */ + @Qualifier + public @interface SpeakEasyText {} + + /** A Speakeasy settings fragment */ + @Qualifier + public @interface SpeakEasySettingsFragment {} +} diff --git a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java index 6dae44128..6257cc0f9 100644 --- a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java +++ b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java @@ -19,6 +19,9 @@ package com.android.incallui.speakeasy; import android.content.Context; import android.support.v4.app.Fragment; import com.android.dialer.inject.HasRootComponent; +import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon; +import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsFragment; +import com.android.incallui.speakeasy.Annotations.SpeakEasyText; import com.google.common.base.Optional; import dagger.Subcomponent; @@ -28,9 +31,11 @@ public abstract class SpeakEasyComponent { public abstract SpeakEasyCallManager speakEasyCallManager(); - public abstract Optional<Fragment> speakEasySettingsFragment(); + public abstract @SpeakEasySettingsFragment Optional<Fragment> speakEasySettingsFragment(); - public abstract Optional<Integer> speakEasyIcon(); + public abstract @SpeakEasyIcon Optional<Integer> speakEasyIcon(); + + public abstract @SpeakEasyText Optional<Integer> speakEasyText(); public static SpeakEasyComponent get(Context context) { return ((SpeakEasyComponent.HasComponent) diff --git a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java index 67b564cb0..9f23ddd37 100644 --- a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java +++ b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java @@ -19,6 +19,9 @@ package com.android.incallui.speakeasy; import android.support.v4.app.Fragment; import com.android.dialer.inject.DialerVariant; import com.android.dialer.inject.InstallIn; +import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon; +import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsFragment; +import com.android.incallui.speakeasy.Annotations.SpeakEasyText; import com.google.common.base.Optional; import dagger.Binds; import dagger.Module; @@ -33,12 +36,17 @@ public abstract class StubSpeakEasyModule { abstract SpeakEasyCallManager bindsSpeakEasy(SpeakEasyCallManagerStub stub); @Provides - static Optional<Fragment> provideSpeakEasySettingsFragment() { + static @SpeakEasySettingsFragment Optional<Fragment> provideSpeakEasySettingsFragment() { return Optional.absent(); } @Provides - static Optional<Integer> provideSpeakEasyIcon() { + static @SpeakEasyIcon Optional<Integer> provideSpeakEasyIcon() { + return Optional.absent(); + } + + @Provides + static @SpeakEasyText Optional<Integer> provideSpeakEasyText() { return Optional.absent(); } } diff --git a/java/com/android/incallui/telecomeventui/res/layout/frag_international_call_on_wifi_dialog.xml b/java/com/android/incallui/telecomeventui/res/layout/frag_international_call_on_wifi_dialog.xml index 996bc75ba..5175b26ae 100644 --- a/java/com/android/incallui/telecomeventui/res/layout/frag_international_call_on_wifi_dialog.xml +++ b/java/com/android/incallui/telecomeventui/res/layout/frag_international_call_on_wifi_dialog.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:text="@string/details" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="16sp"/> <CheckBox @@ -37,7 +37,7 @@ android:layout_height="wrap_content" android:buttonTint="?android:attr/colorPrimary" android:text="@string/always_warn" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="14sp"/> </LinearLayout> diff --git a/java/com/android/incallui/theme/res/values/styles.xml b/java/com/android/incallui/theme/res/values/styles.xml index 086d12e19..3475e3548 100644 --- a/java/com/android/incallui/theme/res/values/styles.xml +++ b/java/com/android/incallui/theme/res/values/styles.xml @@ -20,7 +20,7 @@ circular reveal animation for a new outgoing call to work correctly. We don't just use Theme.Black.NoTitleBar directly, since we want any popups or dialogs from the InCallActivity to have the correct Material style. --> - <style name="Theme.InCallScreen" parent="@style/Dialer.ThemeBase.NoActionBar.Dark"> + <style name="Theme.InCallScreen.Light" parent="@style/Dialer.ThemeBase.NoActionBar"> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> @@ -33,7 +33,20 @@ <item name="android:windowShowWallpaper">true</item> </style> - <style name="Theme.InCallScreen.ManageConference" parent="Dialer.ThemeBase"> + <style name="Theme.InCallScreen" parent="@style/Dialer.Dark.ThemeBase.NoActionBar"> + <item name="android:statusBarColor">@android:color/transparent</item> + <item name="android:navigationBarColor">@android:color/transparent</item> + <item name="android:windowDrawsSystemBarBackgrounds">true</item> + + <item name="dialpad_key_button_touch_tint">@color/incall_dialpad_touch_tint</item> + <item name="dialpad_style">@style/InCallDialpad</item> + <item name="android:windowAnimationStyle">@null</item> + + <item name="android:windowBackground">@drawable/incall_background_gradient</item> + <item name="android:windowShowWallpaper">true</item> + </style> + + <style name="Theme.InCallScreen.ManageConference" parent="Dialer.ThemeBase.ActionBar"> </style> <style name="InCallDialpad" parent="Dialpad.Light"> @@ -59,6 +72,7 @@ @dimen/incall_end_call_spacing </item> <item name="dialpad_elevation">10dp</item> + <item name="dialpad_text_color">?android:attr/textColorPrimaryInverse</item> <item name="dialpad_text_color_secondary">?android:attr/textColorSecondaryInverse</item> </style> diff --git a/java/com/android/incallui/video/impl/res/layout/frag_video_charges_alert_dialog.xml b/java/com/android/incallui/video/impl/res/layout/frag_video_charges_alert_dialog.xml index 56e1d794a..c02791551 100644 --- a/java/com/android/incallui/video/impl/res/layout/frag_video_charges_alert_dialog.xml +++ b/java/com/android/incallui/video/impl/res/layout/frag_video_charges_alert_dialog.xml @@ -34,7 +34,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:text="@string/videocall_charges_alert_dialog_description" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="16sp"/> <CheckBox @@ -45,7 +45,7 @@ android:focusable="true" android:clickable="true" android:text="@string/do_not_show_again" - android:textColor="@color/dialer_primary_text_color" + android:textColor="?android:attr/textColorPrimary" android:textSize="14sp"/> </LinearLayout> </ScrollView>
\ No newline at end of file diff --git a/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml b/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml index ed32ae235..6349a2863 100644 --- a/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml +++ b/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml @@ -45,7 +45,7 @@ android:accessibilityTraversalBefore="@+id/videocall_speaker_button" android:drawablePadding="8dp" android:drawableTop="@drawable/quantum_ic_videocam_off_white_36" - android:drawableTint="@color/videocall_camera_off_tint" + android:drawableTint="?colorIcon" android:padding="64dp" android:text="@string/videocall_remote_video_off" android:textAppearance="@style/Dialer.Incall.TextAppearance" @@ -100,7 +100,7 @@ android:layout_alignTop="@+id/videocall_video_preview" android:scaleType="center" android:src="@drawable/quantum_ic_videocam_off_vd_theme_24" - android:tint="@color/videocall_camera_off_tint" + android:tint="?colorIcon" android:tintMode="src_in" android:visibility="gone" android:importantForAccessibility="no" diff --git a/java/com/android/incallui/video/impl/res/layout/frag_videocall_surfaceview.xml b/java/com/android/incallui/video/impl/res/layout/frag_videocall_surfaceview.xml index dd1bd61c2..51918982b 100644 --- a/java/com/android/incallui/video/impl/res/layout/frag_videocall_surfaceview.xml +++ b/java/com/android/incallui/video/impl/res/layout/frag_videocall_surfaceview.xml @@ -36,7 +36,7 @@ android:accessibilityTraversalBefore="@+id/videocall_speaker_button" android:drawablePadding="8dp" android:drawableTop="@drawable/quantum_ic_videocam_off_white_36" - android:drawableTint="@color/videocall_camera_off_tint" + android:drawableTint="?colorIcon" android:padding="64dp" android:text="@string/videocall_remote_video_off" android:textAppearance="@style/Dialer.Incall.TextAppearance" @@ -66,7 +66,7 @@ android:layout_gravity="center" android:scaleType="center" android:src="@drawable/quantum_ic_videocam_off_vd_theme_24" - android:tint="@color/videocall_camera_off_tint" + android:tint="?colorIcon" android:tintMode="src_in" android:visibility="gone" android:importantForAccessibility="no" diff --git a/java/com/android/incallui/video/impl/res/values/colors.xml b/java/com/android/incallui/video/impl/res/values/colors.xml deleted file mode 100644 index 874bf9404..000000000 --- a/java/com/android/incallui/video/impl/res/values/colors.xml +++ /dev/null @@ -1,20 +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> - <color name="videocall_camera_off_tint">#89ffffff</color> -</resources> diff --git a/java/com/android/incallui/video/impl/res/values/styles.xml b/java/com/android/incallui/video/impl/res/values/styles.xml index 03395d989..61360b6a4 100644 --- a/java/com/android/incallui/video/impl/res/values/styles.xml +++ b/java/com/android/incallui/video/impl/res/values/styles.xml @@ -19,7 +19,7 @@ <item name="android:layout_height">@dimen/videocall_button_size</item> <item name="android:layout_width">@dimen/videocall_button_size</item> <item name="android:background">@drawable/videocall_video_button_background</item> - <item name="android:tint">@color/videocall_button_icon_tint</item> + <item name="android:tint">?android:attr/colorBackgroundFloating</item> <item name="android:tintMode">src_atop</item> <item name="android:padding">@dimen/videocall_button_padding</item> <item name="android:scaleType">fitCenter</item> diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index d35c5ef61..5b733d612 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -61,29 +61,34 @@ public class ImsVideoTech implements VideoTech { @Override public boolean isAvailable(Context context, PhoneAccountHandle phoneAccountHandle) { if (call.getVideoCall() == null) { + LogUtil.i("ImsVideoCall.isAvailable", "null video call"); return false; } // We are already in an IMS video call if (VideoProfile.isVideo(call.getDetails().getVideoState())) { + LogUtil.i("ImsVideoCall.isAvailable", "already video call"); return true; } // The user has disabled IMS video calling in system settings if (!CallUtil.isVideoEnabled(context)) { + LogUtil.i("ImsVideoCall.isAvailable", "disabled in settings"); return false; } // The current call doesn't support transmitting video if (!call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL_TX)) { + LogUtil.i("ImsVideoCall.isAvailable", "no TX"); return false; } // The current call remote device doesn't support receiving video if (!call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE_RX)) { + LogUtil.i("ImsVideoCall.isAvailable", "no RX"); return false; } - + LogUtil.i("ImsVideoCall.isAvailable", "available"); return true; } |