Round icons in search list

This commit is contained in:
ByteHamster 2020-03-25 15:23:27 +01:00
parent c488b6c3fb
commit d77e04d1c1
4 changed files with 82 additions and 82 deletions

View File

@ -10,6 +10,8 @@ import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.FitCenter;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import org.apache.commons.lang3.StringUtils;
@ -57,7 +59,9 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
.placeholder(R.color.light_gray)
.error(R.color.light_gray)
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.fitCenter()
.transforms(new FitCenter(),
new RoundedCorners((int) (4 * convertView.getContext()
.getResources().getDisplayMetrics().density)))
.dontAnimate())
.into(holder.image);
}

View File

@ -11,6 +11,8 @@ import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.FitCenter;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.discovery.PodcastSearchResult;
@ -83,7 +85,8 @@ public class ItunesAdapter extends ArrayAdapter<PodcastSearchResult> {
.apply(new RequestOptions()
.placeholder(R.color.light_gray)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.fitCenter()
.transforms(new FitCenter(),
new RoundedCorners((int) (4 * context.getResources().getDisplayMetrics().density)))
.dontAnimate())
.into(viewHolder.coverView);

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
@ -17,8 +17,8 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:adjustViewBounds="true"
android:contentDescription="@string/cover_label"
android:cropToPadding="true"
@ -26,44 +26,20 @@
tools:src="@drawable/ic_antenna"
tools:background="@android:color/holo_green_dark"/>
<LinearLayout
android:id="@+id/subscribers_container"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/txtvTitle"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/imgFeed"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="-4dp"
android:layout_marginEnd="-4dp"
android:src="?attr/feed" />
<TextView
android:id="@+id/txtvSubscribers"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
tools:text="150"
tools:background="@android:color/holo_green_dark" />
</LinearLayout>
android:layout_centerVertical="true"
android:layout_toRightOf="@id/imgvCover"
android:layout_toEndOf="@id/imgvCover"
android:orientation="vertical">
<TextView
android:id="@+id/txtvTitle"
style="@style/AntennaPod.TextView.ListItemPrimaryTitle2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/imgvCover"
android:layout_toEndOf="@id/imgvCover"
android:layout_toLeftOf="@id/subscribers_container"
android:layout_toStartOf="@id/subscribers_container"
android:layout_alignTop="@id/imgvCover"
android:maxLines="2"
android:includeFontPadding="false"
tools:text="Title"
@ -74,9 +50,6 @@
style="android:style/TextAppearance.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/imgvCover"
android:layout_toEndOf="@id/imgvCover"
android:layout_below="@id/txtvTitle"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:ellipsize="middle"
@ -84,4 +57,24 @@
tools:text="author"
tools:background="@android:color/holo_green_dark"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:layout_width="14sp"
android:layout_height="14sp"
app:srcCompat="?attr/feed"/>
<TextView
android:id="@+id/txtvSubscribers"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
tools:text="150"
tools:background="@android:color/holo_green_dark"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -18,8 +18,6 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:adjustViewBounds="true"
android:contentDescription="@string/cover_label"
android:cropToPadding="true"
@ -33,7 +31,9 @@
android:layout_toRightOf="@id/imgvCover"
android:layout_toEndOf="@id/imgvCover"
android:layout_centerVertical="true"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp">
<TextView
android:id="@+id/txtvTitle"