diff options
| author | kroz <46.kroz@gmail.com> | 2013-12-20 05:41:17 +0100 |
|---|---|---|
| committer | LorDClockaN <davor@losinj.com> | 2014-01-14 22:15:11 +0100 |
| commit | 7401c9f1d27ba0d0edd073ed257771957ec38d4f (patch) | |
| tree | 9205a7b66c04f86e7790660b08da5d9e2adf2182 | |
| parent | caba5c606f4c1c94fd63ef31ea986bd16af9865b (diff) | |
TRDS:[datetimepicker] Dark Calendar (2/2)
made hardcoded datetimepicker themeable
Change-Id: Ib5aa43fa6b4bf53bfc882589d00a58643fd6b215
| -rw-r--r-- | res/layout/date_picker_selected_date.xml | 2 | ||||
| -rw-r--r-- | res/layout/time_header_label.xml | 2 | ||||
| -rw-r--r-- | res/layout/time_picker_dialog.xml | 2 | ||||
| -rw-r--r-- | res/values-holodark-v14/styles.xml | 11 | ||||
| -rw-r--r-- | res/values-holodark/colors.xml | 51 | ||||
| -rw-r--r-- | res/values-holodark/styles.xml | 49 | ||||
| -rw-r--r-- | res/values/colors.xml | 4 | ||||
| -rw-r--r-- | src/com/android/datetimepicker/time/AmPmCirclesView.java | 4 | ||||
| -rw-r--r-- | src/com/android/datetimepicker/time/CircleView.java | 4 | ||||
| -rw-r--r-- | src/com/android/datetimepicker/time/TimePickerDialog.java | 7 |
10 files changed, 126 insertions, 10 deletions
diff --git a/res/layout/date_picker_selected_date.xml b/res/layout/date_picker_selected_date.xml index 2118ce1..7ecc097 100644 --- a/res/layout/date_picker_selected_date.xml +++ b/res/layout/date_picker_selected_date.xml @@ -20,7 +20,7 @@ android:layout_width="@dimen/date_picker_component_width" android:layout_height="0dip" android:layout_weight="1" - android:background="@color/white" + android:background="@color/white_bg" android:gravity="center" android:orientation="vertical" > diff --git a/res/layout/time_header_label.xml b/res/layout/time_header_label.xml index 56776ad..11a7c90 100644 --- a/res/layout/time_header_label.xml +++ b/res/layout/time_header_label.xml @@ -19,7 +19,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" - android:background="@color/white" > + android:background="@color/white_bg" > <View android:id="@+id/center_view" android:layout_width="1dp" diff --git a/res/layout/time_picker_dialog.xml b/res/layout/time_picker_dialog.xml index 24b18c9..388de29 100644 --- a/res/layout/time_picker_dialog.xml +++ b/res/layout/time_picker_dialog.xml @@ -24,7 +24,7 @@ android:id="@+id/time_display_background" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/white" > + android:background="@color/white_bg" > <include layout="@layout/time_header_label" android:layout_width="match_parent" diff --git a/res/values-holodark-v14/styles.xml b/res/values-holodark-v14/styles.xml new file mode 100644 index 0000000..d43a3d6 --- /dev/null +++ b/res/values-holodark-v14/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo"> + <!-- API 14 theme customizations can go here. --> + </style> +</resources>
\ No newline at end of file diff --git a/res/values-holodark/colors.xml b/res/values-holodark/colors.xml new file mode 100644 index 0000000..065e9da --- /dev/null +++ b/res/values-holodark/colors.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2013 SlimRoms Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + + <color name="white">#ffffff</color> + <color name="circle_background">#181818</color> + <color name="line_background">#555555</color> + <color name="ampm_text_color">#8c8c8c</color> + <color name="done_text_color_normal">#ffffff</color> + <color name="done_text_color_disabled">#888888</color> + <color name="numbers_text_color">#cccccc</color> + + <color name="transparent_black">#7f000000</color> + <color name="blue">#33b5e5</color> + <color name="blue_focused">#c1e8f7</color> + <color name="neutral_pressed">#33999999</color> + <color name="darker_blue">#0099cc</color> + <color name="date_picker_text_normal">#ff999999</color> + + <color name="calendar_header">#222222</color> + <color name="date_picker_view_animator">#181818</color> + <color name="calendar_selected_date_text">#ff222222</color> + + <!-- Colors for red theme --> + <color name="red">#ff3333</color> + <color name="red_focused">#853333</color> + <color name="light_gray">#303030</color> + <color name="dark_gray">#262626</color> + <color name="line_dark">#505050</color> + <color name="done_text_color_dark_normal">#ffffff</color> + <color name="done_text_color_dark_disabled">#888888</color> + <color name="done_disabled_dark">#bfbfbf</color> + + <!-- White background from layout and java --> + <color name="white_bg">#ff000000</color> + +</resources>
\ No newline at end of file diff --git a/res/values-holodark/styles.xml b/res/values-holodark/styles.xml new file mode 100644 index 0000000..66662f8 --- /dev/null +++ b/res/values-holodark/styles.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 SlimRoms Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources xmlns:android="http://schemas.android.com/apk/res/android"> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + + <style name="time_label"> + <item name="android:textSize">@dimen/time_label_size</item> + <item name="android:textColor">@color/numbers_text_color</item> + </style> + + <style name="ampm_label"> + <item name="android:textSize">@dimen/ampm_label_size</item> + <item name="android:textAllCaps">true</item> + <item name="android:textColor">@color/ampm_text_color</item> + <item name="android:textStyle">bold</item> + </style> + + <style name="day_of_week_label_condensed" /> +</resources>
\ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index 931056f..4b4b2e7 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -44,4 +44,8 @@ <color name="done_text_color_dark_normal">#ffffff</color> <color name="done_text_color_dark_disabled">#888888</color> <color name="done_disabled_dark">#bfbfbf</color> + + <!-- White background from layout and java --> + <color name="white_bg">#ffffffff</color> + </resources>
\ No newline at end of file diff --git a/src/com/android/datetimepicker/time/AmPmCirclesView.java b/src/com/android/datetimepicker/time/AmPmCirclesView.java index c62aebf..c34eda7 100644 --- a/src/com/android/datetimepicker/time/AmPmCirclesView.java +++ b/src/com/android/datetimepicker/time/AmPmCirclesView.java @@ -74,7 +74,7 @@ public class AmPmCirclesView extends View { } Resources res = context.getResources(); - mUnselectedColor = res.getColor(R.color.white); + mUnselectedColor = res.getColor(R.color.circle_background); mSelectedColor = res.getColor(R.color.blue); mAmPmTextColor = res.getColor(R.color.ampm_text_color); mSelectedAlpha = SELECTED_ALPHA; @@ -106,7 +106,7 @@ public class AmPmCirclesView extends View { mAmPmTextColor = res.getColor(R.color.white); mSelectedAlpha = SELECTED_ALPHA_THEME_DARK; } else { - mUnselectedColor = res.getColor(R.color.white); + mUnselectedColor = res.getColor(R.color.white_bg); mSelectedColor = res.getColor(R.color.blue); mAmPmTextColor = res.getColor(R.color.ampm_text_color); mSelectedAlpha = SELECTED_ALPHA; diff --git a/src/com/android/datetimepicker/time/CircleView.java b/src/com/android/datetimepicker/time/CircleView.java index 549db42..723bb6a 100644 --- a/src/com/android/datetimepicker/time/CircleView.java +++ b/src/com/android/datetimepicker/time/CircleView.java @@ -48,7 +48,7 @@ public class CircleView extends View { super(context); Resources res = context.getResources(); - mCircleColor = res.getColor(R.color.white); + mCircleColor = res.getColor(R.color.circle_background); mDotColor = res.getColor(R.color.numbers_text_color); mPaint.setAntiAlias(true); @@ -82,7 +82,7 @@ public class CircleView extends View { mCircleColor = res.getColor(R.color.dark_gray); mDotColor = res.getColor(R.color.light_gray); } else { - mCircleColor = res.getColor(R.color.white); + mCircleColor = res.getColor(R.color.circle_background); mDotColor = res.getColor(R.color.numbers_text_color); } } diff --git a/src/com/android/datetimepicker/time/TimePickerDialog.java b/src/com/android/datetimepicker/time/TimePickerDialog.java index 6e585b5..546f953 100644 --- a/src/com/android/datetimepicker/time/TimePickerDialog.java +++ b/src/com/android/datetimepicker/time/TimePickerDialog.java @@ -316,6 +316,7 @@ public class TimePickerDialog extends DialogFragment implements OnValueSelectedL mTimePicker.setTheme(getActivity().getApplicationContext(), mThemeDark); // Prepare some colors to use. int white = res.getColor(R.color.white); + int whiteBg = res.getColor(R.color.white_bg); int circleBackground = res.getColor(R.color.circle_background); int line = res.getColor(R.color.line_background); int timeDisplay = res.getColor(R.color.numbers_text_color); @@ -329,13 +330,13 @@ public class TimePickerDialog extends DialogFragment implements OnValueSelectedL int darkDoneBackground = R.drawable.done_background_color_dark; // Set the colors for each view based on the theme. - view.findViewById(R.id.time_display_background).setBackgroundColor(mThemeDark? darkGray : white); - view.findViewById(R.id.time_display).setBackgroundColor(mThemeDark? darkGray : white); + view.findViewById(R.id.time_display_background).setBackgroundColor(mThemeDark? darkGray : circleBackground); + view.findViewById(R.id.time_display).setBackgroundColor(mThemeDark? darkGray : circleBackground); ((TextView) view.findViewById(R.id.separator)).setTextColor(mThemeDark? white : timeDisplay); ((TextView) view.findViewById(R.id.ampm_label)).setTextColor(mThemeDark? white : timeDisplay); view.findViewById(R.id.line).setBackgroundColor(mThemeDark? darkLine : line); mDoneButton.setTextColor(mThemeDark? darkDoneTextColor : doneTextColor); - mTimePicker.setBackgroundColor(mThemeDark? lightGray : circleBackground); + mTimePicker.setBackgroundColor(mThemeDark? lightGray : whiteBg); mDoneButton.setBackgroundResource(mThemeDark? darkDoneBackground : doneBackground); return view; } |
