summaryrefslogtreecommitdiffstats
path: root/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-03-02 12:09:16 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-11-10 17:40:55 +0100
commit9f4f2c3cd098159e741995c453df6d5da9fdb89d (patch)
treea183d3f592c1bfa771ca9938046587c27affdae2 /Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
parentd1d4b77dccabb24d88cb3de78d6e9c374ddf5676 (diff)
downloadcoursera-9f4f2c3cd098159e741995c453df6d5da9fdb89d.zip
coursera-9f4f2c3cd098159e741995c453df6d5da9fdb89d.tar.gz
Android : 05-UserInterface: implement
Diffstat (limited to 'Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java')
-rw-r--r--Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java b/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
index fe8d9eb..a911b1d 100644
--- a/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
+++ b/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
@@ -49,29 +49,31 @@ public class ToDoManagerActivity extends ListActivity {
// Put divider between ToDoItems and FooterView
getListView().setFooterDividersEnabled(true);
- //TODO - Inflate footerView for footer_view.xml file
- TextView footerView = null;
- //TODO - Add footerView to ListView
+ TextView footerView = (TextView) getLayoutInflater().inflate(R.layout.footer_view, null);
+ getListView().addFooterView(footerView);
footerView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
log("Entered footerView.OnClickListener.onClick()");
- //TODO - Attach Listener to FooterView. Implement onClick().
+ Intent intent = new Intent(ToDoManagerActivity.this, AddToDoActivity.class);
+ startActivityForResult(intent, ADD_TODO_ITEM_REQUEST);
}
});
- //TODO - Attach the adapter to this ListActivity's ListView
+ getListView().setAdapter(mAdapter);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
log("Entered onActivityResult()");
- // TODO - Check result code and request code.
- // If user submitted a new ToDoItem
- // Create a new ToDoItem from the data Intent
- // and then add it to the adapter
+ if (requestCode == ADD_TODO_ITEM_REQUEST) {
+ if (resultCode == RESULT_OK) {
+ ToDoItem item = new ToDoItem(data);
+ mAdapter.add(item);
+ }
+ }
}
// Do not modify below here