mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-23 19:55:11 +00:00
fixed network issue
This commit is contained in:
parent
91503cf66c
commit
f467c283fe
1 changed files with 18 additions and 21 deletions
|
@ -66,38 +66,35 @@ class HomeFragment : Home() {
|
|||
}
|
||||
|
||||
private fun checkNetwork() {
|
||||
val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper)
|
||||
|
||||
val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper)
|
||||
disposable = ReactiveNetwork.observeInternetConnectivity()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { isConnectedToInternet ->
|
||||
if (isConnectedToInternet) {
|
||||
if (networkErrorLayout?.visibility != View.GONE) {
|
||||
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0f, 0.3f)
|
||||
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, -1f)
|
||||
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0f, 0.3f)
|
||||
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, -1f)
|
||||
|
||||
oa2.start()
|
||||
oa3.apply {
|
||||
oa3.addListener(onEnd = {
|
||||
networkErrorLayout?.visibility = View.GONE
|
||||
})
|
||||
start()
|
||||
}
|
||||
oa2.start()
|
||||
oa3.apply {
|
||||
oa3.addListener(onEnd = {
|
||||
networkErrorLayout?.visibility = View.GONE
|
||||
})
|
||||
start()
|
||||
}
|
||||
} else {
|
||||
if (networkErrorLayout?.visibility != View.VISIBLE) {
|
||||
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", -1f, 0.3f)
|
||||
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, 0f)
|
||||
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", -1f, 0.3f)
|
||||
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, 0f)
|
||||
|
||||
oa2.apply {
|
||||
oa2.addListener(onStart = {
|
||||
networkErrorLayout?.visibility = View.VISIBLE
|
||||
})
|
||||
start()
|
||||
}
|
||||
oa3.start()
|
||||
oa2.apply {
|
||||
oa2.addListener(onStart = {
|
||||
networkErrorLayout?.visibility = View.VISIBLE
|
||||
})
|
||||
start()
|
||||
}
|
||||
oa3.start()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue