summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2014-11-11 23:25:20 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-11 23:25:21 +0000
commit35b7c4f406bd2602d8d6338e875a546ef9ffd9dc (patch)
tree29d0e6a33281b90d8e7efb2937e2428ec643f566
parentd4a395b0c1c096804dd206d67ba168883e43bfd1 (diff)
parent3fd4122391fa413fc5cef13f13bafb0cdfba80b0 (diff)
downloadpackages_apps_InCallUI-35b7c4f406bd2602d8d6338e875a546ef9ffd9dc.tar.gz
packages_apps_InCallUI-35b7c4f406bd2602d8d6338e875a546ef9ffd9dc.tar.bz2
packages_apps_InCallUI-35b7c4f406bd2602d8d6338e875a546ef9ffd9dc.zip
Merge "Bring ripples back to InCallUI." into lmp-mr1-dev
-rw-r--r--src/com/android/incallui/CallButtonFragment.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java
index cf1c1193..0bfcc80c 100644
--- a/src/com/android/incallui/CallButtonFragment.java
+++ b/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