Change SimilarTrackAdapter UI

This commit is contained in:
CappielloAntonio 2021-08-19 11:46:09 +02:00
parent c2782d7e49
commit b8822fcda4
4 changed files with 59 additions and 4 deletions

3
.idea/misc.xml generated
View file

@ -6,8 +6,10 @@
<entry key="app/src/main/res/drawable-v24/ic_add.xml" value="0.27685185185185185" /> <entry key="app/src/main/res/drawable-v24/ic_add.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable-v24/ic_download.xml" value="0.27685185185185185" /> <entry key="app/src/main/res/drawable-v24/ic_download.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2814814814814815" /> <entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2814814814814815" />
<entry key="app/src/main/res/drawable-v24/ic_shuffle.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/dialog_shape.xml" value="0.27685185185185185" /> <entry key="app/src/main/res/drawable/dialog_shape.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable/ic_close.xml" value="0.27685185185185185" /> <entry key="app/src/main/res/drawable/ic_close.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable/ic_done.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_download_for_offline.xml" value="0.27685185185185185" /> <entry key="app/src/main/res/drawable/ic_download_for_offline.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable/ic_downloading.xml" value="0.2722222222222222" /> <entry key="app/src/main/res/drawable/ic_downloading.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/drawable/ic_drag_handle.xml" value="0.27685185185185185" /> <entry key="app/src/main/res/drawable/ic_drag_handle.xml" value="0.27685185185185185" />
@ -38,6 +40,7 @@
<entry key="app/src/main/res/layout/item_home_discovery_placeholder.xml" value="0.3229166666666667" /> <entry key="app/src/main/res/layout/item_home_discovery_placeholder.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/item_home_horizontal_placeholder.xml" value="0.3229166666666667" /> <entry key="app/src/main/res/layout/item_home_horizontal_placeholder.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/item_home_placeholder.xml" value="0.47191011235955055" /> <entry key="app/src/main/res/layout/item_home_placeholder.xml" value="0.47191011235955055" />
<entry key="app/src/main/res/layout/item_home_similar_track.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/item_home_track.xml" value="0.3229166666666667" /> <entry key="app/src/main/res/layout/item_home_track.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/item_home_year.xml" value="0.3229166666666667" /> <entry key="app/src/main/res/layout/item_home_year.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/item_home_year_placeholder.xml" value="0.3229166666666667" /> <entry key="app/src/main/res/layout/item_home_year_placeholder.xml" value="0.3229166666666667" />

View file

@ -48,7 +48,7 @@ public class SimilarTrackAdapter extends RecyclerView.Adapter<SimilarTrackAdapte
@NonNull @NonNull
@Override @Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mInflater.inflate(R.layout.item_home_track, parent, false); View view = mInflater.inflate(R.layout.item_home_similar_track, parent, false);
return new ViewHolder(view); return new ViewHolder(view);
} }
@ -57,7 +57,6 @@ public class SimilarTrackAdapter extends RecyclerView.Adapter<SimilarTrackAdapte
Song song = songs.get(position); Song song = songs.get(position);
holder.textTitle.setText(MusicUtil.getReadableString(song.getTitle())); holder.textTitle.setText(MusicUtil.getReadableString(song.getTitle()));
holder.textAlbum.setText(MusicUtil.getReadableString(song.getAlbumName()));
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, song.getPrimary(), CustomGlideRequest.SONG_PIC, null) .from(context, song.getPrimary(), CustomGlideRequest.SONG_PIC, null)
@ -78,14 +77,12 @@ public class SimilarTrackAdapter extends RecyclerView.Adapter<SimilarTrackAdapte
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView textTitle; TextView textTitle;
TextView textAlbum;
ImageView cover; ImageView cover;
ViewHolder(View itemView) { ViewHolder(View itemView) {
super(itemView); super(itemView);
textTitle = itemView.findViewById(R.id.title_track_label); textTitle = itemView.findViewById(R.id.title_track_label);
textAlbum = itemView.findViewById(R.id.album_track_label);
cover = itemView.findViewById(R.id.track_cover_image_view); cover = itemView.findViewById(R.id.track_cover_image_view);
itemView.setOnClickListener(this); itemView.setOnClickListener(this);

View file

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillColor="@color/titleTextColor"
android:pathData="M8.94,7.88L5.59,4.53c-0.29,-0.29 -0.77,-0.29 -1.06,0l0,0c-0.29,0.29 -0.29,0.77 0,1.06l3.35,3.35L8.94,7.88z"/>
<path
android:fillColor="@color/titleTextColor"
android:pathData="M12.12,11.06l-1.06,1.06l2.41,2.41l-0.62,0.62C12.54,15.46 12.76,16 13.21,16h2.29c0.28,0 0.5,-0.22 0.5,-0.5v-2.29c0,-0.45 -0.54,-0.67 -0.85,-0.35l-0.62,0.62L12.12,11.06z"/>
<path
android:fillColor="@color/titleTextColor"
android:pathData="M12.85,4.85l0.62,0.62l-8.94,8.94c-0.29,0.29 -0.29,0.77 0,1.06l0,0c0.29,0.29 0.77,0.29 1.06,0l8.94,-8.94l0.62,0.62C15.46,7.46 16,7.24 16,6.79V4.5C16,4.22 15.78,4 15.5,4h-2.29C12.76,4 12.54,4.54 12.85,4.85z"/>
</vector>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="8dp">
<ImageView
android:id="@+id/track_cover_image_view"
android:layout_width="172dp"
android:layout_height="172dp"
android:layout_gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/for_you_image_view"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:background="@drawable/ic_shuffle"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/track_cover_image_view"
app:layout_constraintStart_toStartOf="parent"/>
<TextView
android:id="@+id/title_track_label"
style="@style/ItemTitleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:paddingTop="8dp"
android:paddingLeft="4dp"
android:singleLine="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/for_you_image_view"
app:layout_constraintTop_toBottomOf="@+id/track_cover_image_view" />
</androidx.constraintlayout.widget.ConstraintLayout>