Browse files

Checked the TaskListItem to display complete tasks in GREY, ITALLIC &…

… STRIKED_OUT text format. list looks better now
  • Loading branch information...
1 parent 9496787 commit a9d8fbdcdffae86c070fb02274582f5734ad54fe @sragu committed Feb 25, 2010
Showing with 17 additions and 0 deletions.
  1. +17 −0 Week_2/src/com/oreilly/android/taskmanager/views/TaskListItem.java
View
17 Week_2/src/com/oreilly/android/taskmanager/views/TaskListItem.java
@@ -3,6 +3,9 @@
import com.oreilly.android.taskmanager.tasks.Task;
import android.content.Context;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.CheckedTextView;
import android.widget.LinearLayout;
@@ -26,6 +29,20 @@ public void setTask(Task task) {
this.task = task;
checkbox.setText(task.getName());
checkbox.setChecked(task.isComplete());
+
+
+ if (checkbox.isChecked()) {
+ checkbox.setTextColor(Color.GRAY);
+ checkbox.setPaintFlags(checkbox.getPaintFlags()
+ | Paint.STRIKE_THRU_TEXT_FLAG);
+ checkbox.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
+ } else {
+ checkbox.setTextColor(Color.WHITE);
+ checkbox.setPaintFlags(checkbox.getPaintFlags()
+ & ~Paint.STRIKE_THRU_TEXT_FLAG);
+ checkbox.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
+ }
+
}
public Task getTask() {

0 comments on commit a9d8fbd

Please sign in to comment.