-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ListView loading is now done using AsyncTask with 0.5 sec delay
- Loading branch information
Showing
15 changed files
with
152 additions
and
32 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-155 Bytes
(90%)
TodoListManager/bin/classes/il/ac/huji/todolist/TodoListManagerActivity$1.class
Binary file not shown.
Binary file modified
BIN
-163 Bytes
(93%)
TodoListManager/bin/classes/il/ac/huji/todolist/TodoListManagerActivity$2.class
Binary file not shown.
Binary file modified
BIN
+128 Bytes
(110%)
...ListManager/bin/classes/il/ac/huji/todolist/TodoListManagerActivity$TodoTaskDeleter.class
Binary file not shown.
Binary file added
BIN
+2.63 KB
TodoListManager/bin/classes/il/ac/huji/todolist/TodoListManagerActivity$TodoTaskLoader.class
Binary file not shown.
Binary file modified
BIN
+145 Bytes
(110%)
TodoListManager/bin/classes/il/ac/huji/todolist/TodoListManagerActivity$TodoTaskSaver.class
Binary file not shown.
Binary file modified
BIN
+133 Bytes
(100%)
TodoListManager/bin/classes/il/ac/huji/todolist/TodoListManagerActivity.class
Binary file not shown.
Binary file modified
BIN
+60 Bytes
(100%)
TodoListManager/bin/classes/il/ac/huji/todolist/TodoTask.class
Binary file not shown.
Binary file added
BIN
+2.9 KB
TodoListManager/bin/classes/il/ac/huji/todolist/TodoTaskArrayAdapter.class
Binary file not shown.
Binary file modified
BIN
+76 Bytes
(100%)
TodoListManager/bin/classes/il/ac/huji/todolist/TodoTaskSQLiteHelper.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
TodoListManager/src/il/ac/huji/todolist/TodoTaskArrayAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package il.ac.huji.todolist; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Date; | ||
|
||
import android.content.Context; | ||
import android.graphics.Color; | ||
import android.text.format.DateFormat; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.TextView; | ||
|
||
/** | ||
* A custom array adapter for presenting the list with alternating color text. | ||
* | ||
* @author mickey | ||
*/ | ||
public class TodoTaskArrayAdapter extends ArrayAdapter<TodoTask>{ | ||
|
||
private ArrayList<TodoTask> _listItems; | ||
private int _layout; | ||
|
||
public TodoTaskArrayAdapter(Context context, ArrayList<TodoTask> listItems) { | ||
super(context, R.layout.todo_task, listItems); | ||
_layout = R.layout.todo_task; | ||
_listItems = listItems; | ||
} | ||
|
||
/** | ||
* Display rows in alternating colors | ||
*/ | ||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
LayoutInflater inflater = LayoutInflater.from(getContext()); | ||
|
||
if (convertView == null) { // new row | ||
convertView = inflater.inflate(_layout, parent, false); | ||
} | ||
|
||
TextView taskTitle = (TextView)convertView.findViewById(R.id.txtTodoTitle); | ||
taskTitle.setText(_listItems.get(position).getTitle()); | ||
|
||
TextView taskDueDate = (TextView)convertView.findViewById(R.id.txtTodoDueDate); | ||
|
||
Long today = System.currentTimeMillis(), taskDue = _listItems.get(position).getDue(); | ||
|
||
if (taskDue == null) { // should not happen | ||
taskDueDate.setText(getContext().getResources().getString(R.string.no_due_date)); | ||
} | ||
else { | ||
Date date = new Date(); | ||
date.setTime(taskDue); | ||
String dueDate = DateFormat.getDateFormat(getContext()).format(date); | ||
taskDueDate.setText(dueDate); | ||
} | ||
|
||
|
||
if (today - taskDue > 0) { // over due | ||
taskTitle.setTextColor(Color.RED); | ||
taskDueDate.setTextColor(Color.RED); | ||
} | ||
else { | ||
taskTitle.setTextColor(Color.BLACK); | ||
taskDueDate.setTextColor(Color.BLACK); | ||
} | ||
|
||
return convertView; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters