From 467bc2651c8af553e42da44c2880c2b3a63e5115 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 6 Jun 2012 14:16:27 -0700 Subject: [PATCH] Timer control bug fixes, some text color polish --- .../todoroo/astrid/timers/TimerControlSet.java | 3 ++- astrid/res/layout/control_dialog_ok.xml | 1 + astrid/res/layout/number_picker.xml | 1 + .../astrid/ui/TimeDurationControlSet.java | 16 ++++++++++++++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/timers/TimerControlSet.java b/astrid/plugin-src/com/todoroo/astrid/timers/TimerControlSet.java index 991a34b3c..881225303 100644 --- a/astrid/plugin-src/com/todoroo/astrid/timers/TimerControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/timers/TimerControlSet.java @@ -68,12 +68,13 @@ public class TimerControlSet extends PopupControlSet implements TimerActionListe int prefixResource, int titleResource) { super(activity, -1); this.property = property; - this.controlSet = new TimeDurationControlSet(activity, v, + this.controlSet = new TimeDurationControlSet(activity, v, property, timeButtonId, prefixResource, titleResource); } @Override public void readFromTaskOnInitialize() { + controlSet.setModel(model); controlSet.setTimeDuration(model.getValue(property)); } diff --git a/astrid/res/layout/control_dialog_ok.xml b/astrid/res/layout/control_dialog_ok.xml index 55b1dc07a..3db2909f0 100644 --- a/astrid/res/layout/control_dialog_ok.xml +++ b/astrid/res/layout/control_dialog_ok.xml @@ -9,5 +9,6 @@ android:layout_gravity="center_horizontal" android:background="@drawable/footer_editbutton" android:textStyle="bold" + android:textColor="@android:color/black" android:layout_alignParentBottom="true" android:text="@string/DLG_ok"/> \ No newline at end of file diff --git a/astrid/res/layout/number_picker.xml b/astrid/res/layout/number_picker.xml index 62959d131..4dfe7813f 100644 --- a/astrid/res/layout/number_picker.xml +++ b/astrid/res/layout/number_picker.xml @@ -28,6 +28,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" style="?android:attr/textAppearanceLargeInverse" + android:textColor="@android:color/black" android:gravity="center" android:inputType="phone" android:textSize="30sp" diff --git a/astrid/src/com/todoroo/astrid/ui/TimeDurationControlSet.java b/astrid/src/com/todoroo/astrid/ui/TimeDurationControlSet.java index 6ccab9231..fb037d1c7 100644 --- a/astrid/src/com/todoroo/astrid/ui/TimeDurationControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/TimeDurationControlSet.java @@ -26,7 +26,9 @@ import android.view.View; import android.widget.Button; import com.timsu.astrid.R; +import com.todoroo.andlib.data.Property.IntegerProperty; import com.todoroo.andlib.service.DependencyInjectionService; +import com.todoroo.astrid.data.Task; import com.todoroo.astrid.ui.NNumberPickerDialog.OnNNumberPickedListener; @SuppressWarnings("nls") @@ -40,19 +42,26 @@ public class TimeDurationControlSet implements OnNNumberPickedListener, private int[] initialValues = null; private final int titleResource; private NNumberPickerDialog dialog = null; + private Task model; + private final IntegerProperty property; - public TimeDurationControlSet(Activity activity, View view, int timeButtonId, - int prefixResource, int titleResource) { + public TimeDurationControlSet(Activity activity, View view, IntegerProperty property, + int timeButtonId, int prefixResource, int titleResource) { DependencyInjectionService.getInstance().inject(this); this.activity = activity; this.prefixResource = prefixResource; this.titleResource = titleResource; + this.property = property; timeButton = (Button)view.findViewById(timeButtonId); timeButton.setOnClickListener(this); } + public void setModel(Task model) { + this.model = model; + } + public int getTimeDurationInSeconds() { return timeDuration; } @@ -76,6 +85,9 @@ public class TimeDurationControlSet implements OnNNumberPickedListener, int hours = timeDuration / 3600; int minutes = timeDuration / 60 - 60 * hours; initialValues = new int[] { hours, minutes }; + + if (model != null) + model.setValue(property, timeDuration); } /** Called when NumberPicker activity is completed */