mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-13 20:53:58 +08:00
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user