revise nft ui (#3072)
* Avoid exceed parent rounded corners and clip bottom rounded corners * Ensure border visible * Fix round corners for .webp * Fix title not displaying * Fix layouts * Revise collectibles grid * Revise layout when on image on the same row as a svg (loading with WebView) * Fix activity details NFT displaypull/3172/head
parent
acefb4ba47
commit
e13ddf4825
@ -0,0 +1,66 @@ |
||||
package com.alphawallet.app.util; |
||||
|
||||
import android.graphics.Bitmap; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; |
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; |
||||
import com.bumptech.glide.load.resource.bitmap.TransformationUtils; |
||||
import com.bumptech.glide.util.Preconditions; |
||||
import com.bumptech.glide.util.Util; |
||||
|
||||
import java.nio.ByteBuffer; |
||||
import java.security.MessageDigest; |
||||
|
||||
public final class RoundedTopCorners extends BitmapTransformation |
||||
{ |
||||
private static final String ID = "com.bumptech.glide.load.resource.bitmap.RoundedCorners"; |
||||
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); |
||||
|
||||
private final int roundingRadius; |
||||
|
||||
/** |
||||
* @param roundingRadius the corner radius (in device-specific pixels). |
||||
* @throws IllegalArgumentException if rounding radius is 0 or less. |
||||
*/ |
||||
public RoundedTopCorners(int roundingRadius) |
||||
{ |
||||
Preconditions.checkArgument(roundingRadius > 0, "roundingRadius must be greater than 0."); |
||||
this.roundingRadius = roundingRadius; |
||||
} |
||||
|
||||
@Override |
||||
protected Bitmap transform( |
||||
@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) |
||||
{ |
||||
return TransformationUtils.roundedCorners(pool, toTransform, roundingRadius, roundingRadius, 0, 0); |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object o) |
||||
{ |
||||
if (o instanceof RoundedTopCorners) |
||||
{ |
||||
RoundedTopCorners other = (RoundedTopCorners) o; |
||||
return roundingRadius == other.roundingRadius; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() |
||||
{ |
||||
return Util.hashCode(ID.hashCode(), Util.hashCode(roundingRadius)); |
||||
} |
||||
|
||||
@Override |
||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) |
||||
{ |
||||
messageDigest.update(ID_BYTES); |
||||
|
||||
byte[] radiusData = ByteBuffer.allocate(4).putInt(roundingRadius).array(); |
||||
messageDigest.update(radiusData); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,11 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:shape="rectangle"> |
||||
<solid android:color="?colorSurface" /> |
||||
<stroke |
||||
android:width="1dp" |
||||
android:color="?colorSurfaceQuaternary" /> |
||||
<corners |
||||
android:bottomLeftRadius="10dp" |
||||
android:bottomRightRadius="10dp" /> |
||||
</shape> |
@ -0,0 +1,11 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:shape="rectangle"> |
||||
<solid android:color="?colorSurface" /> |
||||
<stroke |
||||
android:width="1dp" |
||||
android:color="?colorSurfaceQuaternary" /> |
||||
<corners |
||||
android:topLeftRadius="10dp" |
||||
android:topRightRadius="10dp" /> |
||||
</shape> |
@ -1,92 +1,69 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:custom="http://schemas.android.com/apk/res-auto" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:id="@+id/holding_view" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical"> |
||||
|
||||
<com.google.android.material.card.MaterialCardView |
||||
android:layout_width="match_parent" |
||||
xmlns:custom="http://schemas.android.com/apk/res-auto" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:id="@+id/holding_view" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
custom:cardCornerRadius="8dp" |
||||
custom:cardElevation="0dp" |
||||
android:background="@drawable/background_grid_icon" |
||||
custom:strokeColor="?colorSurfaceQuaternary" |
||||
custom:strokeWidth="1dp"> |
||||
|
||||
<LinearLayout |
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical"> |
||||
android:layout_alignParentTop="true" |
||||
android:paddingBottom="35dp"> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/icon_wrapper" |
||||
<com.alphawallet.app.widget.NFTImageView |
||||
android:id="@+id/icon" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center"> |
||||
|
||||
<com.alphawallet.app.widget.NFTImageView |
||||
android:id="@+id/icon" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="156dp" |
||||
android:layout_centerInParent="true" /> |
||||
android:layout_height="match_parent" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/text_count" |
||||
style="@style/Aw.Typography.Title.SemiBold" |
||||
android:layout_width="48dp" |
||||
android:layout_height="48dp" |
||||
android:layout_centerInParent="true" |
||||
android:background="@drawable/value_amount_overlay" |
||||
android:backgroundTint="?colorPrimary" |
||||
android:gravity="center" |
||||
android:textColor="?colorOnPrimary" |
||||
android:visibility="gone" |
||||
tools:text="25" |
||||
tools:visibility="visible" /> |
||||
<TextView |
||||
android:id="@+id/text_count" |
||||
style="@style/Aw.Typography.Title.SemiBold" |
||||
android:layout_width="48dp" |
||||
android:layout_height="48dp" |
||||
android:layout_centerInParent="true" |
||||
android:background="@drawable/value_amount_overlay" |
||||
android:backgroundTint="?colorPrimary" |
||||
android:gravity="center" |
||||
android:textColor="?colorOnPrimary" |
||||
android:visibility="gone" |
||||
tools:text="25" |
||||
tools:visibility="visible" /> |
||||
|
||||
<ProgressBar |
||||
android:id="@+id/loading_spinner" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerInParent="true" |
||||
android:padding="@dimen/standard_16" |
||||
android:visibility="gone" |
||||
tools:visibility="visible" /> |
||||
</RelativeLayout> |
||||
|
||||
</RelativeLayout> |
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/background_round_bottom_corners" |
||||
android:layout_alignParentBottom="true" |
||||
android:padding="@dimen/dp9"> |
||||
|
||||
<RelativeLayout |
||||
<TextView |
||||
android:id="@+id/title" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical" |
||||
android:padding="@dimen/standard_16"> |
||||
android:layout_alignParentStart="true" |
||||
android:ellipsize="end" |
||||
android:gravity="center" |
||||
android:singleLine="true" |
||||
tools:text="Title" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/title" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentStart="true" |
||||
android:ellipsize="end" |
||||
android:gravity="center" |
||||
android:singleLine="true" |
||||
tools:text="Title" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/subtitle" |
||||
style="@style/Aw.Typography.Sub" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_below="@id/title" |
||||
android:gravity="center" |
||||
android:singleLine="true" |
||||
android:visibility="gone" |
||||
tools:text="Subtitle" |
||||
tools:visibility="visible" /> |
||||
|
||||
</RelativeLayout> |
||||
</LinearLayout> |
||||
<TextView |
||||
android:id="@+id/subtitle" |
||||
style="@style/Aw.Typography.Sub" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_below="@id/title" |
||||
android:gravity="center" |
||||
android:singleLine="true" |
||||
android:visibility="gone" |
||||
tools:text="Subtitle" |
||||
tools:visibility="visible" /> |
||||
|
||||
</com.google.android.material.card.MaterialCardView> |
||||
</RelativeLayout> |
||||
</RelativeLayout> |
||||
</RelativeLayout> |
||||
|
Loading…
Reference in new issue