Unverified Commit 0e1d03e7 authored by jbguerraz's avatar jbguerraz Committed by GitHub

Merge branch 'develop' into basicauth

parents 1753e6b8 2bd72661
......@@ -7,6 +7,7 @@ import androidx.core.view.isVisible
import chat.rocket.android.emoji.internal.GlideApp
import chat.rocket.android.util.extensions.getFileName
import chat.rocket.android.util.extensions.getMimeType
import com.bumptech.glide.load.resource.gif.GifDrawable
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition
......@@ -21,22 +22,32 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) {
description.text.clear()
when {
mimeType.startsWith("image") -> {
GlideApp
.with(context)
.asBitmap()
.load(uri)
.override(imagePreview.width, imagePreview.height)
.fitCenter()
.into(object : SimpleTarget<Bitmap>() {
override fun onResourceReady(
resource: Bitmap,
transition: Transition<in Bitmap>?
) {
bitmap = resource
imagePreview.setImageBitmap(resource)
imagePreview.isVisible = true
}
})
if (mimeType.contains("gif")) {
GlideApp
.with(context)
.asGif()
.load(uri)
.override(imagePreview.width, imagePreview.height)
.fitCenter()
.into(imagePreview)
} else {
GlideApp
.with(context)
.asBitmap()
.load(uri)
.override(imagePreview.width, imagePreview.height)
.fitCenter()
.into(object : SimpleTarget<Bitmap>() {
override fun onResourceReady(
resource: Bitmap,
transition: Transition<in Bitmap>?
) {
bitmap = resource
imagePreview.setImageBitmap(resource)
}
})
}
imagePreview.isVisible = true
}
mimeType.startsWith("video") -> audioVideoAttachment.isVisible = true
else -> {
......
......@@ -43,6 +43,7 @@ class MembersAdapter(private val listener: (MemberUiModel) -> Unit) :
fun bind(memberUiModel: MemberUiModel, listener: (MemberUiModel) -> Unit) = with(itemView) {
image_avatar.setImageURI(memberUiModel.avatarUri)
text_member.content = memberUiModel.displayName
text_member.setCompoundDrawablesRelativeWithIntrinsicBounds(DrawableHelper.getUserStatusDrawable(memberUiModel.status, context), null, null, null)
setOnClickListener { listener(memberUiModel) }
}
}
......
......@@ -3,6 +3,7 @@ package chat.rocket.android.members.uimodel
import chat.rocket.android.server.domain.useRealName
import chat.rocket.android.util.extensions.avatarUrl
import chat.rocket.common.model.User
import chat.rocket.common.model.UserStatus
import chat.rocket.core.model.Value
class MemberUiModel(
......@@ -16,6 +17,7 @@ class MemberUiModel(
val username: String?
val email: String?
val utcOffset: Float?
val status: UserStatus?
init {
avatarUri = getUserAvatar()
......@@ -24,6 +26,7 @@ class MemberUiModel(
username = getUserUsername()
email = getUserEmail()
utcOffset = getUserUtcOffset()
status = getUserStatus()
}
private fun getUserAvatar(): String? {
......@@ -47,4 +50,6 @@ class MemberUiModel(
private fun getUserEmail(): String? = member.emails?.get(0)?.address
private fun getUserUtcOffset(): Float? = member.utcOffset
private fun getUserStatus(): UserStatus? = member.status
}
\ No newline at end of file
......@@ -5,10 +5,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:paddingBottom="@dimen/member_item_top_and_bottom_padding"
android:paddingEnd="@dimen/screen_edge_left_and_right_padding"
android:paddingStart="@dimen/screen_edge_left_and_right_padding"
android:paddingTop="@dimen/member_item_top_and_bottom_padding">
android:paddingTop="@dimen/member_item_top_and_bottom_padding"
android:paddingEnd="@dimen/screen_edge_left_and_right_padding"
android:paddingBottom="@dimen/member_item_top_and_bottom_padding">
<include
android:id="@+id/layout_avatar"
......@@ -24,9 +24,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:drawablePadding="@dimen/text_view_drawable_padding"
app:layout_constraintBottom_toBottomOf="@+id/layout_avatar"
app:layout_constraintLeft_toRightOf="@+id/layout_avatar"
app:layout_constraintTop_toTopOf="@+id/layout_avatar"
tools:drawableStart="@drawable/ic_status_invisible_12dp"
tools:text="Ronald Perkins" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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