diff --git a/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java b/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java index 12984f0..bc701ca 100644 --- a/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java @@ -130,7 +130,7 @@ HashMap books; HashMap> schedules; - HashMap> todos; + HashMap> todos; public TextView[][] calendar(int firstDayOfWeek, int prevMonthDay, int lastDay) { int curDay = 1; @@ -233,10 +233,10 @@ if(integerHashMapHashMap != null && !integerHashMapHashMap.isEmpty()) { for (int day : integerHashMapHashMap.keySet()) { if (todos.get(day) == null) { - todos.put(day, new HashMap<>()); + todos.put(day, new ArrayList<>()); } for (int todoId : integerHashMapHashMap.get(day).keySet()) { - todos.get(day).put(todoId, integerHashMapHashMap.get(day).get(todoId)); + todos.get(day).add(integerHashMapHashMap.get(day).get(todoId)); } } } @@ -299,7 +299,10 @@ month = 1; year++; } + todos.clear(); scheduleViewModel.updateSchedulesByMonth(accountId, year, month, token); + booksViewModel.loadBooks(accountId, token); + updateCalendar(curMonth); } }); @@ -312,7 +315,10 @@ month = 12; year--; } + todos.clear(); scheduleViewModel.updateSchedulesByMonth(accountId, year, month, token); + booksViewModel.loadBooks(accountId, token); + updateCalendar(curMonth); } }); @@ -438,7 +444,7 @@ if(select != -1){ if(select == R.id.rbTodo){ if (this.todos.get(Integer.parseInt(days[i][j])) != null) { - for (Todo schedule : this.todos.get(Integer.parseInt(days[i][j])).values()) { + for (Todo schedule : this.todos.get(Integer.parseInt(days[i][j]))) { schedules.add(schedule); } } @@ -450,7 +456,7 @@ } } else { if (this.todos.get(Integer.parseInt(days[i][j])) != null) { - for (Todo schedule : this.todos.get(Integer.parseInt(days[i][j])).values()) { + for (Todo schedule : this.todos.get(Integer.parseInt(days[i][j]))) { schedules.add(schedule); } }