From 6e0dd6b147fe06223bb49e563fdb0be234648eed Mon Sep 17 00:00:00 2001 From: Android Dialer Date: Tue, 26 Jun 2018 10:23:21 -0700 Subject: Added a method to fix graying of drawables Test: "N/A" PiperOrigin-RevId: 202149985 Change-Id: I007724058859dd8905a94d2ba230ed37e5a6d49c --- .../android/dialer/voicemail/settings/RecordButton.java | 14 ++++++++++++++ .../settings/res/drawable/start_playback_drawable.xml | 1 + .../settings/res/drawable/start_recording_drawable.xml | 1 + 3 files changed, 16 insertions(+) (limited to 'java') diff --git a/java/com/android/dialer/voicemail/settings/RecordButton.java b/java/com/android/dialer/voicemail/settings/RecordButton.java index d62637053..ac64cde34 100644 --- a/java/com/android/dialer/voicemail/settings/RecordButton.java +++ b/java/com/android/dialer/voicemail/settings/RecordButton.java @@ -18,10 +18,12 @@ package com.android.dialer.voicemail.settings; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; +import android.graphics.drawable.LayerDrawable; import android.support.v4.content.ContextCompat; import android.util.AttributeSet; import android.widget.Button; @@ -94,6 +96,8 @@ public class RecordButton extends Button { recordedDrawable = ContextCompat.getDrawable(getContext(), R.drawable.start_playback_drawable); playingDrawable = ContextCompat.getDrawable(getContext(), R.drawable.stop_playback_drawable); + fixQuantumIconTint(Color.WHITE); + mainTrackPaint = getBasePaint(R.color.dialer_call_green); secondaryTrackPaint = getBasePaint(R.color.dialer_call_green); secondaryTrackPaint.setAlpha(secondaryTrackAlpha); @@ -101,6 +105,16 @@ public class RecordButton extends Button { setState(RecordVoicemailGreetingActivity.RECORD_GREETING_INIT); } + private void fixQuantumIconTint(int color) { + Drawable playArrow = ((LayerDrawable) recordedDrawable).findDrawableByLayerId(R.id.play_icon); + playArrow.mutate().setTint(color); + ((LayerDrawable) recordedDrawable).setDrawableByLayerId(R.id.play_icon, playArrow); + + Drawable micIcon = ((LayerDrawable) readyDrawable).findDrawableByLayerId(R.id.record_icon); + micIcon.mutate().setTint(color); + ((LayerDrawable) readyDrawable).setDrawableByLayerId(R.id.record_icon, micIcon); + } + /** Returns Paint with base attributes for drawing the main and secondary tracks */ private Paint getBasePaint(int id) { Paint paint = new Paint(); diff --git a/java/com/android/dialer/voicemail/settings/res/drawable/start_playback_drawable.xml b/java/com/android/dialer/voicemail/settings/res/drawable/start_playback_drawable.xml index 2a7ec4a7c..97917465c 100644 --- a/java/com/android/dialer/voicemail/settings/res/drawable/start_playback_drawable.xml +++ b/java/com/android/dialer/voicemail/settings/res/drawable/start_playback_drawable.xml @@ -21,6 +21,7 @@