diff options
author | erfanian <erfanian@google.com> | 2018-05-14 16:00:33 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-15 11:16:37 -0700 |
commit | c876815dca5f701190b36c3b734bb8ae468e1cb3 (patch) | |
tree | 140ed849b8addb797a8d3e5494d290f1e074b5a3 /java | |
parent | 37b588d56db13b9c89d8ccd7dd799b0cbddb1b75 (diff) |
Use component for iconography
Test: tap, manual
PiperOrigin-RevId: 196582079
Change-Id: Iffbfa408cbb32e81824cd46a67d51baa270132cf
Diffstat (limited to 'java')
3 files changed, 15 insertions, 1 deletions
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java index fb1de05bd..d44a5daa2 100644 --- a/java/com/android/incallui/answer/impl/AnswerFragment.java +++ b/java/com/android/incallui/answer/impl/AnswerFragment.java @@ -82,9 +82,11 @@ 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.SpeakEasyComponent; import com.android.incallui.util.AccessibilityUtil; import com.android.incallui.video.protocol.VideoCallScreen; import com.android.incallui.videotech.utils.VideoUtils; +import com.google.common.base.Optional; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -206,7 +208,7 @@ public class AnswerFragment extends Fragment } }; - @DrawableRes public final int icon; + @DrawableRes public int icon; @StringRes public final int contentDescription; @StringRes public final int accessibilityLabel; @StringRes public final int hintText; @@ -456,6 +458,11 @@ public class AnswerFragment extends Fragment 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); diff --git a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java index 320bc69ee..6dae44128 100644 --- a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java +++ b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java @@ -30,6 +30,8 @@ public abstract class SpeakEasyComponent { public abstract Optional<Fragment> speakEasySettingsFragment(); + public abstract Optional<Integer> speakEasyIcon(); + public static SpeakEasyComponent get(Context context) { return ((SpeakEasyComponent.HasComponent) ((HasRootComponent) context.getApplicationContext()).component()) diff --git a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java index d5f644372..67b564cb0 100644 --- a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java +++ b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java @@ -36,4 +36,9 @@ public abstract class StubSpeakEasyModule { static Optional<Fragment> provideSpeakEasySettingsFragment() { return Optional.absent(); } + + @Provides + static Optional<Integer> provideSpeakEasyIcon() { + return Optional.absent(); + } } |