mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
feat: Android 平台屏幕保护
This commit is contained in:
@@ -2,6 +2,8 @@ package com.lifegpc.ehf
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.view.WindowManager
|
||||||
|
import com.lifegpc.ehf.annotation.ChannelMethod
|
||||||
import com.lifegpc.ehf.eventbus.SAFAuthEvent
|
import com.lifegpc.ehf.eventbus.SAFAuthEvent
|
||||||
import com.lifegpc.ehf.platform.ClipboardPlugin
|
import com.lifegpc.ehf.platform.ClipboardPlugin
|
||||||
import com.lifegpc.ehf.platform.MethodChannelUtils
|
import com.lifegpc.ehf.platform.MethodChannelUtils
|
||||||
@@ -24,6 +26,11 @@ class MainActivity : FlutterActivity() {
|
|||||||
flutterEngine,
|
flutterEngine,
|
||||||
ClipboardPlugin
|
ClipboardPlugin
|
||||||
)
|
)
|
||||||
|
MethodChannelUtils.registerMethodChannel(
|
||||||
|
"lifegpc.eh_downloader_flutter/display",
|
||||||
|
flutterEngine,
|
||||||
|
this
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
@@ -40,4 +47,16 @@ class MainActivity : FlutterActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ChannelMethod(methodName = "enableProtect")
|
||||||
|
@Suppress("unused")
|
||||||
|
private fun enableFlagSecure() {
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ChannelMethod(methodName = "disableProtect")
|
||||||
|
@Suppress("unused")
|
||||||
|
private fun disableFlagSecure() {
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user