Skip to content

Commit

Permalink
Show progress bar on login
Browse files Browse the repository at this point in the history
Related #25
  • Loading branch information
alexandr7035 committed Oct 13, 2021
1 parent 6963f4c commit 93d1fb9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ class LoginFragment: Fragment() {
return
}
else {
////Log.d(LOG_TAG, "do login request")
token = binding!!.tokenEditText.text.toString()
// viewModel.doLoginRequest(token)

// Show progress stub and do login
binding?.loginProgressView?.visibility = View.VISIBLE

viewModel.saveToken(token)
viewModel.authorize()
Expand All @@ -89,6 +90,9 @@ class LoginFragment: Fragment() {

viewModel.getAuthResultLiveData().observe(viewLifecycleOwner, { status ->

// Hide progress
binding?.loginProgressView?.visibility = View.GONE

when (status) {
AuthStatus.SUCCESS -> {
// FIXME Not good. Find better solution
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/res/layout/fragment_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,28 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />


<!-- Do not remove clickable -->
<FrameLayout
android:id="@+id/loginProgressView"
android:visibility="gone"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#70FFFFFF"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">

<ProgressBar
android:id="@+id/progressBar"
android:layout_gravity="center"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="5dp"
android:indeterminateTint="@color/gray_400"/>

</FrameLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 93d1fb9

Please sign in to comment.