diff options
| author | Wenyi Wang <wenyiw@google.com> | 2015-12-16 00:55:21 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-12-16 00:55:21 +0000 |
| commit | f31ca43224f11c63d7e0b6d870e39790e7e14eed (patch) | |
| tree | b70014b018ff2355b9fe45e27034947da59cbf1b | |
| parent | b373f1960f484e2cf83587260e0df66120377d3c (diff) | |
| parent | c24a83bcc26ff0168f2f45e8d2bf291453316027 (diff) | |
| download | packages_apps_PhoneCommon-f31ca43224f11c63d7e0b6d870e39790e7e14eed.tar.gz packages_apps_PhoneCommon-f31ca43224f11c63d7e0b6d870e39790e7e14eed.tar.bz2 packages_apps_PhoneCommon-f31ca43224f11c63d7e0b6d870e39790e7e14eed.zip | |
Merge "Backport Context.getDrawable()" into ub-contactsdialer-b-dev
| -rw-r--r-- | src/com/android/phone/common/dialpad/DialpadView.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/phone/common/dialpad/DialpadView.java b/src/com/android/phone/common/dialpad/DialpadView.java index 1d71687..d8ee4db 100644 --- a/src/com/android/phone/common/dialpad/DialpadView.java +++ b/src/com/android/phone/common/dialpad/DialpadView.java @@ -22,7 +22,9 @@ import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; +import android.os.Build; import android.text.Spannable; import android.text.TextUtils; import android.text.style.TtsSpan; @@ -187,8 +189,8 @@ public class DialpadView extends LinearLayout { numberContentDescription = spannable; } - final RippleDrawable rippleBackground = - (RippleDrawable) getContext().getDrawable(R.drawable.btn_dialpad_key); + final RippleDrawable rippleBackground = (RippleDrawable) + getDrawableCompat(getContext(), R.drawable.btn_dialpad_key); if (mRippleColor != null) { rippleBackground.setColor(mRippleColor); } @@ -213,6 +215,14 @@ public class DialpadView extends LinearLayout { } + private Drawable getDrawableCompat(Context context, int id) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + return context.getDrawable(id); + } else { + return context.getResources().getDrawable(id); + } + } + public void setShowVoicemailButton(boolean show) { View view = findViewById(R.id.dialpad_key_voicemail); if (view != null) { |
