Skip to content

Commit

Permalink
perf: 优化无障碍弹窗创建提示
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Nov 29, 2023
1 parent c9bfa5a commit 9934221
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/main/java/li/songe/gkd/service/GkdAbService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.view.WindowManager
import android.view.accessibility.AccessibilityEvent
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.ServiceUtils
import com.blankj.utilcode.util.ToastUtils
import io.ktor.client.request.get
import io.ktor.client.statement.bodyAsText
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -302,7 +303,12 @@ class GkdAbService : CompositionAbService({
height = 1
}
withContext(Dispatchers.Main) {
wm.addView(aliveView, lp)
try {
wm.addView(aliveView, lp)
} catch (e: Exception) {
LogUtils.d(e)
ToastUtils.showShort("创建无障碍悬浮窗失败!")
}
}
} else {
aliveView = null
Expand Down

0 comments on commit 9934221

Please sign in to comment.