Fix strange crash

This commit is contained in:
Benoit Marty 2020-12-16 12:21:25 +01:00
parent e081c3b249
commit 7f02c0596e
2 changed files with 19 additions and 18 deletions

View file

@ -42,7 +42,7 @@ abstract class SimpleFragmentActivity : VectorBaseActivity<ActivityBinding>() {
override fun initUiAndData() { override fun initUiAndData() {
configureToolbar(views.toolbar) configureToolbar(views.toolbar)
waitingView = views.overlayWaitingView.waitingView waitingView = views.waitingView.waitingView
} }
/** /**
@ -51,21 +51,21 @@ abstract class SimpleFragmentActivity : VectorBaseActivity<ActivityBinding>() {
*/ */
fun updateWaitingView(data: WaitingViewData?) { fun updateWaitingView(data: WaitingViewData?) {
data?.let { data?.let {
views.overlayWaitingView.waitingStatusText.text = data.message views.waitingView.waitingStatusText.text = data.message
if (data.progress != null && data.progressTotal != null) { if (data.progress != null && data.progressTotal != null) {
views.overlayWaitingView.waitingHorizontalProgress.isIndeterminate = false views.waitingView.waitingHorizontalProgress.isIndeterminate = false
views.overlayWaitingView.waitingHorizontalProgress.progress = data.progress views.waitingView.waitingHorizontalProgress.progress = data.progress
views.overlayWaitingView.waitingHorizontalProgress.max = data.progressTotal views.waitingView.waitingHorizontalProgress.max = data.progressTotal
views.overlayWaitingView.waitingHorizontalProgress.isVisible = true views.waitingView.waitingHorizontalProgress.isVisible = true
views.overlayWaitingView.waitingCircularProgress.isVisible = false views.waitingView.waitingCircularProgress.isVisible = false
} else if (data.isIndeterminate) { } else if (data.isIndeterminate) {
views.overlayWaitingView.waitingHorizontalProgress.isIndeterminate = true views.waitingView.waitingHorizontalProgress.isIndeterminate = true
views.overlayWaitingView.waitingHorizontalProgress.isVisible = true views.waitingView.waitingHorizontalProgress.isVisible = true
views.overlayWaitingView.waitingCircularProgress.isVisible = false views.waitingView.waitingCircularProgress.isVisible = false
} else { } else {
views.overlayWaitingView.waitingHorizontalProgress.isVisible = false views.waitingView.waitingHorizontalProgress.isVisible = false
views.overlayWaitingView.waitingCircularProgress.isVisible = true views.waitingView.waitingCircularProgress.isVisible = true
} }
showWaitingView() showWaitingView()
@ -76,15 +76,15 @@ abstract class SimpleFragmentActivity : VectorBaseActivity<ActivityBinding>() {
override fun showWaitingView() { override fun showWaitingView() {
hideKeyboard() hideKeyboard()
views.overlayWaitingView.waitingStatusText.isGone = views.overlayWaitingView.waitingStatusText.text.isNullOrBlank() views.waitingView.waitingStatusText.isGone = views.waitingView.waitingStatusText.text.isNullOrBlank()
super.showWaitingView() super.showWaitingView()
} }
override fun hideWaitingView() { override fun hideWaitingView() {
views.overlayWaitingView.waitingStatusText.text = null views.waitingView.waitingStatusText.text = null
views.overlayWaitingView.waitingStatusText.isGone = true views.waitingView.waitingStatusText.isGone = true
views.overlayWaitingView.waitingHorizontalProgress.progress = 0 views.waitingView.waitingHorizontalProgress.progress = 0
views.overlayWaitingView.waitingHorizontalProgress.isVisible = false views.waitingView.waitingHorizontalProgress.isVisible = false
super.hideWaitingView() super.hideWaitingView()
} }

View file

@ -27,8 +27,9 @@
app:layout_constraintTop_toBottomOf="@id/toolbar" /> app:layout_constraintTop_toBottomOf="@id/toolbar" />
<include <include
android:id="@+id/overlay_waiting_view" android:id="@+id/waiting_view"
layout="@layout/merge_overlay_waiting_view" /> layout="@layout/merge_overlay_waiting_view" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>