summaryrefslogtreecommitdiffstats
path: root/Android/05-UserInterface/UILab/src/course/labs/todomanager/AddToDoActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'Android/05-UserInterface/UILab/src/course/labs/todomanager/AddToDoActivity.java')
-rw-r--r--Android/05-UserInterface/UILab/src/course/labs/todomanager/AddToDoActivity.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/Android/05-UserInterface/UILab/src/course/labs/todomanager/AddToDoActivity.java b/Android/05-UserInterface/UILab/src/course/labs/todomanager/AddToDoActivity.java
index 6604871..23e7198 100644
--- a/Android/05-UserInterface/UILab/src/course/labs/todomanager/AddToDoActivity.java
+++ b/Android/05-UserInterface/UILab/src/course/labs/todomanager/AddToDoActivity.java
@@ -43,6 +43,9 @@ public class AddToDoActivity extends Activity {
private RadioButton mDefaultStatusButton;
private RadioButton mDefaultPriorityButton;
+ private int defaultPriority;
+ private int defaultStatus;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -56,6 +59,9 @@ public class AddToDoActivity extends Activity {
dateView = (TextView) findViewById(R.id.date);
timeView = (TextView) findViewById(R.id.time);
+ defaultPriority = mPriorityRadioGroup.getCheckedRadioButtonId ();
+ defaultStatus = mStatusRadioGroup.getCheckedRadioButtonId ();
+
// Set the default date and time
setDefaultDateTime();
@@ -85,7 +91,8 @@ public class AddToDoActivity extends Activity {
@Override
public void onClick(View v) {
log("Entered cancelButton.OnClickListener.onClick()");
- //TODO - Implement onClick().
+ setResult(RESULT_CANCELED, new Intent());
+ finish();
}
});
@@ -95,7 +102,10 @@ public class AddToDoActivity extends Activity {
@Override
public void onClick(View v) {
log("Entered resetButton.OnClickListener.onClick()");
- //TODO - Reset data fields to default values
+ mTitleText.getText().clear();
+ mPriorityRadioGroup.check(defaultPriority);
+ mStatusRadioGroup.check(defaultStatus);
+ setDefaultDateTime();
}
});
@@ -108,23 +118,16 @@ public class AddToDoActivity extends Activity {
log("Entered submitButton.OnClickListener.onClick()");
// Gather ToDoItem data
-
- //TODO - Get Priority
- Priority priority = null;
-
- //TODO - Get Status
- Status status = null;
-
- //TODO - Title
- String titleString = null;
-
- // Date
+ Priority priority = getPriority();
+ Status status = getStatus();
+ String titleString = mTitleText.getText().toString();
String fullDate = dateString + " " + timeString;
// Package ToDoItem data into an Intent
Intent data = new Intent();
ToDoItem.packageIntent(data, titleString, priority, status, fullDate);
- //TODO - return data Intent and finish
+ setResult(RESULT_OK, data);
+ finish();
}
});
}