summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md (renamed from ISSUE_TEMPLATE.md)23
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.md25
-rw-r--r--app/build.gradle7
-rw-r--r--app/src/main/java/de/danoeh/antennapod/PodcastApp.java6
-rw-r--r--core/build.gradle7
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java62
6 files changed, 96 insertions, 34 deletions
diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/bug_report.md
index dc02f85f4..2c2e0cfa2 100644
--- a/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -1,13 +1,20 @@
---
-DELETE ME<br/>
-You don't need to adhere to the template strictly. Feel free to leave out information you feel is not important or does not make sense.
-
-If you are submitting a feature request, please read [this](https://github.com/AntennaPod/AntennaPod/blob/develop/CONTRIBUTING.md#how-to-submit-a-feature-request).
-In particular, please not only tell us that you want something (*what*), but also make suggestions *how* it should be implemented.
+name: Bug report
+about: Create a report to help us improve existing features
---
-**App version:** 1.x (from Google Play/F-Droid/Custom build)
+<!--
+DELETE ME
+
+Use the search function to see if someone else has already submitted the same bug report.
+
+You don't need to adhere to the template strictly. Feel free to leave out information you feel is not important or does not make sense.
+
+If you are experiencing a crash, including the stacktrace will likely get it fixed sooner.
+-->
+
+**App version**: 1.x (from Google Play/F-Droid/Custom build)
**Android version**: 5.x [Please mention if you are using a custom rom!]
@@ -17,7 +24,7 @@ In particular, please not only tell us that you want something (*what*), but als
**Current behaviour**:
-**First occured**: Version 1.x / about x days/weeks ago
+**First occurred**: Version 1.x / about x days/weeks ago
**Steps to reproduce**:
@@ -25,7 +32,7 @@ In particular, please not only tell us that you want something (*what*), but als
1. Than that
1. Then
-**Environment**: [Settings you have changed, e.g. Auto Download. "Unusual" devices you use, e.g. Bluetooth headphones. Do you still use Prestissimo?]
+**Environment**: [Settings you have changed, e.g. Auto Download. "Unusual" devices you use, e.g. Bluetooth headphones. Do you still use Prestissimo? Did you select another media player?]
**Stacktrace/Logcat**:
```
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 000000000..878b857c8
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,25 @@
+---
+name: Feature request
+about: Request a new feature
+
+---
+
+<!--
+DELETE ME
+
+Use the search function to see if someone else has already submitted the same feature request. If there already is another request, please upvote the first post instead of commenting something like "I also want this".
+
+To make it easier for us to keep track of requests, please only make one feature request per issue.
+
+Give a brief explanation about the problem that currently exists and why your requested feature solves this problem.
+
+Try do be as specific as possible. Please not only explain what the feature does, but also how. When your request is about changing or extending the UI, describe what the UI would look like and how the user would interact with it.
+-->
+
+**App version**: 1.x (from Google Play/F-Droid/Custom build)
+
+**Problem you are having**:
+
+**Suggested solution**:
+
+**Screenshots / Drawings / Technical details**:
diff --git a/app/build.gradle b/app/build.gradle
index 97b9596b9..b4812e083 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -24,6 +24,12 @@ android {
testApplicationId "de.test.antennapod"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
generatedDensities = []
+
+ javaCompileOptions {
+ annotationProcessorOptions {
+ arguments = [ eventBusIndex : 'de.danoeh.antennapod.ApEventBusIndex' ]
+ }
+ }
}
signingConfigs {
@@ -145,6 +151,7 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
implementation "com.squareup.okio:okio:$okioVersion"
implementation "org.greenrobot:eventbus:$eventbusVersion"
+ annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
diff --git a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java
index fde9af16f..cb2f597d6 100644
--- a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java
+++ b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java
@@ -8,9 +8,11 @@ import com.joanzapata.iconify.Iconify;
import com.joanzapata.iconify.fonts.FontAwesomeModule;
import com.joanzapata.iconify.fonts.MaterialModule;
+import de.danoeh.antennapod.core.ApCoreEventBusIndex;
import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.spa.SPAUtil;
+import org.greenrobot.eventbus.EventBus;
/** Main application class. */
public class PodcastApp extends Application {
@@ -58,6 +60,10 @@ public class PodcastApp extends Application {
Iconify.with(new MaterialModule());
SPAUtil.sendSPAppsQueryFeedsIntent(this);
+ EventBus.builder()
+ .addIndex(new ApEventBusIndex())
+ .addIndex(new ApCoreEventBusIndex())
+ .installDefaultEventBus();
}
}
diff --git a/core/build.gradle b/core/build.gradle
index 824bf75c8..c0ddd9f2d 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -10,6 +10,12 @@ android {
versionName "1.0"
testApplicationId "de.danoeh.antennapod.core.tests"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+ javaCompileOptions {
+ annotationProcessorOptions {
+ arguments = [ eventBusIndex : 'de.danoeh.antennapod.core.ApCoreEventBusIndex' ]
+ }
+ }
}
buildTypes {
release {
@@ -61,6 +67,7 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
implementation "com.squareup.okio:okio:$okioVersion"
implementation "org.greenrobot:eventbus:$eventbusVersion"
+ annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "org.awaitility:awaitility:$awaitilityVersion"
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java b/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java
index 5c827dfe9..8680b2d2e 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java
@@ -104,13 +104,10 @@ public class QueueSorter {
* prefer a more balanced ordering that avoids having to listen to clusters of consecutive
* episodes from the same feed. This is what "Smart Shuffle" tries to accomplish.
*
- * The Smart Shuffle algorithm involves choosing episodes (in round-robin fashion) from a
- * collection of individual, pubdate-sorted lists that each contain only items from a specific
- * feed.
- *
- * Of course, clusters of consecutive episodes <i>at the end of the queue</i> may be
- * unavoidable. This seems unlikely to be an issue for most users who presumably maintain
- * large queues with new episodes continuously being added.
+ * The Smart Shuffle algorithm involves spreading episodes from each feed out over the whole
+ * queue. To do this, we calculate the number of episodes in each feed, then a common multiple
+ * (not the smallest); each episode is then spread out, and we sort the resulting list of
+ * episodes by "spread out factor" and feed name.
*
* For example, given a queue containing three episodes each from three different feeds
* (A, B, and C), a simple pubdate sort might result in a queue that looks like the following:
@@ -152,8 +149,17 @@ public class QueueSorter {
? (f1, f2) -> f1.getPubDate().compareTo(f2.getPubDate())
: (f1, f2) -> f2.getPubDate().compareTo(f1.getPubDate());
- for (Long id : map.keySet()) {
- Collections.sort(map.get(id), itemComparator);
+ // Calculate the spread
+
+ long spread = 0;
+ for (Map.Entry<Long, List<FeedItem>> mapEntry : map.entrySet()) {
+ List<FeedItem> feedItems = mapEntry.getValue();
+ Collections.sort(feedItems, itemComparator);
+ if (spread == 0) {
+ spread = feedItems.size();
+ } else if (feedItems.size() % spread != 0){
+ spread *= feedItems.size();
+ }
}
// Create a list of the individual FeedItems lists, and sort it by feed title (ascending).
@@ -161,25 +167,29 @@ public class QueueSorter {
List<List<FeedItem>> feeds = new ArrayList<>(map.values());
Collections.sort(feeds,
- // (we use a desc sort here, since we're iterating back-to-front below)
- (f1, f2) -> f2.get(0).getFeed().getTitle().compareTo(f1.get(0).getFeed().getTitle()));
-
- // Cycle through the (sorted) feed lists in a round-robin fashion, removing the first item
- // and adding it back into to the original queue
-
- while (!feeds.isEmpty()) {
- // Iterate across the (sorted) list of feeds, removing the first item in each, and
- // appending it to the queue. Note that we're iterating back-to-front here, since we
- // will be deleting feed lists as they become empty.
- for (int i = feeds.size() - 1; i >= 0; --i) {
- List<FeedItem> items = feeds.get(i);
- queue.add(items.remove(0));
- // Removed the last item in this particular feed? Then remove this feed from the
- // list of feeds.
- if (items.isEmpty()) {
- feeds.remove(i);
+ (f1, f2) -> f1.get(0).getFeed().getTitle().compareTo(f2.get(0).getFeed().getTitle()));
+
+ // Spread each episode out
+ Map<Long, List<FeedItem>> spreadItems = new HashMap<>();
+ for (List<FeedItem> feedItems : feeds) {
+ long thisSpread = spread / feedItems.size();
+ // Starting from 0 ensures we front-load, so the queue starts with one episode from
+ // each feed in the queue
+ long itemSpread = 0;
+ for (FeedItem feedItem : feedItems) {
+ if (!spreadItems.containsKey(itemSpread)) {
+ spreadItems.put(itemSpread, new ArrayList<>());
}
+ spreadItems.get(itemSpread).add(feedItem);
+ itemSpread += thisSpread;
}
}
+
+ // Go through the spread items and add them to the queue
+ List<Long> spreads = new ArrayList<>(spreadItems.keySet());
+ Collections.sort(spreads);
+ for (long itemSpread : spreads) {
+ queue.addAll(spreadItems.get(itemSpread));
+ }
}
}