summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenyi Wang <wenyiw@google.com>2015-12-16 01:01:31 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-12-16 01:01:31 +0000
commitf27370e34a8e0acb66b30f408fc3f43f42d578b5 (patch)
tree0a6c9d878b6b976d7998fa7afeab423e6358f6b8
parent66d9ca7fd09a9ea5705675efce055b7ab74dc5f5 (diff)
parentf31ca43224f11c63d7e0b6d870e39790e7e14eed (diff)
downloadpackages_apps_PhoneCommon-f27370e34a8e0acb66b30f408fc3f43f42d578b5.tar.gz
packages_apps_PhoneCommon-f27370e34a8e0acb66b30f408fc3f43f42d578b5.tar.bz2
packages_apps_PhoneCommon-f27370e34a8e0acb66b30f408fc3f43f42d578b5.zip
Merge "Backport Context.getDrawable()" into ub-contactsdialer-b-dev
am: f31ca43224 * commit 'f31ca43224f11c63d7e0b6d870e39790e7e14eed': Backport Context.getDrawable()
-rw-r--r--src/com/android/phone/common/dialpad/DialpadView.java14
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) {