Skip to content

Commit

Permalink
fix: null checking
Browse files Browse the repository at this point in the history
  • Loading branch information
CappielloAntonio committed Aug 30, 2024
1 parent 6c6d56f commit 67e4079
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ public void onBindViewHolder(ViewHolder holder, int position) {
)
) {
holder.item.differentDiskDividerSector.setVisibility(View.VISIBLE);
holder.item.discTitleTextView.setText(holder.itemView.getContext().getString(R.string.disc_titleless, songs.get(position).getDiscNumber().toString()));

if (songs.get(position).getDiscNumber() != null && !Objects.requireNonNull(songs.get(position).getDiscNumber()).toString().isBlank()) {
holder.item.discTitleTextView.setText(holder.itemView.getContext().getString(R.string.disc_titleless, songs.get(position).getDiscNumber().toString()));
}

if (album.getDiscTitles() != null) {
Optional<DiscTitle> discTitle = album.getDiscTitles().stream().filter(title -> Objects.equals(title.getDisc(), songs.get(position).getDiscNumber())).findFirst();
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_horizontal_track.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:layout_marginEnd="12dp"
android:paddingEnd="12dp"
android:singleLine="true"
android:text="@string/label_placeholder"
tools:text="@string/label_placeholder"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/different_disk_divider"
app:layout_constraintStart_toStartOf="parent"
Expand Down

0 comments on commit 67e4079

Please sign in to comment.