Merge changes I0f1ed20a,Ia68d3b13,I72047d59,Ieff3c7fb,I53c3896a, ...
* changes:
Added method to set Save and Redo buttons enabled/disabled Added logic to setState() method to change state of buttons
Update emergency call map and device number UI.
Fix SpeedDialUiItem.getDefaultVoiceChannel
Fix an AOSP build error caused by version codes
Update connection label.
Remove redundant version checks and annotations in the assisted dialing package.
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
index 756fd61..6715e2b 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
@@ -16,8 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import java.util.Optional;
@@ -25,14 +23,10 @@
public interface AssistedDialingMediator {
/** Returns {@code true} if the current client platform supports Assisted Dialing. */
- public boolean isPlatformEligible();
+ boolean isPlatformEligible();
/** Returns the country code in which the library thinks the user typically resides. */
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<String> userHomeCountryCode();
+ Optional<String> userHomeCountryCode();
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform);
+ Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform);
}
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
index 7214437..7fdb8da 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
@@ -16,10 +16,7 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
-import android.support.annotation.RequiresApi;
import com.android.dialer.common.LogUtil;
import java.util.Optional;
@@ -30,7 +27,6 @@
* call is eligible for assisted dialing, and performing the transformation of numbers eligible for
* assisted dialing.
*/
-@RequiresApi(VERSION_CODES.N)
final class AssistedDialingMediatorImpl implements AssistedDialingMediator {
private final LocationDetector locationDetector;
@@ -58,8 +54,6 @@
/** Returns the country code in which the library thinks the user typically resides. */
@Override
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
public Optional<String> userHomeCountryCode() {
return locationDetector.getUpperCaseUserHomeCountry();
}
@@ -69,8 +63,6 @@
* transformed number should be capable of dialing out of the User's current country and
* successfully connecting with a contact in the User's home country.
*/
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
@Override
public Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform) {
Optional<String> userHomeCountryCode = locationDetector.getUpperCaseUserHomeCountry();
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
index 9a40e05..cb3ca79 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
@@ -16,8 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import java.util.Optional;
@@ -26,16 +24,12 @@
/** Always returns an empty Optional. */
@Override
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
public Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform) {
return Optional.empty();
}
/** Always returns an empty Optional. */
@Override
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
public Optional<String> userHomeCountryCode() {
return Optional.empty();
}
diff --git a/java/com/android/dialer/assisteddialing/ConcreteCreator.java b/java/com/android/dialer/assisteddialing/ConcreteCreator.java
index 0507743..b4f926d 100644
--- a/java/com/android/dialer/assisteddialing/ConcreteCreator.java
+++ b/java/com/android/dialer/assisteddialing/ConcreteCreator.java
@@ -16,13 +16,10 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
-import android.os.Build.VERSION_CODES;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
-import android.support.annotation.VisibleForTesting;
import android.support.v4.os.UserManagerCompat;
import android.telephony.TelephonyManager;
import com.android.dialer.common.LogUtil;
@@ -36,13 +33,11 @@
* <p>This helps keep the dependencies required by AssistedDialingMediator for assisted dialing
* explicit.
*/
-@TargetApi(VERSION_CODES.N)
public final class ConcreteCreator {
- // Floor set at N due to use of Optional.
- @VisibleForTesting public static final int BUILD_CODE_FLOOR = Build.VERSION_CODES.N;
- // Ceiling set at P because this feature will ship as part of the framework in Q.
- @VisibleForTesting public static final int BUILD_CODE_CEILING = 28;
+ // Ceiling set at P (version code 28) because this feature will ship as part of the framework in
+ // Q.
+ public static final int BUILD_CODE_CEILING = 28;
/**
* Creates a new AssistedDialingMediator
@@ -105,8 +100,7 @@
throw new NullPointerException("Provided configProvider was null");
}
- return (Build.VERSION.SDK_INT >= BUILD_CODE_FLOOR
- && Build.VERSION.SDK_INT <= BUILD_CODE_CEILING)
+ return Build.VERSION.SDK_INT <= BUILD_CODE_CEILING
&& configProvider.getBoolean("assisted_dialing_enabled", false);
}
diff --git a/java/com/android/dialer/assisteddialing/Constraints.java b/java/com/android/dialer/assisteddialing/Constraints.java
index cae3734..41a3e92 100644
--- a/java/com/android/dialer/assisteddialing/Constraints.java
+++ b/java/com/android/dialer/assisteddialing/Constraints.java
@@ -16,9 +16,7 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
import android.content.Context;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
@@ -35,8 +33,6 @@
import java.util.Optional;
/** Ensures that a number is eligible for Assisted Dialing */
-@TargetApi(VERSION_CODES.N)
-@SuppressWarnings("AndroidApiChecker") // Use of optional
final class Constraints {
private final PhoneNumberUtil phoneNumberUtil;
private final Context context;
@@ -46,7 +42,7 @@
* Create a new instance of Constraints.
*
* @param context The context used to determine whether or not a number is an emergency number.
- * @param configProviderCountryCodes A csv of supported country codes, e.g. "US,CA"
+ * @param countryCodeProvider A csv of supported country codes, e.g. "US,CA"
*/
public Constraints(@NonNull Context context, @NonNull CountryCodeProvider countryCodeProvider) {
if (context == null) {
@@ -73,7 +69,7 @@
* @return A boolean indicating whether or not the provided values are eligible for assisted
* dialing.
*/
- public boolean meetsPreconditions(
+ boolean meetsPreconditions(
@NonNull String numberToCheck,
@NonNull String userHomeCountryCode,
@NonNull String userRoamingCountryCode) {
diff --git a/java/com/android/dialer/assisteddialing/CountryCodeProvider.java b/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
index 118696e..04b2291 100644
--- a/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
+++ b/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
@@ -16,8 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.ArraySet;
@@ -32,8 +30,6 @@
import java.util.stream.Collectors;
/** A class to provide the appropriate country codes related to assisted dialing. */
-@TargetApi(VERSION_CODES.N)
-@SuppressWarnings("AndroidApiChecker") // Java 8 APIs
public final class CountryCodeProvider {
// TODO(erfanian): Ensure the below standard is consistent between libphonenumber and the
diff --git a/java/com/android/dialer/assisteddialing/LocationDetector.java b/java/com/android/dialer/assisteddialing/LocationDetector.java
index 8e7535c..9fa9441 100644
--- a/java/com/android/dialer/assisteddialing/LocationDetector.java
+++ b/java/com/android/dialer/assisteddialing/LocationDetector.java
@@ -16,8 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.telephony.TelephonyManager;
@@ -36,7 +34,7 @@
private final TelephonyManager telephonyManager;
private final String userProvidedHomeCountry;
- public LocationDetector(
+ LocationDetector(
@NonNull TelephonyManager telephonyManager, @Nullable String userProvidedHomeCountry) {
if (telephonyManager == null) {
throw new NullPointerException("Provided TelephonyManager was null");
@@ -53,9 +51,7 @@
* Returns what we believe to be the User's home country. This should resolve to
* PROPERTY_ICC_OPERATOR_ISO_COUNTRY
*/
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<String> getUpperCaseUserHomeCountry() {
+ Optional<String> getUpperCaseUserHomeCountry() {
if (!TextUtils.isEmpty(userProvidedHomeCountry)) {
LogUtil.i(
@@ -73,9 +69,7 @@
}
/** Returns what we believe to be the User's current (roaming) country */
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<String> getUpperCaseUserRoamingCountry() {
+ Optional<String> getUpperCaseUserRoamingCountry() {
// TODO Increase coverage of location resolution??
String networkCountryIso = telephonyManager.getNetworkCountryIso();
if (networkCountryIso != null) {
diff --git a/java/com/android/dialer/assisteddialing/NumberTransformer.java b/java/com/android/dialer/assisteddialing/NumberTransformer.java
index 8bbad32..eabf856 100644
--- a/java/com/android/dialer/assisteddialing/NumberTransformer.java
+++ b/java/com/android/dialer/assisteddialing/NumberTransformer.java
@@ -16,9 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
-import android.support.annotation.NonNull;
import android.text.TextUtils;
import com.android.dialer.common.LogUtil;
import com.android.dialer.strictmode.StrictModeUtils;
@@ -33,21 +30,9 @@
private final PhoneNumberUtil phoneNumberUtil;
private final Constraints constraints;
- public NumberTransformer(Constraints constraints) {
+ NumberTransformer(Constraints constraints) {
this.constraints = constraints;
- this.phoneNumberUtil = StrictModeUtils.bypass(() -> PhoneNumberUtil.getInstance());
- }
-
- /**
- * Returns a boolean for callers to quickly determine whether or not the AssistedDialingMediator
- * thinks an attempt at assisted dialing is likely to succeed.
- */
- public boolean canDoAssistedDialingTransformation(
- @NonNull String numberToCheck,
- @NonNull String userHomeCountryCode,
- @NonNull String userRoamingCountryCode) {
- return constraints.meetsPreconditions(
- numberToCheck, userHomeCountryCode, userRoamingCountryCode);
+ this.phoneNumberUtil = StrictModeUtils.bypass(PhoneNumberUtil::getInstance);
}
/**
@@ -57,9 +42,7 @@
* transformation fails, we return an empty optional. The operation can be considered a success
* when the Optional we return has a value set.
*/
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<TransformationInfo> doAssistedDialingTransformation(
+ Optional<TransformationInfo> doAssistedDialingTransformation(
String numbertoTransform, String userHomeCountryCode, String userRoamingCountryCode) {
if (!constraints.meetsPreconditions(
diff --git a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
index 965a169..2da2528 100644
--- a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
+++ b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
@@ -15,10 +15,8 @@
*/
package com.android.dialer.assisteddialing.ui;
-import android.annotation.TargetApi;
import android.icu.util.ULocale;
import android.icu.util.ULocale.Builder;
-import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -38,8 +36,6 @@
import java.util.Optional;
/** The setting for Assisted Dialing */
-@TargetApi(VERSION_CODES.N)
-@SuppressWarnings("AndroidApiChecker") // Java 8 APIs
public class AssistedDialingSettingFragment extends PreferenceFragment {
private CountryCodeProvider countryCodeProvider;
diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
index 9e22755..4d268f3 100644
--- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
+++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
@@ -263,14 +263,13 @@
return defaultChannel();
}
- // Default channel is a video channel, so find it's corresponding voice channel
- Channel prevChannel = channels().get(0);
- for (int i = 1; i < channels().size(); i++) {
- Channel currentChannel = channels().get(i);
- if (currentChannel.equals(defaultChannel())) {
- return prevChannel;
+ // Default channel is a video channel, so find it's corresponding voice channel by number since
+ // unreachable channels may not be in the list
+ for (Channel currentChannel : channels()) {
+ if (currentChannel.number().equals(defaultChannel().number())
+ && currentChannel.technology() == Channel.VOICE) {
+ return currentChannel;
}
- prevChannel = currentChannel;
}
return null;
}
@@ -306,7 +305,8 @@
public abstract String photoUri();
/**
- * Since a contact can have multiple phone numbers and each number can have multiple technologies,
+ * Returns a list of channels available. A Duo channel is included iff it is reachable. Since a
+ * contact can have multiple phone numbers and each number can have multiple technologies,
* enumerate each one here so that the user can choose the correct one. Each channel here
* represents a row in the {@link com.android.dialer.speeddial.DisambigDialog}.
*
@@ -330,7 +330,11 @@
public abstract ImmutableList<Channel> channels();
/**
- * Will be null when the user hasn't chosen a default yet.
+ * Will be null when the user hasn't chosen a default yet. Note that a default channel may not be
+ * in the list returned by {@link #channels()}. This is because that list does not contain an
+ * unreachable Duo channel. When the default channel is a Duo channel and it becomes unreachable,
+ * it will remain as the default channel but disappear in the list returned by {@link
+ * #channels()}.
*
* @see com.android.dialer.speeddial.database.SpeedDialEntry#defaultChannel()
*/
diff --git a/java/com/android/dialer/theme/common/res/values/text_styles.xml b/java/com/android/dialer/theme/common/res/values/text_styles.xml
index 0d1fd85..df5dafa 100644
--- a/java/com/android/dialer/theme/common/res/values/text_styles.xml
+++ b/java/com/android/dialer/theme/common/res/values/text_styles.xml
@@ -43,6 +43,12 @@
<item name="android:fontFamily">sans-serif-regular</item>
</style>
+ <style name="Dialer.TextAppearance.Primary2" parent="TextAppearance.AppCompat">
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textSize">16sp</item>
+ <item name="android:fontFamily">sans-serif-regular</item>
+ </style>
+
<style name="Dialer.TextAppearance.Secondary" parent="TextAppearance.AppCompat">
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:textSize">14sp</item>
@@ -81,6 +87,11 @@
<item name="android:maxLines">1</item>
</style>
+ <style name="Dialer.TextAppearance.Primary2.Ellipsize">
+ <item name="android:ellipsize">end</item>
+ <item name="android:maxLines">1</item>
+ </style>
+
<style name="Dialer.TextAppearance.Secondary.Ellipsize">
<item name="android:ellipsize">end</item>
<item name="android:maxLines">1</item>
diff --git a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java
index 39a791d..89e45dc 100644
--- a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java
+++ b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java
@@ -21,6 +21,7 @@
import android.support.annotation.IntDef;
import android.view.View;
import android.view.View.OnClickListener;
+import android.widget.Button;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -46,14 +47,21 @@
private int currentState;
private int duration;
private RecordButton recordButton;
+ private Button saveButton;
+ private Button redoButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record_voicemail_greeting);
+ recordButton = findViewById(R.id.record_button);
+ saveButton = findViewById(R.id.save_button);
+ redoButton = findViewById(R.id.redo_button);
+
duration = 0;
setState(RECORD_GREETING_INIT);
+ recordButton.setOnClickListener(this);
}
@Override
@@ -83,18 +91,32 @@
case RECORD_GREETING_INIT:
recordButton.setState(state);
recordButton.setTracks(0, 0);
+ setSaveRedoButtonsEnabled(false);
break;
case RECORD_GREETING_PLAYING_BACK:
case RECORD_GREETING_RECORDED:
recordButton.setState(state);
recordButton.setTracks(0, (float) duration / MAX_GREETING_DURATION_MS);
+ setSaveRedoButtonsEnabled(true);
break;
case RECORD_GREETING_RECORDING:
recordButton.setState(state);
recordButton.setTracks(0, 1f);
+ setSaveRedoButtonsEnabled(false);
break;
default:
break;
}
}
+
+ /** Enables/Disables save and redo buttons in the layout */
+ private void setSaveRedoButtonsEnabled(boolean enabled) {
+ if (enabled) {
+ saveButton.setVisibility(View.VISIBLE);
+ redoButton.setVisibility(View.VISIBLE);
+ } else {
+ saveButton.setVisibility(View.GONE);
+ redoButton.setVisibility(View.GONE);
+ }
+ }
}
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index b9e6744..dd1fc4f 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -469,6 +469,8 @@
.setSessionModificationState(primary.getVideoTech().getSessionModificationState())
.setDisconnectCause(primary.getDisconnectCause())
.setConnectionLabel(getConnectionLabel())
+ .setPrimaryColor(
+ InCallPresenter.getInstance().getThemeColorManager().getPrimaryColor())
.setSimSuggestionReason(getSimSuggestionReason())
.setConnectionIcon(getCallStateIcon())
.setGatewayNumber(getGatewayNumber())
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 3a68bd4..b5f1e4b 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
@@ -118,9 +118,9 @@
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"/>
- <!-- TODO(a bug): textColorPrimary or textColorPrimaryInverse? -->
<TextView
android:id="@+id/incall_important_call_badge"
+ style="@style/Dialer.TextAppearance.SubHeader"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_marginTop="4dp"
@@ -129,7 +129,6 @@
android:gravity="center"
android:maxLines="1"
android:text="@string/call_incoming_important"
- style="@style/Dialer.TextAppearance.SubHeader"
android:textColor="?android:attr/colorBackground"/>
<FrameLayout
@@ -138,9 +137,7 @@
android:layout_height="wrap_content"/>
<include
- layout="@layout/device_number_row"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
+ layout="@layout/device_number_row"/>
<FrameLayout
android:id="@+id/incall_data_container"
diff --git a/java/com/android/incallui/calllocation/impl/res/drawable/bg_location_card.xml b/java/com/android/incallui/calllocation/impl/res/drawable/bg_location_card.xml
index 0bcba95..c092446 100644
--- a/java/com/android/incallui/calllocation/impl/res/drawable/bg_location_card.xml
+++ b/java/com/android/incallui/calllocation/impl/res/drawable/bg_location_card.xml
@@ -17,5 +17,5 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_material_light">
- <item android:drawable="@android:color/white"/>
+ <item android:drawable="?android:attr/colorBackgroundFloating"/>
</ripple>
diff --git a/java/com/android/incallui/calllocation/impl/res/values/styles.xml b/java/com/android/incallui/calllocation/impl/res/values/styles.xml
deleted file mode 100644
index 45e9c98..0000000
--- a/java/com/android/incallui/calllocation/impl/res/values/styles.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<!--
- ~ Copyright (C) 2018 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<resources>
-
- <style name="LocationAddressTitleTextStyle">
- <item name="android:textSize">14sp</item>
- <item name="android:textColor">#dd000000</item>
- <item name="android:fontFamily">sans-serif-medium</item>
- </style>
-
- <style name="LocationAddressTextStyle">
- <item name="android:textSize">16sp</item>
- <item name="android:textColor">#dd000000</item>
- <item name="android:fontFamily">sans-serif</item>
- </style>
-
- <style name="LocationLatLongTextStyle">
- <item name="android:textSize">14sp</item>
- <item name="android:textColor">#88000000</item>
- <item name="android:fontFamily">sans-serif</item>
- </style>
-
- <style name="LocationLoadingTextStyle">
- <item name="android:textSize">14sp</item>
- <item name="android:textColor">#dd000000</item>
- <item name="android:fontFamily">sans-serif</item>
- </style>
-
- <style name="LocationErrorTextStyle">
- <item name="android:textSize">14sp</item>
- <item name="android:textColor">#dd000000</item>
- <item name="android:fontFamily">sans-serif</item>
- </style>
-</resources>
diff --git a/java/com/android/incallui/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java
index 82a103a..d242c3a 100644
--- a/java/com/android/incallui/contactgrid/TopRow.java
+++ b/java/com/android/incallui/contactgrid/TopRow.java
@@ -21,8 +21,12 @@
import android.support.annotation.Nullable;
import android.telephony.PhoneNumberUtils;
import android.text.BidiFormatter;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.Spanned;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
+import android.text.style.ForegroundColorSpan;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.incallui.call.state.DialerCallState;
@@ -141,8 +145,7 @@
} else if (state.isWifi() && !TextUtils.isEmpty(state.connectionLabel())) {
return state.connectionLabel();
} else if (isAccount(state)) {
- return context.getString(
- R.string.contact_grid_incoming_via_template, state.connectionLabel());
+ return getColoredConnectionLabel(context, state);
} else if (state.isWorkCall()) {
return context.getString(R.string.contact_grid_incoming_work_call);
} else {
@@ -150,6 +153,22 @@
}
}
+ private static Spannable getColoredConnectionLabel(Context context, PrimaryCallState state) {
+ Assert.isNotNull(state.connectionLabel());
+ String label =
+ context.getString(R.string.contact_grid_incoming_via_template, state.connectionLabel());
+ Spannable spannable = new SpannableString(label);
+
+ int start = label.indexOf(state.connectionLabel());
+ int end = start + state.connectionLabel().length();
+ spannable.setSpan(
+ new ForegroundColorSpan(state.primaryColor()),
+ start,
+ end,
+ Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
+ return spannable;
+ }
+
private static CharSequence getLabelForIncomingVideo(
Context context, @SessionModificationState int sessionModificationState, boolean isWifi) {
if (sessionModificationState == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
diff --git a/java/com/android/incallui/contactgrid/res/layout/device_number_row.xml b/java/com/android/incallui/contactgrid/res/layout/device_number_row.xml
index 4f8bbad..f4792d8 100644
--- a/java/com/android/incallui/contactgrid/res/layout/device_number_row.xml
+++ b/java/com/android/incallui/contactgrid/res/layout/device_number_row.xml
@@ -19,21 +19,19 @@
android:id="@+id/contactgrid_location_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
- android:layout_gravity="bottom"
- android:background="#D8D8D8"
+ android:background="@color/dialer_divider_line_color"
android:visibility="gone"/>
<TextView
android:id="@+id/contactgrid_device_number_text"
+ style="@style/Dialer.TextAppearance.Primary2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:padding="16dp"
- android:background="@android:color/white"
- android:elevation="2dp"
+ android:background="?android:attr/colorBackgroundFloating"
+ android:elevation="4dp"
android:gravity="start"
android:orientation="vertical"
- android:textColor="#DD000000"
- android:textSize="16sp"
android:visibility="gone"/>
</merge>
\ No newline at end of file
diff --git a/java/com/android/incallui/contactgrid/res/values/strings.xml b/java/com/android/incallui/contactgrid/res/values/strings.xml
index 7c0f5a6..9ee10c3 100644
--- a/java/com/android/incallui/contactgrid/res/values/strings.xml
+++ b/java/com/android/incallui/contactgrid/res/values/strings.xml
@@ -89,7 +89,7 @@
<string name="contact_grid_incoming_work_call">Work call from</string>
<!-- Displayed in the answer call screen for incoming calls via a phone account. -->
- <string name="contact_grid_incoming_via_template">Incoming via <xliff:g id="provider_name">%s</xliff:g></string>
+ <string name="contact_grid_incoming_via_template">Call via <xliff:g id="provider_name">%s</xliff:g> from</string>
<!-- Displayed in the answer call screen for incoming spam calls. -->
<string name="contact_grid_incoming_suspected_spam">Suspected spam caller</string>
diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
index 423f868..e07caf1 100644
--- a/java/com/android/incallui/incall/protocol/PrimaryCallState.java
+++ b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
@@ -17,6 +17,7 @@
package com.android.incallui.incall.protocol;
import android.graphics.drawable.Drawable;
+import android.support.annotation.ColorInt;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.telecom.DisconnectCause;
@@ -59,6 +60,8 @@
@Nullable
public abstract String connectionLabel();
+ public abstract @ColorInt int primaryColor();
+
@Nullable
public abstract SuggestionProvider.Reason simSuggestionReason();
@@ -127,7 +130,8 @@
.setIsBusinessNumber(false)
.setSupportsCallOnHold(true)
.setSwapToSecondaryButtonState(ButtonState.NOT_SUPPORT)
- .setIsAssistedDialed(false);
+ .setIsAssistedDialed(false)
+ .setPrimaryColor(0);
}
/** Builder class for primary call state info. */
@@ -148,6 +152,8 @@
public abstract Builder setConnectionIcon(Drawable connectionIcon);
+ public abstract Builder setPrimaryColor(@ColorInt int color);
+
public abstract Builder setGatewayNumber(String gatewayNumber);
public abstract Builder setCallSubject(String callSubject);