Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-01 10:37:31 +08:00
parent 91a14d8286
commit d27f5f315c
71 changed files with 94 additions and 1561 deletions

View File

@@ -27,7 +27,6 @@ import java.io.File
class MainActivity : AudioServiceActivity() {
private lateinit var methodChannel: MethodChannel
private var isFoldable = false
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
@@ -181,8 +180,8 @@ class MainActivity : AudioServiceActivity() {
}
}
"isFoldable" -> {
result.success(isFoldable)
"sdkInt" -> {
result.success(Build.VERSION.SDK_INT)
}
else -> result.notImplemented()
@@ -190,18 +189,6 @@ class MainActivity : AudioServiceActivity() {
}
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
if (isFoldable) {
maxScreenSize()?.let {
MethodChannel(
flutterEngine!!.dartExecutor.binaryMessenger,
"ScreenChannel"
).invokeMethod("onConfigChanged", it)
}
}
}
private fun maxScreenSize(): Map<String, Int>? {
try {
val density = resources.displayMetrics.density
@@ -238,14 +225,6 @@ class MainActivity : AudioServiceActivity() {
window.attributes.layoutInDisplayCutoutMode =
LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try {
isFoldable =
packageManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_HINGE_ANGLE)
} catch (e: Exception) {
}
}
}
override fun onDestroy() {