diff --git a/astrid/res/drawable-v11/deadline_timepicker_button_bl_off.xml b/astrid/res/drawable-v11/deadline_timepicker_button_bl_off.xml
deleted file mode 100644
index 8dfcbdbd4..000000000
--- a/astrid/res/drawable-v11/deadline_timepicker_button_bl_off.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable-v11/deadline_timepicker_button_bl_on.xml b/astrid/res/drawable-v11/deadline_timepicker_button_bl_on.xml
deleted file mode 100644
index 4358d6aaa..000000000
--- a/astrid/res/drawable-v11/deadline_timepicker_button_bl_on.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable-v11/deadline_timepicker_button_br_off.xml b/astrid/res/drawable-v11/deadline_timepicker_button_br_off.xml
deleted file mode 100644
index 201a8f62a..000000000
--- a/astrid/res/drawable-v11/deadline_timepicker_button_br_off.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable-v11/deadline_timepicker_button_br_on.xml b/astrid/res/drawable-v11/deadline_timepicker_button_br_on.xml
deleted file mode 100644
index 7bd7de7d2..000000000
--- a/astrid/res/drawable-v11/deadline_timepicker_button_br_on.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable-v11/timepicker_am_btn_off.xml b/astrid/res/drawable-v11/timepicker_am_btn_off.xml
deleted file mode 100644
index 7c31677db..000000000
--- a/astrid/res/drawable-v11/timepicker_am_btn_off.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable-v11/timepicker_am_btn_on.xml b/astrid/res/drawable-v11/timepicker_am_btn_on.xml
deleted file mode 100644
index 8a54a2a67..000000000
--- a/astrid/res/drawable-v11/timepicker_am_btn_on.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable-v11/timepicker_pm_btn_off.xml b/astrid/res/drawable-v11/timepicker_pm_btn_off.xml
deleted file mode 100644
index b0e2847f6..000000000
--- a/astrid/res/drawable-v11/timepicker_pm_btn_off.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable-v11/timepicker_pm_btn_on.xml b/astrid/res/drawable-v11/timepicker_pm_btn_on.xml
deleted file mode 100644
index 516adba02..000000000
--- a/astrid/res/drawable-v11/timepicker_pm_btn_on.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/date_shortcut_bottom.xml b/astrid/res/drawable/date_shortcut_bottom.xml
deleted file mode 100644
index aba6749ee..000000000
--- a/astrid/res/drawable/date_shortcut_bottom.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/date_shortcut_bottom_off.xml b/astrid/res/drawable/date_shortcut_bottom_off.xml
deleted file mode 100644
index f5b68c836..000000000
--- a/astrid/res/drawable/date_shortcut_bottom_off.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/date_shortcut_bottom_on.xml b/astrid/res/drawable/date_shortcut_bottom_on.xml
deleted file mode 100644
index a7e18559c..000000000
--- a/astrid/res/drawable/date_shortcut_bottom_on.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/date_shortcut_middle.xml b/astrid/res/drawable/date_shortcut_middle.xml
deleted file mode 100644
index 33c5f98ba..000000000
--- a/astrid/res/drawable/date_shortcut_middle.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/date_shortcut_middle_off.xml b/astrid/res/drawable/date_shortcut_middle_off.xml
deleted file mode 100644
index c5e383250..000000000
--- a/astrid/res/drawable/date_shortcut_middle_off.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/date_shortcut_middle_on.xml b/astrid/res/drawable/date_shortcut_middle_on.xml
deleted file mode 100644
index 4510b989d..000000000
--- a/astrid/res/drawable/date_shortcut_middle_on.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/date_shortcut_standalone.xml b/astrid/res/drawable/date_shortcut_standalone.xml
deleted file mode 100644
index 412447409..000000000
--- a/astrid/res/drawable/date_shortcut_standalone.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/date_shortcut_standalone_off.xml b/astrid/res/drawable/date_shortcut_standalone_off.xml
deleted file mode 100644
index 3983d6b38..000000000
--- a/astrid/res/drawable/date_shortcut_standalone_off.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/date_shortcut_standalone_on.xml b/astrid/res/drawable/date_shortcut_standalone_on.xml
deleted file mode 100644
index 38575b708..000000000
--- a/astrid/res/drawable/date_shortcut_standalone_on.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/date_shortcut_top.xml b/astrid/res/drawable/date_shortcut_top.xml
deleted file mode 100644
index e0b4cb721..000000000
--- a/astrid/res/drawable/date_shortcut_top.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/date_shortcut_top_off.xml b/astrid/res/drawable/date_shortcut_top_off.xml
deleted file mode 100644
index ce05810fa..000000000
--- a/astrid/res/drawable/date_shortcut_top_off.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/date_shortcut_top_on.xml b/astrid/res/drawable/date_shortcut_top_on.xml
deleted file mode 100644
index 53e90079c..000000000
--- a/astrid/res/drawable/date_shortcut_top_on.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/deadline_timepicker_button_bl.xml b/astrid/res/drawable/deadline_timepicker_button_bl.xml
deleted file mode 100644
index d477daf4b..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_bl.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/deadline_timepicker_button_bl_off.xml b/astrid/res/drawable/deadline_timepicker_button_bl_off.xml
deleted file mode 100644
index 59c387054..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_bl_off.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/deadline_timepicker_button_bl_on.xml b/astrid/res/drawable/deadline_timepicker_button_bl_on.xml
deleted file mode 100644
index 7bd7de7d2..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_bl_on.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/deadline_timepicker_button_br.xml b/astrid/res/drawable/deadline_timepicker_button_br.xml
deleted file mode 100644
index 3d7b3ec91..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_br.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/deadline_timepicker_button_br_off.xml b/astrid/res/drawable/deadline_timepicker_button_br_off.xml
deleted file mode 100644
index 24a48b14a..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_br_off.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/deadline_timepicker_button_br_on.xml b/astrid/res/drawable/deadline_timepicker_button_br_on.xml
deleted file mode 100644
index 4358d6aaa..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_br_on.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/deadline_timepicker_button_tl.xml b/astrid/res/drawable/deadline_timepicker_button_tl.xml
deleted file mode 100644
index 47390f5ae..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_tl.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/deadline_timepicker_button_tl_off.xml b/astrid/res/drawable/deadline_timepicker_button_tl_off.xml
deleted file mode 100644
index 881f6e75d..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_tl_off.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/deadline_timepicker_button_tl_on.xml b/astrid/res/drawable/deadline_timepicker_button_tl_on.xml
deleted file mode 100644
index e0881be13..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_tl_on.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/deadline_timepicker_button_tr.xml b/astrid/res/drawable/deadline_timepicker_button_tr.xml
deleted file mode 100644
index 4e1df4b2f..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_tr.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/deadline_timepicker_button_tr_off.xml b/astrid/res/drawable/deadline_timepicker_button_tr_off.xml
deleted file mode 100644
index bed5dff03..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_tr_off.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/deadline_timepicker_button_tr_on.xml b/astrid/res/drawable/deadline_timepicker_button_tr_on.xml
deleted file mode 100644
index 2f599207a..000000000
--- a/astrid/res/drawable/deadline_timepicker_button_tr_on.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/timepicker_am_btn.xml b/astrid/res/drawable/timepicker_am_btn.xml
deleted file mode 100644
index 8caf019f1..000000000
--- a/astrid/res/drawable/timepicker_am_btn.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/timepicker_am_btn_off.xml b/astrid/res/drawable/timepicker_am_btn_off.xml
deleted file mode 100644
index 191e7274f..000000000
--- a/astrid/res/drawable/timepicker_am_btn_off.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/timepicker_am_btn_on.xml b/astrid/res/drawable/timepicker_am_btn_on.xml
deleted file mode 100644
index 23aa37938..000000000
--- a/astrid/res/drawable/timepicker_am_btn_on.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/timepicker_down_btn.xml b/astrid/res/drawable/timepicker_down_btn.xml
deleted file mode 100644
index 61a252a88..000000000
--- a/astrid/res/drawable/timepicker_down_btn.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/timepicker_pm_btn.xml b/astrid/res/drawable/timepicker_pm_btn.xml
deleted file mode 100644
index b49dbdee3..000000000
--- a/astrid/res/drawable/timepicker_pm_btn.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/drawable/timepicker_pm_btn_off.xml b/astrid/res/drawable/timepicker_pm_btn_off.xml
deleted file mode 100644
index e32322c1a..000000000
--- a/astrid/res/drawable/timepicker_pm_btn_off.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/timepicker_pm_btn_on.xml b/astrid/res/drawable/timepicker_pm_btn_on.xml
deleted file mode 100644
index 0048693b8..000000000
--- a/astrid/res/drawable/timepicker_pm_btn_on.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/astrid/res/drawable/timepicker_up_btn.xml b/astrid/res/drawable/timepicker_up_btn.xml
deleted file mode 100644
index 5428aeeb6..000000000
--- a/astrid/res/drawable/timepicker_up_btn.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/astrid/res/layout/astrid_time_picker.xml b/astrid/res/layout/astrid_time_picker.xml
index d95d3dd26..21d71ba55 100644
--- a/astrid/res/layout/astrid_time_picker.xml
+++ b/astrid/res/layout/astrid_time_picker.xml
@@ -39,7 +39,6 @@
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:textSize="18sp"
- android:background="@drawable/timepicker_am_btn"
android:gravity="center"
android:textColor="@color/task_edit_toggle_button_text"
android:layout_weight="1"
@@ -51,7 +50,6 @@
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:textSize="18sp"
- android:background="@drawable/timepicker_pm_btn"
android:gravity="center"
android:textColor="@color/task_edit_toggle_button_text"
android:layout_weight="1"
diff --git a/astrid/res/layout/number_picker.xml b/astrid/res/layout/number_picker.xml
index 62959d131..00178a30a 100644
--- a/astrid/res/layout/number_picker.xml
+++ b/astrid/res/layout/number_picker.xml
@@ -21,7 +21,6 @@
diff --git a/astrid/src/com/todoroo/astrid/ui/AstridTimePicker.java b/astrid/src/com/todoroo/astrid/ui/AstridTimePicker.java
index 45060787f..33456b315 100644
--- a/astrid/src/com/todoroo/astrid/ui/AstridTimePicker.java
+++ b/astrid/src/com/todoroo/astrid/ui/AstridTimePicker.java
@@ -3,8 +3,10 @@ package com.todoroo.astrid.ui;
import java.util.Calendar;
import android.content.Context;
+import android.content.res.Resources;
import android.text.format.DateUtils;
import android.util.AttributeSet;
+import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CompoundButton;
@@ -31,6 +33,8 @@ public class AstridTimePicker extends LinearLayout {
public void timePickerEnabledChanged(boolean hasTime);
}
+
+
public AstridTimePicker(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -42,9 +46,40 @@ public class AstridTimePicker extends LinearLayout {
hours = (NumberPicker) findViewById(R.id.hours);
minutes = (NumberPicker) findViewById(R.id.minutes);
+ setupButtonBackgrounds(context);
+
initialize(context);
}
+ private void setupButtonBackgrounds(Context context) {
+ Resources r = context.getResources();
+ TypedValue onColor = new TypedValue();
+ context.getTheme().resolveAttribute(R.attr.asThemeTextColor, onColor, false);
+
+ int onColorValue = r.getColor(onColor.data);
+ int offColorValue = r.getColor(android.R.color.transparent);
+ int borderColorValue = r.getColor(R.color.task_edit_deadline_gray);
+ int cornerRadius = (int) (5 * r.getDisplayMetrics().density);
+ int strokeWidth = (int) (2 * r.getDisplayMetrics().density);
+
+ amButton.setBackgroundDrawable(CustomBorderDrawable.customButton(cornerRadius, 0, 0, cornerRadius,
+ onColorValue, offColorValue, borderColorValue, strokeWidth));
+ pmButton.setBackgroundDrawable(CustomBorderDrawable.customButton(0, cornerRadius, cornerRadius, 0,
+ onColorValue, offColorValue, borderColorValue, strokeWidth));
+ noTimeCheck.setBackgroundDrawable(CustomBorderDrawable.customButton(cornerRadius, cornerRadius, cornerRadius, cornerRadius,
+ onColorValue, offColorValue, borderColorValue, strokeWidth));
+
+ hours.findViewById(R.id.increment).setBackgroundDrawable(
+ CustomBorderDrawable.customButton(cornerRadius, 0, 0, 0, onColorValue, offColorValue, borderColorValue, strokeWidth));
+ hours.findViewById(R.id.decrement).setBackgroundDrawable(
+ CustomBorderDrawable.customButton(0, 0, 0, cornerRadius, onColorValue, offColorValue, borderColorValue, strokeWidth));
+
+ minutes.findViewById(R.id.increment).setBackgroundDrawable(
+ CustomBorderDrawable.customButton(0, cornerRadius, 0, 0, onColorValue, offColorValue, borderColorValue, strokeWidth));
+ minutes.findViewById(R.id.decrement).setBackgroundDrawable(
+ CustomBorderDrawable.customButton(0, 0, cornerRadius, 0, onColorValue, offColorValue, borderColorValue, strokeWidth));
+ }
+
private void initialize(Context context) {
if (DateUtilities.is24HourFormat(context)) {
hours.setRange(0, 23);
@@ -65,11 +100,7 @@ public class AstridTimePicker extends LinearLayout {
}
};
- hours.findViewById(R.id.increment).setBackgroundResource(R.drawable.deadline_timepicker_button_tl);
- hours.findViewById(R.id.decrement).setBackgroundResource(R.drawable.deadline_timepicker_button_bl);
hours.findViewById(R.id.timepicker_left_border).setVisibility(View.VISIBLE);
- minutes.findViewById(R.id.increment).setBackgroundResource(R.drawable.deadline_timepicker_button_tr);
- minutes.findViewById(R.id.decrement).setBackgroundResource(R.drawable.deadline_timepicker_button_br);
minutes.findViewById(R.id.timepicker_right_border).setVisibility(View.VISIBLE);
String amString = DateUtils.getAMPMString(Calendar.AM).toLowerCase();
@@ -102,7 +133,6 @@ public class AstridTimePicker extends LinearLayout {
}
});
- noTimeCheck.setBackgroundResource(R.drawable.date_shortcut_standalone);
String noTime = context.getString(R.string.TEA_no_time).toLowerCase();
noTimeCheck.setTextOff(noTime);
noTimeCheck.setTextOn(noTime);
diff --git a/astrid/src/com/todoroo/astrid/ui/CustomBorderDrawable.java b/astrid/src/com/todoroo/astrid/ui/CustomBorderDrawable.java
new file mode 100644
index 000000000..ebccc21c5
--- /dev/null
+++ b/astrid/src/com/todoroo/astrid/ui/CustomBorderDrawable.java
@@ -0,0 +1,50 @@
+package com.todoroo.astrid.ui;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.StateListDrawable;
+import android.graphics.drawable.shapes.RoundRectShape;
+import android.graphics.drawable.shapes.Shape;
+
+public class CustomBorderDrawable extends ShapeDrawable {
+ private final Paint fillpaint, strokepaint;
+ private final float strokeWidth;
+
+ public CustomBorderDrawable(Shape s, int fill, int stroke, int strokeWidth) {
+ super(s);
+ fillpaint = new Paint(this.getPaint());
+ fillpaint.setColor(fill);
+ strokepaint = new Paint(fillpaint);
+ strokepaint.setStyle(Paint.Style.STROKE);
+ strokepaint.setStrokeWidth(strokeWidth);
+ strokepaint.setColor(stroke);
+ this.strokeWidth = strokeWidth;
+ }
+
+ @Override
+ protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
+ shape.resize(canvas.getWidth(), canvas.getHeight());
+ shape.draw(canvas, fillpaint);
+
+ Matrix matrix = new Matrix();
+ matrix.setRectToRect(new RectF(0, 0, canvas.getWidth(), canvas.getHeight()),
+ new RectF(strokeWidth/2, strokeWidth/2, canvas.getWidth() - strokeWidth/2, canvas.getHeight() - strokeWidth/2),
+ Matrix.ScaleToFit.FILL);
+ canvas.concat(matrix);
+ shape.draw(canvas, strokepaint);
+ }
+
+ public static StateListDrawable customButton(int tl, int tr, int br, int bl, int onColor, int offColor, int borderColor, int strokeWidth) {
+ Shape shape = new RoundRectShape(new float[] { tl, tl, tr, tr, br, br, bl, bl}, null, null);
+ ShapeDrawable sdOn = new CustomBorderDrawable(shape, onColor, borderColor, strokeWidth);
+ ShapeDrawable sdOff = new CustomBorderDrawable(shape, offColor, borderColor, strokeWidth);
+
+ StateListDrawable stld = new StateListDrawable();
+ stld.addState(new int[] { android.R.attr.state_pressed }, sdOn);
+ stld.addState(new int[] { android.R.attr.state_checked }, sdOn);
+ stld.addState(new int[] { android.R.attr.state_enabled }, sdOff);
+ return stld;
+ }
+}
diff --git a/astrid/src/com/todoroo/astrid/ui/DateAndTimePicker.java b/astrid/src/com/todoroo/astrid/ui/DateAndTimePicker.java
index 95caa1010..babb91da6 100644
--- a/astrid/src/com/todoroo/astrid/ui/DateAndTimePicker.java
+++ b/astrid/src/com/todoroo/astrid/ui/DateAndTimePicker.java
@@ -4,8 +4,10 @@ import java.util.ArrayList;
import java.util.Date;
import android.content.Context;
+import android.content.res.Resources;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
+import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -132,7 +134,17 @@ public class DateAndTimePicker extends LinearLayout {
urgencyValues.add(new UrgencyValue(labels[0],
Task.URGENCY_NONE));
- DisplayMetrics metrics = context.getResources().getDisplayMetrics();
+ Resources r = context.getResources();
+ DisplayMetrics metrics = r.getDisplayMetrics();
+ TypedValue onColor = new TypedValue();
+ context.getTheme().resolveAttribute(R.attr.asThemeTextColor, onColor, false);
+
+ int onColorValue = r.getColor(onColor.data);
+ int offColorValue = r.getColor(android.R.color.transparent);
+ int borderColorValue = r.getColor(R.color.task_edit_deadline_gray);
+ int cornerRadius = (int) (5 * r.getDisplayMetrics().density);
+ int strokeWidth = (int) (2 * r.getDisplayMetrics().density);
+
for (int i = 0; i < urgencyValues.size(); i++) {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, (int) (42 * metrics.density), 0);
UrgencyValue uv = urgencyValues.get(i);
@@ -143,16 +155,16 @@ public class DateAndTimePicker extends LinearLayout {
tb.setTextOn(label);
tb.setTag(uv);
if (i == 0) {
- tb.setBackgroundResource(R.drawable.date_shortcut_top);
+ tb.setBackgroundDrawable(CustomBorderDrawable.customButton(cornerRadius, cornerRadius, 0, 0, onColorValue, offColorValue, borderColorValue, strokeWidth));
} else if (i == urgencyValues.size() - 2) {
lp.topMargin = (int) (-2 * metrics.density);
- tb.setBackgroundResource(R.drawable.date_shortcut_bottom);
+ tb.setBackgroundDrawable(CustomBorderDrawable.customButton(0, 0, cornerRadius, cornerRadius, onColorValue, offColorValue, borderColorValue, strokeWidth));
} else if (i == urgencyValues.size() - 1) {
lp.topMargin = (int) (5 * metrics.density);
- tb.setBackgroundResource(R.drawable.date_shortcut_standalone);
+ tb.setBackgroundDrawable(CustomBorderDrawable.customButton(cornerRadius, cornerRadius, cornerRadius, cornerRadius, onColorValue, offColorValue, borderColorValue, strokeWidth));
} else {
lp.topMargin = (int) (-2 * metrics.density);
- tb.setBackgroundResource(R.drawable.date_shortcut_middle);
+ tb.setBackgroundDrawable(CustomBorderDrawable.customButton(0, 0, 0, 0, onColorValue, offColorValue, borderColorValue, strokeWidth));
}
int verticalPadding = (int) (SHORTCUT_PADDING * metrics.density);
tb.setPadding(0, verticalPadding, 0, verticalPadding);