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 2d37c7a..1e709ad 100644 --- a/app/src/main/java/com/example/citrusclient/views/HomeFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/HomeFragment.java @@ -142,7 +142,7 @@ Citrus citrus = (Citrus)(getActivity().getApplication()); String token = citrus.getToken(); String accountId = citrus.getAccountId(); - + System.out.println(token); curDate = LocalDate.of(year, month, day); todoList = new ArrayList<>(); @@ -178,7 +178,7 @@ FloatingActionButton scheduleAddButton = view.findViewById(R.id.schedule_add_button); scheduleAddButton.setOnClickListener(v -> { - ((MainActivity) getActivity()).showFragment(new CreateScheduleFragment()); + ((MainActivity) getActivity()).showFragment(new CreateScheduleFragment(year, month ,day)); }); ImageButton prevBotton = view.findViewById(R.id.prev_day_botton); @@ -443,7 +443,7 @@ holder.scheduleButton.setTextColor(Color.rgb(255 - red, 255 - green, 255 - blue)); holder.scheduleButton.setOnClickListener(v -> { - ((MainActivity) activity).showFragment(new CreateScheduleFragment()); + ((MainActivity) activity).showFragment(new CreateScheduleFragment(scheduleData, book)); }); } @@ -490,22 +490,23 @@ int year = curDate.getYear(); int month = curDate.getMonthValue(); int day = curDate.getDayOfMonth(); - long yearMonth = year * 10000 + month * 100 + day; - long scheduleYearMonth = convertTimeInteger(scheduleTime) / 1000000; - + long yearMonthDay = year * 10000 + month * 100 + day; + long scheduleYMD = convertTimeInteger(scheduleTime) / 10000; // long scheduleYearMonth = extractUpperDigits(convertTimeInteger(scheduleTime), 8); - System.out.println(yearMonth); - System.out.println(scheduleYearMonth); - return scheduleTime.substring(scheduleTime.length() - 5); + if(yearMonthDay > scheduleYMD) { + return "00:00"; + } else if(yearMonthDay < scheduleYMD) { + return "23:59"; + } else { + return scheduleTime.substring(scheduleTime.length() - 5); + } } - public static long extractUpperDigits(long number, int digitCount) { - // 10の累乗を計算 - long divisor = (long) Math.pow(10, String.valueOf(number).length() - digitCount); -// System.out.println(divisor); -// System.out.println(number / divisor); - return number / divisor; // 上位の桁を抽出 - } +// public static long extractUpperDigits(long number, int digitCount) { +// // 10の累乗を計算 +// long divisor = (long) Math.pow(10, String.valueOf(number).length() - digitCount); +// return number / divisor; // 上位の桁を抽出 +// } @Override public int getItemCount() {