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
import android.graphics.drawable.BitmapDrawable
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import blurred
import chat.rocket.android.R
......@@ -70,6 +71,7 @@ class UserDetailsActivity : AppCompatActivity(), UserDetailsView, HasSupportFrag
val userId = intent.getStringExtra(EXTRA_USER_ID)
subscriptionId = intent.getStringExtra(EXTRA_SUBSCRIPTION_ID)
showLoadingView(true)
presenter.loadUserDetails(userId = userId)
}
......@@ -104,7 +106,7 @@ class UserDetailsActivity : AppCompatActivity(), UserDetailsView, HasSupportFrag
.load(avatarUrl)
.apply(requestOptions)
.submit()
.get()
.get().also { showLoadingView(false) }
}
toolbar.background = BitmapDrawable(resources, image.blurred(this@UserDetailsActivity))
......@@ -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?) {
chatRoom?.let { c ->
finish()
......
......@@ -18,6 +18,16 @@
android:layout_height="match_parent"
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
android:id="@+id/image_view_message"
android:layout_width="24dp"
......@@ -111,6 +121,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
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.core.widget.NestedScrollView>
......
......@@ -337,5 +337,5 @@
<!-- TODO - Add proper translation -->
<string name="message">Mensagem</string>
<!-- TODO - Add proper translation -->
<string name="timezone">Fuso Horário</string>
<string name="timezone">Fuso horário</string>
</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