This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dialogfragment使用记录 | |
| https://gist.github.com/yizuochengchi/2ad1e5e0127a3d42dd7c569da132c292 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 场景:dialogfragment(tabLayout+viewpager) + 两个Afragment | |
| 解决方案一: | |
| class SafeMutableLiveData<T> : MutableLiveData<T>() { | |
| private var weakLifecycleOwner: WeakReference<LifecycleOwner>? = null | |
| override fun observe(owner: LifecycleOwner, observer: Observer<in T>) { | |
| weakLifecycleOwner?.get()?.let { | |
| removeObservers(it) |
OlderNewer