package Ġcom . snow d ango . num ac . dispatcher Ċ Ċ import Ġandroid . util . Log Ċ import Ġcom . snow d ango . num ac . actions . app invisible list . App In visible List Database Action Ċ import Ġcom . snow d ango . num ac . actions . app list . App List Action Ċ import Ġcom . snow d ango . num ac . actions . app list db . Database Action Ċ import Ġcom . snow d ango . num ac . actions . app recent ly . Recent ly App Database Action Ċ import Ġcom . snow d ango . num ac . actions . change comm nad . Change Command Action Ċ import Ġcom . snow d ango . num ac . actions . command . Command Action Ċ import Ġcom . snow d ango . num ac . actions . cont ro lf avorite . Control Favorite Action Ċ import Ġcom . snow d ango . num ac . actions . remove app . Remove App Action Ċ import Ġcom . snow d ango . num ac . actions . visible . Toggle Visible Action Ċ import Ġjava . util .* Ċ Ċ class ĠDispatcher Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġapp List Listeners Ġ= ĠCollections . synchronized List ( mutable ListOf < App List ActionListener >()) ĊĠĠĠ Ġprivate Ġval Ġapp In Visible List Listener Ġ= ĠCollections . synchronized List ( mutable ListOf < App In visible List Listener >()) ĊĠĠĠ Ġprivate Ġval Ġcommand Listeners Ġ= ĠCollections . synchronized List ( mutable ListOf < Command ActionListener >()) ĊĠĠĠ Ġprivate Ġval Ġdatabase Listeners Ġ= ĠCollections . synchronized List ( mutable ListOf < Database ActionListener >()) ĊĠĠĠ Ġprivate Ġval Ġrecently Listeners Ġ= ĠCollections . synchronized List ( mutable ListOf < Recent ly ActionListener >()) ĊĠĠĠ Ġprivate Ġval Ġremove Listeners Ġ= ĠCollections . synchronized List ( mutable ListOf < Remove App ActionListener >()) ĊĠĠĠ Ġprivate Ġval Ġchange Command Listener Ġ= ĠCollections . synchronized List ( mutable ListOf < Change Command ActionListener >()) ĊĠĠĠ Ġprivate Ġval Ġcontrol Favorite Listener Ġ= ĠCollections . synchronized List ( mutable ListOf < Control Favorite ActionListener >()) ĊĠĠĠ Ġprivate Ġval Ġcontrol Visible Listener Ġ= ĠCollections . synchronized List ( mutable ListOf < Control Visible ActionListener >()) ĊĊĠĠĠ Ġinterface ĠApp List ActionListener Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : ĠApp List Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠApp In visible List Listener { ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : ĠApp In visible List Database Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠCommand ActionListener { ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : ĠCommand Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠDatabase ActionListener Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : ĠDatabase Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠRecent ly ActionListener { ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : ĠRecent ly App Database Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠRemove App ActionListener { ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : ĠRemove App Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠChange Command ActionListener { ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : ĠChange Command Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠControl Favorite ActionListener { ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : Control Favorite Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠControl Visible ActionListener { ĊĠĠĠĠĠĠĠ Ġfun Ġon ( action : ĠToggle Visible Action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdispatch Database ( action : ĠDatabase Action ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatcher ", Ġ" database ") ĊĠĠĠĠĠĠĠ Ġdatabase Listeners . forEach Ġ{ Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdispatch In Visible Db ( action : ĠApp In visible List Database Action ){ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatcher ", Ġ" invisible ") ĊĠĠĠĠĠĠĠ Ġapp In Visible List Listener . forEach { Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdispatch Recent ly ( action : ĠRecent ly App Database Action ){ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatcher ", Ġ" recent ly ") ĊĠĠĠĠĠĠĠ Ġrecently Listeners . forEach Ġ{ Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġfun Ġdispatch App List ( action : ĠApp List Action ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatcher ", Ġ" app List ") ĊĠĠĠĠĠĠĠ Ġapp List Listeners . forEach Ġ{ Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdispatch Command ( action : ĠCommand Action ){ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatcher ", Ġ" command ") ĊĠĠĠĠĠĠĠ Ġcommand Listeners . forEach Ġ{ Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdispatch Remove App ( action : ĠRemove App Action ){ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatcher ", Ġ" remove ") ĊĠĠĠĠĠĠĠ Ġremove Listeners . forEach Ġ{ Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdispatch Change Command ( action : ĠChange Command Action ){ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatcher "," change Command ") ĊĠĠĠĠĠĠĠ Ġchange Command Listener . forEach Ġ{ Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdispatch Favorite Control ( action : ĠControl Favorite Action ){ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatch "," control Ġfavorite ") ĊĠĠĠĠĠĠĠ Ġcontrol Favorite Listener . forEach { Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdispatch Visible Control ( action : ĠToggle Visible Action ){ ĊĠĠĠĠĠĠĠ ĠLog . d (" dispatch "," control Ġvisible ") ĊĠĠĠĠĠĠĠ Ġcontrol Visible Listener . forEach Ġ{ Ġit . on ( action ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġregister Main ( listener App List : ĠApp List ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Command : ĠCommand ActionListener ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . d ( TAG ," register Main ") ĊĠĠĠĠĠĠĠ Ġapp List Listeners . add ( listener App List ) ĊĠĠĠĠĠĠĠ Ġcommand Listeners . add ( listener Command ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġregister App View ( listener Database ActionListener : ĠDatabase ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Recent ly ActionListener : ĠRecent ly ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Remove App ActionListener : ĠRemove App ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Change Command ActionListener : ĠChange Command ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Control Favorite ActionListener : ĠControl Favorite ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Control Visible ActionListener : ĠControl Visible ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener App In visible List Listener : ĠApp In visible List Listener ){ ĊĠĠĠĠĠĠĠ ĠLog . d ( TAG ," register App View ") ĊĠĠĠĠĠĠĠ Ġdatabase Listeners . add ( listener Database ActionListener ) ĊĠĠĠĠĠĠĠ Ġapp In Visible List Listener . add ( listener App In visible List Listener ) ĊĠĠĠĠĠĠĠ Ġrecently Listeners . add ( listener Recent ly ActionListener ) ĊĠĠĠĠĠĠĠ Ġremove Listeners . add ( listener Remove App ActionListener ) ĊĠĠĠĠĠĠĠ Ġchange Command Listener . add ( listener Change Command ActionListener ) ĊĠĠĠĠĠĠĠ Ġcontrol Favorite Listener . add ( listener Control Favorite ActionListener ) ĊĠĠĠĠĠĠĠ Ġcontrol Visible Listener . add ( listener Control Visible ActionListener ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġunregister Main ( listener App List : ĠApp List ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Command : ĠCommand ActionListener ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . d ( TAG ," unregister Main ") ĊĠĠĠĠĠĠĠ Ġapp List Listeners . remove ( listener App List ) ĊĠĠĠĠĠĠĠ Ġcommand Listeners . remove ( listener Command ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġunregister App View ( listener Database Listener : ĠDatabase ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Recent ly Listener : ĠRecent ly ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Remove App ActionListener : ĠRemove App ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Change Command ActionListener : ĠChange Command ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Control Favorite ActionListener : ĠControl Favorite ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener Control Visible ActionListener : ĠControl Visible ActionListener , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener App In visible List Listener : ĠApp In visible List Listener ){ ĊĊĠĠĠĠĠĠĠ ĠLog . d ( TAG ," unregister App View ") ĊĠĠĠĠĠĠĠ Ġdatabase Listeners . remove ( listener Database Listener ) ĊĠĠĠĠĠĠĠ Ġapp In Visible List Listener . remove ( listener App In visible List Listener ) ĊĠĠĠĠĠĠĠ Ġrecently Listeners . remove ( listener Recent ly Listener ) ĊĠĠĠĠĠĠĠ Ġremove Listeners . remove ( listener Remove App ActionListener ) ĊĠĠĠĠĠĠĠ Ġchange Command Listener . remove ( listener Change Command ActionListener ) ĊĠĠĠĠĠĠĠ Ġcontrol Favorite Listener . remove ( listener Control Favorite ActionListener ) ĊĠĠĠĠĠĠĠ Ġcontrol Visible Listener . remove ( listener Control Visible ActionListener ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠTAG Ġ= Ġ" Dispatcher " ĊĠĠĠ Ġ} Ċ }