From bc6566bc92d073e64a8c51a681ff01ba973d7ee7 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 1 Jan 2019 18:50:14 -0500 Subject: Convert fade out to suspended function in login --- .../kotlin/com/pitchedapps/frost/activities/LoginActivity.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt index b5521e3e..150d29f4 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt @@ -91,13 +91,16 @@ class LoginActivity : BaseActivity() { val cookie = web.loadLogin { refresh(it != 100) } L.d { "Login found" } FbCookie.save(cookie.id) - web.fadeOut(onFinish = { - profile.fadeIn() - this@LoginActivity.launch { loadInfo(cookie) } - }) + webFadeOut() + profile.fadeIn() + loadInfo(cookie) } } + private suspend fun webFadeOut(): Unit = suspendCancellableCoroutine { cont -> + web.fadeOut { cont.resume(Unit) } + } + private fun refresh(refreshing: Boolean) { refreshChannel.offer(refreshing) } -- cgit v1.2.3