SoftLogout: Loading UI
This commit is contained in:
parent
a5af949c15
commit
d2fea275d8
|
@ -18,6 +18,7 @@ package im.vector.riotx.features.signout
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import com.airbnb.mvrx.Success
|
import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
import im.vector.matrix.android.api.failure.GlobalError
|
import im.vector.matrix.android.api.failure.GlobalError
|
||||||
|
@ -28,6 +29,7 @@ import im.vector.riotx.core.extensions.replaceFragment
|
||||||
import im.vector.riotx.core.platform.VectorBaseActivity
|
import im.vector.riotx.core.platform.VectorBaseActivity
|
||||||
import im.vector.riotx.features.MainActivity
|
import im.vector.riotx.features.MainActivity
|
||||||
import im.vector.riotx.features.MainActivityArgs
|
import im.vector.riotx.features.MainActivityArgs
|
||||||
|
import kotlinx.android.synthetic.main.activity_login.*
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -47,13 +49,13 @@ class SoftLogoutActivity : VectorBaseActivity() {
|
||||||
injector.inject(this)
|
injector.inject(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayoutRes() = R.layout.activity_simple
|
override fun getLayoutRes() = R.layout.activity_login
|
||||||
|
|
||||||
override fun initUiAndData() {
|
override fun initUiAndData() {
|
||||||
super.initUiAndData()
|
super.initUiAndData()
|
||||||
|
|
||||||
if (isFirstCreation()) {
|
if (isFirstCreation()) {
|
||||||
replaceFragment(R.id.simpleFragmentContainer, SoftLogoutFragment::class.java)
|
replaceFragment(R.id.loginFragmentContainer, SoftLogoutFragment::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
softLogoutViewModel
|
softLogoutViewModel
|
||||||
|
@ -66,6 +68,8 @@ class SoftLogoutActivity : VectorBaseActivity() {
|
||||||
if (softLogoutViewState.asyncLoginAction is Success) {
|
if (softLogoutViewState.asyncLoginAction is Success) {
|
||||||
MainActivity.restartApp(this, MainActivityArgs())
|
MainActivity.restartApp(this, MainActivityArgs())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loginLoading.isVisible = softLogoutViewState.isLoading()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package im.vector.riotx.features.signout
|
package im.vector.riotx.features.signout
|
||||||
|
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MvRxState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
|
|
||||||
|
@ -25,4 +26,10 @@ data class SoftLogoutViewState(
|
||||||
val homeServerUrl: String,
|
val homeServerUrl: String,
|
||||||
val userId: String,
|
val userId: String,
|
||||||
val userDisplayName: String
|
val userDisplayName: String
|
||||||
) : MvRxState
|
) : MvRxState {
|
||||||
|
|
||||||
|
fun isLoading(): Boolean {
|
||||||
|
return asyncLoginAction is Loading
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue