Merge branch 'fix/sentry-404504' into 'release'
fix: 悬浮窗Detach时机问题造成的崩溃 See merge request halo/android/assistant-android!1839
This commit is contained in:
@ -71,9 +71,10 @@ class NDownloadSuspendIconWindow(context: Context, suspend: Boolean = true, priv
|
||||
this.onDragListener = onDragListener
|
||||
}
|
||||
|
||||
override fun detach() {
|
||||
super.detach()
|
||||
override fun onDetach() {
|
||||
root.removeCallbacks(initRunnable)
|
||||
edgeAnimator.removeAllUpdateListeners()
|
||||
edgeAnimator.removeAllListeners()
|
||||
edgeAnimator.cancel()
|
||||
}
|
||||
|
||||
|
||||
@ -46,22 +46,28 @@ abstract class NDownloadSuspendWindow<T : View>(
|
||||
onViewCreated(it)
|
||||
}
|
||||
|
||||
open fun attach() {
|
||||
fun attach() {
|
||||
if (!isAttached) {
|
||||
_isAttached = true
|
||||
windowManager.addView(root, layoutParams)
|
||||
context.registerComponentCallbacks(this)
|
||||
onAttach()
|
||||
}
|
||||
}
|
||||
|
||||
open fun detach() {
|
||||
fun detach() {
|
||||
if (isAttached) {
|
||||
_isAttached = false
|
||||
onDetach()
|
||||
context.unregisterComponentCallbacks(this)
|
||||
windowManager.removeView(root)
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun onAttach() = Unit
|
||||
|
||||
protected open fun onDetach() = Unit
|
||||
|
||||
protected open fun onViewCreated(view: T) = Unit
|
||||
|
||||
override fun onConfigurationChanged(configuration: Configuration) = Unit
|
||||
|
||||
Reference in New Issue
Block a user