Fix cast exception in ChannelCardView

This commit is contained in:
Niels van Velzen 2024-07-13 13:13:31 +02:00 committed by Niels van Velzen
parent b1356ac6a0
commit fd5ca3ffea

View File

@ -7,6 +7,7 @@ import android.widget.FrameLayout;
import org.jellyfin.androidtv.R;
import org.jellyfin.androidtv.databinding.ViewCardChannelBinding;
import org.jellyfin.androidtv.util.TimeUtils;
import org.jellyfin.sdk.model.api.BaseItemDto;
import java.time.Duration;
@ -36,8 +37,8 @@ public class ChannelCardView extends FrameLayout {
private void updateDisplay(BaseItemDto program) {
binding.program.setText(program.getName());
if (program.getStartDate() != null && program.getEndDate() != null) {
binding.time.setText(DateFormat.getTimeFormat(getContext()).format(program.getStartDate())
+ "-" + DateFormat.getTimeFormat(getContext()).format(program.getEndDate()));
binding.time.setText(DateFormat.getTimeFormat(getContext()).format(TimeUtils.getDate(program.getStartDate()))
+ "-" + DateFormat.getTimeFormat(getContext()).format(TimeUtils.getDate(program.getEndDate())));
if (program.getStartDate().isAfter(LocalDateTime.now()) && program.getEndDate().isBefore(LocalDateTime.now())) {
Duration duration = Duration.between(program.getStartDate(), program.getEndDate());