@@ -91,6 +91,15 @@ public static void getEditSubjectDialog(@NonNull final AppCompatActivity activit
9191 from_time .setText (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute ));
9292 week .setFromTime (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute ));
9393 from_hour .setText ("" + WeekUtils .getMatchingScheduleBegin (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute ), activity ));
94+ try {
95+ int value = WeekUtils .getMatchingScheduleBegin (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute ), activity );
96+ if (Integer .parseInt (to_hour .getText ().toString ()) < value ) {
97+ to_time .setText (WeekUtils .getMatchingTimeEnd (value , activity ));
98+ week .setToTime (WeekUtils .getMatchingTimeEnd (value , activity ));
99+ to_hour .setText ("" + value );
100+ }
101+ } catch (Exception ignore ) {
102+ }
94103 }, mHour , mMinute , true );
95104 timePickerDialog .setTitle (R .string .choose_time );
96105 timePickerDialog .show ();
@@ -104,6 +113,15 @@ public static void getEditSubjectDialog(@NonNull final AppCompatActivity activit
104113 to_time .setText (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute1 ));
105114 week .setToTime (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute1 ));
106115 to_hour .setText ("" + WeekUtils .getMatchingScheduleEnd (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute1 ), activity ));
116+ try {
117+ int value = WeekUtils .getMatchingScheduleEnd (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute1 ), activity );
118+ if (Integer .parseInt (from_hour .getText ().toString ()) > value ) {
119+ from_time .setText (WeekUtils .getMatchingTimeBegin (value , activity ));
120+ week .setFromTime (WeekUtils .getMatchingTimeBegin (value , activity ));
121+ from_hour .setText ("" + value );
122+ }
123+ } catch (Exception ignore ) {
124+ }
107125 }, mHour , mMinute , true );
108126 timePickerDialog .setTitle (R .string .choose_time );
109127 timePickerDialog .show ();
@@ -122,6 +140,14 @@ public static void getEditSubjectDialog(@NonNull final AppCompatActivity activit
122140 from_time .setText (WeekUtils .getMatchingTimeBegin (value , activity ));
123141 week .setFromTime (WeekUtils .getMatchingTimeBegin (value , activity ));
124142 from_hour .setText ("" + value );
143+ try {
144+ if (Integer .parseInt (to_hour .getText ().toString ()) < value ) {
145+ to_time .setText (WeekUtils .getMatchingTimeEnd (value , activity ));
146+ week .setToTime (WeekUtils .getMatchingTimeEnd (value , activity ));
147+ to_hour .setText ("" + value );
148+ }
149+ } catch (Exception ignore ) {
150+ }
125151 })
126152 .show ();
127153 });
@@ -139,6 +165,14 @@ public static void getEditSubjectDialog(@NonNull final AppCompatActivity activit
139165 to_time .setText (WeekUtils .getMatchingTimeEnd (value , activity ));
140166 week .setToTime (WeekUtils .getMatchingTimeEnd (value , activity ));
141167 to_hour .setText ("" + value );
168+ try {
169+ if (Integer .parseInt (from_hour .getText ().toString ()) > value ) {
170+ from_time .setText (WeekUtils .getMatchingTimeBegin (value , activity ));
171+ week .setFromTime (WeekUtils .getMatchingTimeBegin (value , activity ));
172+ from_hour .setText ("" + value );
173+ }
174+ } catch (Exception ignore ) {
175+ }
142176 })
143177 .show ();
144178 });
@@ -289,6 +323,15 @@ public static void getAddSubjectDialog(@NonNull final AppCompatActivity activity
289323 from_time .setText (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute ));
290324 week .setFromTime (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute ));
291325 from_hour .setText ("" + WeekUtils .getMatchingScheduleBegin (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute ), activity ));
326+ try {
327+ int value = WeekUtils .getMatchingScheduleBegin (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute ), activity );
328+ if (Integer .parseInt (to_hour .getText ().toString ()) < value ) {
329+ to_time .setText (WeekUtils .getMatchingTimeEnd (value , activity ));
330+ week .setToTime (WeekUtils .getMatchingTimeEnd (value , activity ));
331+ to_hour .setText ("" + value );
332+ }
333+ } catch (Exception ignore ) {
334+ }
292335 }, mHour , mMinute , true );
293336 timePickerDialog .setTitle (R .string .choose_time );
294337 timePickerDialog .show ();
@@ -310,6 +353,15 @@ public static void getAddSubjectDialog(@NonNull final AppCompatActivity activity
310353 to_time .setText (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute1 ));
311354 week .setToTime (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute1 ));
312355 to_hour .setText ("" + WeekUtils .getMatchingScheduleEnd (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute1 ), activity ));
356+ try {
357+ int value = WeekUtils .getMatchingScheduleEnd (String .format (Locale .getDefault (), "%02d:%02d" , hourOfDay , minute1 ), activity );
358+ if (Integer .parseInt (from_hour .getText ().toString ()) > value ) {
359+ from_time .setText (WeekUtils .getMatchingTimeBegin (value , activity ));
360+ week .setFromTime (WeekUtils .getMatchingTimeBegin (value , activity ));
361+ from_hour .setText ("" + value );
362+ }
363+ } catch (Exception ignore ) {
364+ }
313365 }, hour , minute , true );
314366 timePickerDialog .setTitle (R .string .choose_time );
315367 timePickerDialog .show ();
@@ -331,6 +383,14 @@ public static void getAddSubjectDialog(@NonNull final AppCompatActivity activity
331383 from_time .setText (WeekUtils .getMatchingTimeBegin (value , activity ));
332384 week .setFromTime (WeekUtils .getMatchingTimeBegin (value , activity ));
333385 from_hour .setText ("" + value );
386+ try {
387+ if (Integer .parseInt (to_hour .getText ().toString ()) < value ) {
388+ to_time .setText (WeekUtils .getMatchingTimeEnd (value , activity ));
389+ week .setToTime (WeekUtils .getMatchingTimeEnd (value , activity ));
390+ to_hour .setText ("" + value );
391+ }
392+ } catch (Exception ignore ) {
393+ }
334394 })
335395 .show ();
336396 });
@@ -351,6 +411,14 @@ public static void getAddSubjectDialog(@NonNull final AppCompatActivity activity
351411 to_time .setText (WeekUtils .getMatchingTimeEnd (value , activity ));
352412 week .setToTime (WeekUtils .getMatchingTimeEnd (value , activity ));
353413 to_hour .setText ("" + value );
414+ try {
415+ if (Integer .parseInt (from_hour .getText ().toString ()) > value ) {
416+ from_time .setText (WeekUtils .getMatchingTimeBegin (value , activity ));
417+ week .setFromTime (WeekUtils .getMatchingTimeBegin (value , activity ));
418+ from_hour .setText ("" + value );
419+ }
420+ } catch (Exception ignore ) {
421+ }
354422 })
355423 .show ();
356424 });
0 commit comments