summaryrefslogtreecommitdiff
path: root/core/java/android/widget/SimpleMonthAdapter.java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-01-07 13:57:12 -0800
committerAlan Viverette <alanv@google.com>2015-01-07 13:57:12 -0800
commitc5b95c20b6fd3f4e63147efb22dd19c657b17001 (patch)
tree4ce18570ed30cbcd1dd4f69602b19c84b61db0bb /core/java/android/widget/SimpleMonthAdapter.java
parent308ad16e52665a204cda888f6dc3313353fa7c68 (diff)
Fix date picker color handling, expose StateSet utils in more places
Enabled use of color selectors for the day number text, which lets us use the "activated" text color and push the selection background opacity up to 100%. Also ensures the selector circle stays within the bounds of the selected day. BUG: 18864682 Change-Id: Ia36ea748f83e13683a1de8ac1a259d353578d61a
Diffstat (limited to 'core/java/android/widget/SimpleMonthAdapter.java')
-rw-r--r--core/java/android/widget/SimpleMonthAdapter.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/java/android/widget/SimpleMonthAdapter.java b/core/java/android/widget/SimpleMonthAdapter.java
index 24ebb2cd7e66..c807d560968f 100644
--- a/core/java/android/widget/SimpleMonthAdapter.java
+++ b/core/java/android/widget/SimpleMonthAdapter.java
@@ -39,6 +39,7 @@ class SimpleMonthAdapter extends BaseAdapter {
private Calendar mSelectedDay = Calendar.getInstance();
private ColorStateList mCalendarTextColors = ColorStateList.valueOf(Color.BLACK);
+ private ColorStateList mCalendarDayBackgroundColor = ColorStateList.valueOf(Color.MAGENTA);
private OnDaySelectedListener mOnDaySelectedListener;
private int mFirstDayOfWeek;
@@ -88,6 +89,10 @@ class SimpleMonthAdapter extends BaseAdapter {
mCalendarTextColors = colors;
}
+ void setCalendarDayBackgroundColor(ColorStateList dayBackgroundColor) {
+ mCalendarDayBackgroundColor = dayBackgroundColor;
+ }
+
/**
* Sets the text color, size, style, hint color, and highlight color from
* the specified TextAppearance resource. This is mostly copied from
@@ -144,9 +149,11 @@ class SimpleMonthAdapter extends BaseAdapter {
v.setClickable(true);
v.setOnDayClickListener(mOnDayClickListener);
- if (mCalendarTextColors != null) {
- v.setTextColor(mCalendarTextColors);
- }
+ v.setMonthTextColor(mCalendarTextColors);
+ v.setDayOfWeekTextColor(mCalendarTextColors);
+ v.setDayTextColor(mCalendarTextColors);
+
+ v.setDayBackgroundColor(mCalendarDayBackgroundColor);
}
final int minMonth = mMinDate.get(Calendar.MONTH);