diff options
| -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) { |
