History now shows an icon indicating if the task was done or deleted

This commit is contained in:
BONNEVILLE Geoffroy
2017-12-27 10:23:23 +01:00
parent 5e2a09a3c9
commit 4c9e0c9dcd
13 changed files with 21 additions and 6 deletions

View File

@@ -67,8 +67,12 @@ public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerVi
if (mIsToday) return; if (mIsToday) return;
// Set alarm if past due date // Set alarm if past due date
LocalDate dueDate = holder.mItem.getDueDate(); LocalDate dueDate = holder.mItem.getDueDate();
if(dueDate != null && dueDate.isBefore(LocalDate.now())) if (holder.mItem.getDone() == 1)
holder.mAlarmView.setImageResource(R.drawable.ic_access_alarm); holder.mIconView.setImageResource(R.drawable.ic_check_ligth);
else if (holder.mItem.getDeleted() == 1)
holder.mIconView.setImageResource(R.drawable.ic_close_light);
else if(dueDate != null && dueDate.isBefore(LocalDate.now()))
holder.mIconView.setImageResource(R.drawable.ic_access_alarm);
int priority = holder.mItem.getPriority(); int priority = holder.mItem.getPriority();
// Set priority // Set priority
@@ -133,7 +137,7 @@ public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerVi
class SimpleViewHolder extends RecyclerView.ViewHolder { class SimpleViewHolder extends RecyclerView.ViewHolder {
final View mView; final View mView;
final TextView mIdView; final TextView mIdView;
final ImageView mAlarmView; final ImageView mIconView;
final TextView mCycleView; final TextView mCycleView;
final TextView mTitleView; final TextView mTitleView;
Task mItem; Task mItem;
@@ -143,7 +147,7 @@ public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerVi
mView = view; mView = view;
mIdView = view.findViewById(R.id.task_id); mIdView = view.findViewById(R.id.task_id);
mAlarmView = view.findViewById(R.id.task_alarm); mIconView = view.findViewById(R.id.task_icon);
mCycleView = view.findViewById(R.id.task_cycle); mCycleView = view.findViewById(R.id.task_cycle);
mTitleView = view.findViewById(R.id.task_name); mTitleView = view.findViewById(R.id.task_name);
} }

View File

@@ -96,6 +96,14 @@ public class Task {
return dueDate; return dueDate;
} }
public int getDeleted() {
return deleted;
}
public int getDone() {
return done;
}
public void setTodayDate(String todayDate) { public void setTodayDate(String todayDate) {
try { try {
this.todayDate = LocalDate.parse(todayDate); this.todayDate = LocalDate.parse(todayDate);
@@ -114,4 +122,5 @@ public class Task {
public String toString() { public String toString() {
return name; return name;
} }
} }

View File

@@ -104,6 +104,8 @@ public class TaskDataAccess implements AutoCloseable {
task.setName(cursor.getString(1)); task.setName(cursor.getString(1));
task.setTodayDate(cursor.getString(2)); task.setTodayDate(cursor.getString(2));
task.setTaskListName(cursor.getString(3)); task.setTaskListName(cursor.getString(3));
task.setDone(cursor.getInt(5));
task.setDeleted(cursor.getInt(6));
tasks.add(task); tasks.add(task);
cursor.moveToNext(); cursor.moveToNext();
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

View File

@@ -18,7 +18,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" /> android:visibility="gone" />
<ImageView <ImageView
android:id="@+id/task_alarm" android:id="@+id/task_icon"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="10dp" android:paddingTop="10dp"

View File

@@ -17,7 +17,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" /> android:visibility="gone" />
<ImageView <ImageView
android:id="@+id/task_alarm" android:id="@+id/task_icon"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="10dp" android:paddingTop="10dp"