diff --git a/app/src/main/java/com/example/citrusclient/views/HomeFragment.java b/app/src/main/java/com/example/citrusclient/views/HomeFragment.java index 1e709ad..0408b4a 100644 --- a/app/src/main/java/com/example/citrusclient/views/HomeFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/HomeFragment.java @@ -178,7 +178,7 @@ FloatingActionButton scheduleAddButton = view.findViewById(R.id.schedule_add_button); scheduleAddButton.setOnClickListener(v -> { - ((MainActivity) getActivity()).showFragment(new CreateScheduleFragment(year, month ,day)); + ((MainActivity) getActivity()).showFragment(new CreateScheduleFragment(year, month, day)); }); ImageButton prevBotton = view.findViewById(R.id.prev_day_botton); @@ -189,6 +189,7 @@ day = curDate.getDayOfMonth(); curDateButton.setText(year + "年" + month + "月" + day + "日"); + scheduleAdapter.updateCurDate(curDate); updateTodoSchedule(integerBookHashMap); }); @@ -199,6 +200,8 @@ month = curDate.getMonthValue(); day = curDate.getDayOfMonth(); curDateButton.setText(year + "年" + month + "月" + day + "日"); + + scheduleAdapter.updateCurDate(curDate); updateTodoSchedule(integerBookHashMap); }); @@ -261,7 +264,6 @@ Book book = idBookHashMap.get(curBookId); integerBookHashMap.put(curBookId, book); todosViewModel.loadTodosByDay(accountId, curBookId, year, month, day, token); - citrus.setCurBookId(-1); } else { todoList = new ArrayList<>(); integerBookHashMap = new HashMap<>(idBookHashMap); @@ -508,6 +510,12 @@ // return number / divisor; // 上位の桁を抽出 // } + // curDateを更新するメソッドを追加 + public void updateCurDate(LocalDate newCurDate) { + this.curDate = newCurDate; + notifyDataSetChanged(); // 必要に応じてアダプターをリフレッシュ + } + @Override public int getItemCount() { return scheduleList.size();