Commit b59ba20a authored by Leonardo Aramaki's avatar Leonardo Aramaki

Add loading view while loading details

parent 8c0916b1
...@@ -5,6 +5,7 @@ import android.content.Intent ...@@ -5,6 +5,7 @@ import android.content.Intent
import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.BitmapDrawable
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import blurred import blurred
import chat.rocket.android.R import chat.rocket.android.R
...@@ -70,6 +71,7 @@ class UserDetailsActivity : AppCompatActivity(), UserDetailsView, HasSupportFrag ...@@ -70,6 +71,7 @@ class UserDetailsActivity : AppCompatActivity(), UserDetailsView, HasSupportFrag
val userId = intent.getStringExtra(EXTRA_USER_ID) val userId = intent.getStringExtra(EXTRA_USER_ID)
subscriptionId = intent.getStringExtra(EXTRA_SUBSCRIPTION_ID) subscriptionId = intent.getStringExtra(EXTRA_SUBSCRIPTION_ID)
showLoadingView(true)
presenter.loadUserDetails(userId = userId) presenter.loadUserDetails(userId = userId)
} }
...@@ -104,7 +106,7 @@ class UserDetailsActivity : AppCompatActivity(), UserDetailsView, HasSupportFrag ...@@ -104,7 +106,7 @@ class UserDetailsActivity : AppCompatActivity(), UserDetailsView, HasSupportFrag
.load(avatarUrl) .load(avatarUrl)
.apply(requestOptions) .apply(requestOptions)
.submit() .submit()
.get() .get().also { showLoadingView(false) }
} }
toolbar.background = BitmapDrawable(resources, image.blurred(this@UserDetailsActivity)) toolbar.background = BitmapDrawable(resources, image.blurred(this@UserDetailsActivity))
...@@ -133,6 +135,13 @@ class UserDetailsActivity : AppCompatActivity(), UserDetailsView, HasSupportFrag ...@@ -133,6 +135,13 @@ class UserDetailsActivity : AppCompatActivity(), UserDetailsView, HasSupportFrag
} }
} }
private fun showLoadingView(show: Boolean) {
runOnUiThread {
group_user_details.isVisible = !show
view_loading.isVisible = show
}
}
private fun toDirectMessage(chatRoom: ChatRoom?) { private fun toDirectMessage(chatRoom: ChatRoom?) {
chatRoom?.let { c -> chatRoom?.let { c ->
finish() finish()
......
...@@ -18,6 +18,16 @@ ...@@ -18,6 +18,16 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/white"> android:background="@android:color/white">
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading"
style="@style/Authentication.AVLoadingIndicatorView"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<ImageView <ImageView
android:id="@+id/image_view_message" android:id="@+id/image_view_message"
android:layout_width="24dp" android:layout_width="24dp"
...@@ -111,6 +121,12 @@ ...@@ -111,6 +121,12 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" app:layout_constraintTop_toBottomOf="@+id/textView"
tools:text="(UTC-2) 11:08 AM" /> tools:text="(UTC-2) 11:08 AM" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group_user_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="text_view_tz,textView,text_view_status,text_view_message,textView3,text_view_name,text_view_username,image_view_message" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
......
...@@ -337,5 +337,5 @@ ...@@ -337,5 +337,5 @@
<!-- TODO - Add proper translation --> <!-- TODO - Add proper translation -->
<string name="message">Mensagem</string> <string name="message">Mensagem</string>
<!-- TODO - Add proper translation --> <!-- TODO - Add proper translation -->
<string name="timezone">Fuso Horário</string> <string name="timezone">Fuso horário</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment