Refactor -> rename

pull/14/head
Tim Su 13 years ago
parent 12f5e60b02
commit 7aacca7c18

@ -521,7 +521,7 @@ public class EditPeopleControlSet extends PopupControlSet {
// --- events
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
// Nothing, we don't lazy load this control set yet
}
@ -532,7 +532,7 @@ public class EditPeopleControlSet extends PopupControlSet {
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
// Nothing, we don't lazy load this control set yet
return null;
}

@ -39,7 +39,7 @@ public final class AlarmControlSet extends TaskEditControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
alertsContainer.removeAllViews();
TodorooCursor<Metadata> cursor = AlarmService.getInstance().getAlarms(model.getId());
try {
@ -64,7 +64,7 @@ public final class AlarmControlSet extends TaskEditControlSet {
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
LinkedHashSet<Long> alarms = new LinkedHashSet<Long>();
for(int i = 0; i < alertsContainer.getChildCount(); i++) {
Long dateValue = (Long) alertsContainer.getChildAt(i).getTag();

@ -90,7 +90,7 @@ public class GCalControlSet extends PopupControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
String uri = GCalHelper.getTaskEventUri(model);
if(!TextUtils.isEmpty(uri)) {
try {
@ -121,7 +121,7 @@ public class GCalControlSet extends PopupControlSet {
@SuppressWarnings("nls")
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
boolean gcalCreateEventEnabled = Preferences.getStringValue(R.string.gcal_p_default) != null &&
!Preferences.getStringValue(R.string.gcal_p_default).equals("-1");
if ((gcalCreateEventEnabled || calendarSelector.getSelectedItemPosition() != 0) &&

@ -220,7 +220,7 @@ public class OpencrxControlSet extends PopupControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
Metadata metadata = getTaskMetadata(model.getId());
@ -337,7 +337,7 @@ public class OpencrxControlSet extends PopupControlSet {
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
Metadata metadata = getTaskMetadata(task.getId());
try {
if (metadata == null) {

@ -105,7 +105,7 @@ public class ProducteevControlSet extends PopupControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
Metadata metadata = ProducteevDataService.getInstance().getTaskMetadata(model.getId());
if(metadata == null)
metadata = ProducteevTask.newMetadata();
@ -237,7 +237,7 @@ public class ProducteevControlSet extends PopupControlSet {
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
Metadata metadata = ProducteevDataService.getInstance().getTaskMetadata(task.getId());
try {
if (metadata == null) {

@ -179,7 +179,7 @@ public class RepeatControlSet extends PopupControlSet {
@SuppressWarnings("nls")
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
Date date;
if(model.getValue(Task.DUE_DATE) == 0)
date = new Date();
@ -283,7 +283,7 @@ public class RepeatControlSet extends PopupControlSet {
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
String result;
if(!doRepeat)
result = ""; //$NON-NLS-1$

@ -238,7 +238,7 @@ public final class TagsControlSet extends PopupControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
newTags.removeAllViews();
for (int i = 0; i < selectedTags.getCount(); i++) { // clear all selected items
@ -276,7 +276,7 @@ public final class TagsControlSet extends PopupControlSet {
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
// this is a case where we're asked to save but the UI was not yet populated
if(!populated)
return null;

@ -126,12 +126,12 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
// Nothing, we don't lazy load this control set yet
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
// Nothing, we don't lazy load this control set yet
return null;
}

@ -89,12 +89,12 @@ public class TaskRabbitDeadlineControlSet extends PopupControlSet implements Tas
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
// Nothing, we don't lazy load this control set yet
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
// Nothing, we don't lazy load this control set yet
return null;
}

@ -202,12 +202,12 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
// Nothing, we don't lazy load this control set yet
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
// Nothing, we don't lazy load this control set yet
return null;
}

@ -156,7 +156,7 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
// Nothing, we don't lazy load this control set yet
}
@ -166,7 +166,7 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
// Nothing, we don't lazy load this control set yet
return null;
}

@ -194,12 +194,12 @@ public class TaskRabbitSpinnerControlSet extends TaskEditControlSet implements T
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
// Nothing, we don't lazy load this control set yet
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
// Nothing, we don't lazy load this control set yet
return null;
}

@ -36,7 +36,7 @@ public class TimerActionControlSet extends TaskEditControlSet {
@Override
@SuppressWarnings("hiding")
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
if (model.getValue(Task.TIMER_START) == 0)
timerActive = false;
else
@ -52,7 +52,7 @@ public class TimerActionControlSet extends TaskEditControlSet {
@Override
@SuppressWarnings("hiding")
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
// Nothing to do here
return null;
}

@ -29,7 +29,7 @@ public class TimerControlSet extends PopupControlSet implements TimerActionListe
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
estimated.readFromTask(model);
estimated.getView(); // force load
elapsed.readFromTask(model);
@ -47,7 +47,7 @@ public class TimerControlSet extends PopupControlSet implements TimerActionListe
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
if (initialized) {
estimated.writeToModel(task);
elapsed.writeToModel(task);
@ -75,7 +75,7 @@ public class TimerControlSet extends PopupControlSet implements TimerActionListe
}
@Override
public void readFromTaskPrivate() {
public void readFromTaskOnInitialize() {
controlSet.setTimeDuration(model.getValue(property));
}
@ -85,7 +85,7 @@ public class TimerControlSet extends PopupControlSet implements TimerActionListe
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
task.setValue(property, controlSet.getTimeDurationInSeconds());
return null;
}

@ -31,7 +31,7 @@ public abstract class TaskEditControlSet {
afterInflate();
}
if (model != null)
readFromTaskPrivate();
readFromTaskOnInitialize();
this.initialized = true;
}
return view;
@ -47,14 +47,14 @@ public abstract class TaskEditControlSet {
public void readFromTask(Task task) {
this.model = task;
if (initialized)
readFromTaskPrivate();
readFromTaskOnInitialize();
}
/**
* Called once to setup the ui with data from the task
*/
protected abstract void readFromTaskPrivate();
protected abstract void readFromTaskOnInitialize();
/**
* Write data from control set to model
@ -62,12 +62,19 @@ public abstract class TaskEditControlSet {
*/
public String writeToModel(Task task) {
if (initialized) {
return writeToModelPrivate(task);
return writeToModelAfterInitialized(task);
}
return null;
}
protected abstract String writeToModelPrivate(Task task);
/**
* Write to model, if initialization logic has been called
* @return toast text
*/
protected abstract String writeToModelAfterInitialized(Task task);
/**
* Called when views need to be inflated
*/
protected abstract void afterInflate();
}

@ -71,14 +71,14 @@ public class DeadlineControlSet extends PopupControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
long dueDate = model.getValue(Task.DUE_DATE);
initializeWithDate(dueDate);
refreshDisplayView();
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
long dueDate = dateAndTimePicker.constructDueDate();
task.setValue(Task.DUE_DATE, dueDate);
return null;

@ -68,14 +68,14 @@ public class EditNotesControlSet extends PopupControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
editText.setTextKeepState(model.getValue(Task.NOTES));
notesPreview.setText(model.getValue(Task.NOTES));
linkifyDisplayView();
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
task.setValue(Task.NOTES, editText.getText().toString());
return null;
}

@ -45,7 +45,7 @@ public class EditTextControlSet extends TaskEditControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
editText.setTextKeepState(model.getValue(property));
completeBox.setChecked(model.isCompleted());
completeBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@ -62,7 +62,7 @@ public class EditTextControlSet extends TaskEditControlSet {
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
task.setValue(property, editText.getText().toString());
boolean newState = completeBox.isChecked();
if (newState != task.isCompleted()) {

@ -235,7 +235,7 @@ public class HideUntilControlSet extends PopupControlSet implements OnItemSelect
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
@ -244,7 +244,7 @@ public class HideUntilControlSet extends PopupControlSet implements OnItemSelect
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
if(adapter == null || spinner == null)
return null;
HideUntilValue item = adapter.getItem(spinner.getSelectedItemPosition());

@ -145,12 +145,12 @@ public class ImportanceControlSet extends TaskEditControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
setImportance(model.getValue(Task.IMPORTANCE));
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
if(getImportance() != null)
task.setValue(Task.IMPORTANCE, getImportance());
return null;

@ -70,7 +70,7 @@ public class RandomReminderControlSet extends TaskEditControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
long time = model.getValue(Task.REMINDER_PERIOD);
boolean enabled = time > 0;
@ -87,7 +87,7 @@ public class RandomReminderControlSet extends TaskEditControlSet {
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
if(settingCheckbox.isChecked()) {
int hourValue = hours[periodSpinner.getSelectedItemPosition()];
task.setValue(Task.REMINDER_PERIOD, hourValue * DateUtilities.ONE_HOUR);

@ -105,15 +105,15 @@ public class ReminderControlSet extends PopupControlSet {
}
@Override
protected void readFromTaskPrivate() {
protected void readFromTaskOnInitialize() {
setValue(model.getValue(Task.REMINDER_FLAGS));
// Calls to get view will force other control sets to load
randomControlSet.readFromTask(model);
randomControlSet.readFromTaskPrivate();
randomControlSet.readFromTaskOnInitialize();
}
@Override
protected String writeToModelPrivate(Task task) {
protected String writeToModelAfterInitialized(Task task) {
task.setValue(Task.REMINDER_FLAGS, getValue());
// clear snooze if task is being edited
task.setValue(Task.REMINDER_SNOOZE, 0L);

Loading…
Cancel
Save