mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 18:31:40 +00:00
Changed the graphics of the playlist adapter
This commit is contained in:
parent
ea151e8438
commit
e3f088468c
2 changed files with 58 additions and 44 deletions
|
|
@ -9,8 +9,12 @@ import android.widget.Filterable;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
|
||||||
import com.cappielloantonio.play.R;
|
import com.cappielloantonio.play.R;
|
||||||
import com.cappielloantonio.play.databinding.ItemHorizontalPlaylistBinding;
|
import com.cappielloantonio.play.databinding.ItemHorizontalPlaylistBinding;
|
||||||
|
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||||
import com.cappielloantonio.play.interfaces.ClickCallback;
|
import com.cappielloantonio.play.interfaces.ClickCallback;
|
||||||
import com.cappielloantonio.play.subsonic.models.Playlist;
|
import com.cappielloantonio.play.subsonic.models.Playlist;
|
||||||
import com.cappielloantonio.play.util.Constants;
|
import com.cappielloantonio.play.util.Constants;
|
||||||
|
|
@ -74,8 +78,15 @@ public class PlaylistHorizontalAdapter extends RecyclerView.Adapter<PlaylistHori
|
||||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||||
Playlist playlist = playlists.get(position);
|
Playlist playlist = playlists.get(position);
|
||||||
|
|
||||||
holder.item.playlistDialogTitleTextView.setText(MusicUtil.getReadableString(playlist.getName()));
|
holder.item.playlistTitleTextView.setText(MusicUtil.getReadableString(playlist.getName()));
|
||||||
holder.item.playlistDialogCountTextView.setText(holder.itemView.getContext().getString(R.string.playlist_counted_tracks, playlist.getSongCount(), MusicUtil.getReadableDurationString(playlist.getDuration(), false)));
|
holder.item.playlistSubtitleTextView.setText(holder.itemView.getContext().getString(R.string.playlist_counted_tracks, playlist.getSongCount(), MusicUtil.getReadableDurationString(playlist.getDuration(), false)));
|
||||||
|
|
||||||
|
CustomGlideRequest.Builder
|
||||||
|
.from(holder.itemView.getContext(), playlist.getCoverArtId())
|
||||||
|
.build()
|
||||||
|
.transition(DrawableTransitionOptions.withCrossFade())
|
||||||
|
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
|
||||||
|
.into(holder.item.playlistCoverImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -106,7 +117,7 @@ public class PlaylistHorizontalAdapter extends RecyclerView.Adapter<PlaylistHori
|
||||||
|
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
|
||||||
item.playlistDialogTitleTextView.setSelected(true);
|
item.playlistTitleTextView.setSelected(true);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> onClick());
|
itemView.setOnClickListener(v -> onClick());
|
||||||
itemView.setOnLongClickListener(v -> onLongClick());
|
itemView.setOnLongClickListener(v -> onLongClick());
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,50 @@
|
||||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
style="@style/Widget.Material3.CardView.Filled"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:layout_marginEnd="14dp"
|
android:clipChildren="false"
|
||||||
android:layout_marginBottom="4dp"
|
android:orientation="horizontal"
|
||||||
android:checkable="true"
|
android:paddingHorizontal="16dp"
|
||||||
android:clickable="true"
|
android:paddingTop="3dp"
|
||||||
android:focusable="true">
|
android:paddingBottom="3dp">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/playlist_cover_image_view"
|
||||||
|
android:layout_width="52dp"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/playlist_title_text_view"
|
||||||
|
style="@style/LabelMedium"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:ellipsize="marquee"
|
||||||
android:clipChildren="false"
|
android:paddingHorizontal="12dp"
|
||||||
android:padding="4dp">
|
android:singleLine="true"
|
||||||
|
android:text="@string/label_placeholder"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/playlist_subtitle_text_view"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/playlist_cover_image_view"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/playlist_cover_image_view"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/playlist_dialog_title_text_view"
|
android:id="@+id/playlist_subtitle_text_view"
|
||||||
style="@style/LabelMedium"
|
style="@style/LabelSmall"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:paddingStart="12dp"
|
android:paddingHorizontal="12dp"
|
||||||
android:paddingTop="8dp"
|
android:singleLine="true"
|
||||||
android:paddingEnd="12dp"
|
android:text="@string/label_placeholder"
|
||||||
android:singleLine="true"
|
app:layout_constraintBottom_toBottomOf="@+id/playlist_cover_image_view"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toEndOf="@+id/playlist_cover_image_view"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toBottomOf="@+id/playlist_title_text_view" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<TextView
|
|
||||||
android:id="@+id/playlist_dialog_count_text_view"
|
|
||||||
style="@style/LabelSmall"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:ellipsize="marquee"
|
|
||||||
android:paddingStart="12dp"
|
|
||||||
android:paddingEnd="12dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/playlist_dialog_title_text_view" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue