Add a loader waiting for the user location to be known

This commit is contained in:
Benoit Marty 2022-01-27 22:27:43 +01:00
parent 55ed7373f5
commit 26c0fee56d
2 changed files with 11 additions and 0 deletions

View file

@ -20,6 +20,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isGone
import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -114,6 +115,7 @@ class LocationSharingFragment @Inject constructor(
override fun invalidate() = withState(viewModel) { state ->
views.mapView.render(state.toMapState())
views.shareLocationGpsLoading.isGone = state.lastKnownLocation != null
}
companion object {

View file

@ -48,4 +48,13 @@
android:textColor="?colorPrimary"
android:textStyle="bold" />
<ProgressBar
android:id="@+id/shareLocationGpsLoading"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="@dimen/layout_horizontal_margin"
app:layout_constraintBottom_toBottomOf="@id/shareLocationContainer"
app:layout_constraintEnd_toEndOf="@id/shareLocationContainer"
app:layout_constraintTop_toTopOf="@id/shareLocationContainer" />
</androidx.constraintlayout.widget.ConstraintLayout>