@@ -11,17 +11,43 @@ import com.omarea.vtools.popup.FloatTaskManager
1111
1212class ScreenOffCleanup (private val context : Context ) : IEventReceiver {
1313 override fun eventFilter (eventType : EventType ): Boolean {
14- return eventType == EventType .SCREEN_OFF
14+ return eventType == EventType .SCREEN_OFF || eventType == EventType . SCREEN_ON
1515 }
1616
17+ private val status = booleanArrayOf(false , false , false , false )
1718 override fun onReceive (eventType : EventType ) {
18- Scene .post(Runnable {
19- FloatMonitorGame (context).hidePopupWindow()
20- FloatTaskManager (context).hidePopupWindow()
21- FloatFpsWatch (context).hidePopupWindow()
22- FloatMonitor (context).hidePopupWindow()
23- })
19+ Scene .post {
20+ if (eventType == EventType .SCREEN_OFF ) {
21+ status[0 ] = FloatMonitorGame .show == true
22+ status[1 ] = FloatTaskManager .show == true
23+ status[2 ] = FloatFpsWatch .show == true
24+ status[3 ] = FloatMonitor .show == true
25+
26+ FloatMonitorGame (context).hidePopupWindow()
27+ FloatTaskManager (context).hidePopupWindow()
28+ FloatFpsWatch (context).hidePopupWindow()
29+ FloatMonitor (context).hidePopupWindow()
30+ } else if (eventType == EventType .SCREEN_ON ) {
31+ if (status[0 ]) {
32+ FloatMonitorGame (context).showPopupWindow()
33+ status[0 ] = false
34+ }
35+ if (status[1 ]) {
36+ FloatTaskManager (context).showPopupWindow()
37+ status[1 ] = false
38+ }
39+ if (status[2 ]) {
40+ FloatFpsWatch (context).showPopupWindow()
41+ status[2 ] = false
42+ }
43+ if (status[3 ]) {
44+ FloatMonitor (context).showPopupWindow()
45+ status[3 ] = false
46+ }
47+ }
48+ }
2449 }
50+
2551 override val isAsync: Boolean
2652 get() = false
2753}
0 commit comments