package Ġplay ground . develop . social note . utils Ċ Ċ import Ġandroid . app . Notification Channel Ċ import Ġandroid . app . Notification Manager Ċ import Ġandroid . app . Pending Intent Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Build Ċ import Ġandroid . text . Html Ċ import Ġandroid . text . Sp anned Ċ import Ġandroidx . core . app . Notification Compat Ċ import Ġandroidx . core . app . Task Stack Builder Ċ import Ġandroidx . core . text . Html Compat Ċ import Ġplay ground . develop . social note . R Ċ import Ġplay ground . develop . social note . receiver . Ge ofence Reminder Receiver Ċ import Ġplay ground . develop . social note . receiver . Note Reminder Receiver Ċ import Ġplay ground . develop . social note . receiver . Notification Receiver Ċ import Ġplay ground . develop . social note . ui . Add Edit Note Activity Ċ import Ġplay ground . develop . social note . ui . Post Details Activity Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . ACTIVITY _ NOTE _ GE OF ENCE _ NOTIFICATION _ OPEN Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . ACTIVITY _ NOTE _ TIMER _ NOTIFICATION _ OPEN Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . DIS MIS S _ NOTE _ GE OF ENCE _ NOTIFICATION Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . DIS MIS S _ NOTE _ TIME _ REM IND ER _ NOTIFICATION Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . DIS MIS S _ POST _ COMMENT _ NOTIFICATION _ ACTION Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . FI REST ORE _ POST _ AUTHOR _ REGISTER _ TOKEN _ KEY Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . FI REST ORE _ POST _ DOC _ INT ENT _ KEY Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . NOTE _ INT ENT _ KEY Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . OPEN _ FROM _ NOTIFICATION _ COMMENT Ċ import Ġplay ground . develop . social note . utils . Constants . Companion . USER _ COUNTRY _ ISO _ KEY Ċ import Ġjava . util .* ĊĊ Ċ /** Ċ Ġ* ĠCreated Ġby ĠA bd ull ah At ta Ġon Ġ 8 / 9 / 2 0 1 9 . Ċ Ġ*/ Ċ class ĠNotifications Utils Ġ{ ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠNotification Ġupon Ġuser Ġlike Ġ& Ġtext ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġfun Ġsend Post Interact Notification ( context : ĠContext , Ġtext : ĠString , Ġtitle : ĠString , Ġdocument Id : ĠString , Ġtoken : ĠString , Ġcountry Code : ĠString ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnotification Id Ġ= ĠDate (). time ĊĊĠĠĠĠĠĠĠ Ġval Ġnotification Manager : ĠNotification Manager Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . getSystem Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠĠĠĠĠ Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . O ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġchannel Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠNotification Channel ( context . getString ( R . string . notification _ post _ channel _ id ), Ġcontext . getString ( R . string . notification _ social _ posts _ channel _ name ), ĠNotification Manager . IMPORT ANCE _ HIGH ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotification Manager . create Notification Channel ( channel ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġbuilder Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget Post Interact Notification Builder ( context , Ġnotification Id . toInt (), Ġtext , Ġtitle , Ġdocument Id , Ġtoken , Ġcountry Code ) ĊĠĠĠĠĠĠĠ Ġnotification Manager . notify ( notification Id . toInt (), Ġbuilder . build ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Post Interact Notification Builder ( context : ĠContext , Ġnotification Id : ĠInt , Ġtext : ĠString , Ġtitle : ĠString , Ġdocument Id : ĠString , Ġtoken : ĠString , Ġcountry Code : ĠString ?): ĠNotification Compat . Builder Ġ{ ĊĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. Builder ( context , Ġcontext . getString ( R . string . notification _ post _ channel _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Small Icon ( R . drawable . ic _ logo _ notification ). setContent Title ( title ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Text ( text ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Intent ( getPost Content Pending Intent ( context , Ġnotification Id , Ġdocument Id , Ġtoken , Ġcountry Code )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Priority ( Notification Compat . PRIORITY _ HIGH ). setAuto Cancel ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addAction ( get Dismiss Post Notification Action ( context , Ġnotification Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addAction ( get Open Post Notification Action ( context , Ġnotification Id , Ġdocument Id , Ġtoken , Ġcountry Code )) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Open Post Notification Action ( context : ĠContext , Ġnotification Id : ĠInt , Ġdocument Id : ĠString , Ġtoken : ĠString , Ġcountry Code : ĠString ?): ĠNotification Compat . Action ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. Action ( R . drawable . ic _ open , Ġcontext . getString ( R . string . open _ post _ notification _ action _ label ), Ġget Open Post Pending Intent ( context , Ġnotification Id , Ġdocument Id , Ġtoken , Ġcountry Code )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Open Post Pending Intent ( context : ĠContext , Ġnotification Id : ĠInt , Ġdocument Id : ĠString , Ġtoken : ĠString , Ġcountry Code : ĠString ?): ĠPending Intent ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġopen Intent Ġ= ĠIntent ( context , ĠPost Details Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġopen Intent . putExtra ( OPEN _ FROM _ NOTIFICATION _ COMMENT , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġopen Intent . putExtra ( FI REST ORE _ POST _ AUTHOR _ REGISTER _ TOKEN _ KEY , Ġtoken ) ĊĠĠĠĠĠĠĠ Ġopen Intent . putExtra ( FI REST ORE _ POST _ DOC _ INT ENT _ KEY , Ġdocument Id ) ĊĠĠĠĠĠĠĠ Ġopen Intent . putExtra ( DIS MIS S _ POST _ COMMENT _ NOTIFICATION _ ACTION , Ġnotification Id ) ĊĠĠĠĠĠĠĠ Ġopen Intent . putExtra ( USER _ COUNTRY _ ISO _ KEY , Ġcountry Code ) ĊĠĠĠĠĠĠĠ Ġreturn ĠTask Stack Builder . create ( context ). run Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Next Intent With Parent Stack ( open Intent ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget Pending Intent ( notification Id , ĠPending Intent . FLAG _ UPDATE _ CURRENT ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Dismiss Post Notification Action ( context : ĠContext , Ġnotification Id : ĠInt ): ĠNotification Compat . Action ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. Action ( R . drawable . ic _ dismiss , Ġcontext . getString ( R . string . note _ notification _ dismiss _ action _ label ), Ġget Dismiss Post Notification Intent ( context , Ġnotification Id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Dismiss Post Notification Intent ( context : ĠContext , Ġnotification Id : ĠInt ): ĠPending Intent ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdismiss Intent Ġ= ĠIntent ( context , ĠNotification Receiver :: class . java ) ĊĠĠĠĠĠĠĠ Ġdismiss Intent . action Ġ= ĠDIS MIS S _ POST _ COMMENT _ NOTIFICATION _ ACTION ĊĠĠĠĠĠĠĠ Ġdismiss Intent . putExtra ( DIS MIS S _ POST _ COMMENT _ NOTIFICATION _ ACTION , Ġnotification Id ) ĊĠĠĠĠĠĠĠ Ġreturn ĠPending Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Broadcast ( context , Ġnotification Id , Ġdismiss Intent , ĠPending Intent . FLAG _ UPDATE _ CURRENT ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Post Content Pending Intent ( context : ĠContext , Ġnotification Id : ĠInt , Ġdocument Id : ĠString , Ġtoken : ĠString , Ġcountry Code : ĠString ?): ĠPending Intent ? Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġcomment Intent Ġ= ĠIntent ( context , ĠPost Details Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġcomment Intent . putExtra ( FI REST ORE _ POST _ DOC _ INT ENT _ KEY , Ġdocument Id ) ĊĠĠĠĠĠĠĠ Ġcomment Intent . putExtra ( FI REST ORE _ POST _ AUTHOR _ REGISTER _ TOKEN _ KEY , Ġtoken ) ĊĠĠĠĠĠĠĠ Ġcomment Intent . putExtra ( USER _ COUNTRY _ ISO _ KEY , Ġcountry Code ) ĊĠĠĠĠĠĠĠ Ġcomment Intent . putExtra ( OPEN _ FROM _ NOTIFICATION _ COMMENT , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġreturn ĠTask Stack Builder . create ( context ). run Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Next Intent With Parent Stack ( comment Intent ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget Pending Intent ( notification Id , ĠPending Intent . FLAG _ UPDATE _ CURRENT ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsend Note Ge ofence Reminder Notification ( context : ĠContext , Ġnote Body : ĠString , Ġnote Id : ĠLong ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnotification Manager : ĠNotification Manager Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . getSystem Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠĠĠĠĠ Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . O ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġchannel Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠNotification Channel ( context . getString ( R . string . note _ ge ofence _ notification _ id ), Ġcontext . getString ( R . string . note _ ge ofence _ notification _ name ), ĠNotification Manager . IMPORT ANCE _ HIGH ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotification Manager . create Notification Channel ( channel ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġbuilder Ġ= Ġget Ge ofence Note Notification Builder ( context , Ġnote Body , Ġnote Id ) ĊĊĠĠĠĠĠĠĠ Ġnotification Manager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. notify ( context . resources . getInteger ( R . integer . note _ ge ofence _ reminder _ notification _ id ) Ġ+ Ġnote Id . toInt (), Ġbuilder ?. build ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Ge ofence Note Notification Builder ( context : ĠContext , Ġnote Body : ĠString , Ġnote Id : ĠLong ): ĠNotification Compat . Builder ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. Builder ( context , Ġcontext . getString ( R . string . note _ ge ofence _ notification _ channel _ name )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Small Icon ( R . drawable . ic _ logo _ notification ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Title ( context . getString ( R . string . note _ ge ofence _ notification _ title )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Text ( getBody ( note Body )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Intent ( get Note Ge ofence Location Pending Intent ( context , Ġnote Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Priority ( Notification Compat . PRIORITY _ HIGH ). setAuto Cancel ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addAction ( get Open Note Ge ofence Action ( context , Ġnote Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addAction ( dismiss Note Ge ofence Notification Action ( context , Ġnote Id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Dismiss Note Ge ofence Notification Pending Intent ( context : ĠContext , Ġnote Id : ĠLong ): ĠPending Intent ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdismiss Intent Ġ= ĠIntent ( context , ĠGe ofence Reminder Receiver :: class . java ) ĊĠĠĠĠĠĠĠ Ġdismiss Intent . action Ġ= ĠDIS MIS S _ NOTE _ GE OF ENCE _ NOTIFICATION ĊĠĠĠĠĠĠĠ Ġdismiss Intent . putExtra ( DIS MIS S _ NOTE _ GE OF ENCE _ NOTIFICATION , Ġnote Id ) Ġ// Ġjust Ġtreat Ġit Ġas Ġkey ĊĠĠĠĠĠĠĠ Ġreturn ĠPending Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Broadcast ( context , Ġnote Id . toInt (), Ġdismiss Intent , ĠPending Intent . FLAG _ UPDATE _ CURRENT ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġdismiss Note Ge ofence Notification Action ( context : ĠContext , Ġnote Id : ĠLong ): ĠNotification Compat . Action Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. Action ( R . drawable . ic _ dismiss , Ġcontext . getString ( R . string . note _ notification _ dismiss _ action _ label ), Ġget Dismiss Note Ge ofence Notification Pending Intent ( context , Ġnote Id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Open Note Ge ofence Action ( context : ĠContext , Ġnote Id : ĠLong ): ĠNotification Compat . Action Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. Action ( R . drawable . ic _ open , Ġcontext . getString ( R . string . note _ notification _ open _ action _ label ), Ġget Note Ge ofence Location Pending Intent ( context , Ġnote Id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdismiss Note Ge ofence Reminder Notification ( context : ĠContext , Ġnote Id : ĠLong ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnotification Manager : ĠNotification Manager Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . getSystem Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠĠĠĠĠ Ġnotification Manager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. cancel ( context . resources . getInteger ( R . integer . note _ ge ofence _ reminder _ notification _ id ) Ġ+ Ġnote Id . toInt ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Note Ge ofence Location Pending Intent ( context : ĠContext , Ġnote Id : ĠLong ): ĠPending Intent ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnote Intent Ġ= ĠIntent ( context , ĠAdd Edit Note Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġnote Intent . putExtra ( ACTIVITY _ NOTE _ GE OF ENCE _ NOTIFICATION _ OPEN , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġnote Intent . putExtra ( NOTE _ INT ENT _ KEY , Ġnote Id ) ĊĠĠĠĠĠĠĠ Ġreturn ĠTask Stack Builder . create ( context ). run Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Next Intent With Parent Stack ( note Intent ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget Pending Intent ( note Id . toInt (), ĠPending Intent . FLAG _ UPDATE _ CURRENT ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsend Note Time Reminder Notification ( context : ĠContext , Ġnote Body : ĠString , Ġnote Id : ĠLong ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnotification Manager : ĠNotification Manager Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . getSystem Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠĠĠĠĠ Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . O ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġchannel Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠNotification Channel ( context . getString ( R . string . notification _ id ), Ġcontext . getString ( R . string . notification _ note _ time _ reminder _ channel _ name ), ĠNotification Manager . IMPORT ANCE _ HIGH ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotification Manager . create Notification Channel ( channel ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġbuilder Ġ= Ġget Note Time Reminder Notification Builder ( context , Ġnote Body , Ġnote Id ) ĊĊĠĠĠĠĠĠĠ Ġnotification Manager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. notify ( context . resources . getInteger ( R . integer . note _ reminder _ notification _ id ) Ġ+ Ġnote Id . toInt (), Ġbuilder ?. build ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Note Time Reminder Notification Builder ( context : ĠContext , Ġnote Body : ĠString , Ġnote Id : ĠLong ): ĠNotification Compat . Builder ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat . Builder ( context , Ġcontext . getString ( R . string . notification _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Small Icon ( R . drawable . ic _ logo _ notification ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Title ( context . getString ( R . string . note _ time _ reminder _ notification _ title )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Text ( getBody ( note Body )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Intent ( get Open Note Notification Pending Intent ( context , Ġnote Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Priority ( Notification Compat . PRIORITY _ HIGH ). setAuto Cancel ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addAction ( get Open Note Action ( context , Ġnote Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addAction ( dismiss Notifications Action ( context , Ġnote Id )) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġprivate Ġfun Ġget Open Note Action ( context : ĠContext , Ġnote Id : ĠLong ): ĠNotification Compat . Action Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. Action ( R . drawable . ic _ open , Ġcontext . getString ( R . string . note _ notification _ open _ action _ label ), Ġget Open Note Notification Pending Intent ( context , Ġnote Id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġdismiss Notifications Action ( context : ĠContext , Ġnote Id : ĠLong ): ĠNotification Compat . Action Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification Compat ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. Action ( R . drawable . ic _ dismiss , Ġcontext . getString ( R . string . note _ notification _ dismiss _ action _ label ), Ġget Dismiss Notification Pending Intent ( context , Ġnote Id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Open Note Notification Pending Intent ( context : ĠContext , Ġnote Id : ĠLong ): ĠPending Intent ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnote Intent Ġ= ĠIntent ( context , ĠAdd Edit Note Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġnote Intent . putExtra ( ACTIVITY _ NOTE _ TIMER _ NOTIFICATION _ OPEN , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġnote Intent . putExtra ( NOTE _ INT ENT _ KEY , Ġnote Id ) ĊĠĠĠĠĠĠĠ Ġreturn ĠTask Stack Builder . create ( context ). run Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Next Intent With Parent Stack ( note Intent ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget Pending Intent ( note Id . toInt (), ĠPending Intent . FLAG _ UPDATE _ CURRENT ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Dismiss Notification Pending Intent ( context : ĠContext , Ġnote Id : ĠLong ): ĠPending Intent ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdismiss Intent Ġ= ĠIntent ( context , ĠNote Reminder Receiver :: class . java ) ĊĠĠĠĠĠĠĠ Ġdismiss Intent . action Ġ= ĠDIS MIS S _ NOTE _ TIME _ REM IND ER _ NOTIFICATION ĊĠĠĠĠĠĠĠ Ġdismiss Intent . putExtra ( NOTE _ INT ENT _ KEY , Ġnote Id ) ĊĠĠĠĠĠĠĠ Ġreturn ĠPending Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Broadcast ( context , Ġnote Id . toInt (), Ġdismiss Intent , ĠPending Intent . FLAG _ UPDATE _ CURRENT ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdismiss Note Reminder Notification ( context : ĠContext , Ġid : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnotification Manager : ĠNotification Manager Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . getSystem Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠĠĠĠĠ Ġnotification Manager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. cancel ( context . resources . getInteger ( R . integer . note _ reminder _ notification _ id ) Ġ+ Ġid ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġprivate Ġfun Ġget Body ( body : ĠString ): ĠSp anned Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . N ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠHtml Compat . from Html ("$ body Ġ... ", ĠHtml . FROM _ HTML _ MODE _ LEG ACY ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠHtml . from Html ( body ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠI Ġam Ġjust Ġgonna Ġleave Ġit Ġhere ĊĠĠĠĠ Ġ* ĠI Ġam Ġsure ĠI 'll Ġuse Ġit Ġlater Ġsomehow ĊĠĠĠĠ Ġ* ĠI Ġhope . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġfun Ġdismiss All Notifications ( context : ĠContext ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnotification Manager : ĠNotification Manager Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . getSystem Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠĠĠĠĠ Ġnotification Manager . cancel All () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdismiss Comment Notification ( context : ĠContext , Ġnotification Id : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnotification Manager : ĠNotification Manager Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . getSystem Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠĠĠĠĠ Ġnotification Manager . cancel ( notification Id ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġget Notification Utils (): ĠNotifications Utils Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠNotifications Utils () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }