/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 2 2 ĠR az ew are ĠLLC Ċ Ġ* Ċ Ġ* ĠPermission Ġis Ġhereby Ġgranted , Ġfree Ġof Ġcharge , Ġto Ġany Ġperson Ġobtaining Ġa Ġcopy Ċ Ġ* Ġof Ġthis Ġsoftware Ġand Ġassociated Ġdocumentation Ġfiles Ġ( the Ġ" Software "), Ġto Ġdeal Ċ Ġ* Ġin Ġthe ĠSoftware Ġwithout Ġrestriction , Ġincluding Ġwithout Ġlimitation Ġthe Ġrights Ċ Ġ* Ġto Ġuse , Ġcopy , Ġmodify , Ġmerge , Ġpublish , Ġdistribute , Ġsublicense , Ġand / or Ġsell Ċ Ġ* Ġcopies Ġof Ġthe ĠSoftware , Ġand Ġto Ġpermit Ġpersons Ġto Ġwhom Ġthe ĠSoftware Ġis Ċ Ġ* Ġfurnished Ġto Ġdo Ġso , Ġsubject Ġto Ġthe Ġfollowing Ġconditions : Ċ Ġ* Ċ Ġ* ĠThe Ġabove Ġcopyright Ġnotice Ġand Ġthis Ġpermission Ġnotice Ġshall Ġbe Ġincluded Ġin Ċ Ġ* Ġall Ġcopies Ġor Ġsubstantial Ġportions Ġof Ġthe ĠSoftware . Ċ Ġ* Ċ Ġ* ĠNot with standing Ġthe Ġfore going , Ġyou Ġmay Ġnot Ġuse , Ġcopy , Ġmodify , Ġmerge , Ġpublish , Ċ Ġ* Ġdistribute , Ġsublicense , Ġcreate Ġa Ġderivative Ġwork , Ġand / or Ġsell Ġcopies Ġof Ġthe Ċ Ġ* ĠSoftware Ġin Ġany Ġwork Ġthat Ġis Ġdesigned , Ġintended , Ġor Ġmarket ed Ġfor Ġped ag og ical Ġor Ċ Ġ* Ġinstruction al Ġpurposes Ġrelated Ġto Ġprogramming , Ġcoding , Ġapplication Ġdevelopment , Ċ Ġ* Ġor Ġinformation Ġtechnology . Ġ ĠPermission Ġfor Ġsuch Ġuse , Ġcopying , Ġmodification , Ċ Ġ* Ġmer ger , Ġpublication , Ġdistribution , Ġsublic ensing , Ġcreation Ġof Ġderivative Ġworks , Ċ Ġ* Ġor Ġsale Ġis Ġexpress ly Ġwith held . Ċ Ġ* Ċ Ġ* ĠThis Ġproject Ġand Ġsource Ġcode Ġmay Ġuse Ġlibraries Ġor Ġframeworks Ġthat Ġare Ċ Ġ* Ġreleased Ġunder Ġvarious ĠOpen - Source Ġlicenses . ĠUse Ġof Ġthose Ġlibraries Ġand Ċ Ġ* Ġframeworks Ġare Ġgoverned Ġby Ġtheir Ġown Ġindividual Ġlicenses . Ċ Ġ* Ċ Ġ* ĠTHE ĠSOFTWARE ĠIS ĠPROVIDED Ġ" AS ĠIS ", ĠWITHOUT ĠWARRANTY ĠOF ĠANY ĠKIND , ĠEXPRESS ĠOR Ċ Ġ* ĠIMPLIED , ĠINCLUDING ĠBUT ĠNOT ĠLIMITED ĠTO ĠTHE ĠWARRANTIES ĠOF ĠMERCHANTABILITY , Ċ Ġ* ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE ĠAND ĠNONINFRINGEMENT . ĠIN ĠNO ĠEVENT ĠSHALL ĠTHE Ċ Ġ* ĠAUTHORS ĠOR ĠCOPYRIGHT ĠHOLDERS ĠBE ĠLIABLE ĠFOR ĠANY ĠCLAIM , ĠDAMAGES ĠOR ĠOTHER Ċ Ġ* ĠLIABILITY , ĠWHETHER ĠIN ĠAN ĠACTION ĠOF ĠCONTRACT , ĠTORT ĠOR ĠOTHERWISE , ĠARISING ĠFROM , Ċ Ġ* ĠOUT ĠOF ĠOR ĠIN ĠCONNECTION ĠWITH ĠTHE ĠSOFTWARE ĠOR ĠTHE ĠUSE ĠOR ĠOTHER ĠDEALINGS ĠIN Ċ Ġ* ĠTHE ĠSOFTWARE . Ċ Ġ*/ Ċ Ċ package Ġcom . your company . android . stu ddy . alarm Ċ Ċ import Ġandroid . content . SharedPreferences Ċ import Ġcom . your company . android . stu ddy . currentTimeMillis Ċ import Ġcom . your company . android . stu ddy . plus One Day Ċ import Ġcom . your company . android . stu ddy . set Hour And Minute Ċ import Ġjava . util .* Ċ Ċ private Ġconst Ġval ĠEX ACT _ ALARM _ PREFER ENCES _ KEY Ġ= Ġ" exact _ alarm " Ċ private Ġconst Ġval ĠIN EX ACT _ ALARM _ PREFER ENCES _ KEY Ġ= Ġ" in exact _ alarm " Ċ Ċ private Ġconst Ġval ĠIN EX ACT _ WINDOW _ ALARM _ TRIGGER _ PREFER ENCES _ KEY Ġ= Ġ" in exact _ window _ alarm _ trigger " Ċ private Ġconst Ġval ĠIN EX ACT _ WINDOW _ ALARM _ WINDOW _ PREFER ENCES _ KEY Ġ= Ġ" in exact _ window _ alarm _ window " Ċ Ċ private Ġconst Ġval ĠIN EX ACT _ REPEAT ING _ ALARM _ TRIGGER _ PREFER ENCES _ KEY Ġ= ĊĠĠĠ Ġ" in exact _ repe ating _ alarm _ trigger " Ċ private Ġconst Ġval ĠIN EX ACT _ REPEAT ING _ ALARM _ INTERVAL _ PREFER ENCES _ KEY Ġ= ĊĠĠĠ Ġ" in exact _ repe ating _ alarm _ window " Ċ Ċ private Ġconst Ġval ĠAL ARM _ NOT _ SET Ġ= Ġ- 1 L Ċ Ċ fun ĠSharedPreferences . get Exact Alarm (): ĠExact Alarm Ġ{ ĊĠ Ġval Ġtrigger At Millis Ġ= Ġget Long ( EX ACT _ ALARM _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĠ Ġreturn ĠExact Alarm ( trigger At Millis ) Ċ } Ċ Ċ fun ĠSharedPreferences . put Exact Alarm ( exact Alarm : ĠExact Alarm ) Ġ{ ĊĠ Ġedit (). put Long ( EX ACT _ ALARM _ PREFER ENCES _ KEY , Ġexact Alarm . trigger At Millis ). apply () Ċ } Ċ Ċ fun ĠSharedPreferences . clear Exact Alarm () Ġ{ ĊĠ Ġedit (). put Long ( EX ACT _ ALARM _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ). apply () Ċ } Ċ Ċ fun ĠSharedPreferences . getIn exact Alarm (): ĠExact Alarm Ġ{ ĊĠ Ġval Ġtrigger At Millis Ġ= Ġget Long ( IN EX ACT _ ALARM _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĠ Ġreturn ĠExact Alarm ( trigger At Millis ) Ċ } Ċ Ċ fun ĠSharedPreferences . put In exact Alarm ( in exact Alarm : ĠExact Alarm ) Ġ{ ĊĠ Ġedit (). put Long ( IN EX ACT _ ALARM _ PREFER ENCES _ KEY , Ġin exact Alarm . trigger At Millis ). apply () Ċ } Ċ Ċ fun ĠSharedPreferences . clear In exact Alarm () Ġ{ ĊĠ Ġedit (). put Long ( IN EX ACT _ ALARM _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ). apply () Ċ } Ċ Ċ fun ĠSharedPreferences . getWindow Alarm (): ĠWindow Alarm Ġ{ ĊĠ Ġval Ġtrigger At Millis Ġ= Ġget Long ( IN EX ACT _ WINDOW _ ALARM _ TRIGGER _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĠ Ġval Ġwindow Millis Ġ= Ġget Long ( IN EX ACT _ WINDOW _ ALARM _ WINDOW _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĊĠ Ġreturn ĠWindow Alarm ( trigger At Millis , Ġwindow Millis ) Ċ } Ċ Ċ fun ĠSharedPreferences . put Window Alarm ( window Alarm : ĠWindow Alarm ) Ġ{ ĊĠ Ġedit () ĊĠĠĠĠĠ Ġ. put Long ( IN EX ACT _ WINDOW _ ALARM _ TRIGGER _ PREFER ENCES _ KEY , Ġwindow Alarm . trigger At Millis ) ĊĠĠĠĠĠ Ġ. put Long ( IN EX ACT _ WINDOW _ ALARM _ WINDOW _ PREFER ENCES _ KEY , Ġwindow Alarm . window Length Millis ) ĊĠĠĠĠĠ Ġ. apply () Ċ } Ċ Ċ fun ĠSharedPreferences . clear Window Alarm () Ġ{ ĊĠ Ġedit () ĊĠĠĠĠĠ Ġ. put Long ( IN EX ACT _ WINDOW _ ALARM _ TRIGGER _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĠĠĠĠĠ Ġ. put Long ( IN EX ACT _ WINDOW _ ALARM _ WINDOW _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĠĠĠĠĠ Ġ. apply () Ċ } Ċ Ċ fun ĠSharedPreferences . get Repe ating Alarm (): ĠRe pe ating Alarm Ġ{ ĊĠ Ġval Ġtrigger At Millis Ġ= Ġget Long ( IN EX ACT _ REPEAT ING _ ALARM _ TRIGGER _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĠ Ġval Ġinterval Millis Ġ= Ġget Long ( IN EX ACT _ REPEAT ING _ ALARM _ INTERVAL _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĊĠ Ġreturn ĠRe pe ating Alarm ( trigger At Millis , Ġinterval Millis ) Ċ } Ċ Ċ fun ĠSharedPreferences . put Repe ating Alarm ( repe ating Alarm : ĠRe pe ating Alarm ) Ġ{ ĊĠ Ġedit () ĊĠĠĠĠĠ Ġ. put Long ( IN EX ACT _ REPEAT ING _ ALARM _ TRIGGER _ PREFER ENCES _ KEY , Ġrepe ating Alarm . trigger At Millis ) ĊĠĠĠĠĠ Ġ. put Long ( IN EX ACT _ REPEAT ING _ ALARM _ INTERVAL _ PREFER ENCES _ KEY , Ġrepe ating Alarm . interval Millis ) ĊĠĠĠĠĠ Ġ. apply () Ċ } Ċ Ċ fun ĠSharedPreferences . clear Repe ating Alarm () Ġ{ ĊĠ Ġedit () ĊĠĠĠĠĠ Ġ. put Long ( IN EX ACT _ REPEAT ING _ ALARM _ TRIGGER _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĠĠĠĠĠ Ġ. put Long ( IN EX ACT _ REPEAT ING _ ALARM _ INTERVAL _ PREFER ENCES _ KEY , ĠAL ARM _ NOT _ SET ) ĊĠĠĠĠĠ Ġ. apply () Ċ } Ċ Ċ fun ĠconvertTo Alarm Time Millis ( hour : ĠInt , Ġminute : ĠInt ): ĠLong Ġ{ ĊĠ Ġval Ġcalendar Ġ= ĠCalendar . getInstance () ĊĠ Ġval ĠcurrentTime Millis Ġ= Ġcalendar . time In Millis ĊĠ Ġval Ġproposed Time Millis Ġ= Ġcalendar . set Hour And Minute ( hour , Ġminute ). time In Millis ĊĊĠ Ġval Ġalarm Time Millis : ĠLong Ġ= Ġif Ġ( pro posed Time Millis Ġ> ĠcurrentTime Millis ) Ġ{ ĊĠĠĠ Ġproposed Time Millis ĊĠ Ġ} Ġelse Ġ{ ĊĠĠĠ Ġproposed Time Millis . plus One Day () ĊĠ Ġ} ĊĊĠ Ġreturn Ġalarm Time Millis Ċ } Ċ Ċ data Ġclass ĠExact Alarm ( val Ġtrigger At Millis : ĠLong ) Ġ{ ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠ Ġval ĠNOT _ SET Ġ= ĠExact Alarm ( ALARM _ NOT _ SET ) ĊĠ Ġ} ĊĊĠ Ġfun ĠisSet (): ĠBoolean Ġ= Ġtrigger At Millis Ġ!= ĠAL ARM _ NOT _ SET ĊĊĠ Ġfun Ġis NotIn Past (): ĠBoolean Ġ= Ġtrigger At Millis Ġ> ĠcurrentTime Millis () Ċ } Ċ Ċ data Ġclass ĠWindow Alarm ( val Ġtrigger At Millis : ĠLong , Ġval Ġwindow Length Millis : ĠLong ) Ġ{ ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠ Ġval ĠNOT _ SET Ġ= ĠWindow Alarm ( ALARM _ NOT _ SET , ĠAL ARM _ NOT _ SET ) ĊĠ Ġ} ĊĊĠ Ġfun ĠisSet (): ĠBoolean Ġ= Ġtrigger At Millis Ġ!= ĠAL ARM _ NOT _ SET Ġ&& Ġwindow Length Millis Ġ!= ĠAL ARM _ NOT _ SET ĊĊĠ Ġfun Ġis NotIn Past (): ĠBoolean Ġ= Ġtrigger At Millis Ġ> ĠcurrentTime Millis () Ċ } Ċ Ċ data Ġclass ĠRe pe ating Alarm ( val Ġtrigger At Millis : ĠLong , Ġval Ġinterval Millis : ĠLong ) Ġ{ ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠ Ġval ĠNOT _ SET Ġ= ĠRe pe ating Alarm ( ALARM _ NOT _ SET , ĠAL ARM _ NOT _ SET ) ĊĠ Ġ} ĊĊĠ Ġfun ĠisSet (): ĠBoolean Ġ= Ġtrigger At Millis Ġ!= ĠAL ARM _ NOT _ SET Ġ&& Ġinterval Millis Ġ!= ĠAL ARM _ NOT _ SET Ċ }