Tweak error messages when interacting with text only episode (#7984)

This commit is contained in:
Hans-Peter Lehmann 2025-09-12 22:11:29 +02:00 committed by GitHub
parent bc16763c5e
commit 428d1901b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 7 deletions

View File

@ -5,9 +5,11 @@ import android.content.Context;
import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedItemFilter;
import org.greenrobot.eventbus.EventBus;
public class AddToQueueSwipeAction implements SwipeAction {
@ -33,15 +35,20 @@ public class AddToQueueSwipeAction implements SwipeAction {
@Override
public void performAction(FeedItem item, Fragment fragment, FeedItemFilter filter) {
if (!item.isTagged(FeedItem.TAG_QUEUE)) {
DBWriter.addQueueItem(fragment.requireContext(), item);
} else {
if (item.isTagged(FeedItem.TAG_QUEUE)) {
new RemoveFromQueueSwipeAction().performAction(item, fragment, filter);
} else if (item.getMedia() == null) {
EventBus.getDefault().post(new MessageEvent(fragment.getString(R.string.no_media_label)));
} else {
DBWriter.addQueueItem(fragment.requireContext(), item);
}
}
@Override
public boolean willRemove(FeedItemFilter filter, FeedItem item) {
return filter.showQueued || filter.showNew;
if (item.getMedia() == null) {
return false;
}
return filter.showNotQueued || filter.showNew;
}
}

View File

@ -4,8 +4,10 @@ import android.content.Context;
import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.actionbutton.DownloadActionButton;
import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedItemFilter;
import org.greenrobot.eventbus.EventBus;
public class StartDownloadSwipeAction implements SwipeAction {
@ -31,9 +33,12 @@ public class StartDownloadSwipeAction implements SwipeAction {
@Override
public void performAction(FeedItem item, Fragment fragment, FeedItemFilter filter) {
if (!item.isDownloaded() && !item.getFeed().isLocalFeed()) {
new DownloadActionButton(item)
.onClick(fragment.requireContext());
if (item.getMedia() == null) {
EventBus.getDefault().post(new MessageEvent(fragment.getString(R.string.no_media_label)));
} else if (item.getFeed().isLocalFeed() || item.isDownloaded()) {
EventBus.getDefault().post(new MessageEvent(fragment.getString(R.string.already_downloaded)));
} else {
new DownloadActionButton(item).onClick(fragment.requireContext());
}
}

View File

@ -345,6 +345,7 @@
<string name="confirm_mobile_streaming_notification_message">Streaming over mobile data connection is disabled in the settings. Tap to stream anyway.</string>
<string name="confirm_mobile_streaming_button_always">Always</string>
<string name="confirm_mobile_streaming_button_once">Once</string>
<string name="already_downloaded">Episode is already downloaded</string>
<!-- Mediaplayer messages -->
<string name="playback_error_generic">The media file could not be played.\n\n- Try deleting and re-downloading the episode.\n- Check your network connection, and make sure no VPN or login page is blocking access.\n- Try long-pressing and sharing the \"Media address\" to your web browser to see if it can be played there. If not, contact the podcast creators.</string>