Updated on 2026-08-14
This commit is contained in:
commit
fc0803b40a
6 changed files with 80 additions and 41 deletions
|
|
@ -5,7 +5,6 @@ import android.widget.TextView
|
|||
import androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
import coil.imageLoader
|
||||
import coil.request.ImageRequest
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.IconsUtil
|
||||
import com.tangem.blockchain.common.Token
|
||||
|
|
@ -21,13 +20,13 @@ private const val QCX = "QCX"
|
|||
private const val VOYR = "VOYRME"
|
||||
|
||||
fun loadCurrencyIcon(
|
||||
currencyImageView: ImageFilterView,
|
||||
currencyImageView: CurrencyIconView,
|
||||
currencyTextView: TextView,
|
||||
token: Token?,
|
||||
blockchain: Blockchain,
|
||||
) {
|
||||
CurrencyIconLoader(
|
||||
currencyImageView = currencyImageView,
|
||||
currencyImageView = currencyImageView.imageView,
|
||||
currencyTextView = currencyTextView,
|
||||
token = token,
|
||||
blockchain = blockchain
|
||||
|
|
@ -135,14 +134,6 @@ private inline fun ImageView.loadIcon(
|
|||
.placeholder(placeholderRes)
|
||||
.error(placeholderRes)
|
||||
.fallback(placeholderRes)
|
||||
.transformations(
|
||||
RoundedCornersTransformation(
|
||||
topLeft = 32f,
|
||||
topRight = 32f,
|
||||
bottomLeft = 32f,
|
||||
bottomRight = 32f
|
||||
)
|
||||
)
|
||||
.listener(
|
||||
onStart = { onStart() },
|
||||
onSuccess = { _, _ -> onSuccess() },
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.tangem.tap.features.wallet.ui.images
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
import com.tangem.tangem_sdk_new.extensions.dpToPx
|
||||
import com.tangem.wallet.databinding.ViewCurrencyIconBinding
|
||||
|
||||
class CurrencyIconView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0,
|
||||
) : MaterialCardView(context, attrs, defStyleAttr) {
|
||||
private val binding = ViewCurrencyIconBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
this
|
||||
)
|
||||
|
||||
val imageView: ImageFilterView
|
||||
get() = binding.iv
|
||||
|
||||
init {
|
||||
elevation = 0f
|
||||
cardElevation = 0f
|
||||
radius = dpToPx(8f)
|
||||
background = null
|
||||
}
|
||||
}
|
||||
|
|
@ -5,4 +5,4 @@
|
|||
|
||||
<corners android:radius="8dp" />
|
||||
|
||||
</shape>
|
||||
</shape>
|
||||
|
|
|
|||
|
|
@ -16,34 +16,32 @@
|
|||
android:elevation="3dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:clipToPadding="false">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
android:id="@+id/iv_currency"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/shape_circle"
|
||||
tools:tint="@color/iconGray" />
|
||||
<com.tangem.tap.features.wallet.ui.images.CurrencyIconView
|
||||
android:id="@+id/iv_currency"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_token_letter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_currency"
|
||||
android:id="@+id/tv_token_letter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_currency"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_currency"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_currency"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_currency"
|
||||
|
|
|
|||
|
|
@ -39,14 +39,13 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/tv_fiat_amount"
|
||||
tools:text="0.43 BTC" />
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
<com.tangem.tap.features.wallet.ui.images.CurrencyIconView
|
||||
android:id="@+id/iv_currency"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_margin="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/shape_circle" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_token_letter"
|
||||
|
|
@ -100,4 +99,4 @@
|
|||
app:constraint_referenced_ids="tv_amount, tv_fiat_amount, tv_status" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
|||
21
app/src/main/res/layout/view_currency_icon.xml
Normal file
21
app/src/main/res/layout/view_currency_icon.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@null"
|
||||
android:elevation="0dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="0dp"
|
||||
tools:parentTag="androidx.cardview.widget.CardView">
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
android:id="@+id/iv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitCenter"
|
||||
tools:src="@drawable/ic_eth" />
|
||||
|
||||
</merge>
|
||||
Loading…
Add table
Add a link
Reference in a new issue