Themed the custom buttons in the time picker and removed all those nasty shape drawables

pull/14/head
Sam Bosley 13 years ago
parent 2dc7e45a0d
commit 9453b3b3d6

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:bottomLeftRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:bottomLeftRadius="5dip"/>
</shape>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:bottomRightRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:bottomRightRadius="5dip"/>
</shape>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:topLeftRadius="5dip"
android:bottomLeftRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:topLeftRadius="5dip"
android:bottomLeftRadius="5dip"/>
</shape>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:topRightRadius="5dip"
android:bottomRightRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:topRightRadius="5dip"
android:bottomRightRadius="5dip"/>
</shape>

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/date_shortcut_bottom_off" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/date_shortcut_bottom_on" />
</selector>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:bottomRightRadius="5dip"
android:bottomLeftRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:bottomRightRadius="5dip"
android:bottomLeftRadius="5dip"/>
</shape>

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/date_shortcut_middle_off" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/date_shortcut_middle_on" />
</selector>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/blue_theme_color"/>
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
</shape>

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/date_shortcut_standalone_off" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/date_shortcut_standalone_on" />
</selector>

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:topLeftRadius="5dip"
android:topRightRadius="5dip"
android:bottomLeftRadius="5dip"
android:bottomRightRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:topLeftRadius="5dip"
android:topRightRadius="5dip"
android:bottomLeftRadius="5dip"
android:bottomRightRadius="5dip"/>
</shape>

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/date_shortcut_top_off" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/date_shortcut_top_on" />
</selector>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:topLeftRadius="5dip"
android:topRightRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:topLeftRadius="5dip"
android:topRightRadius="5dip"/>
</shape>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false"
android:drawable="@drawable/deadline_timepicker_button_bl_off" />
<item android:state_pressed="true"
android:drawable="@drawable/deadline_timepicker_button_bl_on" />
</selector>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:bottomRightRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:bottomRightRadius="5dip"/>
</shape>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false"
android:drawable="@drawable/deadline_timepicker_button_br_off" />
<item android:state_pressed="true"
android:drawable="@drawable/deadline_timepicker_button_br_on" />
</selector>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:bottomLeftRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:bottomLeftRadius="5dip"/>
</shape>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false"
android:drawable="@drawable/deadline_timepicker_button_tl_off" />
<item android:state_pressed="true"
android:drawable="@drawable/deadline_timepicker_button_tl_on" />
</selector>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:topLeftRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:topLeftRadius="5dip"/>
</shape>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false"
android:drawable="@drawable/deadline_timepicker_button_tr_off" />
<item android:state_pressed="true"
android:drawable="@drawable/deadline_timepicker_button_tr_on" />
</selector>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:topRightRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:topRightRadius="5dip"/>
</shape>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:drawable="@drawable/timepicker_am_btn_off" />
<item android:state_checked="true"
android:drawable="@drawable/timepicker_am_btn_on" />
</selector>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:topLeftRadius="5dip"
android:bottomRightRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:topLeftRadius="5dip"
android:bottomRightRadius="5dip"/>
</shape>

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:state_enabled="true"
android:state_focused="false" android:drawable="@drawable/timepicker_down_normal" />
<item android:state_pressed="true" android:state_enabled="true"
android:drawable="@drawable/timepicker_down_pressed" />
<item android:state_pressed="false" android:state_enabled="true"
android:state_focused="true" android:drawable="@drawable/timepicker_down_selected" />
<item android:state_pressed="false" android:state_enabled="false"
android:state_focused="false" android:drawable="@drawable/timepicker_down_disabled" />
<item android:state_pressed="false" android:state_enabled="false"
android:state_focused="true" android:drawable="@drawable/timepicker_down_disabled_focused" />
</selector>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:drawable="@drawable/timepicker_pm_btn_off" />
<item android:state_checked="true"
android:drawable="@drawable/timepicker_pm_btn_on" />
</selector>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<corners
android:topRightRadius="5dip"
android:bottomLeftRadius="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dip"
android:color="@color/task_edit_deadline_gray"/>
<solid
android:color="@color/blue_theme_color"/>
<corners
android:topRightRadius="5dip"
android:bottomLeftRadius="5dip"/>
</shape>

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:state_enabled="true"
android:state_focused="false" android:drawable="@drawable/timepicker_up_normal" />
<item android:state_pressed="true" android:state_enabled="true"
android:drawable="@drawable/timepicker_up_pressed" />
<item android:state_pressed="false" android:state_enabled="true"
android:state_focused="true" android:drawable="@drawable/timepicker_up_selected" />
<item android:state_pressed="false" android:state_enabled="false"
android:state_focused="false" android:drawable="@drawable/timepicker_up_disabled" />
<item android:state_pressed="false" android:state_enabled="false"
android:state_focused="true" android:drawable="@drawable/timepicker_up_disabled_focused" />
</selector>

@ -39,7 +39,6 @@
android:paddingTop="8dip" android:paddingTop="8dip"
android:paddingBottom="8dip" android:paddingBottom="8dip"
android:textSize="18sp" android:textSize="18sp"
android:background="@drawable/timepicker_am_btn"
android:gravity="center" android:gravity="center"
android:textColor="@color/task_edit_toggle_button_text" android:textColor="@color/task_edit_toggle_button_text"
android:layout_weight="1" android:layout_weight="1"
@ -51,7 +50,6 @@
android:paddingTop="8dip" android:paddingTop="8dip"
android:paddingBottom="8dip" android:paddingBottom="8dip"
android:textSize="18sp" android:textSize="18sp"
android:background="@drawable/timepicker_pm_btn"
android:gravity="center" android:gravity="center"
android:textColor="@color/task_edit_toggle_button_text" android:textColor="@color/task_edit_toggle_button_text"
android:layout_weight="1" android:layout_weight="1"

@ -21,7 +21,6 @@
<com.todoroo.astrid.ui.NumberPickerButton android:id="@+id/increment" <com.todoroo.astrid.ui.NumberPickerButton android:id="@+id/increment"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/timepicker_up_btn"
/> />
<EditText android:id="@+id/timepicker_input" <EditText android:id="@+id/timepicker_input"
@ -37,7 +36,6 @@
<com.todoroo.astrid.ui.NumberPickerButton android:id="@+id/decrement" <com.todoroo.astrid.ui.NumberPickerButton android:id="@+id/decrement"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/timepicker_down_btn"
/> />
</merge> </merge>

@ -3,8 +3,10 @@ package com.todoroo.astrid.ui;
import java.util.Calendar; import java.util.Calendar;
import android.content.Context; import android.content.Context;
import android.content.res.Resources;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.CompoundButton; import android.widget.CompoundButton;
@ -31,6 +33,8 @@ public class AstridTimePicker extends LinearLayout {
public void timePickerEnabledChanged(boolean hasTime); public void timePickerEnabledChanged(boolean hasTime);
} }
public AstridTimePicker(Context context, AttributeSet attrs) { public AstridTimePicker(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@ -42,9 +46,40 @@ public class AstridTimePicker extends LinearLayout {
hours = (NumberPicker) findViewById(R.id.hours); hours = (NumberPicker) findViewById(R.id.hours);
minutes = (NumberPicker) findViewById(R.id.minutes); minutes = (NumberPicker) findViewById(R.id.minutes);
setupButtonBackgrounds(context);
initialize(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) { private void initialize(Context context) {
if (DateUtilities.is24HourFormat(context)) { if (DateUtilities.is24HourFormat(context)) {
hours.setRange(0, 23); 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); 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); minutes.findViewById(R.id.timepicker_right_border).setVisibility(View.VISIBLE);
String amString = DateUtils.getAMPMString(Calendar.AM).toLowerCase(); 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(); String noTime = context.getString(R.string.TEA_no_time).toLowerCase();
noTimeCheck.setTextOff(noTime); noTimeCheck.setTextOff(noTime);
noTimeCheck.setTextOn(noTime); noTimeCheck.setTextOn(noTime);

@ -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;
}
}

@ -4,8 +4,10 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import android.content.Context; import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -132,7 +134,17 @@ public class DateAndTimePicker extends LinearLayout {
urgencyValues.add(new UrgencyValue(labels[0], urgencyValues.add(new UrgencyValue(labels[0],
Task.URGENCY_NONE)); 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++) { for (int i = 0; i < urgencyValues.size(); i++) {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, (int) (42 * metrics.density), 0); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, (int) (42 * metrics.density), 0);
UrgencyValue uv = urgencyValues.get(i); UrgencyValue uv = urgencyValues.get(i);
@ -143,16 +155,16 @@ public class DateAndTimePicker extends LinearLayout {
tb.setTextOn(label); tb.setTextOn(label);
tb.setTag(uv); tb.setTag(uv);
if (i == 0) { 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) { } else if (i == urgencyValues.size() - 2) {
lp.topMargin = (int) (-2 * metrics.density); 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) { } else if (i == urgencyValues.size() - 1) {
lp.topMargin = (int) (5 * metrics.density); 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 { } else {
lp.topMargin = (int) (-2 * metrics.density); 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); int verticalPadding = (int) (SHORTCUT_PADDING * metrics.density);
tb.setPadding(0, verticalPadding, 0, verticalPadding); tb.setPadding(0, verticalPadding, 0, verticalPadding);

Loading…
Cancel
Save