forked from melod1n/fast-messenger
fix link attachment view
fix wall post attachment view
This commit is contained in:
@@ -2,6 +2,7 @@ package com.meloda.fast.screens.messages
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
@@ -249,13 +250,21 @@ class AttachmentInflater constructor(
|
||||
binding.caption.text = link.caption
|
||||
binding.caption.isVisible = !link.caption.isNullOrBlank()
|
||||
|
||||
link.photo?.getMaxSize()?.let {
|
||||
link.photo?.getSizeOrSmaller('y')?.let {
|
||||
binding.preview.load(it.url) { crossfade(150) }
|
||||
binding.preview.isVisible = true
|
||||
binding.linkIcon.isVisible = false
|
||||
return
|
||||
}
|
||||
|
||||
binding.preview.isVisible = false
|
||||
binding.preview.setImageDrawable(
|
||||
ColorDrawable(
|
||||
ContextCompat.getColor(
|
||||
context,
|
||||
R.color.a3_200
|
||||
)
|
||||
)
|
||||
)
|
||||
binding.linkIcon.isVisible = true
|
||||
}
|
||||
|
||||
private fun sticker(sticker: VkSticker) {
|
||||
@@ -274,7 +283,7 @@ class AttachmentInflater constructor(
|
||||
}
|
||||
|
||||
private fun wall(wall: VkWall) {
|
||||
val binding = ItemMessageAttachmentWallPostBinding.inflate(inflater, container, true)
|
||||
val binding = ItemMessageAttachmentWallPostBinding.inflate(inflater, textContainer, true)
|
||||
|
||||
val group = if (wall.fromId > 0) null else groups[wall.fromId]
|
||||
val user = if (wall.fromId < 0) null else profiles[wall.fromId]
|
||||
@@ -301,12 +310,6 @@ class AttachmentInflater constructor(
|
||||
binding.postTitle.isVisible = false
|
||||
|
||||
binding.avatar.isVisible = group != null || user != null
|
||||
binding.avatar.shapeAppearanceModel.toBuilder()
|
||||
.setAllCornerSizes(AndroidUtils.px(20))
|
||||
.build()
|
||||
.let {
|
||||
binding.avatar.shapeAppearanceModel = it
|
||||
}
|
||||
|
||||
if (binding.avatar.isVisible) {
|
||||
binding.avatar.load(avatar) { crossfade(150) }
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M17,7h-3c-0.55,0 -1,0.45 -1,1s0.45,1 1,1h3c1.65,0 3,1.35 3,3s-1.35,3 -3,3h-3c-0.55,0 -1,0.45 -1,1s0.45,1 1,1h3c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5zM8,12c0,0.55 0.45,1 1,1h6c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L9,11c-0.55,0 -1,0.45 -1,1zM10,15L7,15c-1.65,0 -3,-1.35 -3,-3s1.35,-3 3,-3h3c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h3c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1z"/>
|
||||
</vector>
|
||||
@@ -9,16 +9,31 @@
|
||||
android:orientation="horizontal"
|
||||
android:padding="6dp">
|
||||
|
||||
<com.meloda.fast.widget.CircleImageView
|
||||
android:id="@+id/preview"
|
||||
<FrameLayout
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
android:layout_height="48dp">
|
||||
|
||||
<com.meloda.fast.widget.CircleImageView
|
||||
android:id="@+id/preview"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
tools:src="@color/a3_200" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/linkIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_round_link_24"
|
||||
app:tint="@color/a3_700" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="4dp">
|
||||
android:padding="6dp">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/postTitle"
|
||||
@@ -26,16 +26,16 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
<com.meloda.fast.widget.CircleImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
|
||||
Reference in New Issue
Block a user