From d388c75825b6c5a0b58fbf71b0f627df51b2b6ed Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Tue, 15 Nov 2016 13:59:06 -0800 Subject: [PATCH] Add support for a custom left affordance icon Bug: 32872231 Test: manually tested as described in ag/1627217 Change-Id: I42e50c592ffcc59939971d21ed376fba85c5bb27 --- .../statusbar/phone/KeyguardBottomAreaView.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 89defec6f94c7..dd99e89509c9a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -32,6 +32,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Configuration; +import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.os.IBinder; @@ -141,6 +142,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private boolean mLeftIsVoiceAssist; private AssistManager mAssistManager; + private Drawable mLeftAssistIcon; private IntentButton mRightButton = new DefaultRightButton(); private IntentButton mLeftButton = new DefaultLeftButton(); @@ -340,6 +342,14 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL ? View.VISIBLE : View.GONE); } + /** + * Set an alternate icon for the left assist affordance (replace the mic icon) + */ + public void setLeftAssistIcon(Drawable drawable) { + mLeftAssistIcon = drawable; + updateLeftAffordanceIcon(); + } + private void updateLeftAffordanceIcon() { IconState state = mLeftButton.getIcon(); mLeftAffordanceView.setVisibility(state.isVisible ? View.VISIBLE : View.GONE); @@ -806,7 +816,11 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mLeftIsVoiceAssist = canLaunchVoiceAssist(); if (mLeftIsVoiceAssist) { mIconState.isVisible = mUserSetupComplete; - mIconState.drawable = mContext.getDrawable(R.drawable.ic_mic_26dp); + if (mLeftAssistIcon == null) { + mIconState.drawable = mContext.getDrawable(R.drawable.ic_mic_26dp); + } else { + mIconState.drawable = mLeftAssistIcon; + } mIconState.contentDescription = mContext.getString( R.string.accessibility_voice_assist_button); } else {