|
|
@ -26,7 +26,9 @@ import android.view.View;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.Button;
|
|
|
|
|
|
|
|
|
|
|
|
import com.timsu.astrid.R;
|
|
|
|
import com.timsu.astrid.R;
|
|
|
|
|
|
|
|
import com.todoroo.andlib.data.Property.IntegerProperty;
|
|
|
|
import com.todoroo.andlib.service.DependencyInjectionService;
|
|
|
|
import com.todoroo.andlib.service.DependencyInjectionService;
|
|
|
|
|
|
|
|
import com.todoroo.astrid.data.Task;
|
|
|
|
import com.todoroo.astrid.ui.NNumberPickerDialog.OnNNumberPickedListener;
|
|
|
|
import com.todoroo.astrid.ui.NNumberPickerDialog.OnNNumberPickedListener;
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("nls")
|
|
|
|
@SuppressWarnings("nls")
|
|
|
@ -40,19 +42,26 @@ public class TimeDurationControlSet implements OnNNumberPickedListener,
|
|
|
|
private int[] initialValues = null;
|
|
|
|
private int[] initialValues = null;
|
|
|
|
private final int titleResource;
|
|
|
|
private final int titleResource;
|
|
|
|
private NNumberPickerDialog dialog = null;
|
|
|
|
private NNumberPickerDialog dialog = null;
|
|
|
|
|
|
|
|
private Task model;
|
|
|
|
|
|
|
|
private final IntegerProperty property;
|
|
|
|
|
|
|
|
|
|
|
|
public TimeDurationControlSet(Activity activity, View view, int timeButtonId,
|
|
|
|
public TimeDurationControlSet(Activity activity, View view, IntegerProperty property,
|
|
|
|
int prefixResource, int titleResource) {
|
|
|
|
int timeButtonId, int prefixResource, int titleResource) {
|
|
|
|
DependencyInjectionService.getInstance().inject(this);
|
|
|
|
DependencyInjectionService.getInstance().inject(this);
|
|
|
|
|
|
|
|
|
|
|
|
this.activity = activity;
|
|
|
|
this.activity = activity;
|
|
|
|
this.prefixResource = prefixResource;
|
|
|
|
this.prefixResource = prefixResource;
|
|
|
|
this.titleResource = titleResource;
|
|
|
|
this.titleResource = titleResource;
|
|
|
|
|
|
|
|
this.property = property;
|
|
|
|
|
|
|
|
|
|
|
|
timeButton = (Button)view.findViewById(timeButtonId);
|
|
|
|
timeButton = (Button)view.findViewById(timeButtonId);
|
|
|
|
timeButton.setOnClickListener(this);
|
|
|
|
timeButton.setOnClickListener(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setModel(Task model) {
|
|
|
|
|
|
|
|
this.model = model;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getTimeDurationInSeconds() {
|
|
|
|
public int getTimeDurationInSeconds() {
|
|
|
|
return timeDuration;
|
|
|
|
return timeDuration;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -76,6 +85,9 @@ public class TimeDurationControlSet implements OnNNumberPickedListener,
|
|
|
|
int hours = timeDuration / 3600;
|
|
|
|
int hours = timeDuration / 3600;
|
|
|
|
int minutes = timeDuration / 60 - 60 * hours;
|
|
|
|
int minutes = timeDuration / 60 - 60 * hours;
|
|
|
|
initialValues = new int[] { hours, minutes };
|
|
|
|
initialValues = new int[] { hours, minutes };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
|
|
|
model.setValue(property, timeDuration);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Called when NumberPicker activity is completed */
|
|
|
|
/** Called when NumberPicker activity is completed */
|
|
|
|