Skip to content

Commit d0c4b12

Browse files
committed
perf: minMargin
1 parent 6ea4a18 commit d0c4b12

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/src/main/kotlin/li/songe/gkd/service/OverlayWindowService.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ abstract class OverlayWindowService : LifecycleService(), SavedStateRegistryOwne
7979

8080
abstract val positionStoreKey: String
8181

82+
private val minMargin: Int
83+
get() = 10.dp.px.toInt()
84+
8285
val positionFlow by lazy {
8386
createTextFlow(
8487
key = positionStoreKey,
@@ -87,7 +90,7 @@ abstract class OverlayWindowService : LifecycleService(), SavedStateRegistryOwne
8790
if (size == 2) {
8891
get(0) to get(1)
8992
} else {
90-
0 to 0
93+
minMargin to BarUtils.getStatusBarHeight()
9194
}
9295
}
9396
},
@@ -125,8 +128,8 @@ abstract class OverlayWindowService : LifecycleService(), SavedStateRegistryOwne
125128
}
126129
}
127130
onCreated {
128-
val marginX = 20.dp.px.toInt()
129-
val marginY = BarUtils.getStatusBarHeight() + 5.dp.px.toInt()
131+
val marginX = minMargin
132+
val marginY = minMargin
130133
val layoutParams = WindowManager.LayoutParams(
131134
WindowManager.LayoutParams.WRAP_CONTENT,
132135
WindowManager.LayoutParams.WRAP_CONTENT,

0 commit comments

Comments
 (0)