From edb440a5a9a05e24c344a71b272b9238217e9c55 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 31 Mar 2024 18:40:15 +0200 Subject: Restructure related UI classes together (#7044) --- .../main/java/de/danoeh/antennapod/model/feed/Feed.java | 9 ++++----- .../de/danoeh/antennapod/model/playback/RemoteMedia.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'model/src/main') diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java b/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java index 8d36d24a3..15d256c24 100644 --- a/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java +++ b/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java @@ -1,12 +1,11 @@ package de.danoeh.antennapod.model.feed; -import android.text.TextUtils; - import androidx.annotation.Nullable; import java.util.ArrayList; import java.util.Date; import java.util.List; +import org.apache.commons.lang3.StringUtils; /** * Data Object for a whole feed. @@ -205,9 +204,9 @@ public class Feed { } public String getHumanReadableIdentifier() { - if (!TextUtils.isEmpty(customTitle)) { + if (!StringUtils.isEmpty(customTitle)) { return customTitle; - } else if (!TextUtils.isEmpty(feedTitle)) { + } else if (!StringUtils.isEmpty(feedTitle)) { return feedTitle; } else { return downloadUrl; @@ -266,7 +265,7 @@ public class Feed { } public String getTitle() { - return !TextUtils.isEmpty(customTitle) ? customTitle : feedTitle; + return !StringUtils.isEmpty(customTitle) ? customTitle : feedTitle; } public void setTitle(String title) { diff --git a/model/src/main/java/de/danoeh/antennapod/model/playback/RemoteMedia.java b/model/src/main/java/de/danoeh/antennapod/model/playback/RemoteMedia.java index b963f3de1..c979488a6 100644 --- a/model/src/main/java/de/danoeh/antennapod/model/playback/RemoteMedia.java +++ b/model/src/main/java/de/danoeh/antennapod/model/playback/RemoteMedia.java @@ -3,7 +3,6 @@ package de.danoeh.antennapod.model.playback; import android.content.Context; import android.os.Parcel; import android.os.Parcelable; -import android.text.TextUtils; import androidx.annotation.Nullable; import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.model.feed.Feed; @@ -13,6 +12,7 @@ import de.danoeh.antennapod.model.feed.FeedMedia; import java.util.Date; import java.util.List; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.HashCodeBuilder; /** @@ -68,7 +68,7 @@ public class RemoteMedia implements Playable { this.episodeTitle = item.getTitle(); this.episodeLink = item.getLink(); this.feedAuthor = item.getFeed().getAuthor(); - if (!TextUtils.isEmpty(item.getImageUrl())) { + if (!StringUtils.isEmpty(item.getImageUrl())) { this.imageUrl = item.getImageUrl(); } else { this.imageUrl = item.getFeed().getImageUrl(); @@ -280,21 +280,21 @@ public class RemoteMedia implements Playable { public boolean equals(Object other) { if (other instanceof RemoteMedia) { RemoteMedia rm = (RemoteMedia) other; - return TextUtils.equals(downloadUrl, rm.downloadUrl) - && TextUtils.equals(feedUrl, rm.feedUrl) - && TextUtils.equals(itemIdentifier, rm.itemIdentifier); + return StringUtils.equals(downloadUrl, rm.downloadUrl) + && StringUtils.equals(feedUrl, rm.feedUrl) + && StringUtils.equals(itemIdentifier, rm.itemIdentifier); } if (other instanceof FeedMedia) { FeedMedia fm = (FeedMedia) other; - if (!TextUtils.equals(downloadUrl, fm.getStreamUrl())) { + if (!StringUtils.equals(downloadUrl, fm.getStreamUrl())) { return false; } FeedItem fi = fm.getItem(); - if (fi == null || !TextUtils.equals(itemIdentifier, fi.getItemIdentifier())) { + if (fi == null || !StringUtils.equals(itemIdentifier, fi.getItemIdentifier())) { return false; } Feed feed = fi.getFeed(); - return feed != null && TextUtils.equals(feedUrl, feed.getDownloadUrl()); + return feed != null && StringUtils.equals(feedUrl, feed.getDownloadUrl()); } return false; } -- cgit v1.2.3