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 a29c4e3..53bc700 100644 --- a/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/CalendarFragment.java @@ -243,7 +243,6 @@ year++; } scheduleViewModel.updateSchedulesByMonth(accountId, year, month, token); - } }); @@ -274,6 +273,17 @@ p2.weight = 1; tableRow.addView(layout); layout.addView(days[i][j]); + final int ii = i; + final int jj = j; + layout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + citrus.setCurMonth(month); + citrus.setCurYear(year); + citrus.setCurDay(Integer.parseInt(daysString[ii][jj])); + ((MainActivity) getActivity()).showFragment(new HomeFragment()); + } + }); RecyclerView recyclerView = new RecyclerView(requireContext()); RecyclerView.LayoutManager layoutmanager = new LinearLayoutManager(requireContext()); recyclerView.setLayoutManager(layoutmanager); @@ -315,6 +325,7 @@ int lastDay = CurLastDay.getDayOfMonth(); String[][] days = calendarString(firstDayOfWeek, prevMonthDay, lastDay); + int one = 0; for(int i = 0; i < 6; i++) { TableRow tableRow = (TableRow) tableLayout.getChildAt(i); @@ -322,7 +333,10 @@ LinearLayout layout = (LinearLayout) tableRow.getChildAt(j); RecyclerView recyclerView = (RecyclerView) layout.getChildAt(1); List schedules = new ArrayList<>(); - if(this.schedules != null) { + if(days[i][j].equals("1")){ + one++; + } + if(this.schedules != null && one == 1) { if (this.schedules.get(Integer.parseInt(days[i][j])) != null) { for (Schedule schedule : this.schedules.get(Integer.parseInt(days[i][j])).values()) { schedules.add(schedule);