File tree 2 files changed +12
-0
lines changed
android/src/main/kotlin/qiuxiang/android_window
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,12 @@ class AndroidWindow(
116
116
windowManager.removeView(rootView)
117
117
}
118
118
119
+ fun updateLayout () {
120
+ @Suppress(" Deprecation" )
121
+ windowManager.defaultDisplay.getMetrics(metrics)
122
+ setPosition(layoutParams.x, layoutParams.y)
123
+ }
124
+
119
125
fun setLayout (width : Int , height : Int ) {
120
126
layoutParams.width = width
121
127
layoutParams.height = height
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import android.app.Notification
4
4
import android.app.NotificationChannel
5
5
import android.app.NotificationManager
6
6
import android.content.Intent
7
+ import android.content.res.Configuration
7
8
import android.os.Build
8
9
import android.os.IBinder
9
10
import io.flutter.embedding.engine.FlutterEngine
@@ -19,6 +20,11 @@ class WindowService : android.app.Service() {
19
20
return null
20
21
}
21
22
23
+ override fun onConfigurationChanged (newConfig : Configuration ) {
24
+ super .onConfigurationChanged(newConfig)
25
+ androidWindow.updateLayout()
26
+ }
27
+
22
28
override fun onStartCommand (intent : Intent , flags : Int , startId : Int ): Int {
23
29
if (! running) {
24
30
engine = FlutterEngine (application)
You can’t perform that action at this time.
0 commit comments