the screenactivity is called by the screen lock service to display the specified screen lock interface, which is equivalent to a controller that controls different unlock interfaces. Different unlock interfaces are displayed. This class also handles some details and hides the status bar.
Import Java. util. timer; import Java. util. timertask; import android. app. activity; import android. content. broadcastreceiver; import android. content. context; import android. content. intent; import android. content. intentfilter; import android. graphics. pixelformat; import android. OS. bundle; import android. view. windowmanager;/*** the controller of display interface * @ author Liao **/public class screenactivity E Xtends activity {private timer; @ overrideprotected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. saf_fullscreen); // configuration parameters for this activitygetwindow (). setformat (pixelformat. translucent); getwindow (). setbackgrounddrawable (null); hidestatusbar (true); // registered receive close activiysintentfilter localintentfilter = ne W intentfilter (); localintentfilter. addaction (saflockconstants. intent_unlock); registerreceiver (mreceiver, localintentfilter);} @ overrideprotected void onresume () {super. onresume (); // set a timer, executing a timing tasktimer = new timer (); timer. schedule (New timertask () {@ overridepublic void run () {// start the specified activityintent mlockscreenintent = new intent (saflockconstants. lock_intent); mlocks Creenintent. addflags (intent. flag_activity_new_task); mlockscreenintent. addflags (intent. flag_activity_no_animation); startactivity (mlockscreenintent) ;}, 300) ;}@ overrideprotected void ondestroy () {super. ondestroy (); // unregister this receiverunregisterreceiver (mreceiver);}/*** finish this Activiy */private void close () {This. finish ();}/*** receive the broadcast to finish activity */broadcastreceiver Mreceiver = new broadcastreceiver () {@ overridepublic void onreceive (context, intent) {close ();}}; /*** hide the statusbar of this activity * @ Param flag */Public void hidestatusbar (Boolean flag) {If (! Flag) {This. getwindow (). clearflags (windowmanager. layoutparams. flag_fullscreen); this. getwindow (). addflags (windowmanager. layoutparams. flag_force_not_fullscreen);} else {This. getwindow (). addflags (windowmanager. layoutparams. flag_fullscreen); this. getwindow (). clearflags (windowmanager. layoutparams. flag_force_not_fullscreen );}}}
To be continued...