From 83c3c51890c8cee83822fd41d323728b8ed2b254 Mon Sep 17 00:00:00 2001 From: Maurice Lam Date: Mon, 30 Mar 2015 09:18:58 -0700 Subject: [PATCH] [SetupWizardLib] Fix setup wizard crash Check for null before trying to set alpha on the drawables of the button. Also call setTextColor so that the text alpha of the button is also set (in addition to just the drawables). Bug: 19982609 Change-Id: I1d5c19d792ada1fa8b31902a2b0e27ff80af597f --- .../src/com/android/setupwizardlib/view/NavigationBar.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/main/src/com/android/setupwizardlib/view/NavigationBar.java b/library/main/src/com/android/setupwizardlib/view/NavigationBar.java index 2228e69..3d88593 100644 --- a/library/main/src/com/android/setupwizardlib/view/NavigationBar.java +++ b/library/main/src/com/android/setupwizardlib/view/NavigationBar.java @@ -136,10 +136,12 @@ public class NavigationBar extends LinearLayout implements View.OnClickListener // The color of the button is #de000000 / #deffffff when enabled. When disabled, the // alpha value = 0x3b/0xff * 0xde/0xff = 20%. final int alpha = enabled ? 0xff : 0x3b; - getTextColors().withAlpha(alpha); + setTextColor(getTextColors().withAlpha(alpha)); final Drawable[] compoundDrawables = getCompoundDrawables(); for (Drawable d : compoundDrawables) { - d.setAlpha(alpha); + if (d != null) { + d.setAlpha(alpha); + } } } }