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 f7526c1..6a8a305 100644 --- a/app/src/main/java/com/example/citrusclient/views/HomeFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/HomeFragment.java @@ -171,11 +171,13 @@ FloatingActionButton todoAddButton = view.findViewById(R.id.todo_add_button); todoAddButton.setOnClickListener(v -> { ((MainActivity) getActivity()).showFragment(new CreateTodoFragment(year, month, day)); + todoAdapter.notifyDataSetChanged(); }); FloatingActionButton scheduleAddButton = view.findViewById(R.id.schedule_add_button); scheduleAddButton.setOnClickListener(v -> { ((MainActivity) getActivity()).showFragment(new CreateScheduleFragment()); + scheduleAdapter.notifyDataSetChanged(); }); ImageButton prevBotton = view.findViewById(R.id.prev_day_botton); @@ -187,6 +189,8 @@ curDateButton.setText(year + "年" + month + "月" + day + "日"); updateTodoSchedule(integerBookHashMap); + todoAdapter.notifyDataSetChanged(); + scheduleAdapter.notifyDataSetChanged(); }); ImageButton nextBotton = view.findViewById(R.id.next_day_botton); @@ -197,6 +201,9 @@ day = curDate.getDayOfMonth(); curDateButton.setText(year + "年" + month + "月" + day + "日"); updateTodoSchedule(integerBookHashMap); + todoAdapter.notifyDataSetChanged(); + scheduleAdapter.notifyDataSetChanged(); + }); @@ -208,6 +215,8 @@ @Override public void onChanged(HashMap idBookHashMap) { updateTodoSchedule(idBookHashMap); + todoAdapter.notifyDataSetChanged(); + scheduleAdapter.notifyDataSetChanged(); } }); @@ -221,6 +230,7 @@ todoAdapter.setTodos(todoList, integerBookHashMap); } } + todoAdapter.setTodos(todoList, integerBookHashMap); } else { todoAdapter.setTodos(todoList, integerBookHashMap); } @@ -305,6 +315,7 @@ this.idBookHashMap = new HashMap<>(); // 空のHashMapを作成 } this.context = context; + notifyDataSetChanged(); } public void setTodos(List todos ,HashMap idBookHashMap) { @@ -316,7 +327,6 @@ } sortTodosById(); - notifyDataSetChanged(); }