diff --git a/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/adapters/TaskListRecyclerViewAdapter.java b/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/adapters/TaskListRecyclerViewAdapter.java index df6c172..2c5de73 100644 --- a/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/adapters/TaskListRecyclerViewAdapter.java +++ b/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/adapters/TaskListRecyclerViewAdapter.java @@ -53,10 +53,8 @@ public class TaskListRecyclerViewAdapter extends RecyclerView.Adapter 1 ? "s" : "") +" remaining")); } /** Performs an action on a task: done, next or delete */ @@ -214,9 +237,10 @@ public class TasksFragment extends Fragment implements } UpdateCycleCount(); - UpdateTaskCount(); - taskDataAccess.close(); + + UpdateTaskCount(); + UpdateRemainingTaskCount(); } }).show(); } @@ -285,18 +309,22 @@ public class TasksFragment extends Fragment implements priorityRadio.getText().toString(), taskList.getId()); - UpdateTaskCount(); taskDataAccess.close(); - // Update the corresponding tab adapter + Bundle args = dialog.getArguments(); // Should never happen because we will have to be on this tab to open the dialog if (taskRecyclerViewAdapter == null) return; // Add the task - if (task == null) + if (task == null) { taskRecyclerViewAdapter.add(newTask, 0); - // Update the task + recyclerView.scrollToPosition(0); + + // Update the task count + UpdateTaskCount(); + } + // Update the task else { int position = args.getInt("position"); // Check if task list was changed @@ -307,9 +335,10 @@ public class TasksFragment extends Fragment implements // Add it to the corresponding tab provided it is already instanciated mAdapter.onTaskListChanged(newTask, listSpinner.getSelectedItemPosition()); - } - else taskRecyclerViewAdapter.update(newTask, position); + } else taskRecyclerViewAdapter.update(newTask, position); } + + UpdateRemainingTaskCount(); } @Override diff --git a/DoNExt/app/src/main/res/layout/activity_main.xml b/DoNExt/app/src/main/res/layout/activity_main.xml index be78694..c9abe80 100644 --- a/DoNExt/app/src/main/res/layout/activity_main.xml +++ b/DoNExt/app/src/main/res/layout/activity_main.xml @@ -20,7 +20,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" - app:layout_scrollFlags="scroll|enterAlways" + app:layout_scrollFlags="enterAlways" app:popupTheme="@style/AppTheme.PopupOverlay" /> + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true"/> + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> + \ No newline at end of file