/*if (dueDate != null) {
            SimpleDateFormat sdf = new SimpleDateFormat(TodoItem.DUE_DATE_FORMAT);
            Date date = new Date();
            try {
                date = sdf.parse(dueDate);
            } catch (ParseException e) {
                Log.w(getClass().getSimpleName(), "Failed to parse due date, '" + dueDate + "' using format " + TodoItem.DUE_DATE_FORMAT);
            }
            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            datePicker.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
        }*/
private void configureEditableItem() {
        String editText = item.getText();
        etEditItem = (EditText) findViewById(R.id.etEditItem);
        etEditItem.setText(editText);
        etEditItem.setSelection(editText.length());
        // TODO: allow user to not choose a date (and make the datepicker look a lot better)
        etDueDate = (EditText) findViewById(R.id.etDueDate);
        String dueDate = item.getDueDate();
        etDueDate.setText(dueDate);
        /*if (dueDate != null) {
            SimpleDateFormat sdf = new SimpleDateFormat(TodoItem.DUE_DATE_FORMAT);
            Date date = new Date();
            try {
                date = sdf.parse(dueDate);
            } catch (ParseException e) {
                Log.w(getClass().getSimpleName(), "Failed to parse due date, '" + dueDate + "' using format " + TodoItem.DUE_DATE_FORMAT);
            }
            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            datePicker.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
        }*/
        spPriority = (Spinner) findViewById(R.id.spinnerPriority);
        ArrayAdapter<TodoItem.Priority> priorityAdapter = new ArrayAdapter<TodoItem.Priority>(
                this, android.R.layout.simple_list_item_1, TodoItem.Priority.values());
        spPriority.setAdapter(priorityAdapter);
        int priorityIndex = item.getPriority().ordinal();
        spPriority.setSelection(priorityIndex);
    }
String dueDate = item.getDueDate();
etDueDate.setText(dueDate);
/*if (dueDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat(TodoItem.DUE_DATE_FORMAT);
Date date = new Date();
try {
date = sdf.parse(dueDate);
} catch (ParseException e) {
Log.w(getClass().getSimpleName(), "Failed to parse due date, '" + dueDate + "' using format " + TodoItem.DUE_DATE_FORMAT);
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
datePicker.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
}*/
spPriority = (Spinner) findViewById(R.id.spinnerPriority);
ArrayAdapter<TodoItem.Priority> priorityAdapter = new ArrayAdapter<TodoItem.Priority>(
private void configureEditableItem() {
String editText = item.getText();
etEditItem = (EditText) findViewById(R.id.etEditItem);
etEditItem.setText(editText);
etEditItem.setSelection(editText.length());
// TODO: allow user to not choose a date (and make the datepicker look a lot better)
etDueDate = (EditText) findViewById(R.id.etDueDate);
String dueDate = item.getDueDate();
etDueDate.setText(dueDate);
/*if (dueDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat(TodoItem.DUE_DATE_FORMAT);
Date date = new Date();
try {
date = sdf.parse(dueDate);
} catch (ParseException e) {
Log.w(getClass().getSimpleName(), "Failed to parse due date, '" + dueDate + "' using format " + TodoItem.DUE_DATE_FORMAT);
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
datePicker.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
}*/
spPriority = (Spinner) findViewById(R.id.spinnerPriority);
ArrayAdapter<TodoItem.Priority> priorityAdapter = new ArrayAdapter<TodoItem.Priority>(
this, android.R.layout.simple_list_item_1, TodoItem.Priority.values());
spPriority.setAdapter(priorityAdapter);
int priorityIndex = item.getPriority().ordinal();
spPriority.setSelection(priorityIndex);
}
private void configureEditableItem() {
String editText = item.getText();
etEditItem = (EditText) findViewById(R.id.etEditItem);
etEditItem.setText(editText);
etEditItem.setSelection(editText.length());
// TODO: allow user to not choose a date (and make the datepicker look a lot better)
etDueDate = (EditText) findViewById(R.id.etDueDate);
String dueDate = item.getDueDate();
etDueDate.setText(dueDate);
/*if (dueDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat(TodoItem.DUE_DATE_FORMAT);
Date date = new Date();
try {
date = sdf.parse(dueDate);
} catch (ParseException e) {
Log.w(getClass().getSimpleName(), "Failed to parse due date, '" + dueDate + "' using format " + TodoItem.DUE_DATE_FORMAT);
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
datePicker.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
}*/
spPriority = (Spinner) findViewById(R.id.spinnerPriority);
ArrayAdapter<TodoItem.Priority> priorityAdapter = new ArrayAdapter<TodoItem.Priority>(
this, android.R.layout.simple_list_item_1, TodoItem.Priority.values());
spPriority.setAdapter(priorityAdapter);
int priorityIndex = item.getPriority().ordinal();
spPriority.setSelection(priorityIndex);
}