Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-06 14:14:19 +08:00
parent 1a8c348af1
commit 07843a5e77
239 changed files with 3175 additions and 13237 deletions

View File

@@ -43,9 +43,6 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
tools:replace="android:allowBackup">
<meta-data
android:name="io.flutter.embedding.android.EnableImpeller"
android:value="false" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@@ -26,12 +26,10 @@ import kotlin.system.exitProcess
import java.io.File
class MainActivity : AudioServiceActivity() {
private lateinit var methodChannel: MethodChannel
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
methodChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "PiliPlus")
val methodChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "PiliPlus")
methodChannel.setMethodCallHandler { call, result ->
when (call.method) {
"back" -> back();
@@ -174,12 +172,6 @@ class MainActivity : AudioServiceActivity() {
}
}
"maxScreenSize" -> {
maxScreenSize()?.let {
result.success(it)
}
}
"sdkInt" -> {
result.success(Build.VERSION.SDK_INT)
}
@@ -189,28 +181,6 @@ class MainActivity : AudioServiceActivity() {
}
}
private fun maxScreenSize(): Map<String, Int>? {
try {
val density = resources.displayMetrics.density
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val maxBounds = windowManager.maximumWindowMetrics.bounds
return mapOf(
"maxWidth" to (maxBounds.width() / density).roundToInt(),
"maxHeight" to (maxBounds.height() / density).roundToInt(),
)
} else {
val realSizePoint = Point()
windowManager.defaultDisplay.getRealSize(realSizePoint)
return mapOf(
"maxWidth" to (realSizePoint.x / density).roundToInt(),
"maxHeight" to (realSizePoint.y / density).roundToInt(),
)
}
} catch (e: Exception) {
return null
}
}
private fun back() {
val intent = Intent(Intent.ACTION_MAIN).apply {
addCategory(Intent.CATEGORY_HOME)
@@ -232,11 +202,6 @@ class MainActivity : AudioServiceActivity() {
super.onDestroy()
}
override fun onUserLeaveHint() {
super.onUserLeaveHint()
methodChannel.invokeMethod("onUserLeaveHint", null)
}
override fun onPictureInPictureModeChanged(
isInPictureInPictureMode: Boolean,
newConfig: Configuration?