summaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/feed/FeedUrlNotFoundException.java26
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java4
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java20
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java12
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java39
-rw-r--r--core/src/main/res/layout/popup_bubble_view.xml55
-rw-r--r--core/src/main/res/values/arrays.xml23
-rw-r--r--core/src/main/res/values/strings.xml6
8 files changed, 128 insertions, 57 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedUrlNotFoundException.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedUrlNotFoundException.java
new file mode 100644
index 000000000..93b7e5d84
--- /dev/null
+++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedUrlNotFoundException.java
@@ -0,0 +1,26 @@
+package de.danoeh.antennapod.core.feed;
+
+import java.io.IOException;
+
+public class FeedUrlNotFoundException extends IOException {
+ private final String artistName;
+ private final String trackName;
+
+ public FeedUrlNotFoundException(String url, String trackName) {
+ this.artistName = url;
+ this.trackName = trackName;
+ }
+
+ public String getArtistName() {
+ return artistName;
+ }
+
+ public String getTrackName() {
+ return trackName;
+ }
+
+ @Override
+ public String getMessage() {
+ return "Result does not specify a feed url";
+ }
+} \ No newline at end of file
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java b/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java
index 394eb3943..a2facae64 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/BasicAuthorizationInterceptor.java
@@ -50,6 +50,10 @@ public class BasicAuthorizationInterceptor implements Interceptor {
}
Request.Builder newRequest = request.newBuilder();
+ if (!TextUtils.equals(response.request().url().toString(), request.url().toString())) {
+ newRequest.url(response.request().url());
+ }
+
Log.d(TAG, "Authorization failed, re-trying with ISO-8859-1 encoded credentials");
String credentials = HttpDownloader.encodeCredentials(parts[0], parts[1], "ISO-8859-1");
newRequest.header("Authorization", credentials);
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java
index 412914329..c60a2a4b6 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java
@@ -435,10 +435,9 @@ public final class DBTasks {
item.getTitle(), DownloadError.ERROR_PARSER_EXCEPTION_DUPLICATE, false,
"The podcast host appears to have added the same episode twice. "
+ "AntennaPod still refreshed the feed and attempted to repair it."
- + "{" + possibleDuplicate.getTitle() + "} with ID "
- + possibleDuplicate.getItemIdentifier()
- + " seems to be the same as {" + item.getTitle() + "} with ID "
- + item.getItemIdentifier(), false));
+ + "\n\nOriginal episode:\n" + duplicateEpisodeDetails(item)
+ + "\n\nSecond episode that is also in the feed:\n"
+ + duplicateEpisodeDetails(possibleDuplicate), false));
continue;
}
@@ -451,10 +450,9 @@ public final class DBTasks {
item.getTitle(), DownloadError.ERROR_PARSER_EXCEPTION_DUPLICATE, false,
"The podcast host changed the ID of an existing episode instead of just "
+ "updating the episode itself. AntennaPod still refreshed the feed and "
- + "attempted to repair it.\n\n"
- + "{" + oldItem.getTitle() + "} with ID " + oldItem.getItemIdentifier()
- + " seems to be the same as {" + item.getTitle() + "} with ID "
- + item.getItemIdentifier(), false));
+ + "attempted to repair it."
+ + "\n\nOriginal episode:\n" + duplicateEpisodeDetails(oldItem)
+ + "\n\nNow the feed contains:\n" + duplicateEpisodeDetails(item), false));
oldItem.setItemIdentifier(item.getItemIdentifier());
if (oldItem.isPlayed() && oldItem.getMedia() != null) {
@@ -542,6 +540,12 @@ public final class DBTasks {
return resultFeed;
}
+ private static String duplicateEpisodeDetails(FeedItem item) {
+ return "Title: " + item.getTitle()
+ + "\nID: " + item.getItemIdentifier()
+ + ((item.getMedia() == null) ? "" : "\nURL: " + item.getMedia().getDownload_url());
+ }
+
/**
* Searches the FeedItems of a specific Feed for a given string.
*
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java
index 09161ca7b..7f2742ab0 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java
@@ -50,6 +50,12 @@ public class FeedItemPermutors {
case DURATION_LONG_SHORT:
comparator = (f1, f2) -> Integer.compare(duration(f2), duration(f1));
break;
+ case EPISODE_FILENAME_A_Z:
+ comparator = (f1, f2) -> itemLink(f1).compareTo(itemLink(f2));
+ break;
+ case EPISODE_FILENAME_Z_A:
+ comparator = (f1, f2) -> itemLink(f2).compareTo(itemLink(f1));
+ break;
case FEED_TITLE_A_Z:
comparator = (f1, f2) -> feedTitle(f1).compareTo(feedTitle(f2));
break;
@@ -91,6 +97,12 @@ public class FeedItemPermutors {
}
@NonNull
+ private static String itemLink(@Nullable FeedItem item) {
+ return (item != null && item.getLink() != null)
+ ? item.getLink().toLowerCase(Locale.getDefault()) : "";
+ }
+
+ @NonNull
private static String feedTitle(@Nullable FeedItem item) {
return (item != null && item.getFeed() != null && item.getFeed().getTitle() != null)
? item.getFeed().getTitle().toLowerCase(Locale.getDefault()) : "";
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java
index 34b9d294d..974519400 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java
@@ -43,14 +43,6 @@ public class ShareUtils {
shareLink(context, feed.getTitle() + ": " + feed.getDownload_url());
}
- public static void shareFeedItemLink(Context context, FeedItem item) {
- shareFeedItemLink(context, item, false);
- }
-
- public static void shareFeedItemDownloadLink(Context context, FeedItem item) {
- shareFeedItemDownloadLink(context, item, false);
- }
-
private static String getItemShareText(FeedItem item) {
return item.getFeed().getTitle() + ": " + item.getTitle();
}
@@ -59,21 +51,26 @@ public class ShareUtils {
return FeedItemUtil.getLinkWithFallback(item) != null;
}
- public static void shareFeedItemLink(Context context, FeedItem item, boolean withPosition) {
- String text = getItemShareText(item) + " " + FeedItemUtil.getLinkWithFallback(item);
- if (withPosition) {
- int pos = item.getMedia().getPosition();
- text += " [" + Converter.getDurationStringLong(pos) + "]";
+ public static void shareFeedItemLinkWithDownloadLink(Context context, FeedItem item, boolean withPosition) {
+ String text = getItemShareText(item);
+ int pos = 0;
+ if (item.getMedia() != null && withPosition) {
+ text += "\n" + context.getResources().getString(R.string.share_starting_position_label) + ": ";
+ pos = item.getMedia().getPosition();
+ text += Converter.getDurationStringLong(pos);
+ }
+
+ if (hasLinkToShare(item)) {
+ text += "\n\n" + context.getResources().getString(R.string.share_dialog_episode_website_label) + ": ";
+ text += FeedItemUtil.getLinkWithFallback(item);
}
- shareLink(context, text);
- }
- public static void shareFeedItemDownloadLink(Context context, FeedItem item, boolean withPosition) {
- String text = getItemShareText(item) + " " + item.getMedia().getDownload_url();
- if (withPosition) {
- int pos = item.getMedia().getPosition();
- text += "#t=" + pos / 1000;
- text += " [" + Converter.getDurationStringLong(pos) + "]";
+ if (item.getMedia() != null && item.getMedia().getDownload_url() != null) {
+ text += "\n\n" + context.getResources().getString(R.string.share_dialog_media_file_label) + ": ";
+ text += item.getMedia().getDownload_url();
+ if (withPosition) {
+ text += "#t=" + pos / 1000;
+ }
}
shareLink(context, text);
}
diff --git a/core/src/main/res/layout/popup_bubble_view.xml b/core/src/main/res/layout/popup_bubble_view.xml
index 6b2e16f99..cc93bec72 100644
--- a/core/src/main/res/layout/popup_bubble_view.xml
+++ b/core/src/main/res/layout/popup_bubble_view.xml
@@ -1,40 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="16dp">
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
<TextView
- android:layout_width="match_parent"
- android:textColor="?attr/colorOnSecondary"
- android:layout_height="wrap_content"
- android:lines="3"
- android:id="@+id/balloon_message"/>
+ android:id="@+id/balloon_message"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="?attr/colorOnSecondary"
+ android:lines="3" />
<LinearLayout
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:gravity="end">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginTop="4dp"
+ android:gravity="end">
<Button
- style="@style/Widget.MaterialComponents.Button.TextButton"
- android:textColor="?attr/colorOnSecondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/no"
- android:id="@+id/balloon_button_negative"/>
+ android:id="@+id/balloon_button_negative"
+ android:layout_width="wrap_content"
+ android:layout_height="36dp"
+ android:textColor="?attr/colorOnSecondary"
+ android:text="@string/no"
+ style="@style/Widget.MaterialComponents.Button.TextButton" />
<Button
- style="@style/Widget.MaterialComponents.Button.TextButton"
- android:textColor="?attr/colorOnSecondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/yes"
- android:id="@+id/balloon_button_positive"/>
+ android:id="@+id/balloon_button_positive"
+ android:layout_width="wrap_content"
+ android:layout_height="36dp"
+ android:textColor="?attr/colorOnSecondary"
+ android:text="@string/yes"
+ style="@style/Widget.MaterialComponents.Button.TextButton" />
</LinearLayout>
+
</LinearLayout>
diff --git a/core/src/main/res/values/arrays.xml b/core/src/main/res/values/arrays.xml
index ba4d48219..de83bbf59 100644
--- a/core/src/main/res/values/arrays.xml
+++ b/core/src/main/res/values/arrays.xml
@@ -209,6 +209,18 @@
<item>@string/sort_duration_long_short</item>
</string-array>
+ <!-- sort for local feed screen -->
+ <string-array name="local_feed_episodes_sort_options">
+ <item>@string/sort_date_new_old</item>
+ <item>@string/sort_date_old_new</item>
+ <item>@string/sort_title_a_z</item>
+ <item>@string/sort_title_z_a</item>
+ <item>@string/sort_duration_short_long</item>
+ <item>@string/sort_duration_long_short</item>
+ <item>@string/sort_filename_a_z</item>
+ <item>@string/sort_filename_z_a</item>
+ </string-array>
+
<string-array name="feed_episodes_sort_values">
<item>DATE_NEW_OLD</item>
<item>DATE_OLD_NEW</item>
@@ -218,6 +230,17 @@
<item>DURATION_LONG_SHORT</item>
</string-array>
+ <string-array name="local_feed_episodes_sort_values">
+ <item>DATE_NEW_OLD</item>
+ <item>DATE_OLD_NEW</item>
+ <item>EPISODE_TITLE_A_Z</item>
+ <item>EPISODE_TITLE_Z_A</item>
+ <item>DURATION_SHORT_LONG</item>
+ <item>DURATION_LONG_SHORT</item>
+ <item>EPISODE_FILENAME_A_Z</item>
+ <item>EPISODE_FILENAME_Z_A</item>
+ </string-array>
+
<string-array name="compact_notification_buttons_options">
<item>@string/rewind_label</item>
<item>@string/fast_forward_label</item>
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index d6915b76b..dc3f390da 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -282,6 +282,7 @@
<string name="download_type_media">Media file</string>
<string name="download_request_error_dialog_message_prefix">An error occurred when trying to download the file:\u0020</string>
<string name="null_value_podcast_error">No podcast was provided that could be shown.</string>
+ <string name="no_feed_url_podcast_found_by_search">The suggested podcast did not have an RSS link, AntennaPod found a podcast that could match</string>
<string name="authentication_notification_title">Authentication required</string>
<string name="authentication_notification_msg">The resource you requested requires a username and a password</string>
<string name="confirm_mobile_download_dialog_title">Confirm Mobile Download</string>
@@ -761,6 +762,8 @@
<string name="sort_date_old_new">Date (Old \u2192 New)</string>
<string name="sort_duration_short_long">Duration (Short \u2192 Long)</string>
<string name="sort_duration_long_short">Duration (Long \u2192 Short)</string>
+ <string name="sort_filename_a_z">File Name (A \u2192 Z)</string>
+ <string name="sort_filename_z_a">File Name (Z \u2192 A)</string>
<string name="sort_a_z">A \u2192 Z</string>
<string name="sort_z_a">Z \u2192 A</string>
@@ -779,9 +782,10 @@
<!-- Share episode dialog -->
<string name="share_dialog_include_label">Include:</string>
<string name="share_playback_position_dialog_label">Playback position</string>
- <string name="share_dialog_media_file_url_label">Media file address</string>
<string name="share_dialog_episode_website_label">Episode webpage</string>
+ <string name="share_dialog_link_to_episode">Link to episode</string>
<string name="share_dialog_media_file_label">Media file</string>
+ <string name="share_starting_position_label">Starting from</string>
<!-- Audio controls -->
<string name="audio_controls">Audio controls</string>