mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3261 Editor | Fix | Fix image scaling for object image icons (#2290)
This commit is contained in:
parent
196933c574
commit
aa0ebbdfa5
2 changed files with 15 additions and 13 deletions
|
@ -179,10 +179,15 @@ sealed class Title(view: View) : BlockViewHolder(view), TextHolder {
|
|||
Timber.d("Setting image for ${item.id}, image=${item.image}")
|
||||
item.image?.let { url ->
|
||||
image.visible()
|
||||
loadImageWithCustomResize(image, url)
|
||||
} ?: run { image.setImageDrawable(null) }
|
||||
Glide
|
||||
.with(image)
|
||||
.load(url)
|
||||
.centerCrop()
|
||||
.into(image)
|
||||
} ?: apply { image.setImageDrawable(null) }
|
||||
}
|
||||
|
||||
// TODO use for objects with image layout; move to the dedicated view holder.
|
||||
private fun loadImageWithCustomResize(imageView: ImageView, url: String) {
|
||||
val context = imageView.context
|
||||
val displayMetrics = context.resources.displayMetrics
|
||||
|
|
|
@ -52,34 +52,31 @@
|
|||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/imageIcon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="443dp"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="96dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="51dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@color/shape_tertiary"
|
||||
android:padding="4dp"
|
||||
android:transitionName="@string/logo_transition"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:shapeAppearance="@style/TitleImageAppearanceOverlay"
|
||||
app:strokeColor="@color/shape_tertiary"
|
||||
app:strokeWidth="1dp"
|
||||
tools:visibility="visible" />
|
||||
app:strokeColor="@color/background_primary"
|
||||
app:strokeWidth="4dp"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<com.anytypeio.anytype.core_ui.widgets.text.TextInputWidget
|
||||
android:id="@+id/title"
|
||||
style="@style/BlockTitleContentStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:hint="@string/untitled"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
app:ignoreDragAndDrop="true"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/barrier"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue