From de53e545276c7854de0d2886a6cb8c849b3b1e62 Mon Sep 17 00:00:00 2001 From: linyuh Date: Tue, 26 Jun 2018 10:33:34 -0700 Subject: Remove redundant version checks and annotations in the assisted dialing package. Test: Existing tests PiperOrigin-RevId: 202151952 Change-Id: I0c1ad7b35ec1a57ae9f5d51ba935bfcd9f529379 --- .../assisteddialing/AssistedDialingMediator.java | 12 +++-------- .../AssistedDialingMediatorImpl.java | 8 -------- .../AssistedDialingMediatorStub.java | 6 ------ .../dialer/assisteddialing/ConcreteCreator.java | 10 ++-------- .../dialer/assisteddialing/Constraints.java | 8 ++------ .../assisteddialing/CountryCodeProvider.java | 4 ---- .../dialer/assisteddialing/LocationDetector.java | 12 +++-------- .../dialer/assisteddialing/NumberTransformer.java | 23 +++------------------- .../ui/AssistedDialingSettingFragment.java | 4 ---- 9 files changed, 13 insertions(+), 74 deletions(-) diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java index 756fd6125..6715e2b21 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 @@ import java.util.Optional; 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 userHomeCountryCode(); + Optional userHomeCountryCode(); - @SuppressWarnings("AndroidApiChecker") // Use of optional - @TargetApi(VERSION_CODES.N) - public Optional attemptAssistedDial(@NonNull String numberToTransform); + Optional attemptAssistedDial(@NonNull String numberToTransform); } diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java index 7214437ab..7fdb8dafc 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 @@ import java.util.Optional; * 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 @@ final class AssistedDialingMediatorImpl implements AssistedDialingMediator { /** 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 userHomeCountryCode() { return locationDetector.getUpperCaseUserHomeCountry(); } @@ -69,8 +63,6 @@ final class AssistedDialingMediatorImpl implements AssistedDialingMediator { * 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 attemptAssistedDial(@NonNull String numberToTransform) { Optional userHomeCountryCode = locationDetector.getUpperCaseUserHomeCountry(); diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java index 9a40e0576..cb3ca79f9 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 @@ public final class AssistedDialingMediatorStub implements AssistedDialingMediato /** Always returns an empty Optional. */ @Override - @SuppressWarnings("AndroidApiChecker") // Use of optional - @TargetApi(VERSION_CODES.N) public Optional attemptAssistedDial(@NonNull String numberToTransform) { return Optional.empty(); } /** Always returns an empty Optional. */ @Override - @SuppressWarnings("AndroidApiChecker") // Use of optional - @TargetApi(VERSION_CODES.N) public Optional userHomeCountryCode() { return Optional.empty(); } diff --git a/java/com/android/dialer/assisteddialing/ConcreteCreator.java b/java/com/android/dialer/assisteddialing/ConcreteCreator.java index 050774340..ab8ea70a7 100644 --- a/java/com/android/dialer/assisteddialing/ConcreteCreator.java +++ b/java/com/android/dialer/assisteddialing/ConcreteCreator.java @@ -16,13 +16,11 @@ 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 +34,10 @@ import com.android.dialer.strictmode.StrictModeUtils; *

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; + public static final int BUILD_CODE_CEILING = VERSION_CODES.P; /** * Creates a new AssistedDialingMediator @@ -105,8 +100,7 @@ public final class ConcreteCreator { 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 cae3734be..41a3e92b2 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.Locale; 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 @@ final class Constraints { * 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 @@ final class Constraints { * @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 118696e9b..04b229150 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.StringTokenizer; 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 8e7535c1b..9fa944125 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 @@ final class LocationDetector { 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 @@ final class LocationDetector { * 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 getUpperCaseUserHomeCountry() { + Optional getUpperCaseUserHomeCountry() { if (!TextUtils.isEmpty(userProvidedHomeCountry)) { LogUtil.i( @@ -73,9 +69,7 @@ final class LocationDetector { } /** Returns what we believe to be the User's current (roaming) country */ - @SuppressWarnings("AndroidApiChecker") // Use of optional - @TargetApi(VERSION_CODES.N) - public Optional getUpperCaseUserRoamingCountry() { + Optional 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 8bbad329d..eabf8564e 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 @@ final class NumberTransformer { 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 @@ final class NumberTransformer { * 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 doAssistedDialingTransformation( + Optional 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 965a16975..2da25287e 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.List; 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; -- cgit v1.2.3 From d745887310ae896649b11d9044cfbf070b2e5ac9 Mon Sep 17 00:00:00 2001 From: wangqi Date: Tue, 26 Jun 2018 13:39:18 -0700 Subject: Update connection label. Bug: 79878432 Test: manual PiperOrigin-RevId: 202185676 Change-Id: I53c3896a68f9dbed9316360d7f4ad6dd7cbe17ec --- java/com/android/incallui/CallCardPresenter.java | 2 ++ java/com/android/incallui/contactgrid/TopRow.java | 23 ++++++++++++++++++++-- .../incallui/contactgrid/res/values/strings.xml | 2 +- .../incallui/incall/protocol/PrimaryCallState.java | 8 +++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index b9e6744ea..dd1fc4f37 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -469,6 +469,8 @@ public class CallCardPresenter .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/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java index 82a103a61..d242c3a14 100644 --- a/java/com/android/incallui/contactgrid/TopRow.java +++ b/java/com/android/incallui/contactgrid/TopRow.java @@ -21,8 +21,12 @@ import android.graphics.drawable.Drawable; 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 @@ public class TopRow { } 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 @@ public class TopRow { } } + 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/values/strings.xml b/java/com/android/incallui/contactgrid/res/values/strings.xml index 7c0f5a679..9ee10c327 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 @@ Work call from - Incoming via %s + Call via %s from Suspected spam caller diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java index 423f86875..e07caf1b6 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 @@ public abstract class PrimaryCallState { @Nullable public abstract String connectionLabel(); + public abstract @ColorInt int primaryColor(); + @Nullable public abstract SuggestionProvider.Reason simSuggestionReason(); @@ -127,7 +130,8 @@ public abstract class PrimaryCallState { .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 class PrimaryCallState { 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); -- cgit v1.2.3 From ab99dbe6ec1857fe35bde3bfc58032fdec59048d Mon Sep 17 00:00:00 2001 From: linyuh Date: Tue, 26 Jun 2018 16:06:23 -0700 Subject: Fix an AOSP build error caused by version codes Test: None. PiperOrigin-RevId: 202212283 Change-Id: Ieff3c7fb8a4234a46ef93cf2cc3fb9362439c64a --- java/com/android/dialer/assisteddialing/ConcreteCreator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/com/android/dialer/assisteddialing/ConcreteCreator.java b/java/com/android/dialer/assisteddialing/ConcreteCreator.java index ab8ea70a7..b4f926dd3 100644 --- a/java/com/android/dialer/assisteddialing/ConcreteCreator.java +++ b/java/com/android/dialer/assisteddialing/ConcreteCreator.java @@ -18,7 +18,6 @@ package com.android.dialer.assisteddialing; 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.v4.os.UserManagerCompat; @@ -36,8 +35,9 @@ import com.android.dialer.strictmode.StrictModeUtils; */ public final class ConcreteCreator { - // Ceiling set at P because this feature will ship as part of the framework in Q. - public static final int BUILD_CODE_CEILING = VERSION_CODES.P; + // 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 -- cgit v1.2.3 From 23c51ac27a5b3e99d9ce6a2509c8aa4ca14f2d17 Mon Sep 17 00:00:00 2001 From: yueg Date: Tue, 26 Jun 2018 17:53:20 -0700 Subject: Fix SpeedDialUiItem.getDefaultVoiceChannel Test: SpeedDialUiItemTest PiperOrigin-RevId: 202228252 Change-Id: I72047d599a58a7932942fa8988d38e623fc2aeab --- .../dialer/speeddial/loader/SpeedDialUiItem.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java index 9e227553b..4d268f35b 100644 --- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java +++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java @@ -263,14 +263,13 @@ public abstract class SpeedDialUiItem { 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 class SpeedDialUiItem { 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 class SpeedDialUiItem { public abstract ImmutableList 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() */ -- cgit v1.2.3 From 20f8f6018e0f80083ebbabb43965ec19996d5f87 Mon Sep 17 00:00:00 2001 From: wangqi Date: Tue, 26 Jun 2018 17:59:21 -0700 Subject: Update emergency call map and device number UI. Bug: 79878432 Test: manual PiperOrigin-RevId: 202228927 Change-Id: Ia68d3b1366a36ba5bdde85049b1b23ca98495ed1 --- .../dialer/theme/common/res/values/text_styles.xml | 11 +++++ .../impl/res/layout/fragment_incoming_call.xml | 7 +--- .../impl/res/drawable/bg_location_card.xml | 2 +- .../calllocation/impl/res/values/styles.xml | 47 ---------------------- .../contactgrid/res/layout/device_number_row.xml | 10 ++--- 5 files changed, 18 insertions(+), 59 deletions(-) delete mode 100644 java/com/android/incallui/calllocation/impl/res/values/styles.xml 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 0d1fd850e..df5dafa31 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 @@ sans-serif-regular + + + + - - - - - - - - - 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 4f8bbad5a..f4792d8ed 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"/> \ No newline at end of file -- cgit v1.2.3 From d637af51091dc86a197da6520484e10a356a421b Mon Sep 17 00:00:00 2001 From: Android Dialer Date: Tue, 26 Jun 2018 18:02:04 -0700 Subject: Added method to set Save and Redo buttons enabled/disabled Added logic to setState() method to change state of buttons Test: "N/A" PiperOrigin-RevId: 202229300 Change-Id: I0f1ed20a41c59431edf4684e57bdbce18a8d7dbd --- .../settings/RecordVoicemailGreetingActivity.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java index 39a791d5f..89e45dca7 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.os.Bundle; 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 @@ public class RecordVoicemailGreetingActivity extends Activity implements OnClick 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 @@ public class RecordVoicemailGreetingActivity extends Activity implements OnClick 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); + } + } } -- cgit v1.2.3