killed dead code, added calendar picker to alarms

pull/14/head
Tim Su 14 years ago
parent 77c674c461
commit b56e6af02e

@ -22,17 +22,21 @@ package com.todoroo.andlib.widget;
import java.text.Format;
import java.util.Date;
import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.TimePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnDismissListener;
import android.text.format.DateFormat;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TimePicker;
import com.todoroo.astrid.ui.CalendarDialog;
public class DateControlSet implements OnTimeSetListener,
OnDateSetListener, View.OnClickListener {
@ -106,12 +110,32 @@ public class DateControlSet implements OnTimeSetListener,
timeButton.setText(timeFormatter.format(date));
}
private boolean dialogCancelled = false;
public void onClick(View v) {
if(v == timeButton)
new TimePickerDialog(context, this, date.getHours(),
date.getMinutes(), false).show();
else
new DatePickerDialog(context, this, 1900 +
date.getYear(), date.getMonth(), date.getDate()).show();
else if(v == dateButton){
final CalendarDialog calendarDialog = new CalendarDialog(context, date);
calendarDialog.show();
calendarDialog.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface arg0) {
if (!dialogCancelled) {
date = calendarDialog.getCalendarDate();
updateDate();
}
dialogCancelled = false;
}
});
calendarDialog.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface arg0) {
dialogCancelled = true;
}
});
}
}
}

@ -30,6 +30,7 @@
android:layout_height="wrap_content"
android:hint="@string/TEA_title_hint"
android:autoText="true"
android:text=""
android:capitalize="sentences" />
<!-- importance -->

@ -940,10 +940,6 @@ public final class TaskEditActivity extends TabActivity {
}
});
/***** Calendar Dialog Changes -- End *****/
// DatePickerDialog datePicker = new DatePickerDialog(TaskEditActivity.this,
// this, 1900 + customDate.getYear(), customDate.getMonth(), customDate.getDate());
// datePicker.setOnCancelListener(this);
// datePicker.show();
spinner.setSelection(previousSetting);
} else {
@ -984,32 +980,6 @@ public final class TaskEditActivity extends TabActivity {
timePicker.show();
}
/*public void onDateSet(DatePicker view, int year, int month, int monthDay) {
customDate.setYear(year - 1900);
customDate.setMonth(month);
customDate.setDate(monthDay);
customDate.setMinutes(0);
if(customSetting != Task.URGENCY_SPECIFIC_DAY_TIME) {
customDateFinished();
return;
}
boolean specificTime = existingDateHour != SPECIFIC_DATE;
if(existingDateHour < 0) {
existingDateHour = customDate.getHours();
existingDateMinutes= customDate.getMinutes();
}
DeadlineTimePickerDialog timePicker = new DeadlineTimePickerDialog(TaskEditActivity.this, this,
existingDateHour, existingDateMinutes,
DateUtilities.is24HourFormat(TaskEditActivity.this),
specificTime);
timePicker.setOnCancelListener(this);
timePicker.show();
}*/
public void onTimeSet(TimePicker view, boolean hasTime, int hourOfDay, int minute) {
if(!hasTime)
customSetting = Task.URGENCY_SPECIFIC_DAY;

Loading…
Cancel
Save