loading
This commit is contained in:
parent
32553d70d1
commit
fc62d3a0cb
|
|
@ -4,6 +4,7 @@ import android.app.Activity
|
|||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
|
|
@ -53,12 +54,6 @@ class WinRecordsActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabS
|
|||
|
||||
override fun ViewBinding.initWindowInsets() {
|
||||
setImmerseRootView(contentRoot)
|
||||
/*ViewCompat.setOnApplyWindowInsetsListener(contentRoot) { v, insets ->
|
||||
val systemBars =
|
||||
insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
||||
v.updatePadding(top = systemBars.top)
|
||||
insets
|
||||
}*/
|
||||
}
|
||||
|
||||
override fun ViewBinding.initListeners() {
|
||||
|
|
@ -79,9 +74,14 @@ class WinRecordsActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabS
|
|||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
viewModel.ZeroBuyListData.collect { result ->
|
||||
when (result) {
|
||||
is com.gamedog.vididin.netbase.Result.Loading -> { }
|
||||
is com.gamedog.vididin.netbase.Result.Success -> updateUIs(result.data)
|
||||
is Result.Error -> { }
|
||||
is Result.Loading -> { showLoading(false) }
|
||||
is Result.Success -> {
|
||||
hideLoading()
|
||||
updateUIs(result.data)
|
||||
}
|
||||
is Result.Error -> {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +91,15 @@ class WinRecordsActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabS
|
|||
}
|
||||
|
||||
private fun updateUIs(data: ZeroBuyResp) {
|
||||
mAdapter.submitList(data.mCurrentList)
|
||||
if (data.mFinishedList.isNullOrEmpty()) {
|
||||
binding.tvNoDataHint.isVisible = true
|
||||
binding.recyclerView.isVisible = false
|
||||
} else {
|
||||
binding.tvNoDataHint.isVisible = false
|
||||
binding.recyclerView.isVisible = true
|
||||
mAdapter.submitList(data.mFinishedList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class ZeroBuyActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
|||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
viewModel.ZeroBuyListData.collect { result ->
|
||||
when (result) {
|
||||
is Result.Loading -> { showLoading(true) }
|
||||
is Result.Loading -> { showLoading(false) }
|
||||
is Result.Success -> {
|
||||
hideLoading()
|
||||
updateUIs(result.data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue