mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 07:30:13 -04:00
Change layout icon now works in Today
Left join in DB is correct now
This commit is contained in:
@@ -58,9 +58,9 @@ public class TodayActivity extends AppCompatActivity
|
||||
editor.putString("pref_conf_task_layout", String.valueOf(layoutType % 2 + 1));
|
||||
editor.apply();
|
||||
|
||||
// TODO: refresh the task list
|
||||
// TODO: find a less ugly way to refresh the list
|
||||
// Update the ViewPagerAdapter to refresh all tabs
|
||||
//mSectionsPagerAdapter.notifyDataSetChanged();
|
||||
this.recreate();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerViewAdapter.SimpleViewHolder> {
|
||||
|
||||
private List<Task> mValues;
|
||||
private final int viewType;
|
||||
private int viewType;
|
||||
|
||||
public TaskRecyclerViewAdapter(List<Task> items, int viewType) {
|
||||
mValues = items;
|
||||
@@ -89,6 +89,10 @@ public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerVi
|
||||
return viewType;
|
||||
}
|
||||
|
||||
public void setItemViewType(int viewType) {
|
||||
this.viewType = viewType;
|
||||
}
|
||||
|
||||
public void add(Task item, int position) {
|
||||
mValues.add(position, item);
|
||||
notifyItemInserted(position);
|
||||
|
@@ -87,7 +87,6 @@ public class Task {
|
||||
return taskListName;
|
||||
}
|
||||
|
||||
// TODO: implement this via SQL
|
||||
public void setTaskListName(String taskListName) {
|
||||
this.taskListName = taskListName;
|
||||
}
|
||||
|
@@ -83,20 +83,17 @@ public class TaskDataAccess implements AutoCloseable {
|
||||
}
|
||||
|
||||
public List<Task> getAllTasks() {
|
||||
/*Cursor cursor = database.query(DatabaseHelper.TASKS_TABLE_NAME, taskColumns,
|
||||
DatabaseHelper.TASKS_COLUMN_DONE + " = " + 0 +
|
||||
" AND " + DatabaseHelper.TASKS_COLUMN_DELETED + " = " + 0,
|
||||
null, null, null,
|
||||
DatabaseHelper.TASKS_COLUMN_CYCLE + ", " + DatabaseHelper.COLUMN_ID + " DESC");*/
|
||||
Cursor cursor = database.rawQuery("SELECT " +
|
||||
DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.COLUMN_ID + "," +
|
||||
DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.TASKS_COLUMN_NAME + "," +
|
||||
DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.TASKS_COLUMN_TODAYDATE + "," +
|
||||
DatabaseHelper.TASKLIST_TABLE_NAME + "." + DatabaseHelper.TASKLIST_COLUMN_NAME + " AS tasklistname " +
|
||||
" FROM " + DatabaseHelper.TASKLIST_TABLE_NAME +
|
||||
" LEFT JOIN " + DatabaseHelper.TASKS_TABLE_NAME +
|
||||
" FROM " + DatabaseHelper.TASKS_TABLE_NAME +
|
||||
" LEFT JOIN " + DatabaseHelper.TASKLIST_TABLE_NAME +
|
||||
" ON " + DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.TASKS_COLUMN_LIST +
|
||||
" = " + DatabaseHelper.TASKLIST_TABLE_NAME + "." + DatabaseHelper.COLUMN_ID
|
||||
" = " + DatabaseHelper.TASKLIST_TABLE_NAME + "." + DatabaseHelper.COLUMN_ID +
|
||||
" WHERE " + DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.TASKS_COLUMN_DONE + " = " + 0 +
|
||||
" AND " + DatabaseHelper.TASKS_TABLE_NAME + "." + DatabaseHelper.TASKS_COLUMN_DELETED + " = " + 0
|
||||
, null);
|
||||
List<Task> tasks = new ArrayList<>();
|
||||
|
||||
@@ -114,7 +111,6 @@ public class TaskDataAccess implements AutoCloseable {
|
||||
cursor.close();
|
||||
|
||||
return tasks;
|
||||
//return getTasksFromCursor(cursor);
|
||||
}
|
||||
|
||||
public List<Task> getAllTasksFromList(long id) {
|
||||
|
@@ -193,8 +193,16 @@ public class TasksFragment extends Fragment implements
|
||||
// Update total tasks
|
||||
int totalTasks = taskRecyclerViewAdapter.getItemCount();
|
||||
TextView totalTasksView = (TextView) view.findViewById(R.id.total_task_count);
|
||||
if (totalTasks == 0) view.findViewById(R.id.no_more_tasks).setVisibility(View.VISIBLE);
|
||||
else totalTasksView.setText(resources.getQuantityString(R.plurals.task_total, totalTasks, totalTasks));
|
||||
View noMoreTasks = view.findViewById(R.id.no_more_tasks);
|
||||
if (totalTasks == 0) {
|
||||
noMoreTasks.setVisibility(View.VISIBLE);
|
||||
totalTasksView.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
noMoreTasks.setVisibility(View.GONE);
|
||||
totalTasksView.setVisibility(View.VISIBLE);
|
||||
totalTasksView.setText(resources.getQuantityString(R.plurals.task_total, totalTasks, totalTasks));
|
||||
}
|
||||
|
||||
// Update remaining tasks
|
||||
TextView remainingTasksView = (TextView) view.findViewById(R.id.remaining_task_count);
|
||||
@@ -433,7 +441,6 @@ public class TasksFragment extends Fragment implements
|
||||
@Override
|
||||
public void onDismissed(Snackbar snackbar, int event) {
|
||||
super.onDismissed(snackbar, event);
|
||||
|
||||
// When clicked on undo, do not write to DB
|
||||
if (event == DISMISS_EVENT_ACTION) return;
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<item quantity="other">%1$d tâches</item>
|
||||
</plurals>
|
||||
<plurals name="task_remaining">
|
||||
<item quantity="one">%1$d tâche%2$s restante</item>
|
||||
<item quantity="other">%1$d tâche%2$s restantes</item>
|
||||
<item quantity="one">%1$d tâche restante</item>
|
||||
<item quantity="other">%1$d tâches restantes</item>
|
||||
</plurals>
|
||||
</resources>
|
@@ -53,7 +53,7 @@
|
||||
<string name="task_alarm">Task is past due date</string>
|
||||
<string name="action_todayList">Vue Aujourd\'hui</string>
|
||||
<string name="title_activity_today">Aujourd\'hui</string>
|
||||
<string name="new_task_today">Ajouter la tâche à la vue Aujourd\'hui?</string>
|
||||
<string name="new_task_today">Faire cette tâche aujourd\'hui?</string>
|
||||
<string name="today_search_hint">Rechercher…</string>
|
||||
<string name="action_today_select">Choisissez des tâches</string>
|
||||
<string name="task_list_edit_list_hint">Nom de la liste</string>
|
||||
|
@@ -72,7 +72,7 @@
|
||||
<!-- Strings related to Today -->
|
||||
<string name="title_activity_today">Today</string>
|
||||
<string name="action_todayList">Today View</string>
|
||||
<string name="new_task_today">Add task to Today View?</string>
|
||||
<string name="new_task_today">Do this task today?</string>
|
||||
<string name="today_search_hint">Search…</string>
|
||||
<string name="action_today_select">Select tasks</string>
|
||||
<string name="task_list_edit_list_hint">List name</string>
|
||||
|
Reference in New Issue
Block a user