diff options
author | Nancy Chen <nancychen@google.com> | 2014-11-11 23:29:18 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-11 23:29:18 +0000 |
commit | 46d33ce533bcc2d4f966626153559322c7b5c602 (patch) | |
tree | beddbea05c114cf30622aef9d088b0366540c3ac /InCallUI | |
parent | 84171cedfec9fd71ec75df6f9601e1559492a593 (diff) | |
parent | 667b38f0d682938a6a387bf370eecab1abc15cdf (diff) |
am 35b7c4f4: Merge "Bring ripples back to InCallUI." into lmp-mr1-dev
* commit '35b7c4f406bd2602d8d6338e875a546ef9ffd9dc':
Bring ripples back to InCallUI.
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonFragment.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index cf1c11932..0bfcc80c2 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -17,10 +17,12 @@ package com.android.incallui; import android.content.Context; +import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.GradientDrawable; +import android.graphics.drawable.RippleDrawable; import android.graphics.drawable.StateListDrawable; import android.os.Bundle; import android.telecom.AudioState; @@ -219,7 +221,7 @@ public class CallButtonFragment for (ImageButton button : compoundButtons) { final LayerDrawable layers = (LayerDrawable) button.getBackground(); - final StateListDrawable btnCompoundDrawable = compoundBackgroundDrawable(themeColors); + final RippleDrawable btnCompoundDrawable = compoundBackgroundDrawable(themeColors); layers.setDrawableByLayerId(R.id.compoundBackgroundItem, btnCompoundDrawable); } @@ -234,42 +236,46 @@ public class CallButtonFragment for (ImageButton button : normalButtons) { final LayerDrawable layers = (LayerDrawable) button.getBackground(); - final StateListDrawable btnCompoundDrawable = backgroundDrawable(themeColors); - layers.setDrawableByLayerId(R.id.backgroundItem, btnCompoundDrawable); + final RippleDrawable btnDrawable = backgroundDrawable(themeColors); + layers.setDrawableByLayerId(R.id.backgroundItem, btnDrawable); } mCurrentThemeColors = themeColors; } /** - * Generate a StateListDrawable which will be the background for a compound button, i.e. + * Generate a RippleDrawable which will be the background for a compound button, i.e. * a button with pressed and unpressed states. The unpressed state will be the same color * as the rest of the call card, the pressed state will be the dark version of that color. */ - private StateListDrawable compoundBackgroundDrawable(MaterialPalette palette) { + private RippleDrawable compoundBackgroundDrawable(MaterialPalette palette) { Resources res = getResources(); - StateListDrawable stateListDrawable = new StateListDrawable(); + ColorStateList rippleColor = + ColorStateList.valueOf(res.getColor(R.color.incall_accent_color)); + StateListDrawable stateListDrawable = new StateListDrawable(); addSelectedAndFocused(res, stateListDrawable); addFocused(res, stateListDrawable); addSelected(res, stateListDrawable, palette); addUnselected(res, stateListDrawable, palette); - return stateListDrawable; + return new RippleDrawable(rippleColor, stateListDrawable, null); } /** - * Generate a StateListDrawable which will be the background of a button to ensure it + * Generate a RippleDrawable which will be the background of a button to ensure it * is the same color as the rest of the call card. */ - private StateListDrawable backgroundDrawable(MaterialPalette palette) { + private RippleDrawable backgroundDrawable(MaterialPalette palette) { Resources res = getResources(); - StateListDrawable stateListDrawable = new StateListDrawable(); + ColorStateList rippleColor = + ColorStateList.valueOf(res.getColor(R.color.incall_accent_color)); + StateListDrawable stateListDrawable = new StateListDrawable(); addFocused(res, stateListDrawable); addUnselected(res, stateListDrawable, palette); - return stateListDrawable; + return new RippleDrawable(rippleColor, stateListDrawable, null); } // state_selected and state_focused |