summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/build.gradle8
-rw-r--r--core/src/androidTest/java/de/danoeh/antennapod/core/ApplicationTest.java13
-rw-r--r--core/src/androidTest/java/de/danoeh/antennapod/core/tests/AntennaPodTestRunner.java15
-rw-r--r--core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/DateUtilsTest.java (renamed from core/src/androidTest/java/de/danoeh/antennapod/core/util/DateUtilsTest.java)20
-rw-r--r--core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/LongLongMapTest.java61
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoProvider.java65
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java123
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/feed/FeedEvent.java28
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java33
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java82
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java69
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/feed/QueueEvent.java2
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetService.java82
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java2
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java5
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java574
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java25
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java146
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java23
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java77
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java11
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java27
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java6
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java4
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/APDownloadAlgorithm.java102
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java267
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java71
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java107
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java188
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java60
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java5
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/IntList.java240
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/LongIntMap.java252
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/LongList.java1
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java19
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java31
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/gui/UndoBarController.java3
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java50
-rwxr-xr-xcore/src/main/res/drawable-hdpi/ic_feed_grey600_24dp.pngbin1601 -> 2359 bytes
-rwxr-xr-xcore/src/main/res/drawable-hdpi/ic_feed_white_24dp.pngbin1367 -> 1663 bytes
-rw-r--r--core/src/main/res/drawable-hdpi/ic_filter_grey600_24dp.pngbin0 -> 135 bytes
-rw-r--r--core/src/main/res/drawable-hdpi/ic_filter_white_24dp.pngbin0 -> 131 bytes
-rw-r--r--core/src/main/res/drawable-hdpi/ic_lock_closed_grey600_24dp.pngbin0 -> 366 bytes
-rw-r--r--core/src/main/res/drawable-hdpi/ic_lock_closed_white_24dp.pngbin0 -> 358 bytes
-rw-r--r--core/src/main/res/drawable-hdpi/ic_lock_open_grey600_24dp.pngbin0 -> 362 bytes
-rw-r--r--core/src/main/res/drawable-hdpi/ic_lock_open_white_24dp.pngbin0 -> 356 bytes
-rwxr-xr-xcore/src/main/res/drawable-mdpi/ic_feed_grey600_24dp.pngbin1018 -> 1566 bytes
-rwxr-xr-xcore/src/main/res/drawable-mdpi/ic_feed_white_24dp.pngbin875 -> 1156 bytes
-rw-r--r--core/src/main/res/drawable-mdpi/ic_filter_grey600_24dp.pngbin0 -> 111 bytes
-rw-r--r--core/src/main/res/drawable-mdpi/ic_filter_white_24dp.pngbin0 -> 111 bytes
-rw-r--r--core/src/main/res/drawable-mdpi/ic_lock_closed_grey600_24dp.pngbin0 -> 242 bytes
-rw-r--r--core/src/main/res/drawable-mdpi/ic_lock_closed_white_24dp.pngbin0 -> 237 bytes
-rw-r--r--core/src/main/res/drawable-mdpi/ic_lock_open_grey600_24dp.pngbin0 -> 242 bytes
-rw-r--r--core/src/main/res/drawable-mdpi/ic_lock_open_white_24dp.pngbin0 -> 238 bytes
-rwxr-xr-xcore/src/main/res/drawable-xhdpi/ic_feed_grey600_24dp.pngbin2223 -> 3200 bytes
-rwxr-xr-xcore/src/main/res/drawable-xhdpi/ic_feed_white_24dp.pngbin1933 -> 2314 bytes
-rw-r--r--core/src/main/res/drawable-xhdpi/ic_filter_grey600_24dp.pngbin0 -> 141 bytes
-rw-r--r--core/src/main/res/drawable-xhdpi/ic_filter_white_24dp.pngbin0 -> 141 bytes
-rw-r--r--core/src/main/res/drawable-xhdpi/ic_lock_closed_grey600_24dp.pngbin0 -> 430 bytes
-rw-r--r--core/src/main/res/drawable-xhdpi/ic_lock_closed_white_24dp.pngbin0 -> 421 bytes
-rw-r--r--core/src/main/res/drawable-xhdpi/ic_lock_open_grey600_24dp.pngbin0 -> 427 bytes
-rw-r--r--core/src/main/res/drawable-xhdpi/ic_lock_open_white_24dp.pngbin0 -> 420 bytes
-rwxr-xr-xcore/src/main/res/drawable-xxhdpi/ic_feed_grey600_24dp.pngbin3265 -> 4754 bytes
-rwxr-xr-xcore/src/main/res/drawable-xxhdpi/ic_feed_white_24dp.pngbin2884 -> 3406 bytes
-rw-r--r--core/src/main/res/drawable-xxhdpi/ic_filter_grey600_24dp.pngbin0 -> 189 bytes
-rw-r--r--core/src/main/res/drawable-xxhdpi/ic_filter_white_24dp.pngbin0 -> 188 bytes
-rw-r--r--core/src/main/res/drawable-xxhdpi/ic_lock_closed_grey600_24dp.pngbin0 -> 630 bytes
-rw-r--r--core/src/main/res/drawable-xxhdpi/ic_lock_closed_white_24dp.pngbin0 -> 621 bytes
-rw-r--r--core/src/main/res/drawable-xxhdpi/ic_lock_open_grey600_24dp.pngbin0 -> 627 bytes
-rw-r--r--core/src/main/res/drawable-xxhdpi/ic_lock_open_white_24dp.pngbin0 -> 621 bytes
-rw-r--r--core/src/main/res/drawable-xxxhdpi/ic_filter_grey600_24dp.pngbin0 -> 235 bytes
-rw-r--r--core/src/main/res/drawable-xxxhdpi/ic_filter_white_24dp.pngbin0 -> 234 bytes
-rw-r--r--core/src/main/res/drawable-xxxhdpi/ic_lock_closed_grey600_24dp.pngbin0 -> 854 bytes
-rw-r--r--core/src/main/res/drawable-xxxhdpi/ic_lock_closed_white_24dp.pngbin0 -> 839 bytes
-rw-r--r--core/src/main/res/drawable-xxxhdpi/ic_lock_open_grey600_24dp.pngbin0 -> 850 bytes
-rw-r--r--core/src/main/res/drawable-xxxhdpi/ic_lock_open_white_24dp.pngbin0 -> 838 bytes
-rw-r--r--core/src/main/res/values-az/strings.xml2
-rw-r--r--core/src/main/res/values-ca/strings.xml2
-rw-r--r--core/src/main/res/values-cs-rCZ/strings.xml2
-rw-r--r--core/src/main/res/values-da/strings.xml2
-rw-r--r--core/src/main/res/values-de/strings.xml2
-rw-r--r--core/src/main/res/values-es-rES/strings.xml2
-rw-r--r--core/src/main/res/values-es/strings.xml3
-rw-r--r--core/src/main/res/values-fr/strings.xml2
-rw-r--r--core/src/main/res/values-hi-rIN/strings.xml2
-rw-r--r--core/src/main/res/values-it-rIT/strings.xml7
-rw-r--r--core/src/main/res/values-iw-rIL/strings.xml16
-rw-r--r--core/src/main/res/values-ja/strings.xml2
-rw-r--r--core/src/main/res/values-ko/strings.xml18
-rw-r--r--core/src/main/res/values-nl/strings.xml2
-rw-r--r--core/src/main/res/values-pl-rPL/strings.xml2
-rw-r--r--core/src/main/res/values-pt-rBR/strings.xml2
-rw-r--r--core/src/main/res/values-pt/strings.xml2
-rw-r--r--core/src/main/res/values-ro-rRO/strings.xml2
-rw-r--r--core/src/main/res/values-ru/strings.xml17
-rw-r--r--core/src/main/res/values-sv-rSE/strings.xml2
-rw-r--r--core/src/main/res/values-tr/strings.xml19
-rw-r--r--core/src/main/res/values-uk-rUA/strings.xml16
-rw-r--r--core/src/main/res/values-zh-rCN/strings.xml2
-rw-r--r--core/src/main/res/values/arrays.xml35
-rw-r--r--core/src/main/res/values/attrs.xml3
-rw-r--r--core/src/main/res/values/dimens.xml4
-rw-r--r--core/src/main/res/values/strings.xml45
-rw-r--r--core/src/main/res/values/styles.xml12
104 files changed, 2216 insertions, 908 deletions
diff --git a/core/build.gradle b/core/build.gradle
index c327f194c..ae2c11070 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -9,6 +9,8 @@ android {
targetSdkVersion 21
versionCode 1
versionName "1.0"
+ testApplicationId "de.danoeh.antennapod.core.tests"
+ testInstrumentationRunner "de.danoeh.antennapod.core.tests.AntennaPodTestRunner"
}
buildTypes {
release {
@@ -40,9 +42,9 @@ dependencies {
compile 'commons-io:commons-io:2.4'
compile 'com.jayway.android.robotium:robotium-solo:5.2.1'
compile 'org.jsoup:jsoup:1.7.3'
- compile 'com.squareup.picasso:picasso:2.4.0'
- compile 'com.squareup.okhttp:okhttp:2.2.0'
- compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
+ compile 'com.squareup.picasso:picasso:2.5.2'
+ compile 'com.squareup.okhttp:okhttp:2.3.0'
+ compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.squareup.okio:okio:1.2.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'de.greenrobot:eventbus:2.4.0'
diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/ApplicationTest.java b/core/src/androidTest/java/de/danoeh/antennapod/core/ApplicationTest.java
deleted file mode 100644
index 894bcfa63..000000000
--- a/core/src/androidTest/java/de/danoeh/antennapod/core/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package de.danoeh.antennapod.core;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
- */
-public class ApplicationTest extends ApplicationTestCase<Application> {
- public ApplicationTest() {
- super(Application.class);
- }
-} \ No newline at end of file
diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/tests/AntennaPodTestRunner.java b/core/src/androidTest/java/de/danoeh/antennapod/core/tests/AntennaPodTestRunner.java
new file mode 100644
index 000000000..fbb5459d4
--- /dev/null
+++ b/core/src/androidTest/java/de/danoeh/antennapod/core/tests/AntennaPodTestRunner.java
@@ -0,0 +1,15 @@
+package de.danoeh.antennapod.core.tests;
+
+import android.test.InstrumentationTestRunner;
+import android.test.suitebuilder.TestSuiteBuilder;
+import junit.framework.TestSuite;
+
+public class AntennaPodTestRunner extends InstrumentationTestRunner {
+
+ @Override
+ public TestSuite getAllTests() {
+ return new TestSuiteBuilder(AntennaPodTestRunner.class)
+ .includeAllPackagesUnderHere()
+ .build();
+ }
+} \ No newline at end of file
diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/util/DateUtilsTest.java b/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/DateUtilsTest.java
index cca753895..2a2d6414a 100644
--- a/core/src/androidTest/java/de/danoeh/antennapod/core/util/DateUtilsTest.java
+++ b/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/DateUtilsTest.java
@@ -1,4 +1,4 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.core.tests.util;
import android.test.AndroidTestCase;
@@ -7,6 +7,8 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
+import de.danoeh.antennapod.core.util.DateUtils;
+
public class DateUtilsTest extends AndroidTestCase {
public void testParseDateWithMicroseconds() throws Exception {
@@ -56,4 +58,20 @@ public class DateUtilsTest extends AndroidTestCase {
assertEquals(900, actual.getTime()%1000);
}
+ public void testParseDateWithTimezoneName() throws Exception {
+ GregorianCalendar exp = new GregorianCalendar(2015, 2, 28, 6, 31, 4);
+ exp.setTimeZone(TimeZone.getTimeZone("UTC"));
+ Date expected = new Date(exp.getTimeInMillis());
+ Date actual = DateUtils.parse("Sat, 28 Mar 2015 01:31:04 EST");
+ assertEquals(expected, actual);
+ }
+
+ public void testParseDateWithTimeZoneOffset() throws Exception {
+ GregorianCalendar exp = new GregorianCalendar(2015, 2, 28, 12, 16, 12);
+ exp.setTimeZone(TimeZone.getTimeZone("UTC"));
+ Date expected = new Date(exp.getTimeInMillis());
+ Date actual = DateUtils.parse("Sat, 28 March 2015 08:16:12 -0400");
+ assertEquals(expected, actual);
+ }
+
}
diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/LongLongMapTest.java b/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/LongLongMapTest.java
new file mode 100644
index 000000000..50c2a9c3c
--- /dev/null
+++ b/core/src/androidTest/java/de/danoeh/antennapod/core/tests/util/LongLongMapTest.java
@@ -0,0 +1,61 @@
+package de.danoeh.antennapod.core.tests.util;
+
+import android.test.AndroidTestCase;
+
+import de.danoeh.antennapod.core.util.LongIntMap;
+
+public class LongLongMapTest extends AndroidTestCase {
+
+ public void testEmptyMap() {
+ LongIntMap map = new LongIntMap();
+ assertEquals(0, map.size());
+ assertEquals("LongLongMap{}", map.toString());
+ assertEquals(0, map.get(42));
+ assertEquals(-1, map.get(42, -1));
+ assertEquals(false, map.delete(42));
+ assertEquals(-1, map.indexOfKey(42));
+ assertEquals(-1, map.indexOfValue(42));
+ assertEquals(1, map.hashCode());
+ }
+
+ public void testSingleElement() {
+ LongIntMap map = new LongIntMap();
+ map.put(17, 42);
+ assertEquals(1, map.size());
+ assertEquals("LongLongMap{17=42}", map.toString());
+ assertEquals(42, map.get(17));
+ assertEquals(42, map.get(17, -1));
+ assertEquals(0, map.indexOfKey(17));
+ assertEquals(0, map.indexOfValue(42));
+ assertEquals(true, map.delete(17));
+ }
+
+ public void testAddAndDelete() {
+ LongIntMap map = new LongIntMap();
+ for(int i=0; i < 100; i++) {
+ map.put(i * 17, i * 42);
+ }
+ assertEquals(100, map.size());
+ assertEquals(0, map.get(0));
+ assertEquals(42, map.get(17));
+ assertEquals(42, map.get(17, -1));
+ assertEquals(1, map.indexOfKey(17));
+ assertEquals(1, map.indexOfValue(42));
+ for(int i=0; i < 100; i++) {
+ assertEquals(true, map.delete(i * 17));
+ }
+ }
+
+ public void testOverwrite() {
+ LongIntMap map = new LongIntMap();
+ map.put(17, 42);
+ assertEquals(1, map.size());
+ assertEquals("LongLongMap{17=42}", map.toString());
+ assertEquals(42, map.get(17));
+ map.put(17, 23);
+ assertEquals(1, map.size());
+ assertEquals("LongLongMap{17=23}", map.toString());
+ assertEquals(23, map.get(17));
+ }
+
+}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoProvider.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoProvider.java
index b6ece6dc8..4f2d5b204 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoProvider.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoProvider.java
@@ -6,8 +6,12 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
+import android.text.TextUtils;
import android.util.Log;
+import com.squareup.okhttp.Interceptor;
+import com.squareup.okhttp.OkHttpClient;
+import com.squareup.okhttp.Response;
import com.squareup.picasso.Cache;
import com.squareup.picasso.LruCache;
import com.squareup.picasso.OkHttpDownloader;
@@ -22,13 +26,18 @@ import org.apache.commons.lang3.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.HttpURLConnection;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import de.danoeh.antennapod.core.service.download.HttpDownloader;
+import de.danoeh.antennapod.core.storage.DBReader;
+
/**
* Provides access to Picasso instances.
*/
public class PicassoProvider {
+
private static final String TAG = "PicassoProvider";
private static final boolean DEBUG = false;
@@ -56,10 +65,12 @@ public class PicassoProvider {
if (picassoSetup) {
return;
}
+ OkHttpClient client = new OkHttpClient();
+ client.interceptors().add(new BasicAuthenticationInterceptor(appContext));
Picasso picasso = new Picasso.Builder(appContext)
.indicatorsEnabled(DEBUG)
.loggingEnabled(DEBUG)
- .downloader(new OkHttpDownloader(appContext))
+ .downloader(new OkHttpDownloader(client))
.addRequestHandler(new MediaRequestHandler(appContext))
.executor(getExecutorService())
.memoryCache(getMemoryCache(appContext))
@@ -75,6 +86,48 @@ public class PicassoProvider {
picassoSetup = true;
}
+ private static class BasicAuthenticationInterceptor implements Interceptor {
+
+ private final Context context;
+
+ public BasicAuthenticationInterceptor(Context context) {
+ this.context = context;
+ }
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ com.squareup.okhttp.Request request = chain.request();
+ String url = request.urlString();
+ String authentication = DBReader.getImageAuthentication(context, url);
+
+ if(TextUtils.isEmpty(authentication)) {
+ Log.d(TAG, "no credentials for '" + url + "'");
+ return chain.proceed(request);
+ }
+
+ // add authentication
+ String[] auth = authentication.split(":");
+ String credentials = HttpDownloader.encodeCredentials(auth[0], auth[1], "ISO-8859-1");
+ com.squareup.okhttp.Request newRequest = request
+ .newBuilder()
+ .addHeader("Authorization", credentials)
+ .build();
+ Log.d(TAG, "Basic authentication with ISO-8859-1 encoding");
+ Response response = chain.proceed(newRequest);
+ if (!response.isSuccessful() && response.code() == HttpURLConnection.HTTP_UNAUTHORIZED) {
+ credentials = HttpDownloader.encodeCredentials(auth[0], auth[1], "UTF-8");
+ newRequest = request
+ .newBuilder()
+ .addHeader("Authorization", credentials)
+ .build();
+ Log.d(TAG, "Basic authentication with UTF-8 encoding");
+ return chain.proceed(newRequest);
+ } else {
+ return response;
+ }
+ }
+ }
+
private static class MediaRequestHandler extends RequestHandler {
final Context context;
@@ -90,7 +143,7 @@ public class PicassoProvider {
}
@Override
- public Result load(Request data) throws IOException {
+ public Result load(Request data, int networkPolicy) throws IOException {
Bitmap bitmap = null;
MediaMetadataRetriever mmr = null;
try {
@@ -109,13 +162,7 @@ public class PicassoProvider {
}
if (bitmap == null) {
- // check for fallback Uri
- String fallbackParam = data.uri.getQueryParameter(PicassoImageResource.PARAM_FALLBACK);
-
- if (fallbackParam != null) {
- Uri fallback = Uri.parse(fallbackParam);
- bitmap = decodeStreamFromFile(data, fallback);
- }
+ Log.wtf(TAG, "THIS SHOULD NEVER EVER HAPPEN!!");
}
return new Result(bitmap, Picasso.LoadedFrom.DISK);
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java b/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java
index c0f71ed55..29ba721fe 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java
@@ -2,6 +2,7 @@ package de.danoeh.antennapod.core.feed;
import android.content.Context;
import android.net.Uri;
+import android.support.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
@@ -10,9 +11,7 @@ import java.util.Date;
import java.util.List;
import de.danoeh.antennapod.core.asynctask.PicassoImageResource;
-import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBWriter;
-import de.danoeh.antennapod.core.util.EpisodeFilter;
import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
import de.danoeh.antennapod.core.util.flattr.FlattrThing;
@@ -81,12 +80,20 @@ public class Feed extends FeedFile implements FlattrThing, PicassoImageResource
*/
private String nextPageLink;
+ private boolean lastUpdateFailed;
+
+ /**
+ * Contains property strings. If such a property applies to a feed item, it is not shown in the feed list
+ */
+ private FeedItemFilter itemfilter;
+
/**
* This constructor is used for restoring a feed from the database.
*/
public Feed(long id, Date lastUpdate, String title, String link, String description, String paymentLink,
String author, String language, String type, String feedIdentifier, FeedImage image, String fileUrl,
- String downloadUrl, boolean downloaded, FlattrStatus status, boolean paged, String nextPageLink) {
+ String downloadUrl, boolean downloaded, FlattrStatus status, boolean paged, String nextPageLink,
+ String filter, boolean lastUpdateFailed) {
super(fileUrl, downloadUrl, downloaded);
this.id = id;
this.title = title;
@@ -106,8 +113,13 @@ public class Feed extends FeedFile implements FlattrThing, PicassoImageResource
this.flattrStatus = status;
this.paged = paged;
this.nextPageLink = nextPageLink;
-
- items = new ArrayList<FeedItem>();
+ this.items = new ArrayList<FeedItem>();
+ if(filter != null) {
+ this.itemfilter = new FeedItemFilter(filter);
+ } else {
+ this.itemfilter = new FeedItemFilter(new String[0]);
+ }
+ this.lastUpdateFailed = lastUpdateFailed;
}
/**
@@ -117,7 +129,7 @@ public class Feed extends FeedFile implements FlattrThing, PicassoImageResource
String author, String language, String type, String feedIdentifier, FeedImage image, String fileUrl,
String downloadUrl, boolean downloaded) {
this(id, lastUpdate, title, link, description, paymentLink, author, language, type, feedIdentifier, image,
- fileUrl, downloadUrl, downloaded, new FlattrStatus(), false, null);
+ fileUrl, downloadUrl, downloaded, new FlattrStatus(), false, null, null, false);
}
/**
@@ -125,7 +137,6 @@ public class Feed extends FeedFile implements FlattrThing, PicassoImageResource
*/
public Feed() {
super();
- items = new ArrayList<FeedItem>();
lastUpdate = new Date();
this.flattrStatus = new FlattrStatus();
}
@@ -159,53 +170,15 @@ public class Feed extends FeedFile implements FlattrThing, PicassoImageResource
preferences = new FeedPreferences(0, true, username, password);
}
- /**
- * Returns the number of FeedItems where 'read' is false. If the 'display
- * only episodes' - preference is set to true, this method will only count
- * items with episodes.
- */
- public int getNumOfNewItems() {
- int count = 0;
- for (FeedItem item : items) {
- if (item.getState() == FeedItem.State.NEW) {
- if (!UserPreferences.isDisplayOnlyEpisodes()
- || item.getMedia() != null) {
- count++;
- }
- }
- }
- return count;
- }
-
- /**
- * Returns the number of FeedItems where the media started to play but
- * wasn't finished yet.
- */
- public int getNumOfStartedItems() {
- int count = 0;
-
- for (FeedItem item : items) {
- FeedItem.State state = item.getState();
- if (state == FeedItem.State.IN_PROGRESS
- || state == FeedItem.State.PLAYING) {
- count++;
- }
- }
- return count;
- }
/**
* Returns true if at least one item in the itemlist is unread.
*
- * @param enableEpisodeFilter true if this method should only count items with episodes if
- * the 'display only episodes' - preference is set to true by the
- * user.
*/
- public boolean hasNewItems(boolean enableEpisodeFilter) {
+ public boolean hasNewItems() {
for (FeedItem item : items) {
- if (item.getState() == FeedItem.State.NEW) {
- if (!(enableEpisodeFilter && UserPreferences
- .isDisplayOnlyEpisodes()) || item.getMedia() != null) {
+ if (item.getState() == FeedItem.State.UNREAD) {
+ if (item.getMedia() != null) {
return true;
}
}
@@ -216,30 +189,17 @@ public class Feed extends FeedFile implements FlattrThing, PicassoImageResource
/**
* Returns the number of FeedItems.
*
- * @param enableEpisodeFilter true if this method should only count items with episodes if
- * the 'display only episodes' - preference is set to true by the
- * user.
*/
- public int getNumOfItems(boolean enableEpisodeFilter) {
- if (enableEpisodeFilter && UserPreferences.isDisplayOnlyEpisodes()) {
- return EpisodeFilter.countItemsWithEpisodes(items);
- } else {
- return items.size();
- }
+ public int getNumOfItems() {
+ return items.size();
}
/**
* Returns the item at the specified index.
*
- * @param enableEpisodeFilter true if this method should ignore items without episdodes if
- * the episodes filter has been enabled by the user.
*/
- public FeedItem getItemAtIndex(boolean enableEpisodeFilter, int position) {
- if (enableEpisodeFilter && UserPreferences.isDisplayOnlyEpisodes()) {
- return EpisodeFilter.accessEpisodeByIndex(items, position);
- } else {
- return items.get(position);
- }
+ public FeedItem getItemAtIndex(int position) {
+ return items.get(position);
}
/**
@@ -350,6 +310,19 @@ public class Feed extends FeedFile implements FlattrThing, PicassoImageResource
return false;
}
+ public FeedItem getMostRecentItem() {
+ // we could sort, but we don't need to, a simple search is fine...
+ Date mostRecentDate = new Date(0);
+ FeedItem mostRecentItem = null;
+ for (FeedItem item : items) {
+ if (item.getPubDate().after(mostRecentDate)) {
+ mostRecentDate = item.getPubDate();
+ mostRecentItem = item;
+ }
+ }
+ return mostRecentItem;
+ }
+
@Override
public int getTypeAsInt() {
return FEEDFILETYPE_FEED;
@@ -503,4 +476,24 @@ public class Feed extends FeedFile implements FlattrThing, PicassoImageResource
public void setNextPageLink(String nextPageLink) {
this.nextPageLink = nextPageLink;
}
+
+ @Nullable
+ public FeedItemFilter getItemFilter() {
+ return itemfilter;
+ }
+
+ public void setHiddenItemProperties(String[] properties) {
+ if (properties != null) {
+ this.itemfilter = new FeedItemFilter(properties);
+ }
+ }
+
+ public boolean hasLastUpdateFailed() {
+ return this.lastUpdateFailed;
+ }
+
+ public void setLastUpdateFailed(boolean lastUpdateFailed) {
+ this.lastUpdateFailed = lastUpdateFailed;
+ }
+
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedEvent.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedEvent.java
new file mode 100644
index 000000000..d04d236e4
--- /dev/null
+++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedEvent.java
@@ -0,0 +1,28 @@
+package de.danoeh.antennapod.core.feed;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public class FeedEvent {
+
+ public enum Action {
+ FILTER_CHANGED
+ }
+
+ public final Action action;
+ public final long feedId;
+
+ public FeedEvent(Action action, long feedId) {
+ this.action = action;
+ this.feedId = feedId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
+ .append("action", action)
+ .append("feedId", feedId)
+ .toString();
+ }
+
+}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java
index 4fd7a184c..11348953e 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java
@@ -63,6 +63,8 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
private List<Chapter> chapters;
private FeedImage image;
+ private boolean autoDownload = true;
+
public FeedItem() {
this.read = true;
this.flattrStatus = new FlattrStatus();
@@ -74,7 +76,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
* */
public FeedItem(long id, String title, String link, Date pubDate, String paymentLink, long feedId,
FlattrStatus flattrStatus, boolean hasChapters, FeedImage image, boolean read,
- String itemIdentifier) {
+ String itemIdentifier, boolean autoDownload) {
this.id = id;
this.title = title;
this.link = link;
@@ -86,6 +88,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
this.image = image;
this.read = read;
this.itemIdentifier = itemIdentifier;
+ this.autoDownload = autoDownload;
}
/**
@@ -236,7 +239,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
}
public boolean isRead() {
- return read || isInProgress();
+ return read;
}
public void setRead(boolean read) {
@@ -315,10 +318,10 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
@Override
public Uri getImageUri() {
- if (hasItemImageDownloaded()) {
- return image.getImageUri();
- } else if (hasMedia()) {
+ if(media != null && media.hasEmbeddedPicture()) {
return media.getImageUri();
+ } else if (hasItemImageDownloaded()) {
+ return image.getImageUri();
} else if (feed != null) {
return feed.getImageUri();
} else {
@@ -327,7 +330,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
}
public enum State {
- NEW, IN_PROGRESS, READ, PLAYING
+ UNREAD, IN_PROGRESS, READ, PLAYING
}
public State getState() {
@@ -339,7 +342,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
return State.IN_PROGRESS;
}
}
- return (isRead() ? State.READ : State.NEW);
+ return (isRead() ? State.READ : State.UNREAD);
}
public long getFeedId() {
@@ -388,6 +391,22 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
return hasChapters;
}
+ public void setAutoDownload(boolean autoDownload) {
+ this.autoDownload = autoDownload;
+ }
+
+ public boolean getAutoDownload() {
+ return this.autoDownload;
+ }
+
+ public boolean isAutoDownloadable() {
+ return this.hasMedia() &&
+ false == this.getMedia().isPlaying() &&
+ false == this.getMedia().isDownloaded() &&
+ false == this.isRead() &&
+ this.getAutoDownload();
+ }
+
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java
new file mode 100644
index 000000000..4ad084b39
--- /dev/null
+++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java
@@ -0,0 +1,82 @@
+package de.danoeh.antennapod.core.feed;
+
+import android.content.Context;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.danoeh.antennapod.core.storage.DBReader;
+
+public class FeedItemFilter {
+
+ private final String[] properties;
+
+ private boolean hideUnplayed = false;
+ private boolean hidePaused = false;
+ private boolean hidePlayed = false;
+ private boolean hideQueued = false;
+ private boolean hideNotQueued = false;
+ private boolean hideDownloaded = false;
+ private boolean hideNotDownloaded = false;
+
+ public FeedItemFilter(String properties) {
+ this(StringUtils.split(properties, ','));
+ }
+
+ public FeedItemFilter(String[] properties) {
+ this.properties = properties;
+ for(String property : properties) {
+ // see R.arrays.feed_filter_values
+ switch(property) {
+ case "unplayed":
+ hideUnplayed = true;
+ break;
+ case "paused":
+ hidePaused = true;
+ break;
+ case "played":
+ hidePlayed = true;
+ break;
+ case "queued":
+ hideQueued = true;
+ break;
+ case "not_queued":
+ hideNotQueued = true;
+ break;
+ case "downloaded":
+ hideDownloaded = true;
+ break;
+ case "not_downloaded":
+ hideNotDownloaded = true;
+ break;
+ }
+ }
+ }
+
+ public List<FeedItem> filter(Context context, List<FeedItem> items) {
+ if(properties.length == 0) {
+ return items;
+ }
+ List<FeedItem> result = new ArrayList<FeedItem>();
+ for(FeedItem item : items) {
+ if(hideUnplayed && false == item.isRead()) continue;
+ if(hidePaused && item.getState() == FeedItem.State.IN_PROGRESS) continue;
+ if(hidePlayed && item.isRead()) continue;
+ boolean isQueued = DBReader.getQueueIDList(context).contains(item.getId());
+ if(hideQueued && isQueued) continue;
+ if(hideNotQueued && false == isQueued) continue;
+ boolean isDownloaded = item.getMedia() != null && item.getMedia().isDownloaded();
+ if(hideDownloaded && isDownloaded) continue;
+ if(hideNotDownloaded && false == isDownloaded) continue;
+ result.add(item);
+ }
+ return result;
+ }
+
+ public String[] getValues() {
+ return properties.clone();
+ }
+
+}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java
index 93f826894..f875eb812 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java
@@ -2,6 +2,7 @@ package de.danoeh.antennapod.core.feed;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
+import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
@@ -34,6 +35,7 @@ public class FeedMedia extends FeedFile implements Playable {
private String mime_type;
private volatile FeedItem item;
private Date playbackCompletionDate;
+ private boolean hasEmbeddedPicture;
/* Used for loading item when restoring from parcel. */
private long itemID;
@@ -50,6 +52,7 @@ public class FeedMedia extends FeedFile implements Playable {
long size, String mime_type, String file_url, String download_url,
boolean downloaded, Date playbackCompletionDate, int played_duration) {
super(file_url, download_url, downloaded);
+ checkEmbeddedPicture();
this.id = id;
this.item = item;
this.duration = duration;
@@ -61,12 +64,6 @@ public class FeedMedia extends FeedFile implements Playable {
? null : (Date) playbackCompletionDate.clone();
}
- public FeedMedia(long id, FeedItem item) {
- super();
- this.id = id;
- this.item = item;
- }
-
@Override
public String getHumanReadableIdentifier() {
if (item != null && item.getTitle() != null) {
@@ -227,18 +224,15 @@ public class FeedMedia extends FeedFile implements Playable {
return (this.position > 0);
}
- public FeedImage getImage() {
- if (item != null) {
- return (item.hasItemImageDownloaded()) ? item.getImage() : item.getFeed().getImage();
- }
- return null;
- }
-
@Override
public int describeContents() {
return 0;
}
+ public boolean hasEmbeddedPicture() {
+ return this.hasEmbeddedPicture;
+ }
+
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(id);
@@ -415,28 +409,45 @@ public class FeedMedia extends FeedFile implements Playable {
@Override
public Uri getImageUri() {
- final Uri feedImgUri = getFeedImageUri();
-
- if (localFileAvailable()) {
+ if (hasEmbeddedPicture) {
Uri.Builder builder = new Uri.Builder();
- builder.scheme(SCHEME_MEDIA)
- .encodedPath(getLocalMediaUrl());
- if (feedImgUri != null) {
- builder.appendQueryParameter(PARAM_FALLBACK, feedImgUri.toString());
- }
+ builder.scheme(SCHEME_MEDIA).encodedPath(getLocalMediaUrl());
return builder.build();
- } else if (item.hasItemImageDownloaded()) {
- return item.getImage().getImageUri();
} else {
- return feedImgUri;
+ return item.getImageUri();
}
}
- private Uri getFeedImageUri() {
- if (item != null && item.getFeed() != null) {
- return item.getFeed().getImageUri();
- } else {
- return null;
+ @Override
+ public void setDownloaded(boolean downloaded) {
+ super.setDownloaded(downloaded);
+ checkEmbeddedPicture();
+ }
+
+ @Override
+ public void setFile_url(String file_url) {
+ super.setFile_url(file_url);
+ checkEmbeddedPicture();
+ }
+
+ private void checkEmbeddedPicture() {
+ if (!localFileAvailable()) {
+ hasEmbeddedPicture = false;
+ return;
+ }
+ MediaMetadataRetriever mmr = new MediaMetadataRetriever();
+ try {
+ mmr.setDataSource(getLocalMediaUrl());
+ byte[] image = mmr.getEmbeddedPicture();
+ if(image != null) {
+ hasEmbeddedPicture = true;
+ }
+ else {
+ hasEmbeddedPicture = false;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ hasEmbeddedPicture = false;
}
}
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/QueueEvent.java b/core/src/main/java/de/danoeh/antennapod/core/feed/QueueEvent.java
index 9f1eec754..c8497f509 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/feed/QueueEvent.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/feed/QueueEvent.java
@@ -8,7 +8,7 @@ import java.util.List;
public class QueueEvent {
public enum Action {
- ADDED, ADDED_ITEMS, REMOVED, CLEARED, DELETED_MEDIA, SORTED
+ ADDED, ADDED_ITEMS, REMOVED, CLEARED, DELETED_MEDIA, SORTED, MOVED
}
public final Action action;
diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetService.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetService.java
index db242c3bc..1a40120e2 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetService.java
@@ -75,84 +75,9 @@ public class GpodnetService {
public GpodnetService() {
httpClient = AntennapodHttpClient.getHttpClient();
- if (Build.VERSION.SDK_INT <= 10) {
- Log.d(TAG, "Use custom SSL factory");
- SSLSocketFactory factory = getCustomSslSocketFactory();
- httpClient.setSslSocketFactory(factory);
- }
BASE_HOST = GpodnetPreferences.getHostname();
}
- private synchronized static SSLSocketFactory getCustomSslSocketFactory() {
- try {
- TrustManagerFactory defaultTrustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- defaultTrustManagerFactory.init((KeyStore) null); // use system keystore
- final X509TrustManager defaultTrustManager = (X509TrustManager) defaultTrustManagerFactory.getTrustManagers()[0];
- TrustManager[] customTrustManagers = new TrustManager[]{new X509TrustManager() {
- @Override
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- @Override
- public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
- }
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- // chain may out of order - construct data structures to walk from server certificate to root certificate
- Map<Principal, X509Certificate> certificates = new HashMap<Principal, X509Certificate>(chain.length - 1);
- X509Certificate subject = null;
- for (X509Certificate cert : chain) {
- cert.checkValidity();
- if (cert.getSubjectDN().toString().startsWith("CN=" + DEFAULT_BASE_HOST)) {
- subject = cert;
- } else {
- certificates.put(cert.getSubjectDN(), cert);
- }
- }
- if (subject == null) {
- throw new CertificateException("Chain does not contain a certificate for " + DEFAULT_BASE_HOST);
- }
- // follow chain to root CA
- while (certificates.get(subject.getIssuerDN()) != null) {
- subject.checkValidity();
- X509Certificate issuer = certificates.get(subject.getIssuerDN());
- try {
- subject.verify(issuer.getPublicKey());
- } catch (Exception e) {
- Log.d(TAG, "failed: " + issuer.getSubjectDN() + " -> " + subject.getSubjectDN());
- throw new CertificateException("Could not verify certificate");
- }
- subject = issuer;
- }
- X500Principal rootAuthority = subject.getIssuerX500Principal();
- boolean accepted = false;
- for (X509Certificate cert :
- defaultTrustManager.getAcceptedIssuers()) {
- if (cert.getSubjectX500Principal().equals(rootAuthority)) {
- try {
- subject.verify(cert.getPublicKey());
- accepted = true;
- } catch (Exception e) {
- Log.d(TAG, "failed: " + cert.getSubjectDN() + " -> " + subject.getSubjectDN());
- throw new CertificateException("Could not verify root certificate");
- }
- }
- }
- if (accepted == false) {
- throw new CertificateException("Could not verify root certificate");
- }
- }
- }};
- SSLContext sslContext = SSLContext.getInstance("TLS");
- sslContext.init(null, customTrustManagers, null);
- return sslContext.getSocketFactory();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
/**
* Returns the [count] most used tags.
*/
@@ -726,7 +651,12 @@ public class GpodnetService {
Validate.notNull(body);
ByteArrayOutputStream outputStream;
- int contentLength = (int) body.contentLength();
+ int contentLength = 0;
+ try {
+ contentLength = (int) body.contentLength();
+ } catch (IOException ignore) {
+ // ignore
+ }
if (contentLength > 0) {
outputStream = new ByteArrayOutputStream(contentLength);
} else {
diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java
index 0c431d60b..bd6210d13 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java
@@ -258,7 +258,7 @@ public class GpodnetEpisodeAction {
private int total = -1;
public Builder(FeedItem item, Action action) {
- this(item.getFeed().getDownload_url(), item.getItemIdentifier(), action);
+ this(item.getFeed().getDownload_url(), item.getMedia().getDownload_url(), action);
}
public Builder(String podcast, String episode, Action action) {
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java
index cfdd0c5d6..c3c6ce8c5 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java
@@ -173,7 +173,7 @@ public class GpodnetPreferences {
writePreference(PREF_SYNC_REMOVED, removedFeeds);
}
feedListLock.unlock();
- GpodnetSyncService.sendSyncIntent(ClientConfig.applicationCallbacks.getApplicationInstance());
+ GpodnetSyncService.sendSyncSubscriptionsIntent(ClientConfig.applicationCallbacks.getApplicationInstance());
}
public static void addRemovedFeed(String feed) {
@@ -186,7 +186,7 @@ public class GpodnetPreferences {
writePreference(PREF_SYNC_ADDED, addedFeeds);
}
feedListLock.unlock();
- GpodnetSyncService.sendSyncIntent(ClientConfig.applicationCallbacks.getApplicationInstance());
+ GpodnetSyncService.sendSyncSubscriptionsIntent(ClientConfig.applicationCallbacks.getApplicationInstance());
}
public static Set<String> getAddedFeedsCopy() {
@@ -225,6 +225,7 @@ public class GpodnetPreferences {
ensurePreferencesLoaded();
queuedEpisodeActions.add(action);
writePreference(PREF_SYNC_EPISODE_ACTIONS, writeEpisodeActionsToString(queuedEpisodeActions));
+ GpodnetSyncService.sendSyncActionsIntent(ClientConfig.applicationCallbacks.getApplicationInstance());
}
public static List<GpodnetEpisodeAction> getQueuedEpisodeActions() {
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java
index 022c03ca7..594241573 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java
@@ -16,11 +16,12 @@ import org.json.JSONException;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import de.danoeh.antennapod.core.BuildConfig;
import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.receiver.FeedUpdateReceiver;
@@ -33,35 +34,52 @@ import de.danoeh.antennapod.core.receiver.FeedUpdateReceiver;
*/
public class UserPreferences implements
SharedPreferences.OnSharedPreferenceChangeListener {
+
public static final String IMPORT_DIR = "import/";
+
private static final String TAG = "UserPreferences";
+ // User Infercasce
+ public static final String PREF_THEME = "prefTheme";
+ public static final String PREF_HIDDEN_DRAWER_ITEMS = "prefHiddenDrawerItems";
+ public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
+ public static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
+
+ // Queue
+ public static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront";
+
+ // Playback
public static final String PREF_PAUSE_ON_HEADSET_DISCONNECT = "prefPauseOnHeadsetDisconnect";
public static final String PREF_UNPAUSE_ON_HEADSET_RECONNECT = "prefUnpauseOnHeadsetReconnect";
public static final String PREF_FOLLOW_QUEUE = "prefFollowQueue";
- public static final String PREF_DOWNLOAD_MEDIA_ON_WIFI_ONLY = "prefDownloadMediaOnWifiOnly";
- public static final String PREF_UPDATE_INTERVAL = "prefAutoUpdateIntervall";
- public static final String PREF_PARALLEL_DOWNLOADS = "prefParallelDownloads";
- public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate";
- public static final String PREF_DISPLAY_ONLY_EPISODES = "prefDisplayOnlyEpisodes";
public static final String PREF_AUTO_DELETE = "prefAutoDelete";
public static final String PREF_SMART_MARK_AS_PLAYED_SECS = "prefSmartMarkAsPlayedSecs";
+ private static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray";
+ public static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss";
+ public static final String PREF_RESUME_AFTER_CALL = "prefResumeAfterCall";
+
+ // Network
+ public static final String PREF_UPDATE_INTERVAL = "prefAutoUpdateIntervall";
+ public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate";
+ public static final String PREF_PARALLEL_DOWNLOADS = "prefParallelDownloads";
+ public static final String PREF_EPISODE_CACHE_SIZE = "prefEpisodeCacheSize";
+ public static final String PREF_ENABLE_AUTODL = "prefEnableAutoDl";
+ public static final String PREF_ENABLE_AUTODL_ON_BATTERY = "prefEnableAutoDownloadOnBattery";
+ public static final String PREF_ENABLE_AUTODL_WIFI_FILTER = "prefEnableAutoDownloadWifiFilter";
+ public static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks";
+
+ // Services
public static final String PREF_AUTO_FLATTR = "pref_auto_flattr";
public static final String PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD = "prefAutoFlattrPlayedDurationThreshold";
- public static final String PREF_THEME = "prefTheme";
+
+ // Other
public static final String PREF_DATA_FOLDER = "prefDataFolder";
- public static final String PREF_ENABLE_AUTODL = "prefEnableAutoDl";
- public static final String PREF_ENABLE_AUTODL_WIFI_FILTER = "prefEnableAutoDownloadWifiFilter";
- public static final String PREF_ENABLE_AUTODL_ON_BATTERY = "prefEnableAutoDownloadOnBattery";
- private static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks";
- public static final String PREF_EPISODE_CACHE_SIZE = "prefEpisodeCacheSize";
- private static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed";
- private static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray";
- public static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss";
- private static final String PREF_SEEK_DELTA_SECS = "prefSeekDeltaSecs";
- private static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
- private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
- public static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront";
+
+ // Mediaplayer
+ public static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed";
+ private static final String PREF_FAST_FORWARD_SECS = "prefFastForwardSecs";
+ private static final String PREF_REWIND_SECS = "prefRewindSecs";
+ public static final String PREF_QUEUE_LOCKED = "prefQueueLocked";
// TODO: Make this value configurable
private static final float PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT = 0.8f;
@@ -71,32 +89,45 @@ public class UserPreferences implements
private static UserPreferences instance;
private final Context context;
- // Preferences
+ // User Interface
+ private int theme;
+ private List<String> hiddenDrawerItems;
+ private int notifyPriority;
+ private boolean persistNotify;
+
+ // Queue
+ private boolean enqueueAtFront;
+
+ // Playback
private boolean pauseOnHeadsetDisconnect;
private boolean unpauseOnHeadsetReconnect;
private boolean followQueue;
- private boolean downloadMediaOnWifiOnly;
- private long updateInterval;
- private boolean allowMobileUpdate;
- private boolean displayOnlyEpisodes;
private boolean autoDelete;
private int smartMarkAsPlayedSecs;
- private boolean autoFlattr;
- private float autoFlattrPlayedDurationThreshold;
- private int theme;
+ private String[] playbackSpeedArray;
+ private boolean pauseForFocusLoss;
+ private boolean resumeAfterCall;
+
+ // Network
+ private long updateInterval;
+ private boolean allowMobileUpdate;
+ private int parallelDownloads;
+ private int episodeCacheSize;
private boolean enableAutodownload;
- private boolean enableAutodownloadWifiFilter;
private boolean enableAutodownloadOnBattery;
+ private boolean enableAutodownloadWifiFilter;
private String[] autodownloadSelectedNetworks;
- private int parallelDownloads;
- private int episodeCacheSize;
+
+ // Services
+ private boolean autoFlattr;
+ private float autoFlattrPlayedDurationThreshold;
+
+ // Settings somewhere in the GUI
private String playbackSpeed;
- private String[] playbackSpeedArray;
- private boolean pauseForFocusLoss;
- private int seekDeltaSecs;
- private boolean isFreshInstall;
- private int notifyPriority;
- private boolean persistNotify;
+ private int fastForwardSecs;
+ private int rewindSecs;
+ private boolean queueLocked;
+
private UserPreferences(Context context) {
this.context = context;
@@ -109,8 +140,7 @@ public class UserPreferences implements
* @throws IllegalArgumentException if context is null
*/
public static void createInstance(Context context) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Creating new instance of UserPreferences");
+ Log.d(TAG, "Creating new instance of UserPreferences");
Validate.notNull(context);
instance = new UserPreferences(context);
@@ -123,48 +153,54 @@ public class UserPreferences implements
}
private void loadPreferences() {
- SharedPreferences sp = PreferenceManager
- .getDefaultSharedPreferences(context);
- EPISODE_CACHE_SIZE_UNLIMITED = context.getResources().getInteger(
- R.integer.episode_cache_size_unlimited);
- pauseOnHeadsetDisconnect = sp.getBoolean(
- PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
- unpauseOnHeadsetReconnect = sp.getBoolean(
- PREF_UNPAUSE_ON_HEADSET_RECONNECT, true);
+ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
+
+ // User Interface
+ theme = readThemeValue(sp.getString(PREF_THEME, "0"));
+ if (sp.getBoolean(PREF_EXPANDED_NOTIFICATION, false)) {
+ notifyPriority = NotificationCompat.PRIORITY_MAX;
+ } else {
+ notifyPriority = NotificationCompat.PRIORITY_DEFAULT;
+ }
+ hiddenDrawerItems = Arrays.asList(StringUtils.split(sp.getString(PREF_HIDDEN_DRAWER_ITEMS, ""), ','));
+ persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
+
+ // Queue
+ enqueueAtFront = sp.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false);
+
+ // Playback
+ pauseOnHeadsetDisconnect = sp.getBoolean(PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
+ unpauseOnHeadsetReconnect = sp.getBoolean(PREF_UNPAUSE_ON_HEADSET_RECONNECT, true);
followQueue = sp.getBoolean(PREF_FOLLOW_QUEUE, false);
- downloadMediaOnWifiOnly = sp.getBoolean(
- PREF_DOWNLOAD_MEDIA_ON_WIFI_ONLY, true);
- updateInterval = readUpdateInterval(sp.getString(PREF_UPDATE_INTERVAL,
- "0"));
- allowMobileUpdate = sp.getBoolean(PREF_MOBILE_UPDATE, false);
- displayOnlyEpisodes = sp.getBoolean(PREF_DISPLAY_ONLY_EPISODES, false);
autoDelete = sp.getBoolean(PREF_AUTO_DELETE, false);
smartMarkAsPlayedSecs = Integer.valueOf(sp.getString(PREF_SMART_MARK_AS_PLAYED_SECS, "30"));
- autoFlattr = sp.getBoolean(PREF_AUTO_FLATTR, false);
- autoFlattrPlayedDurationThreshold = sp.getFloat(PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD,
- PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT);
- theme = readThemeValue(sp.getString(PREF_THEME, "0"));
- enableAutodownloadWifiFilter = sp.getBoolean(
- PREF_ENABLE_AUTODL_WIFI_FILTER, false);
- autodownloadSelectedNetworks = StringUtils.split(
- sp.getString(PREF_AUTODL_SELECTED_NETWORKS, ""), ',');
+ playbackSpeedArray = readPlaybackSpeedArray(sp.getString(
+ PREF_PLAYBACK_SPEED_ARRAY, null));
+ pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
+
+ // Network
+ updateInterval = readUpdateInterval(sp.getString(PREF_UPDATE_INTERVAL, "0"));
+ allowMobileUpdate = sp.getBoolean(PREF_MOBILE_UPDATE, false);
parallelDownloads = Integer.valueOf(sp.getString(PREF_PARALLEL_DOWNLOADS, "6"));
- episodeCacheSize = readEpisodeCacheSizeInternal(sp.getString(
- PREF_EPISODE_CACHE_SIZE, "20"));
+ EPISODE_CACHE_SIZE_UNLIMITED = context.getResources().getInteger(
+ R.integer.episode_cache_size_unlimited);
+ episodeCacheSize = readEpisodeCacheSizeInternal(sp.getString(PREF_EPISODE_CACHE_SIZE, "20"));
enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false);
enableAutodownloadOnBattery = sp.getBoolean(PREF_ENABLE_AUTODL_ON_BATTERY, true);
+ enableAutodownloadWifiFilter = sp.getBoolean(PREF_ENABLE_AUTODL_WIFI_FILTER, false);
+ autodownloadSelectedNetworks = StringUtils.split(
+ sp.getString(PREF_AUTODL_SELECTED_NETWORKS, ""), ',');
+
+ // Services
+ autoFlattr = sp.getBoolean(PREF_AUTO_FLATTR, false);
+ autoFlattrPlayedDurationThreshold = sp.getFloat(PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD,
+ PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT);
+
+ // MediaPlayer
playbackSpeed = sp.getString(PREF_PLAYBACK_SPEED, "1.0");
- playbackSpeedArray = readPlaybackSpeedArray(sp.getString(
- PREF_PLAYBACK_SPEED_ARRAY, null));
- pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
- seekDeltaSecs = Integer.valueOf(sp.getString(PREF_SEEK_DELTA_SECS, "30"));
- if (sp.getBoolean(PREF_EXPANDED_NOTIFICATION, false)) {
- notifyPriority = NotificationCompat.PRIORITY_MAX;
- }
- else {
- notifyPriority = NotificationCompat.PRIORITY_DEFAULT;
- }
- persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
+ fastForwardSecs = sp.getInt(PREF_FAST_FORWARD_SECS, 30);
+ rewindSecs = sp.getInt(PREF_REWIND_SECS, 30);
+ queueLocked = sp.getBoolean(PREF_QUEUE_LOCKED, false);
}
private int readThemeValue(String valueFromPrefs) {
@@ -214,8 +250,7 @@ public class UserPreferences implements
selectedSpeeds[i] = jsonArray.getString(i);
}
} catch (JSONException e) {
- Log.e(TAG,
- "Got JSON error when trying to get speeds from JSONArray");
+ Log.e(TAG, "Got JSON error when trying to get speeds from JSONArray");
e.printStackTrace();
}
}
@@ -224,45 +259,78 @@ public class UserPreferences implements
private static void instanceAvailable() {
if (instance == null) {
- throw new IllegalStateException(
- "UserPreferences was used before being set up");
+ throw new IllegalStateException("UserPreferences was used before being set up");
}
}
- public static boolean isPauseOnHeadsetDisconnect() {
+ /**
+ * Returns theme as R.style value
+ *
+ * @return R.style.Theme_AntennaPod_Light or R.style.Theme_AntennaPod_Dark
+ */
+ public static int getTheme() {
instanceAvailable();
- return instance.pauseOnHeadsetDisconnect;
+ return instance.theme;
}
- public static boolean isUnpauseOnHeadsetReconnect() {
+ public static int getNoTitleTheme() {
+ int theme = getTheme();
+ if (theme == R.style.Theme_AntennaPod_Dark) {
+ return R.style.Theme_AntennaPod_Dark_NoTitle;
+ } else {
+ return R.style.Theme_AntennaPod_Light_NoTitle;
+ }
+ }
+
+ public static List<String> getHiddenDrawerItems() {
instanceAvailable();
- return instance.unpauseOnHeadsetReconnect;
+ return new ArrayList<String>(instance.hiddenDrawerItems);
}
- public static boolean isFollowQueue() {
+ /**
+ * Returns notification priority.
+ *
+ * @return NotificationCompat.PRIORITY_MAX or NotificationCompat.PRIORITY_DEFAULT
+ */
+ public static int getNotifyPriority() {
instanceAvailable();
- return instance.followQueue;
+ return instance.notifyPriority;
+ }
+
+ /**
+ * Returns true if notifications are persistent
+ *
+ * @return {@code true} if notifications are persistent, {@code false} otherwise
+ */
+ public static boolean isPersistNotify() {
+ instanceAvailable();
+ return instance.persistNotify;
}
- public static boolean isDownloadMediaOnWifiOnly() {
+ /**
+ * Returns {@code true} if new queue elements are added to the front
+ *
+ * @return {@code true} if new queue elements are added to the front; {@code false} otherwise
+ */
+ public static boolean enqueueAtFront() {
instanceAvailable();
- return instance.downloadMediaOnWifiOnly;
+ return instance.enqueueAtFront;
}
- public static long getUpdateInterval() {
+ public static boolean isPauseOnHeadsetDisconnect() {
instanceAvailable();
- return instance.updateInterval;
+ return instance.pauseOnHeadsetDisconnect;
}
- public static boolean isAllowMobileUpdate() {
+ public static boolean isUnpauseOnHeadsetReconnect() {
instanceAvailable();
- return instance.allowMobileUpdate;
+ return instance.unpauseOnHeadsetReconnect;
}
- public static boolean isDisplayOnlyEpisodes() {
+
+ public static boolean isFollowQueue() {
instanceAvailable();
- //return instance.displayOnlyEpisodes;
- return false;
+ return instance.followQueue;
}
public static boolean isAutoDelete() {
@@ -271,7 +339,7 @@ public class UserPreferences implements
}
public static int getSmartMarkAsPlayedSecs() {
- instanceAvailable();;
+ instanceAvailable();
return instance.smartMarkAsPlayedSecs;
}
@@ -280,48 +348,29 @@ public class UserPreferences implements
return instance.autoFlattr;
}
- public static int getNotifyPriority() {
- instanceAvailable();
- return instance.notifyPriority;
- }
-
- public static boolean isPersistNotify() {
+ public static String getPlaybackSpeed() {
instanceAvailable();
- return instance.persistNotify;
+ return instance.playbackSpeed;
}
-
- /**
- * Returns the time after which an episode should be auto-flattr'd in percent of the episode's
- * duration.
- */
- public static float getAutoFlattrPlayedDurationThreshold() {
+ public static String[] getPlaybackSpeedArray() {
instanceAvailable();
- return instance.autoFlattrPlayedDurationThreshold;
+ return instance.playbackSpeedArray;
}
- public static int getTheme() {
+ public static boolean shouldPauseForFocusLoss() {
instanceAvailable();
- return instance.theme;
- }
-
- public static int getNoTitleTheme() {
- int theme = getTheme();
- if (theme == R.style.Theme_AntennaPod_Dark) {
- return R.style.Theme_AntennaPod_Dark_NoTitle;
- } else {
- return R.style.Theme_AntennaPod_Light_NoTitle;
- }
+ return instance.pauseForFocusLoss;
}
- public static boolean isEnableAutodownloadWifiFilter() {
+ public static long getUpdateInterval() {
instanceAvailable();
- return instance.enableAutodownloadWifiFilter;
+ return instance.updateInterval;
}
- public static String[] getAutodownloadSelectedNetworks() {
+ public static boolean isAllowMobileUpdate() {
instanceAvailable();
- return instance.autodownloadSelectedNetworks;
+ return instance.allowMobileUpdate;
}
public static int getParallelDownloads() {
@@ -333,21 +382,6 @@ public class UserPreferences implements
return EPISODE_CACHE_SIZE_UNLIMITED;
}
- public static String getPlaybackSpeed() {
- instanceAvailable();
- return instance.playbackSpeed;
- }
-
- public static String[] getPlaybackSpeedArray() {
- instanceAvailable();
- return instance.playbackSpeedArray;
- }
-
- public static int getSeekDeltaMs() {
- instanceAvailable();
- return 1000 * instance.seekDeltaSecs;
- }
-
/**
* Returns the capacity of the episode cache. This method will return the
* negative integer EPISODE_CACHE_SIZE_UNLIMITED if the cache size is set to
@@ -368,88 +402,163 @@ public class UserPreferences implements
return instance.enableAutodownloadOnBattery;
}
- public static boolean shouldPauseForFocusLoss() {
+ public static boolean isEnableAutodownloadWifiFilter() {
instanceAvailable();
- return instance.pauseForFocusLoss;
+ return instance.enableAutodownloadWifiFilter;
+ }
+
+ public static int getFastFowardSecs() {
+ instanceAvailable();
+ return instance.fastForwardSecs;
+ }
+
+ public static int getRewindSecs() {
+ instanceAvailable();
+ return instance.rewindSecs;
+ }
+
+
+ /**
+ * Returns the time after which an episode should be auto-flattr'd in percent of the episode's
+ * duration.
+ */
+ public static float getAutoFlattrPlayedDurationThreshold() {
+ instanceAvailable();
+ return instance.autoFlattrPlayedDurationThreshold;
+ }
+
+ public static String[] getAutodownloadSelectedNetworks() {
+ instanceAvailable();
+ return instance.autodownloadSelectedNetworks;
}
- public static boolean isFreshInstall() {
+ public static boolean shouldResumeAfterCall() {
instanceAvailable();
- return instance.isFreshInstall;
+ return instance.resumeAfterCall;
+ }
+
+ public static boolean isQueueLocked() {
+ instanceAvailable();
+ return instance.queueLocked;
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sp, String key) {
Log.d(TAG, "Registered change of user preferences. Key: " + key);
-
- if (key.equals(PREF_DOWNLOAD_MEDIA_ON_WIFI_ONLY)) {
- downloadMediaOnWifiOnly = sp.getBoolean(
- PREF_DOWNLOAD_MEDIA_ON_WIFI_ONLY, true);
-
- } else if (key.equals(PREF_MOBILE_UPDATE)) {
- allowMobileUpdate = sp.getBoolean(PREF_MOBILE_UPDATE, false);
-
- } else if (key.equals(PREF_FOLLOW_QUEUE)) {
- followQueue = sp.getBoolean(PREF_FOLLOW_QUEUE, false);
-
- } else if (key.equals(PREF_UPDATE_INTERVAL)) {
- updateInterval = readUpdateInterval(sp.getString(
- PREF_UPDATE_INTERVAL, "0"));
- ClientConfig.applicationCallbacks.setUpdateInterval(updateInterval);
- } else if (key.equals(PREF_AUTO_DELETE)) {
- autoDelete = sp.getBoolean(PREF_AUTO_DELETE, false);
- } else if (key.equals(PREF_SMART_MARK_AS_PLAYED_SECS)) {
- smartMarkAsPlayedSecs = Integer.valueOf(sp.getString(PREF_SMART_MARK_AS_PLAYED_SECS, "30"));
- } else if (key.equals(PREF_AUTO_FLATTR)) {
- autoFlattr = sp.getBoolean(PREF_AUTO_FLATTR, false);
- } else if (key.equals(PREF_DISPLAY_ONLY_EPISODES)) {
- displayOnlyEpisodes = sp.getBoolean(PREF_DISPLAY_ONLY_EPISODES,
- false);
- } else if (key.equals(PREF_THEME)) {
- theme = readThemeValue(sp.getString(PREF_THEME, ""));
- } else if (key.equals(PREF_ENABLE_AUTODL_WIFI_FILTER)) {
- enableAutodownloadWifiFilter = sp.getBoolean(
- PREF_ENABLE_AUTODL_WIFI_FILTER, false);
- } else if (key.equals(PREF_AUTODL_SELECTED_NETWORKS)) {
- autodownloadSelectedNetworks = StringUtils.split(
- sp.getString(PREF_AUTODL_SELECTED_NETWORKS, ""), ',');
- } else if(key.equals(PREF_PARALLEL_DOWNLOADS)) {
- parallelDownloads = Integer.valueOf(sp.getString(PREF_PARALLEL_DOWNLOADS, "6"));
- } else if (key.equals(PREF_EPISODE_CACHE_SIZE)) {
- episodeCacheSize = readEpisodeCacheSizeInternal(sp.getString(
- PREF_EPISODE_CACHE_SIZE, "20"));
- } else if (key.equals(PREF_ENABLE_AUTODL)) {
- enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false);
- } else if (key.equals(PREF_ENABLE_AUTODL_ON_BATTERY)) {
- enableAutodownloadOnBattery = sp.getBoolean(PREF_ENABLE_AUTODL_ON_BATTERY, true);
- } else if (key.equals(PREF_PLAYBACK_SPEED)) {
- playbackSpeed = sp.getString(PREF_PLAYBACK_SPEED, "1.0");
- } else if (key.equals(PREF_PLAYBACK_SPEED_ARRAY)) {
- playbackSpeedArray = readPlaybackSpeedArray(sp.getString(
- PREF_PLAYBACK_SPEED_ARRAY, null));
- } else if (key.equals(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS)) {
- pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
- } else if (key.equals(PREF_SEEK_DELTA_SECS)) {
- seekDeltaSecs = Integer.valueOf(sp.getString(PREF_SEEK_DELTA_SECS, "30"));
- } else if (key.equals(PREF_PAUSE_ON_HEADSET_DISCONNECT)) {
- pauseOnHeadsetDisconnect = sp.getBoolean(PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
- } else if (key.equals(PREF_UNPAUSE_ON_HEADSET_RECONNECT)) {
- unpauseOnHeadsetReconnect = sp.getBoolean(PREF_UNPAUSE_ON_HEADSET_RECONNECT, true);
- } else if (key.equals(PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD)) {
- autoFlattrPlayedDurationThreshold = sp.getFloat(PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD,
- PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT);
- } else if (key.equals(PREF_EXPANDED_NOTIFICATION)) {
- if (sp.getBoolean(PREF_EXPANDED_NOTIFICATION, false)) {
- notifyPriority = NotificationCompat.PRIORITY_MAX;
- }
- else {
- notifyPriority = NotificationCompat.PRIORITY_DEFAULT;
- }
- } else if (key.equals(PREF_PERSISTENT_NOTIFICATION)) {
- persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
+ switch(key) {
+ // User Interface
+ case PREF_THEME:
+ theme = readThemeValue(sp.getString(PREF_THEME, ""));
+ break;
+ case PREF_HIDDEN_DRAWER_ITEMS:
+ hiddenDrawerItems = Arrays.asList(StringUtils.split(sp.getString(PREF_HIDDEN_DRAWER_ITEMS, ""), ','));
+ break;
+ case PREF_EXPANDED_NOTIFICATION:
+ if (sp.getBoolean(PREF_EXPANDED_NOTIFICATION, false)) {
+ notifyPriority = NotificationCompat.PRIORITY_MAX;
+ } else {
+ notifyPriority = NotificationCompat.PRIORITY_DEFAULT;
+ }
+ break;
+ case PREF_PERSISTENT_NOTIFICATION:
+ persistNotify = sp.getBoolean(PREF_PERSISTENT_NOTIFICATION, false);
+ break;
+ // Queue
+ case PREF_QUEUE_ADD_TO_FRONT:
+ enqueueAtFront = sp.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false);
+ break;
+ // Playback
+ case PREF_PAUSE_ON_HEADSET_DISCONNECT:
+ pauseOnHeadsetDisconnect = sp.getBoolean(PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
+ break;
+ case PREF_UNPAUSE_ON_HEADSET_RECONNECT:
+ unpauseOnHeadsetReconnect = sp.getBoolean(PREF_UNPAUSE_ON_HEADSET_RECONNECT, true);
+ break;
+ case PREF_FOLLOW_QUEUE:
+ followQueue = sp.getBoolean(PREF_FOLLOW_QUEUE, false);
+ break;
+ case PREF_AUTO_DELETE:
+ autoDelete = sp.getBoolean(PREF_AUTO_DELETE, false);
+ break;
+ case PREF_SMART_MARK_AS_PLAYED_SECS:
+ smartMarkAsPlayedSecs = Integer.valueOf(sp.getString(PREF_SMART_MARK_AS_PLAYED_SECS, "30"));
+ break;
+ case PREF_PLAYBACK_SPEED_ARRAY:
+ playbackSpeedArray = readPlaybackSpeedArray(sp.getString(PREF_PLAYBACK_SPEED_ARRAY, null));
+ break;
+ case PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS:
+ pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
+ break;
+ case PREF_RESUME_AFTER_CALL:
+ resumeAfterCall = sp.getBoolean(PREF_RESUME_AFTER_CALL, true);
+ break;
+ // Network
+ case PREF_UPDATE_INTERVAL:
+ updateInterval = readUpdateInterval(sp.getString(PREF_UPDATE_INTERVAL, "0"));
+ ClientConfig.applicationCallbacks.setUpdateInterval(updateInterval);
+ break;
+ case PREF_MOBILE_UPDATE:
+ allowMobileUpdate = sp.getBoolean(PREF_MOBILE_UPDATE, false);
+ break;
+ case PREF_PARALLEL_DOWNLOADS:
+ parallelDownloads = Integer.valueOf(sp.getString(PREF_PARALLEL_DOWNLOADS, "6"));
+ break;
+ case PREF_EPISODE_CACHE_SIZE:
+ episodeCacheSize = readEpisodeCacheSizeInternal(sp.getString(PREF_EPISODE_CACHE_SIZE, "20"));
+ break;
+ case PREF_ENABLE_AUTODL:
+ enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false);
+ break;
+ case PREF_ENABLE_AUTODL_ON_BATTERY:
+ enableAutodownloadOnBattery = sp.getBoolean(PREF_ENABLE_AUTODL_ON_BATTERY, true);
+ break;
+ case PREF_ENABLE_AUTODL_WIFI_FILTER:
+ enableAutodownloadWifiFilter = sp.getBoolean(PREF_ENABLE_AUTODL_WIFI_FILTER, false);
+ break;
+ case PREF_AUTODL_SELECTED_NETWORKS:
+ autodownloadSelectedNetworks = StringUtils.split(
+ sp.getString(PREF_AUTODL_SELECTED_NETWORKS, ""), ',');
+ break;
+ // Services
+ case PREF_AUTO_FLATTR:
+ autoFlattr = sp.getBoolean(PREF_AUTO_FLATTR, false);
+ break;
+ case PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD:
+ autoFlattrPlayedDurationThreshold = sp.getFloat(PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD,
+ PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD_DEFAULT);
+ break;
+ // Mediaplayer
+ case PREF_PLAYBACK_SPEED:
+ playbackSpeed = sp.getString(PREF_PLAYBACK_SPEED, "1.0");
+ break;
+ case PREF_FAST_FORWARD_SECS:
+ fastForwardSecs = sp.getInt(PREF_FAST_FORWARD_SECS, 30);
+ break;
+ case PREF_REWIND_SECS:
+ rewindSecs = sp.getInt(PREF_REWIND_SECS, 30);
+ break;
+ case PREF_QUEUE_LOCKED:
+ queueLocked = sp.getBoolean(PREF_QUEUE_LOCKED, false);
+ break;
+ default:
+ Log.w(TAG, "Unhandled key: " + key);
}
}
+ public static void setPrefFastForwardSecs(int secs) {
+ Log.d(TAG, "setPrefFastForwardSecs(" + secs +")");
+ SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(instance.context).edit();
+ editor.putInt(PREF_FAST_FORWARD_SECS, secs);
+ editor.commit();
+ }
+
+ public static void setPrefRewindSecs(int secs) {
+ Log.d(TAG, "setPrefRewindSecs(" + secs +")");
+ SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(instance.context).edit();
+ editor.putInt(PREF_REWIND_SECS, secs);
+ editor.commit();
+ }
+
public static void setPlaybackSpeed(String speed) {
PreferenceManager.getDefaultSharedPreferences(instance.context).edit()
.putString(PREF_PLAYBACK_SPEED, speed).apply();
@@ -509,6 +618,26 @@ public class UserPreferences implements
instance.autoFlattrPlayedDurationThreshold = autoFlattrThreshold;
}
+ public static void setHiddenDrawerItems(Context context, List<String> items) {
+ instanceAvailable();
+ instance.hiddenDrawerItems = items;
+ String str = StringUtils.join(items, ',');
+ PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext())
+ .edit()
+ .putString(PREF_HIDDEN_DRAWER_ITEMS, str)
+ .commit();
+ }
+
+ public static void setQueueLocked(boolean locked) {
+ instanceAvailable();
+ instance.queueLocked = locked;
+ PreferenceManager.getDefaultSharedPreferences(instance.context)
+ .edit()
+ .putBoolean(PREF_QUEUE_LOCKED, locked)
+ .commit();
+ }
+
+
/**
* Return the folder where the app stores all of its data. This method will
* return the standard data folder if none has been set by the user.
@@ -524,8 +653,7 @@ public class UserPreferences implements
.getDefaultSharedPreferences(context.getApplicationContext());
String strDir = prefs.getString(PREF_DATA_FOLDER, null);
if (strDir == null) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Using default data folder");
+ Log.d(TAG, "Using default data folder");
return context.getExternalFilesDir(type);
} else {
File dataDir = new File(strDir);
@@ -556,21 +684,18 @@ public class UserPreferences implements
if (!typeDir.exists()) {
if (dataDir.canWrite()) {
if (!typeDir.mkdir()) {
- Log.e(TAG, "Could not create data folder named "
- + type);
+ Log.e(TAG, "Could not create data folder named " + type);
return null;
}
}
}
return typeDir;
}
-
}
}
public static void setDataFolder(String dir) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Result from DirectoryChooser: " + dir);
+ Log.d(TAG, "Result from DirectoryChooser: " + dir);
instanceAvailable();
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(instance.context);
@@ -593,8 +718,7 @@ public class UserPreferences implements
Log.e(TAG, "Could not create .nomedia file");
e.printStackTrace();
}
- if (BuildConfig.DEBUG)
- Log.d(TAG, ".nomedia file created");
+ Log.d(TAG, ".nomedia file created");
}
}
@@ -607,16 +731,13 @@ public class UserPreferences implements
IMPORT_DIR);
if (importDir != null) {
if (importDir.exists()) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Import directory already exists");
+ Log.d(TAG, "Import directory already exists");
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Creating import directory");
+ Log.d(TAG, "Creating import directory");
importDir.mkdir();
}
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Could not access external storage.");
+ Log.d(TAG, "Could not access external storage.");
}
}
@@ -625,8 +746,7 @@ public class UserPreferences implements
*/
public static void restartUpdateAlarm(long triggerAtMillis, long intervalMillis) {
instanceAvailable();
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Restarting update alarm.");
+ Log.d(TAG, "Restarting update alarm.");
AlarmManager alarmManager = (AlarmManager) instance.context
.getSystemService(Context.ALARM_SERVICE);
PendingIntent updateIntent = PendingIntent.getBroadcast(
@@ -635,11 +755,9 @@ public class UserPreferences implements
if (intervalMillis != 0) {
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, triggerAtMillis, intervalMillis,
updateIntent);
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Changed alarm to new interval");
+ Log.d(TAG, "Changed alarm to new interval");
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Automatic update was deactivated");
+ Log.d(TAG, "Automatic update was deactivated");
}
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java
index 95dc4fb07..d37f97a5f 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java
@@ -3,41 +3,26 @@ package de.danoeh.antennapod.core.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
import android.util.Log;
-import de.danoeh.antennapod.core.BuildConfig;
-import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBTasks;
+import de.danoeh.antennapod.core.util.NetworkUtils;
/**
* Refreshes all feeds when it receives an intent
*/
public class FeedUpdateReceiver extends BroadcastReceiver {
+
private static final String TAG = "FeedUpdateReceiver";
@Override
public void onReceive(Context context, Intent intent) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Received intent");
- boolean mobileUpdate = UserPreferences.isAllowMobileUpdate();
- if (mobileUpdate || connectedToWifi(context)) {
+ Log.d(TAG, "Received intent");
+ if (NetworkUtils.isDownloadAllowed(context)) {
DBTasks.refreshExpiredFeeds(context);
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG,
- "Blocking automatic update: no wifi available / no mobile updates allowed");
+ Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed");
}
}
- private boolean connectedToWifi(Context context) {
- ConnectivityManager connManager = (ConnectivityManager) context
- .getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo mWifi = connManager
- .getNetworkInfo(ConnectivityManager.TYPE_WIFI);
-
- return mWifi.isConnected();
- }
-
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java b/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java
index e39197387..3f2222f42 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java
@@ -12,7 +12,6 @@ import android.util.Log;
import android.util.Pair;
import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -22,6 +21,7 @@ import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.feed.FeedItem;
+import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.gpoddernet.GpodnetService;
import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceAuthenticationException;
import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException;
@@ -50,17 +50,38 @@ public class GpodnetSyncService extends Service {
public static final String ARG_ACTION = "action";
public static final String ACTION_SYNC = "de.danoeh.antennapod.intent.action.sync";
+ public static final String ACTION_SYNC_SUBSCRIPTIONS = "de.danoeh.antennapod.intent.action.sync_subscriptions";
+ public static final String ACTION_SYNC_ACTIONS = "de.danoeh.antennapod.intent.action.sync_ACTIONS";
private GpodnetService service;
+ private boolean syncSubscriptions = false;
+ private boolean syncActions = false;
+
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
final String action = (intent != null) ? intent.getStringExtra(ARG_ACTION) : null;
- if (action != null && action.equals(ACTION_SYNC)) {
- Log.d(TAG, String.format("Waiting %d milliseconds before uploading changes", WAIT_INTERVAL));
- syncWaiterThread.restart();
+ if (action != null) {
+ switch(action) {
+ case ACTION_SYNC:
+ syncSubscriptions = true;
+ syncActions = true;
+ break;
+ case ACTION_SYNC_SUBSCRIPTIONS:
+ syncSubscriptions = true;
+ break;
+ case ACTION_SYNC_ACTIONS:
+ syncActions = true;
+ break;
+ default:
+ Log.e(TAG, "Received invalid intent: action argument is invalid");
+ }
+ if(syncSubscriptions || syncActions) {
+ Log.d(TAG, String.format("Waiting %d milliseconds before uploading changes", WAIT_INTERVAL));
+ syncWaiterThread.restart();
+ }
} else {
- Log.e(TAG, "Received invalid intent: action argument is null or invalid");
+ Log.e(TAG, "Received invalid intent: action argument is null");
}
return START_FLAG_REDELIVERY;
}
@@ -91,8 +112,14 @@ public class GpodnetSyncService extends Service {
stopSelf();
return;
}
- syncSubscriptionChanges();
- syncEpisodeActions();
+ if(syncSubscriptions) {
+ syncSubscriptionChanges();
+ syncSubscriptions = false;
+ }
+ if(syncActions) {
+ syncEpisodeActions();
+ syncActions = false;
+ }
stopSelf();
}
@@ -100,37 +127,36 @@ public class GpodnetSyncService extends Service {
final long timestamp = GpodnetPreferences.getLastSubscriptionSyncTimestamp();
try {
final List<String> localSubscriptions = DBReader.getFeedListDownloadUrls(this);
+ Collection<String> localAdded = GpodnetPreferences.getAddedFeedsCopy();
+ Collection<String> localRemoved = GpodnetPreferences.getRemovedFeedsCopy();
GpodnetService service = tryLogin();
// first sync: download all subscriptions...
GpodnetSubscriptionChange subscriptionChanges = service.getSubscriptionChanges(GpodnetPreferences.getUsername(),
GpodnetPreferences.getDeviceID(), timestamp);
- long lastUpdate = subscriptionChanges.getTimestamp();
+ long newTimeStamp = subscriptionChanges.getTimestamp();
Log.d(TAG, "Downloaded subscription changes: " + subscriptionChanges);
- processSubscriptionChanges(localSubscriptions, subscriptionChanges);
-
- Collection<String> added;
- Collection<String> removed;
- if (timestamp == 0) {
- added = localSubscriptions;
- GpodnetPreferences.removeRemovedFeeds(GpodnetPreferences.getRemovedFeedsCopy());
- removed = Collections.emptyList();
- } else {
- added = GpodnetPreferences.getAddedFeedsCopy();
- removed = GpodnetPreferences.getRemovedFeedsCopy();
+ processSubscriptionChanges(localSubscriptions, localAdded, localRemoved, subscriptionChanges);
+
+ if(timestamp == 0) {
+ // this is this apps first sync with gpodder:
+ // only submit changes gpodder has not just sent us
+ localAdded = localSubscriptions;
+ localAdded.removeAll(subscriptionChanges.getAdded());
+ localRemoved.removeAll(subscriptionChanges.getRemoved());
}
- if(added.size() > 0 || removed.size() > 0) {
+ if(localAdded.size() > 0 || localRemoved.size() > 0) {
Log.d(TAG, String.format("Uploading subscriptions, Added: %s\nRemoved: %s",
- added, removed));
+ localAdded, localRemoved));
GpodnetUploadChangesResponse uploadResponse = service.uploadChanges(GpodnetPreferences.getUsername(),
- GpodnetPreferences.getDeviceID(), added, removed);
- lastUpdate = uploadResponse.timestamp;
+ GpodnetPreferences.getDeviceID(), localAdded, localRemoved);
+ newTimeStamp = uploadResponse.timestamp;
Log.d(TAG, "Upload changes response: " + uploadResponse);
- GpodnetPreferences.removeAddedFeeds(added);
- GpodnetPreferences.removeRemovedFeeds(removed);
+ GpodnetPreferences.removeAddedFeeds(localAdded);
+ GpodnetPreferences.removeRemovedFeeds(localRemoved);
}
- GpodnetPreferences.setLastSubscriptionSyncTimestamp(lastUpdate);
+ GpodnetPreferences.setLastSubscriptionSyncTimestamp(newTimeStamp);
clearErrorNotifications();
} catch (GpodnetServiceException e) {
e.printStackTrace();
@@ -140,6 +166,27 @@ public class GpodnetSyncService extends Service {
}
}
+ private synchronized void processSubscriptionChanges(List<String> localSubscriptions,
+ Collection<String> localAdded,
+ Collection<String> localRemoved,
+ GpodnetSubscriptionChange changes) throws DownloadRequestException {
+ // local changes are always superior to remote changes!
+ // add subscription if (1) not already subscribed and (2) not just unsubscribed
+ for (String downloadUrl : changes.getAdded()) {
+ if (false == localSubscriptions.contains(downloadUrl) &&
+ false == localRemoved.contains(downloadUrl)) {
+ Feed feed = new Feed(downloadUrl, new Date(0));
+ DownloadRequester.getInstance().downloadFeed(this, feed);
+ }
+ }
+ // remove subscription if not just subscribed (again)
+ for (String downloadUrl : changes.getRemoved()) {
+ if(false == localAdded.contains(downloadUrl)) {
+ DBTasks.removeFeedWithDownloadUrl(GpodnetSyncService.this, downloadUrl);
+ }
+ }
+ }
+
private synchronized void syncEpisodeActions() {
final long timestamp = GpodnetPreferences.getLastEpisodeActionsSyncTimestamp();
Log.d(TAG, "last episode actions sync timestamp: " + timestamp);
@@ -173,25 +220,13 @@ public class GpodnetSyncService extends Service {
}
}
- private synchronized void processSubscriptionChanges(List<String> localSubscriptions, GpodnetSubscriptionChange changes) throws DownloadRequestException {
- for (String downloadUrl : changes.getAdded()) {
- if (!localSubscriptions.contains(downloadUrl)) {
- Feed feed = new Feed(downloadUrl, new Date());
- DownloadRequester.getInstance().downloadFeed(this, feed);
- }
- }
- for (String downloadUrl : changes.getRemoved()) {
- DBTasks.removeFeedWithDownloadUrl(GpodnetSyncService.this, downloadUrl);
- }
- }
- private synchronized void processEpisodeActions(List<GpodnetEpisodeAction> localActions, List<GpodnetEpisodeAction> remoteActions) throws DownloadRequestException {
+ private synchronized void processEpisodeActions(List<GpodnetEpisodeAction> localActions,
+ List<GpodnetEpisodeAction> remoteActions) throws DownloadRequestException {
if(remoteActions.size() == 0) {
return;
}
Map<Pair<String, String>, GpodnetEpisodeAction> localMostRecentPlayAction = new HashMap<Pair<String, String>, GpodnetEpisodeAction>();
- Map<Pair<String, String>, GpodnetEpisodeAction> remoteMostRecentPlayAction = new HashMap<Pair<String, String>, GpodnetEpisodeAction>();
- // make sure more recent local actions are not overwritten by older remote actions
for(GpodnetEpisodeAction action : localActions) {
Pair key = new Pair(action.getPodcast(), action.getEpisode());
GpodnetEpisodeAction mostRecent = localMostRecentPlayAction.get(key);
@@ -201,6 +236,9 @@ public class GpodnetSyncService extends Service {
localMostRecentPlayAction.put(key, action);
}
}
+
+ // make sure more recent local actions are not overwritten by older remote actions
+ Map<Pair<String, String>, GpodnetEpisodeAction> mostRecentPlayAction = new HashMap<Pair<String, String>, GpodnetEpisodeAction>();
for (GpodnetEpisodeAction action : remoteActions) {
switch (action.getAction()) {
case NEW:
@@ -218,11 +256,11 @@ public class GpodnetSyncService extends Service {
GpodnetEpisodeAction localMostRecent = localMostRecentPlayAction.get(key);
if(localMostRecent == null ||
localMostRecent.getTimestamp().before(action.getTimestamp())) {
- GpodnetEpisodeAction mostRecent = remoteMostRecentPlayAction.get(key);
+ GpodnetEpisodeAction mostRecent = mostRecentPlayAction.get(key);
if (mostRecent == null) {
- remoteMostRecentPlayAction.put(key, action);
+ mostRecentPlayAction.put(key, action);
} else if (mostRecent.getTimestamp().before(action.getTimestamp())) {
- remoteMostRecentPlayAction.put(key, action);
+ mostRecentPlayAction.put(key, action);
}
}
break;
@@ -231,10 +269,12 @@ public class GpodnetSyncService extends Service {
break;
}
}
- for (GpodnetEpisodeAction action : remoteMostRecentPlayAction.values()) {
+ for (GpodnetEpisodeAction action : mostRecentPlayAction.values()) {
FeedItem playItem = DBReader.getFeedItem(this, action.getPodcast(), action.getEpisode());
if (playItem != null) {
- playItem.getMedia().setPosition(action.getPosition() * 1000);
+ FeedMedia media = playItem.getMedia();
+ media.setPosition(action.getPosition() * 1000);
+ DBWriter.setFeedMedia(this, media);
if(playItem.getMedia().hasAlmostEnded()) {
DBWriter.markItemRead(this, playItem, true, true);
DBWriter.addItemToPlaybackHistory(this, playItem.getMedia());
@@ -342,4 +382,20 @@ public class GpodnetSyncService extends Service {
context.startService(intent);
}
}
+
+ public static void sendSyncSubscriptionsIntent(Context context) {
+ if (GpodnetPreferences.loggedIn()) {
+ Intent intent = new Intent(context, GpodnetSyncService.class);
+ intent.putExtra(ARG_ACTION, ACTION_SYNC_SUBSCRIPTIONS);
+ context.startService(intent);
+ }
+ }
+
+ public static void sendSyncActionsIntent(Context context) {
+ if (GpodnetPreferences.loggedIn()) {
+ Intent intent = new Intent(context, GpodnetSyncService.class);
+ intent.putExtra(ARG_ACTION, ACTION_SYNC_ACTIONS);
+ context.startService(intent);
+ }
+ }
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
index d5f17c099..e7b226eca 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
@@ -520,9 +520,7 @@ public class DownloadService extends Service {
/**
* Creates a notification at the end of the service lifecycle to notify the
* user about the number of completed downloads. A report will only be
- * created if the number of successfully downloaded feeds is bigger than 1
- * or if there is at least one failed download which is not an image or if
- * there is at least one downloaded media file.
+ * created if there is at least one failed download excluding images
*/
private void updateReport() {
// check if report should be created
@@ -550,16 +548,16 @@ public class DownloadService extends Service {
.setTicker(
getString(R.string.download_report_title))
.setContentTitle(
- getString(R.string.download_report_title))
+ getString(R.string.download_report_content_title))
.setContentText(
String.format(
getString(R.string.download_report_content),
successfulDownloads, failedDownloads)
)
- .setSmallIcon(R.drawable.stat_notify_sync)
+ .setSmallIcon(R.drawable.stat_notify_sync_error)
.setLargeIcon(
BitmapFactory.decodeResource(getResources(),
- R.drawable.stat_notify_sync)
+ R.drawable.stat_notify_sync_error)
)
.setContentIntent(
ClientConfig.downloadServiceCallbacks.getReportNotificationContentIntent(this)
@@ -939,6 +937,13 @@ public class DownloadService extends Service {
if (successful) {
+ // we create a 'successful' download log if the feed's last refresh failed
+ List<DownloadStatus> log = DBReader.getFeedDownloadLog(DownloadService.this, feed);
+ if(log.size() > 0 && log.get(0).isSuccessful() == false) {
+ saveDownloadStatus(new DownloadStatus(feed,
+ feed.getHumanReadableIdentifier(), DownloadError.SUCCESS, successful,
+ reasonDetailed));
+ }
return Pair.create(request, result);
} else {
numberOfDownloads.decrementAndGet();
@@ -1055,9 +1060,11 @@ public class DownloadService extends Service {
@Override
public void run() {
- if (request.isDeleteOnFailure()) {
+ if(request.getFeedfileType() == Feed.FEEDFILETYPE_FEED) {
+ DBWriter.setFeedLastUpdateFailed(DownloadService.this, request.getFeedfileId(), true);
+ } else if (request.isDeleteOnFailure()) {
Log.d(TAG, "Ignoring failed download, deleteOnFailure=true");
- } else {
+ } else {
File dest = new File(request.getDestination());
if (dest.exists() && request.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) {
Log.d(TAG, "File has been partially downloaded. Writing file url");
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java
index 7abb6df5e..ac0fe8036 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java
@@ -2,7 +2,6 @@ package de.danoeh.antennapod.core.service.download;
import android.util.Log;
-import com.squareup.okhttp.Credentials;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
@@ -18,19 +17,20 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
+import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.net.UnknownHostException;
import java.util.Date;
-import de.danoeh.antennapod.core.BuildConfig;
import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.feed.FeedImage;
import de.danoeh.antennapod.core.util.DownloadError;
import de.danoeh.antennapod.core.util.StorageUtils;
import de.danoeh.antennapod.core.util.URIUtil;
+import okio.ByteString;
public class HttpDownloader extends Downloader {
private static final String TAG = "HttpDownloader";
@@ -81,11 +81,12 @@ public class HttpDownloader extends Downloader {
if (userInfo != null) {
String[] parts = userInfo.split(":");
if (parts.length == 2) {
- String credentials = Credentials.basic(parts[0], parts[1]);
+ String credentials = encodeCredentials(parts[0], parts[1], "ISO-8859-1");
httpReq.header("Authorization", credentials);
}
} else if (!StringUtils.isEmpty(request.getUsername()) && request.getPassword() != null) {
- String credentials = Credentials.basic(request.getUsername(), request.getPassword());
+ String credentials = encodeCredentials(request.getUsername(), request.getPassword(),
+ "ISO-8859-1");
httpReq.header("Authorization", credentials);
}
@@ -99,13 +100,29 @@ public class HttpDownloader extends Downloader {
Response response = httpClient.newCall(httpReq.build()).execute();
responseBody = response.body();
-
String contentEncodingHeader = response.header("Content-Encoding");
-
- final boolean isGzip = StringUtils.equalsIgnoreCase(contentEncodingHeader, "gzip");
-
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Response code is " + response.code());
+ boolean isGzip = StringUtils.equalsIgnoreCase(contentEncodingHeader, "gzip");
+
+ Log.d(TAG, "Response code is " + response.code());
+
+ if(!response.isSuccessful() && response.code() == HttpURLConnection.HTTP_UNAUTHORIZED) {
+ Log.d(TAG, "Authorization failed, re-trying with UTF-8 encoding");
+ if (userInfo != null) {
+ String[] parts = userInfo.split(":");
+ if (parts.length == 2) {
+ String credentials = encodeCredentials(parts[0], parts[1], "UTF-8");
+ httpReq.header("Authorization", credentials);
+ }
+ } else if (!StringUtils.isEmpty(request.getUsername()) && request.getPassword() != null) {
+ String credentials = encodeCredentials(request.getUsername(), request.getPassword(),
+ "UTF-8");
+ httpReq.header("Authorization", credentials);
+ }
+ response = httpClient.newCall(httpReq.build()).execute();
+ responseBody = response.body();
+ contentEncodingHeader = response.header("Content-Encoding");
+ isGzip = StringUtils.equalsIgnoreCase(contentEncodingHeader, "gzip");
+ }
if(!response.isSuccessful() && response.code() == HttpURLConnection.HTTP_NOT_MODIFIED) {
Log.d(TAG, "Feed '" + request.getSource() + "' not modified since last update, Download canceled");
@@ -151,22 +168,18 @@ public class HttpDownloader extends Downloader {
out = new RandomAccessFile(destination, "rw");
}
-
byte[] buffer = new byte[BUFFER_SIZE];
int count = 0;
request.setStatusMsg(R.string.download_running);
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Getting size of download");
+ Log.d(TAG, "Getting size of download");
request.setSize(responseBody.contentLength() + request.getSoFar());
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Size is " + request.getSize());
+ Log.d(TAG, "Size is " + request.getSize());
if (request.getSize() < 0) {
request.setSize(DownloadStatus.SIZE_UNKNOWN);
}
long freeSpace = StorageUtils.getFreeSpaceAvailable();
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Free space is " + freeSpace);
+ Log.d(TAG, "Free space is " + freeSpace);
if (request.getSize() != DownloadStatus.SIZE_UNKNOWN
&& request.getSize() > freeSpace) {
@@ -174,8 +187,7 @@ public class HttpDownloader extends Downloader {
return;
}
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Starting download");
+ Log.d(TAG, "Starting download");
while (!cancelled
&& (count = connection.read(buffer)) != -1) {
out.write(buffer, 0, count);
@@ -226,15 +238,12 @@ public class HttpDownloader extends Downloader {
}
private void onSuccess() {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Download was successful");
+ Log.d(TAG, "Download was successful");
result.setSuccessful();
}
private void onFail(DownloadError reason, String reasonDetailed) {
- if (BuildConfig.DEBUG) {
- Log.d(TAG, "Download failed");
- }
+ Log.d(TAG, "Download failed");
result.setFailed(reason, reasonDetailed);
if (request.isDeleteOnFailure()) {
cleanup();
@@ -242,8 +251,7 @@ public class HttpDownloader extends Downloader {
}
private void onCancelled() {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Download was cancelled");
+ Log.d(TAG, "Download was cancelled");
result.setCancelled();
cleanup();
}
@@ -256,14 +264,23 @@ public class HttpDownloader extends Downloader {
File dest = new File(request.getDestination());
if (dest.exists()) {
boolean rc = dest.delete();
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Deleted file " + dest.getName() + "; Result: "
+ Log.d(TAG, "Deleted file " + dest.getName() + "; Result: "
+ rc);
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "cleanup() didn't delete file: does not exist.");
+ Log.d(TAG, "cleanup() didn't delete file: does not exist.");
}
}
}
+ public static String encodeCredentials(String username, String password, String charset) {
+ try {
+ String credentials = username + ":" + password;
+ byte[] bytes = credentials.getBytes(charset);
+ String encoded = ByteString.of(bytes).base64();
+ return "Basic " + encoded;
+ } catch (UnsupportedEncodingException e) {
+ throw new AssertionError();
+ }
+ }
+
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
index 43c345fec..3f6769ee4 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
@@ -254,6 +254,8 @@ public class PlaybackService extends Service {
unregisterReceiver(bluetoothStateUpdated);
unregisterReceiver(audioBecomingNoisy);
unregisterReceiver(skipCurrentEpisodeReceiver);
+ unregisterReceiver(pausePlayCurrentEpisodeReceiver);
+ unregisterReceiver(pauseResumeCurrentEpisodeReceiver);
mediaPlayer.shutdown();
taskManager.shutdown();
}
@@ -344,11 +346,11 @@ public class PlaybackService extends Service {
break;
case KeyEvent.KEYCODE_MEDIA_NEXT:
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
- mediaPlayer.seekDelta(UserPreferences.getSeekDeltaMs());
+ mediaPlayer.seekDelta(UserPreferences.getFastFowardSecs() * 1000);
break;
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
case KeyEvent.KEYCODE_MEDIA_REWIND:
- mediaPlayer.seekDelta(-UserPreferences.getSeekDeltaMs());
+ mediaPlayer.seekDelta(-UserPreferences.getRewindSecs() * 1000);
break;
case KeyEvent.KEYCODE_MEDIA_STOP:
if (status == PlayerStatus.PLAYING) {
@@ -481,9 +483,8 @@ public class PlaybackService extends Service {
}
Intent statusUpdate = new Intent(ACTION_PLAYER_STATUS_CHANGED);
- statusUpdate.putExtra(EXTRA_NEW_PLAYER_STATUS, newInfo.playerStatus.ordinal());
+ // statusUpdate.putExtra(EXTRA_NEW_PLAYER_STATUS, newInfo.playerStatus.ordinal());
sendBroadcast(statusUpdate);
- sendBroadcast(new Intent(ACTION_PLAYER_STATUS_CHANGED));
updateWidget();
refreshRemoteControlClientState(newInfo);
bluetoothNotifyChange(newInfo, AVRCP_ACTION_PLAYER_STATUS_CHANGED);
@@ -626,7 +627,6 @@ public class PlaybackService extends Service {
prepareImmediately = startWhenPrepared = true;
} else {
Log.d(TAG, "No more episodes available to play");
-
prepareImmediately = startWhenPrepared = false;
stopForeground(true);
stopWidgetUpdater();
@@ -933,7 +933,6 @@ public class PlaybackService extends Service {
// Auto flattr
if (isAutoFlattrable(media) &&
(media.getPlayedDuration() > UserPreferences.getAutoFlattrPlayedDurationThreshold() * duration)) {
-
Log.d(TAG, "saveCurrentPosition: performing auto flattr since played duration " + Integer.toString(media.getPlayedDuration())
+ " is " + UserPreferences.getAutoFlattrPlayedDurationThreshold() * 100 + "% of file duration " + Integer.toString(duration));
DBTasks.flattrItemIfLoggedIn(this, item);
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java
index f0acc3531..243ee78e4 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java
@@ -40,7 +40,7 @@ import de.danoeh.antennapod.core.util.playback.VideoPlayer;
* Manages the MediaPlayer object of the PlaybackService.
*/
public class PlaybackServiceMediaPlayer {
- public static final String TAG = "PlaybackServiceMediaPlayer";
+ public static final String TAG = "PlaybackSvcMediaPlayer";
/**
* Return value of some PSMP methods if the method call failed.
@@ -449,15 +449,15 @@ public class PlaybackServiceMediaPlayer {
if (playerStatus == PlayerStatus.PLAYING
|| playerStatus == PlayerStatus.PAUSED
|| playerStatus == PlayerStatus.PREPARED) {
- if (stream) {
- // statusBeforeSeeking = playerStatus;
- // setPlayerStatus(PlayerStatus.SEEKING, media);
+ if (!stream) {
+ statusBeforeSeeking = playerStatus;
+ setPlayerStatus(PlayerStatus.SEEKING, media);
}
mediaPlayer.seekTo(t);
} else if (playerStatus == PlayerStatus.INITIALIZED) {
media.setPosition(t);
- startWhenPrepared.set(true);
+ startWhenPrepared.set(false);
prepare();
}
playerLock.unlock();
@@ -534,20 +534,20 @@ public class PlaybackServiceMediaPlayer {
* Returns the position of the current media object or INVALID_TIME if the position could not be retrieved.
*/
public int getPosition() {
- if (!playerLock.tryLock()) {
- return INVALID_TIME;
- }
+ playerLock.lock();
int retVal = INVALID_TIME;
if (playerStatus == PlayerStatus.PLAYING
|| playerStatus == PlayerStatus.PAUSED
- || playerStatus == PlayerStatus.PREPARED) {
+ || playerStatus == PlayerStatus.PREPARED
+ || playerStatus == PlayerStatus.SEEKING) {
retVal = mediaPlayer.getCurrentPosition();
} else if (media != null && media.getPosition() > 0) {
retVal = media.getPosition();
}
playerLock.unlock();
+ Log.d(TAG, "getPosition() -> " + retVal);
return retVal;
}
@@ -735,6 +735,7 @@ public class PlaybackServiceMediaPlayer {
int state;
if (playerStatus != null) {
+ Log.d(TAG, "playerStatus: " + playerStatus.toString());
switch (playerStatus) {
case PLAYING:
state = PlaybackStateCompat.STATE_PLAYING;
@@ -798,10 +799,10 @@ public class PlaybackServiceMediaPlayer {
// If there is an incoming call, playback should be paused permanently
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
final int callState = (tm != null) ? tm.getCallState() : 0;
- Log.d(TAG, "Call state: " + callState);
Log.i(TAG, "Call state:" + callState);
- if (focusChange == AudioManager.AUDIOFOCUS_LOSS || callState != TelephonyManager.CALL_STATE_IDLE) {
+ if (focusChange == AudioManager.AUDIOFOCUS_LOSS ||
+ (!UserPreferences.shouldResumeAfterCall() && callState != TelephonyManager.CALL_STATE_IDLE)) {
Log.d(TAG, "Lost audio focus");
pause(true, false);
callback.shouldStop();
@@ -1095,13 +1096,13 @@ public class PlaybackServiceMediaPlayer {
@Override
public void onFastForward() {
super.onFastForward();
- seekDelta(UserPreferences.getSeekDeltaMs());
+ seekDelta(UserPreferences.getFastFowardSecs() * 1000);
}
@Override
public void onRewind() {
super.onRewind();
- seekDelta(-UserPreferences.getSeekDeltaMs());
+ seekDelta(-UserPreferences.getRewindSecs() * 1000);
}
@Override
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java
index cde03adea..fc73c9446 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java
@@ -19,8 +19,10 @@ import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.QueueEvent;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.util.playback.Playable;
+
import de.greenrobot.event.EventBus;
+
/**
* Manages the background tasks of PlaybackSerivce, i.e.
* the sleep timer, the position saver, the widget updater and
@@ -147,9 +149,9 @@ public class PlaybackServiceTaskManager {
positionSaverFuture = schedExecutor.scheduleWithFixedDelay(positionSaver, POSITION_SAVER_WAITING_INTERVAL,
POSITION_SAVER_WAITING_INTERVAL, TimeUnit.MILLISECONDS);
- if (BuildConfig.DEBUG) Log.d(TAG, "Started PositionSaver");
+ Log.d(TAG, "Started PositionSaver");
} else {
- if (BuildConfig.DEBUG) Log.d(TAG, "Call to startPositionSaver was ignored.");
+ Log.d(TAG, "Call to startPositionSaver was ignored.");
}
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java
index de6c02de7..f647fd537 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java
@@ -41,10 +41,10 @@ public class APCleanupAlgorithm implements EpisodeCleanupAlgorithm<Integer> {
Date r = rhs.getMedia().getPlaybackCompletionDate();
if (l == null) {
- l = new Date(0);
+ l = new Date();
}
if (r == null) {
- r = new Date(0);
+ r = new Date();
}
return l.compareTo(r);
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APDownloadAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/APDownloadAlgorithm.java
index c5f871f48..92de1eee7 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/APDownloadAlgorithm.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/APDownloadAlgorithm.java
@@ -4,10 +4,9 @@ import android.content.Context;
import android.util.Log;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Iterator;
import java.util.List;
-import de.danoeh.antennapod.core.BuildConfig;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.NetworkUtils;
@@ -53,75 +52,53 @@ public class APDownloadAlgorithm implements AutomaticDownloadAlgorithm {
Log.d(TAG, "Performing auto-dl of undownloaded episodes");
- final List<FeedItem> queue = DBReader.getQueue(context);
- final List<FeedItem> unreadItems = DBReader
- .getUnreadItemsList(context);
+ List<FeedItem> candidates;
+ if(mediaIds.length > 0) {
+ candidates = DBReader.getFeedItems(context, mediaIds);
+ } else {
+ final List<FeedItem> queue = DBReader.getQueue(context);
+ final List<FeedItem> unreadItems = DBReader.getUnreadItemsList(context);
+ candidates = new ArrayList<FeedItem>(queue.size() + unreadItems.size());
+ candidates.addAll(queue);
+ for(FeedItem unreadItem : unreadItems) {
+ if(candidates.contains(unreadItem) == false) {
+ candidates.add(unreadItem);
+ }
+ }
+ }
- int undownloadedEpisodes = DBTasks.getNumberOfUndownloadedEpisodes(queue,
- unreadItems);
- int downloadedEpisodes = DBReader
- .getNumberOfDownloadedEpisodes(context);
+ // filter items that are not auto downloadable
+ Iterator<FeedItem> it = candidates.iterator();
+ while(it.hasNext()) {
+ FeedItem item = it.next();
+ if(item.isAutoDownloadable() == false) {
+ it.remove();
+ }
+ }
+
+ int autoDownloadableEpisodes = candidates.size();
+ int downloadedEpisodes = DBReader.getNumberOfDownloadedEpisodes(context);
int deletedEpisodes = cleanupAlgorithm.performCleanup(context,
- APCleanupAlgorithm.getPerformAutoCleanupArgs(context, undownloadedEpisodes));
- int episodeSpaceLeft = undownloadedEpisodes;
+ APCleanupAlgorithm.getPerformAutoCleanupArgs(context, autoDownloadableEpisodes));
boolean cacheIsUnlimited = UserPreferences.getEpisodeCacheSize() == UserPreferences
.getEpisodeCacheSizeUnlimited();
-
- if (!cacheIsUnlimited
- && UserPreferences.getEpisodeCacheSize() < downloadedEpisodes
- + undownloadedEpisodes) {
- episodeSpaceLeft = UserPreferences.getEpisodeCacheSize()
- - (downloadedEpisodes - deletedEpisodes);
+ int episodeCacheSize = UserPreferences.getEpisodeCacheSize();
+
+ int episodeSpaceLeft;
+ if (cacheIsUnlimited ||
+ episodeCacheSize >= downloadedEpisodes + autoDownloadableEpisodes) {
+ episodeSpaceLeft = autoDownloadableEpisodes;
+ } else {
+ episodeSpaceLeft = episodeCacheSize - (downloadedEpisodes - deletedEpisodes);
}
- Arrays.sort(mediaIds); // sort for binary search
- final boolean ignoreMediaIds = mediaIds.length == 0;
- List<FeedItem> itemsToDownload = new ArrayList<FeedItem>();
-
- if (episodeSpaceLeft > 0 && undownloadedEpisodes > 0) {
- for (int i = 0; i < queue.size(); i++) { // ignore playing item
- FeedItem item = queue.get(i);
- long mediaId = (item.hasMedia()) ? item.getMedia().getId() : -1;
- if ((ignoreMediaIds || Arrays.binarySearch(mediaIds, mediaId) >= 0)
- && item.hasMedia()
- && !item.getMedia().isDownloaded()
- && !item.getMedia().isPlaying()
- && item.getFeed().getPreferences().getAutoDownload()) {
- itemsToDownload.add(item);
- episodeSpaceLeft--;
- undownloadedEpisodes--;
- if (episodeSpaceLeft == 0 || undownloadedEpisodes == 0) {
- break;
- }
- }
- }
- }
+ FeedItem[] itemsToDownload = candidates.subList(0, episodeSpaceLeft)
+ .toArray(new FeedItem[episodeSpaceLeft]);
- if (episodeSpaceLeft > 0 && undownloadedEpisodes > 0) {
- for (FeedItem item : unreadItems) {
- long mediaId = (item.hasMedia()) ? item.getMedia().getId() : -1;
- if ((ignoreMediaIds || Arrays.binarySearch(mediaIds, mediaId) >= 0)
- && item.hasMedia()
- && !item.getMedia().isDownloaded()
- && item.getFeed().getPreferences().getAutoDownload()) {
- itemsToDownload.add(item);
- episodeSpaceLeft--;
- undownloadedEpisodes--;
- if (episodeSpaceLeft == 0 || undownloadedEpisodes == 0) {
- break;
- }
- }
- }
- }
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Enqueueing " + itemsToDownload.size()
- + " items for download");
+ Log.d(TAG, "Enqueueing " + itemsToDownload.length + " items for download");
try {
- DBTasks.downloadFeedItems(false, context,
- itemsToDownload.toArray(new FeedItem[itemsToDownload
- .size()])
- );
+ DBTasks.downloadFeedItems(false, context, itemsToDownload);
} catch (DownloadRequestException e) {
e.printStackTrace();
}
@@ -130,4 +107,5 @@ public class APDownloadAlgorithm implements AutomaticDownloadAlgorithm {
}
};
}
+
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
index a7c98c7c6..cc20b3d37 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
@@ -4,8 +4,11 @@ import android.content.Context;
import android.database.Cursor;
import android.util.Log;
+import org.apache.commons.lang3.StringUtils;
+
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.List;
@@ -21,6 +24,7 @@ import de.danoeh.antennapod.core.feed.SimpleChapter;
import de.danoeh.antennapod.core.feed.VorbisCommentChapter;
import de.danoeh.antennapod.core.service.download.DownloadStatus;
import de.danoeh.antennapod.core.util.DownloadError;
+import de.danoeh.antennapod.core.util.LongIntMap;
import de.danoeh.antennapod.core.util.LongList;
import de.danoeh.antennapod.core.util.comparator.DownloadStatusComparator;
import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator;
@@ -174,8 +178,7 @@ public final class DBReader {
*/
public static List<FeedItem> getFeedItemList(Context context,
final Feed feed) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle());
+ Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle());
PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open();
@@ -228,7 +231,9 @@ public final class DBReader {
itemlistCursor.getInt(PodDBAdapter.IDX_FI_SMALL_HAS_CHAPTERS) > 0,
image,
(itemlistCursor.getInt(PodDBAdapter.IDX_FI_SMALL_READ) > 0),
- itemlistCursor.getString(PodDBAdapter.IDX_FI_SMALL_ITEM_IDENTIFIER));
+ itemlistCursor.getString(PodDBAdapter.IDX_FI_SMALL_ITEM_IDENTIFIER),
+ itemlistCursor.getInt(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DOWNLOAD)) > 0
+ );
itemIds.add(String.valueOf(item.getId()));
@@ -312,7 +317,10 @@ public final class DBReader {
cursor.getInt(PodDBAdapter.IDX_FEED_SEL_STD_DOWNLOADED) > 0,
new FlattrStatus(cursor.getLong(PodDBAdapter.IDX_FEED_SEL_STD_FLATTR_STATUS)),
cursor.getInt(PodDBAdapter.IDX_FEED_SEL_STD_IS_PAGED) > 0,
- cursor.getString(PodDBAdapter.IDX_FEED_SEL_STD_NEXT_PAGE_LINK));
+ cursor.getString(PodDBAdapter.IDX_FEED_SEL_STD_NEXT_PAGE_LINK),
+ cursor.getString(cursor.getColumnIndex(PodDBAdapter.KEY_HIDE)),
+ cursor.getInt(cursor.getColumnIndex(PodDBAdapter.KEY_LAST_UPDATE_FAILED)) > 0
+ );
if (image != null) {
image.setOwner(feed);
@@ -327,6 +335,21 @@ public final class DBReader {
return feed;
}
+ private static DownloadStatus extractDownloadStatusFromCursorRow(final Cursor cursor) {
+ long id = cursor.getLong(PodDBAdapter.KEY_ID_INDEX);
+ long feedfileId = cursor.getLong(PodDBAdapter.KEY_FEEDFILE_INDEX);
+ int feedfileType = cursor.getInt(PodDBAdapter.KEY_FEEDFILETYPE_INDEX);
+ boolean successful = cursor.getInt(PodDBAdapter.KEY_SUCCESSFUL_INDEX) > 0;
+ int reason = cursor.getInt(PodDBAdapter.KEY_REASON_INDEX);
+ String reasonDetailed = cursor.getString(PodDBAdapter.KEY_REASON_DETAILED_INDEX);
+ String title = cursor.getString(PodDBAdapter.KEY_DOWNLOADSTATUS_TITLE_INDEX);
+ Date completionDate = new Date(cursor.getLong(PodDBAdapter.KEY_COMPLETION_DATE_INDEX));
+
+ return new DownloadStatus(id, title, feedfileId,
+ feedfileType, successful, DownloadError.fromCode(reason), completionDate,
+ reasonDetailed);
+ }
+
private static FeedItem getMatchingItemForMedia(long itemId,
List<FeedItem> items) {
@@ -468,21 +491,45 @@ public final class DBReader {
}
/**
+ * Loads a list of FeedItems that are considered new.
+ *
+ * @param context A context that is used for opening a database connection.
+ * @return A list of FeedItems that are considered new.
+ */
+ public static List<FeedItem> getNewItemsList(Context context) {
+ Log.d(TAG, "getNewItemsList()");
+
+ PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+
+ Cursor itemlistCursor = adapter.getNewItemsCursor();
+ List<FeedItem> items = extractItemlistFromCursor(adapter, itemlistCursor);
+ itemlistCursor.close();
+
+ loadFeedDataOfFeedItemlist(context, items);
+
+ adapter.close();
+
+ return items;
+ }
+
+ /**
* Loads the IDs of the FeedItems whose 'read'-attribute is set to false.
*
* @param context A context that is used for opening a database connection.
* @return A list of IDs of the FeedItems whose 'read'-attribute is set to false. This method should be preferred
* over {@link #getUnreadItemsList(android.content.Context)} if the FeedItems in the UnreadItems list are not used.
*/
- public static long[] getUnreadItemIds(Context context) {
+ public static LongList getNewItemIds(Context context) {
PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open();
- Cursor cursor = adapter.getUnreadItemIdsCursor();
- long[] itemIds = new long[cursor.getCount()];
+ Cursor cursor = adapter.getNewItemIdsCursor();
+ LongList itemIds = new LongList(cursor.getCount());
int i = 0;
if (cursor.moveToFirst()) {
do {
- itemIds[i] = cursor.getLong(PodDBAdapter.KEY_ID_INDEX);
+ long id = cursor.getLong(PodDBAdapter.KEY_ID_INDEX);
+ itemIds.add(id);
i++;
} while (cursor.moveToNext());
}
@@ -565,27 +612,7 @@ public final class DBReader {
if (logCursor.moveToFirst()) {
do {
- long id = logCursor.getLong(PodDBAdapter.KEY_ID_INDEX);
-
- long feedfileId = logCursor
- .getLong(PodDBAdapter.KEY_FEEDFILE_INDEX);
- int feedfileType = logCursor
- .getInt(PodDBAdapter.KEY_FEEDFILETYPE_INDEX);
- boolean successful = logCursor
- .getInt(PodDBAdapter.KEY_SUCCESSFUL_INDEX) > 0;
- int reason = logCursor.getInt(PodDBAdapter.KEY_REASON_INDEX);
- String reasonDetailed = logCursor
- .getString(PodDBAdapter.KEY_REASON_DETAILED_INDEX);
- String title = logCursor
- .getString(PodDBAdapter.KEY_DOWNLOADSTATUS_TITLE_INDEX);
- Date completionDate = new Date(
- logCursor
- .getLong(PodDBAdapter.KEY_COMPLETION_DATE_INDEX)
- );
- downloadLog.add(new DownloadStatus(id, title, feedfileId,
- feedfileType, successful, DownloadError.fromCode(reason), completionDate,
- reasonDetailed));
-
+ downloadLog.add(extractDownloadStatusFromCursorRow(logCursor));
} while (logCursor.moveToNext());
}
logCursor.close();
@@ -594,6 +621,60 @@ public final class DBReader {
}
/**
+ * Loads the download log for a particular feed from the database.
+ *
+ * @param context A context that is used for opening a database connection.
+ * @param feed Feed for which the download log is loaded
+ * @return A list with DownloadStatus objects that represent the feed's download log,
+ * newest events first.
+ */
+ public static List<DownloadStatus> getFeedDownloadLog(Context context, Feed feed) {
+ Log.d(TAG, "getFeedDownloadLog(CONTEXT, " + feed.toString() + ")");
+
+ PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+ Cursor cursor = adapter.getDownloadLog(Feed.FEEDFILETYPE_FEED, feed.getId());
+ List<DownloadStatus> downloadLog = new ArrayList<DownloadStatus>(
+ cursor.getCount());
+
+ if (cursor.moveToFirst()) {
+ do {
+ downloadLog.add(extractDownloadStatusFromCursorRow(cursor));
+ } while (cursor.moveToNext());
+ }
+ cursor.close();
+ Collections.sort(downloadLog, new DownloadStatusComparator());
+ return downloadLog;
+ }
+
+ /**
+ * Loads the download log for a particular feed media from the database.
+ *
+ * @param context A context that is used for opening a database connection.
+ * @param media Feed media for which the download log is loaded
+ * @return A list with DownloadStatus objects that represent the feed media's download log,
+ * newest events first.
+ */
+ public static List<DownloadStatus> getFeedMediaDownloadLog(Context context, FeedMedia media) {
+ Log.d(TAG, "getFeedDownloadLog(CONTEXT, " + media.toString() + ")");
+
+ PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+ Cursor cursor = adapter.getDownloadLog(FeedMedia.FEEDFILETYPE_FEEDMEDIA, media.getId());
+ List<DownloadStatus> downloadLog = new ArrayList<DownloadStatus>(
+ cursor.getCount());
+
+ if (cursor.moveToFirst()) {
+ do {
+ downloadLog.add(extractDownloadStatusFromCursorRow(cursor));
+ } while (cursor.moveToNext());
+ }
+ cursor.close();
+ Collections.sort(downloadLog, new DownloadStatusComparator());
+ return downloadLog;
+ }
+
+ /**
* Loads the FeedItemStatistics objects of all Feeds in the database. This method should be preferred over
* {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.core.feed.Feed)} if only metadata about
* the FeedItems is needed.
@@ -670,6 +751,31 @@ public final class DBReader {
}
}
return item;
+ }
+
+ static List<FeedItem> getFeedItems(final Context context, PodDBAdapter adapter, final long... itemIds) {
+
+ String[] ids = new String[itemIds.length];
+ for(int i = 0; i < itemIds.length; i++) {
+ long itemId = itemIds[i];
+ ids[i] = Long.toString(itemId);
+ }
+
+ List<FeedItem> result;
+
+ Cursor itemCursor = adapter.getFeedItemCursor(ids);
+ if (itemCursor.moveToFirst()) {
+ result = extractItemlistFromCursor(adapter, itemCursor);
+ loadFeedDataOfFeedItemlist(context, result);
+ for(FeedItem item : result) {
+ if (item.hasChapters()) {
+ loadChaptersOfFeedItem(adapter, item);
+ }
+ }
+ } else {
+ result = Collections.emptyList();
+ }
+ return result;
}
@@ -691,7 +797,6 @@ public final class DBReader {
FeedItem item = getFeedItem(context, itemId, adapter);
adapter.close();
return item;
-
}
static FeedItem getFeedItem(final Context context, final String podcastUrl, final String episodeUrl, PodDBAdapter adapter) {
@@ -712,6 +817,55 @@ public final class DBReader {
}
/**
+ * Loads specific FeedItems from the database. This method canbe used for loading more
+ * than one FeedItem
+ *
+ * @param context A context that is used for opening a database connection.
+ * @param itemIds The IDs of the FeedItems
+ * @return The FeedItems or an empty list if none of the FeedItems could be found. All FeedComponent-attributes
+ * as well as chapter marks of the FeedItems will also be loaded from the database.
+ */
+ public static List<FeedItem> getFeedItems(final Context context, final long... itemIds) {
+ Log.d(TAG, "Loading feeditem with ids: " + StringUtils.join(itemIds, ","));
+
+ PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+ List<FeedItem> items = getFeedItems(context, adapter, itemIds);
+ adapter.close();
+ return items;
+ }
+
+
+ /**
+ * Returns credentials based on image URL
+ *
+ * @param context A context that is used for opening a database connection.
+ * @param imageUrl The URL of the image
+ * @return Credentials in format "<Username>:<Password>", empty String if no authorization given
+ */
+ public static String getImageAuthentication(final Context context, final String imageUrl) {
+ Log.d(TAG, "Loading credentials for image with URL " + imageUrl);
+
+ PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+ String credentials = getImageAuthentication(context, imageUrl, adapter);
+ adapter.close();
+ return credentials;
+
+ }
+
+ static String getImageAuthentication(final Context context, final String imageUrl, PodDBAdapter adapter) {
+ String credentials = null;
+ Cursor cursor = adapter.getImageAuthenticationCursor(imageUrl);
+ if (cursor.moveToFirst()) {
+ String username = cursor.getString(0);
+ String password = cursor.getString(1);
+ return username + ":" + password;
+ }
+ return "";
+ }
+
+ /**
* Loads a specific FeedItem from the database.
*
* @param context A context that is used for opening a database connection.
@@ -828,10 +982,24 @@ public final class DBReader {
* @param context A context that is used for opening a database connection.
* @return The number of unread items.
*/
- public static int getNumberOfUnreadItems(final Context context) {
+ public static int getNumberOfNewItems(final Context context) {
+ PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+ final int result = adapter.getNumberOfNewItems();
+ adapter.close();
+ return result;
+ }
+
+ /**
+ * Returns a map containing the number of unread items per feed
+ *
+ * @param context A context that is used for opening a database connection.
+ * @return The number of unread items per feed.
+ */
+ public static LongIntMap getNumberOfUnreadFeedItems(final Context context, long... feedIds) {
PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open();
- final int result = adapter.getNumberOfUnreadItems();
+ final LongIntMap result = adapter.getNumberOfUnreadFeedItems(feedIds);
adapter.close();
return result;
}
@@ -960,9 +1128,31 @@ public final class DBReader {
PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open();
List<Feed> feeds = getFeedList(adapter);
+ long[] feedIds = new long[feeds.size()];
+ for(int i=0; i < feeds.size(); i++) {
+ feedIds[i] = feeds.get(i).getId();
+ }
+ final LongIntMap numUnreadFeedItems = adapter.getNumberOfUnreadFeedItems(feedIds);
+ Collections.sort(feeds, new Comparator<Feed>() {
+ @Override
+ public int compare(Feed lhs, Feed rhs) {
+ long numUnreadLhs = numUnreadFeedItems.get(lhs.getId());
+ Log.d(TAG, "feed with id " + lhs.getId() + " has " + numUnreadLhs + " unread items");
+ long numUnreadRhs = numUnreadFeedItems.get(rhs.getId());
+ Log.d(TAG, "feed with id " + rhs.getId() + " has " + numUnreadRhs + " unread items");
+ if(numUnreadLhs > numUnreadRhs) {
+ // reverse natural order: podcast with most unplayed episodes first
+ return -1;
+ } else if(numUnreadLhs == numUnreadRhs) {
+ return lhs.getTitle().compareTo(rhs.getTitle());
+ } else {
+ return 1;
+ }
+ }
+ });
int queueSize = adapter.getQueueSize();
- int numUnreadItems = adapter.getNumberOfUnreadItems();
- NavDrawerData result = new NavDrawerData(feeds, queueSize, numUnreadItems);
+ int numNewItems = adapter.getNumberOfNewItems();
+ NavDrawerData result = new NavDrawerData(feeds, queueSize, numNewItems, numUnreadFeedItems);
adapter.close();
return result;
}
@@ -970,12 +1160,15 @@ public final class DBReader {
public static class NavDrawerData {
public List<Feed> feeds;
public int queueSize;
- public int numUnreadItems;
+ public int numNewItems;
+ public LongIntMap numUnreadFeedItems;
- public NavDrawerData(List<Feed> feeds, int queueSize, int numUnreadItems) {
+ public NavDrawerData(List<Feed> feeds, int queueSize, int numNewItems,
+ LongIntMap numUnreadFeedItems) {
this.feeds = feeds;
this.queueSize = queueSize;
- this.numUnreadItems = numUnreadItems;
+ this.numNewItems = numNewItems;
+ this.numUnreadFeedItems = numUnreadFeedItems;
}
}
}
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 9fa17bf72..e570ee709 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
@@ -20,7 +20,6 @@ import java.util.concurrent.FutureTask;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicBoolean;
-import de.danoeh.antennapod.core.BuildConfig;
import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.asynctask.FlattrClickWorker;
import de.danoeh.antennapod.core.asynctask.FlattrStatusFetcher;
@@ -171,10 +170,10 @@ public final class DBTasks {
isRefreshing.set(false);
if (FlattrUtils.hasToken()) {
- if (BuildConfig.DEBUG) Log.d(TAG, "Flattring all pending things.");
+ Log.d(TAG, "Flattring all pending things.");
new FlattrClickWorker(context).executeAsync(); // flattr pending things
- if (BuildConfig.DEBUG) Log.d(TAG, "Fetching flattr status.");
+ Log.d(TAG, "Fetching flattr status.");
new FlattrStatusFetcher(context).start();
}
@@ -185,9 +184,7 @@ public final class DBTasks {
}
}.start();
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG,
- "Ignoring request to refresh all feeds: Refresh lock is locked");
+ Log.d(TAG, "Ignoring request to refresh all feeds: Refresh lock is locked");
}
}
@@ -223,8 +220,7 @@ public final class DBTasks {
* @param context Used for DB access.
*/
public static void refreshExpiredFeeds(final Context context) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Refreshing expired feeds");
+ Log.d(TAG, "Refreshing expired feeds");
new Thread() {
public void run() {
@@ -306,6 +302,7 @@ public final class DBTasks {
*/
public static void refreshFeed(Context context, Feed feed)
throws DownloadRequestException {
+ Log.d(TAG, "id " + feed.getId());
refreshFeed(context, feed, false);
}
@@ -428,25 +425,6 @@ public final class DBTasks {
}
}
- static int getNumberOfUndownloadedEpisodes(
- final List<FeedItem> queue, final List<FeedItem> unreadItems) {
- int counter = 0;
- for (FeedItem item : queue) {
- if (item.hasMedia() && !item.getMedia().isDownloaded()
- && !item.getMedia().isPlaying()
- && item.getFeed().getPreferences().getAutoDownload()) {
- counter++;
- }
- }
- for (FeedItem item : unreadItems) {
- if (item.hasMedia() && !item.getMedia().isDownloaded()
- && item.getFeed().getPreferences().getAutoDownload()) {
- counter++;
- }
- }
- return counter;
- }
-
/**
* Looks for undownloaded episodes in the queue or list of unread items and request a download if
* 1. Network is available
@@ -479,14 +457,6 @@ public final class DBTasks {
}
/**
- * Adds all FeedItem objects whose 'read'-attribute is false to the queue in a separate thread.
- */
- public static void enqueueAllNewItems(final Context context) {
- long[] unreadItems = DBReader.getUnreadItemIds(context);
- DBWriter.addQueueItem(context, unreadItems);
- }
-
- /**
* Returns the successor of a FeedItem in the queue.
*
* @param context Used for accessing the DB.
@@ -560,7 +530,7 @@ public final class DBTasks {
/**
* Adds new Feeds to the database or updates the old versions if they already exists. If another Feed with the same
* identifying value already exists, this method will add new FeedItems from the new Feed to the existing Feed.
- * These FeedItems will be marked as unread.
+ * These FeedItems will be marked as unread with the exception of the most recent FeedItem.
* <p/>
* This method can update multiple feeds at once. Submitting a feed twice in the same method call can result in undefined behavior.
* <p/>
@@ -586,17 +556,20 @@ public final class DBTasks {
final Feed savedFeed = searchFeedByIdentifyingValueOrID(context, adapter,
newFeed);
if (savedFeed == null) {
- if (BuildConfig.DEBUG)
- Log.d(TAG,
- "Found no existing Feed with title "
- + newFeed.getTitle() + ". Adding as new one."
- );
+ Log.d(TAG, "Found no existing Feed with title "
+ + newFeed.getTitle() + ". Adding as new one.");
+
// Add a new Feed
+ // all new feeds will have the most recent item marked as unplayed
+ FeedItem mostRecent = newFeed.getMostRecentItem();
+ if (mostRecent != null) {
+ mostRecent.setRead(false);
+ }
+
newFeedsList.add(newFeed);
resultFeeds[feedIdx] = newFeed;
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Feed with title " + newFeed.getTitle()
+ Log.d(TAG, "Feed with title " + newFeed.getTitle()
+ " already exists. Syncing new with existing one.");
Collections.sort(newFeed.getItems(), new FeedItemPubdateComparator());
@@ -604,21 +577,17 @@ public final class DBTasks {
final boolean markNewItemsAsUnread;
if (newFeed.getPageNr() == savedFeed.getPageNr()) {
if (savedFeed.compareWithOther(newFeed)) {
- if (BuildConfig.DEBUG)
- Log.d(TAG,
- "Feed has updated attribute values. Updating old feed's attributes");
+ Log.d(TAG, "Feed has updated attribute values. Updating old feed's attributes");
savedFeed.updateFromOther(newFeed);
}
markNewItemsAsUnread = true;
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "New feed has a higher page number. Merging without marking as unread");
+ Log.d(TAG, "New feed has a higher page number. Merging without marking as unread");
markNewItemsAsUnread = false;
savedFeed.setNextPageLink(newFeed.getNextPageLink());
}
if (savedFeed.getPreferences().compareWithOther(newFeed.getPreferences())) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Feed has updated preferences. Updating old feed's preferences");
+ Log.d(TAG, "Feed has updated preferences. Updating old feed's preferences");
savedFeed.getPreferences().updateFromOther(newFeed.getPreferences());
}
// Look for new or updated Items
@@ -630,6 +599,7 @@ public final class DBTasks {
// item is new
final int i = idx;
item.setFeed(savedFeed);
+ item.setAutoDownload(savedFeed.getPreferences().getAutoDownload());
savedFeed.getItems().add(i, item);
if (markNewItemsAsUnread) {
item.setRead(false);
@@ -641,6 +611,7 @@ public final class DBTasks {
// update attributes
savedFeed.setLastUpdate(newFeed.getLastUpdate());
savedFeed.setType(newFeed.getType());
+ savedFeed.setLastUpdateFailed(false);
updatedFeedsList.add(savedFeed);
resultFeeds[feedIdx] = savedFeed;
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java
index bd0cfee5b..fe5d0dfd3 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java
@@ -29,6 +29,7 @@ import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.asynctask.FlattrClickWorker;
import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.core.feed.Feed;
+import de.danoeh.antennapod.core.feed.FeedEvent;
import de.danoeh.antennapod.core.feed.FeedImage;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.FeedMedia;
@@ -353,30 +354,16 @@ public class DBWriter {
FeedItem item = null;
if (queue != null) {
- boolean queueModified = false;
- boolean unreadItemsModified = false;
-
if (!itemListContains(queue, itemId)) {
item = DBReader.getFeedItem(context, itemId);
if (item != null) {
queue.add(index, item);
- queueModified = true;
- if (!item.isRead()) {
- item.setRead(true);
- unreadItemsModified = true;
- }
+ adapter.setQueue(queue);
+ EventBus.getDefault().post(new QueueEvent(QueueEvent.Action.ADDED, item, index));
}
}
- if (queueModified) {
- adapter.setQueue(queue);
- EventBus.getDefault().post(new QueueEvent(QueueEvent.Action.ADDED, item, index));
- }
- if (unreadItemsModified && item != null) {
- adapter.setSingleFeedItem(item);
- EventDistributor.getInstance()
- .sendUnreadItemsUpdateBroadcast();
- }
}
+
adapter.close();
if (performAutoDownload) {
DBTasks.autodownloadUndownloadedItems(context);
@@ -417,21 +404,15 @@ public class DBWriter {
if (item != null) {
// add item to either front ot back of queue
- boolean addToFront = PreferenceManager.getDefaultSharedPreferences(context)
- .getBoolean(UserPreferences.PREF_QUEUE_ADD_TO_FRONT, false);
+ boolean addToFront = UserPreferences.enqueueAtFront();
if(addToFront){
queue.add(0, item);
- }else{
+ } else {
queue.add(item);
}
queueModified = true;
- if (!item.isRead()) {
- item.setRead(true);
- itemsToSave.add(item);
- unreadItemsModified = true;
- }
}
}
}
@@ -439,11 +420,6 @@ public class DBWriter {
adapter.setQueue(queue);
EventBus.getDefault().post(new QueueEvent(QueueEvent.Action.ADDED_ITEMS, queue));
}
- if (unreadItemsModified) {
- adapter.setFeedItemlist(itemsToSave);
- EventDistributor.getInstance()
- .sendUnreadItemsUpdateBroadcast();
- }
}
adapter.close();
DBTasks.autodownloadUndownloadedItems(context);
@@ -608,8 +584,7 @@ public class DBWriter {
adapter.setQueue(queue);
if (broadcastUpdate) {
- EventBus.getDefault().post(new QueueEvent(QueueEvent.Action.REMOVED, item));
- EventBus.getDefault().post(new QueueEvent(QueueEvent.Action.ADDED, item, to));
+ EventBus.getDefault().post(new QueueEvent(QueueEvent.Action.MOVED, item, to));
}
}
@@ -937,6 +912,26 @@ public class DBWriter {
}
/**
+ * Saves if a feed's last update failed
+ *
+ * @param lastUpdateFailed true if last update failed
+ */
+ public static Future<?> setFeedLastUpdateFailed(final Context context,
+ final long feedId,
+ final boolean lastUpdateFailed) {
+ return dbExec.submit(new Runnable() {
+
+ @Override
+ public void run() {
+ PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+ adapter.setFeedLastUpdateFailed(feedId, lastUpdateFailed);
+ adapter.close();
+ }
+ });
+ }
+
+ /**
* format an url for querying the database
* (postfix a / and apply percent-encoding)
*/
@@ -1040,4 +1035,52 @@ public class DBWriter {
}
});
}
+
+ /**
+ * Sets the 'auto_download'-attribute of specific FeedItem.
+ *
+ * @param context A context that is used for opening a database connection.
+ * @param feedItem FeedItem.
+ */
+ public static Future<?> setFeedItemAutoDownload(final Context context, final FeedItem feedItem,
+ final boolean autoDownload) {
+ Log.d(TAG, "FeedItem[id=" + feedItem.getId() + "] SET auto_download " + autoDownload);
+ return dbExec.submit(new Runnable() {
+
+ @Override
+ public void run() {
+ final PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+ adapter.setFeedItemAutoDownload(feedItem, autoDownload);
+ adapter.close();
+
+ EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast();
+ }
+ });
+
+ }
+
+ /**
+ * Set filter of the feed
+ *
+ * @param context Used for opening a database connection.
+ * @param feedId The feed's ID
+ * @param filterValues Values that represent properties to filter by
+ */
+ public static Future<?> setFeedItemsFilter(final Context context, final long feedId,
+ final List<String> filterValues) {
+ Log.d(TAG, "setFeedFilter");
+
+ return dbExec.submit(new Runnable() {
+ @Override
+ public void run() {
+ PodDBAdapter adapter = new PodDBAdapter(context);
+ adapter.open();
+ adapter.setFeedItemFilter(feedId, filterValues);
+ adapter.close();
+ EventBus.getDefault().post(new FeedEvent(FeedEvent.Action.FILTER_CHANGED, feedId));
+ }
+ });
+ }
+
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java
index f518a4f5f..4780098e0 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java
@@ -11,6 +11,7 @@ import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import java.util.Arrays;
@@ -26,8 +27,11 @@ import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.feed.FeedPreferences;
import de.danoeh.antennapod.core.service.download.DownloadStatus;
+import de.danoeh.antennapod.core.util.LongIntMap;
import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
+;
+
// TODO Remove media column from feeditem table
/**
@@ -149,6 +153,8 @@ public class PodDBAdapter {
public static final String KEY_PASSWORD = "password";
public static final String KEY_IS_PAGED = "is_paged";
public static final String KEY_NEXT_PAGE_LINK = "next_page_link";
+ public static final String KEY_HIDE = "hide";
+ public static final String KEY_LAST_UPDATE_FAILED = "last_update_failed";
// Table names
public static final String TABLE_NAME_FEEDS = "Feeds";
@@ -175,8 +181,9 @@ public class PodDBAdapter {
+ KEY_USERNAME + " TEXT,"
+ KEY_PASSWORD + " TEXT,"
+ KEY_IS_PAGED + " INTEGER DEFAULT 0,"
- + KEY_NEXT_PAGE_LINK + " TEXT)";
-
+ + KEY_NEXT_PAGE_LINK + " TEXT,"
+ + KEY_HIDE + " TEXT,"
+ + KEY_LAST_UPDATE_FAILED + " INTEGER DEFAULT 0)";
public static final String CREATE_TABLE_FEED_ITEMS = "CREATE TABLE "
+ TABLE_NAME_FEED_ITEMS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE
@@ -186,7 +193,8 @@ public class PodDBAdapter {
+ KEY_MEDIA + " INTEGER," + KEY_FEED + " INTEGER,"
+ KEY_HAS_CHAPTERS + " INTEGER," + KEY_ITEM_IDENTIFIER + " TEXT,"
+ KEY_FLATTR_STATUS + " INTEGER,"
- + KEY_IMAGE + " INTEGER)";
+ + KEY_IMAGE + " INTEGER,"
+ + KEY_AUTO_DOWNLOAD + " INTEGER)";
public static final String CREATE_TABLE_FEED_IMAGES = "CREATE TABLE "
+ TABLE_NAME_FEED_IMAGES + " (" + TABLE_PRIMARY_KEY + KEY_TITLE
@@ -200,7 +208,8 @@ public class PodDBAdapter {
+ " INTEGER," + KEY_SIZE + " INTEGER," + KEY_MIME_TYPE + " TEXT,"
+ KEY_PLAYBACK_COMPLETION_DATE + " INTEGER,"
+ KEY_FEEDITEM + " INTEGER,"
- + KEY_PLAYED_DURATION + " INTEGER)";
+ + KEY_PLAYED_DURATION + " INTEGER,"
+ + KEY_AUTO_DOWNLOAD + " INTEGER)";
public static final String CREATE_TABLE_DOWNLOAD_LOG = "CREATE TABLE "
+ TABLE_NAME_DOWNLOAD_LOG + " (" + TABLE_PRIMARY_KEY + KEY_FEEDFILE
@@ -218,6 +227,28 @@ public class PodDBAdapter {
+ " TEXT," + KEY_START + " INTEGER," + KEY_FEEDITEM + " INTEGER,"
+ KEY_LINK + " TEXT," + KEY_CHAPTER_TYPE + " INTEGER)";
+ // SQL Statements for creating indexes
+ public static final String CREATE_INDEX_FEEDITEMS_FEED = "CREATE INDEX "
+ + TABLE_NAME_FEED_ITEMS + "_" + KEY_FEED + " ON " + TABLE_NAME_FEED_ITEMS + " ("
+ + KEY_FEED + ")";
+
+ public static final String CREATE_INDEX_FEEDITEMS_IMAGE = "CREATE INDEX "
+ + TABLE_NAME_FEED_ITEMS + "_" + KEY_IMAGE + " ON " + TABLE_NAME_FEED_ITEMS + " ("
+ + KEY_IMAGE + ")";
+
+ public static final String CREATE_INDEX_QUEUE_FEEDITEM = "CREATE INDEX "
+ + TABLE_NAME_QUEUE + "_" + KEY_FEEDITEM + " ON " + TABLE_NAME_QUEUE + " ("
+ + KEY_FEEDITEM + ")";
+
+ public static final String CREATE_INDEX_FEEDMEDIA_FEEDITEM = "CREATE INDEX "
+ + TABLE_NAME_FEED_MEDIA + "_" + KEY_FEEDITEM + " ON " + TABLE_NAME_FEED_MEDIA + " ("
+ + KEY_FEEDITEM + ")";
+
+ public static final String CREATE_INDEX_SIMPLECHAPTERS_FEEDITEM = "CREATE INDEX "
+ + TABLE_NAME_SIMPLECHAPTERS + "_" + KEY_FEEDITEM + " ON " + TABLE_NAME_SIMPLECHAPTERS + " ("
+ + KEY_FEEDITEM + ")";
+
+
private SQLiteDatabase db;
private final Context context;
private PodDBHelper helper;
@@ -246,6 +277,8 @@ public class PodDBAdapter {
TABLE_NAME_FEEDS + "." + KEY_NEXT_PAGE_LINK,
TABLE_NAME_FEEDS + "." + KEY_USERNAME,
TABLE_NAME_FEEDS + "." + KEY_PASSWORD,
+ TABLE_NAME_FEEDS + "." + KEY_HIDE,
+ TABLE_NAME_FEEDS + "." + KEY_LAST_UPDATE_FAILED,
};
// column indices for FEED_SEL_STD
@@ -270,7 +303,6 @@ public class PodDBAdapter {
public static final int IDX_FEED_SEL_PREFERENCES_USERNAME = 18;
public static final int IDX_FEED_SEL_PREFERENCES_PASSWORD = 19;
-
/**
* Select all columns from the feeditems-table except description and
* content-encoded.
@@ -286,7 +318,9 @@ public class PodDBAdapter {
TABLE_NAME_FEED_ITEMS + "." + KEY_HAS_CHAPTERS,
TABLE_NAME_FEED_ITEMS + "." + KEY_ITEM_IDENTIFIER,
TABLE_NAME_FEED_ITEMS + "." + KEY_FLATTR_STATUS,
- TABLE_NAME_FEED_ITEMS + "." + KEY_IMAGE};
+ TABLE_NAME_FEED_ITEMS + "." + KEY_IMAGE,
+ TABLE_NAME_FEED_ITEMS + "." + KEY_AUTO_DOWNLOAD
+ };
/**
* Contains FEEDITEM_SEL_FI_SMALL as comma-separated list. Useful for raw queries.
@@ -400,17 +434,20 @@ public class PodDBAdapter {
values.put(KEY_FLATTR_STATUS, feed.getFlattrStatus().toLong());
values.put(KEY_IS_PAGED, feed.isPaged());
values.put(KEY_NEXT_PAGE_LINK, feed.getNextPageLink());
+ if(feed.getItemFilter() != null && feed.getItemFilter().getValues().length > 0) {
+ values.put(KEY_HIDE, StringUtils.join(feed.getItemFilter().getValues(), ","));
+ } else {
+ values.put(KEY_HIDE, "");
+ }
+ values.put(KEY_LAST_UPDATE_FAILED, feed.hasLastUpdateFailed());
if (feed.getId() == 0) {
// Create new entry
- if (BuildConfig.DEBUG)
- Log.d(this.toString(), "Inserting new Feed into db");
+ Log.d(this.toString(), "Inserting new Feed into db");
feed.setId(db.insert(TABLE_NAME_FEEDS, null, values));
} else {
- if (BuildConfig.DEBUG)
- Log.d(this.toString(), "Updating existing Feed in db");
+ Log.d(this.toString(), "Updating existing Feed in db");
db.update(TABLE_NAME_FEEDS, values, KEY_ID + "=?",
new String[]{String.valueOf(feed.getId())});
-
}
return feed.getId();
}
@@ -426,6 +463,13 @@ public class PodDBAdapter {
db.update(TABLE_NAME_FEEDS, values, KEY_ID + "=?", new String[]{String.valueOf(prefs.getFeedID())});
}
+ public void setFeedItemFilter(long feedId, List<String> filterValues) {
+ ContentValues values = new ContentValues();
+ values.put(KEY_HIDE, StringUtils.join(filterValues, ","));
+ Log.d(TAG, StringUtils.join(filterValues, ","));
+ db.update(TABLE_NAME_FEEDS, values, KEY_ID + "=?", new String[]{String.valueOf(feedId)});
+ }
+
/**
* Inserts or updates an image entry
*
@@ -696,6 +740,7 @@ public class PodDBAdapter {
values.put(KEY_HAS_CHAPTERS, item.getChapters() != null || item.hasChapters());
values.put(KEY_ITEM_IDENTIFIER, item.getItemIdentifier());
values.put(KEY_FLATTR_STATUS, item.getFlattrStatus().toLong());
+ values.put(KEY_AUTO_DOWNLOAD, item.getAutoDownload());
if (item.hasItemImage()) {
if (item.getImage().getId() == 0) {
setImage(item.getImage());
@@ -766,6 +811,13 @@ public class PodDBAdapter {
}
}
+ public void setFeedLastUpdateFailed(long feedId, boolean failed) {
+ final String sql = "UPDATE " + TABLE_NAME_FEEDS
+ + " SET " + KEY_LAST_UPDATE_FAILED+ "=" + (failed ? "1" : "0")
+ + " WHERE " + KEY_ID + "="+ feedId;
+ db.execSQL(sql);
+ }
+
/**
* Inserts or updates a download status.
*/
@@ -787,6 +839,13 @@ public class PodDBAdapter {
return status.getId();
}
+ public void setFeedItemAutoDownload(FeedItem feedItem, boolean autoDownload) {
+ ContentValues values = new ContentValues();
+ values.put(KEY_AUTO_DOWNLOAD, autoDownload);
+ db.update(TABLE_NAME_FEED_ITEMS, values, KEY_ID + "=?",
+ new String[] { String.valueOf(feedItem.getId()) } );
+ }
+
public long getDownloadLogSize() {
final String query = String.format("SELECT COUNT(%s) FROM %s", KEY_ID, TABLE_NAME_DOWNLOAD_LOG);
Cursor result = db.rawQuery(query, null);
@@ -977,6 +1036,14 @@ public class PodDBAdapter {
return c;
}
+ public final Cursor getDownloadLog(final int feedFileType, final long feedFileId) {
+ final String query = "SELECT * FROM " + TABLE_NAME_DOWNLOAD_LOG +
+ " WHERE " + KEY_FEEDFILE + "=" + feedFileId + " AND " + KEY_FEEDFILETYPE + "=" + feedFileType
+ + " ORDER BY " + KEY_ID + " DESC";
+ Cursor c = db.rawQuery(query, null);
+ return c;
+ }
+
public final Cursor getDownloadLogCursor(final int limit) {
Cursor c = db.query(TABLE_NAME_DOWNLOAD_LOG, null, null, null, null,
null, KEY_COMPLETION_DATE + " DESC LIMIT " + limit);
@@ -1021,11 +1088,43 @@ public class PodDBAdapter {
return c;
}
- public final Cursor getUnreadItemIdsCursor() {
- Cursor c = db.query(TABLE_NAME_FEED_ITEMS, new String[]{KEY_ID},
- KEY_READ + "=0", null, null, null, KEY_PUBDATE + " DESC");
- return c;
+ public final Cursor getNewItemIdsCursor() {
+ final String query = "SELECT " + TABLE_NAME_FEED_ITEMS + "." + KEY_ID
+ + " FROM " + TABLE_NAME_FEED_ITEMS
+ + " INNER JOIN " + TABLE_NAME_FEED_MEDIA + " ON "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + "="
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_FEEDITEM
+ + " LEFT OUTER JOIN " + TABLE_NAME_QUEUE + " ON "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + "="
+ + TABLE_NAME_QUEUE + "." + KEY_FEEDITEM
+ + " WHERE "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_READ + " = 0 AND " // unplayed
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_DOWNLOADED + " = 0 AND " // undownloaded
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_POSITION + " = 0 AND " // not partially played
+ + TABLE_NAME_QUEUE + "." + KEY_ID + " IS NULL"; // not in queue
+ return db.rawQuery(query, null);
+ }
+ /**
+ * Returns a cursor which contains all feed items that are considered new.
+ * The returned cursor uses the FEEDITEM_SEL_FI_SMALL selection.
+ */
+ public final Cursor getNewItemsCursor() {
+ final String query = "SELECT " + SEL_FI_SMALL_STR + " FROM " + TABLE_NAME_FEED_ITEMS
+ + " INNER JOIN " + TABLE_NAME_FEED_MEDIA + " ON "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + "="
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_FEEDITEM
+ + " LEFT OUTER JOIN " + TABLE_NAME_QUEUE + " ON "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + "="
+ + TABLE_NAME_QUEUE + "." + KEY_FEEDITEM
+ + " WHERE "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_READ + " = 0 AND " // unplayed
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_DOWNLOADED + " = 0 AND " // undownloaded
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_POSITION + " = 0 AND " // not partially played
+ + TABLE_NAME_QUEUE + "." + KEY_ID + " IS NULL" // not in queue
+ + " ORDER BY " + KEY_PUBDATE + " DESC";
+ Cursor c = db.rawQuery(query, null);
+ return c;
}
public final Cursor getRecentlyPublishedItemsCursor(int limit) {
@@ -1121,7 +1220,7 @@ public class PodDBAdapter {
}
public final Cursor getFeedItemCursor(final String id) {
- return getFeedItemCursor(new String[] { id });
+ return getFeedItemCursor(new String[]{id});
}
public final Cursor getFeedItemCursor(final String[] ids) {
@@ -1146,6 +1245,20 @@ public class PodDBAdapter {
return db.rawQuery(query, null);
}
+ public Cursor getImageAuthenticationCursor(final String imageUrl) {
+ final String query = "SELECT " + KEY_USERNAME + "," + KEY_PASSWORD + " FROM "
+ + TABLE_NAME_FEED_IMAGES + " INNER JOIN " + TABLE_NAME_FEEDS + " ON " +
+ TABLE_NAME_FEED_IMAGES + "." + KEY_ID + "=" + TABLE_NAME_FEEDS + "." + KEY_IMAGE + " WHERE "
+ + TABLE_NAME_FEED_IMAGES + "." + KEY_DOWNLOAD_URL + "='" + imageUrl + "' UNION SELECT "
+ + KEY_USERNAME + "," + KEY_PASSWORD + " FROM " + TABLE_NAME_FEED_IMAGES + " INNER JOIN "
+ + TABLE_NAME_FEED_ITEMS + " ON " + TABLE_NAME_FEED_IMAGES + "." + KEY_ID + "=" +
+ TABLE_NAME_FEED_ITEMS + "." + KEY_IMAGE + " INNER JOIN " + TABLE_NAME_FEEDS + " ON "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_FEED + "=" + TABLE_NAME_FEEDS + "." + KEY_ID + " WHERE "
+ + TABLE_NAME_FEED_IMAGES + "." + KEY_DOWNLOAD_URL + "='" + imageUrl + "'";
+ Log.d(TAG, "Query: " + query);
+ return db.rawQuery(query, null);
+ }
+
public int getQueueSize() {
final String query = String.format("SELECT COUNT(%s) FROM %s", KEY_ID, TABLE_NAME_QUEUE);
Cursor c = db.rawQuery(query, null);
@@ -1157,9 +1270,20 @@ public class PodDBAdapter {
return result;
}
- public final int getNumberOfUnreadItems() {
- final String query = "SELECT COUNT(DISTINCT " + KEY_ID + ") AS count FROM " + TABLE_NAME_FEED_ITEMS +
- " WHERE " + KEY_READ + " = 0";
+ public final int getNumberOfNewItems() {
+ final String query = "SELECT COUNT(" + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + ")"
+ +" FROM " + TABLE_NAME_FEED_ITEMS
+ + " LEFT JOIN " + TABLE_NAME_FEED_MEDIA + " ON "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + "="
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_FEEDITEM
+ + " LEFT JOIN " + TABLE_NAME_QUEUE + " ON "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + "="
+ + TABLE_NAME_QUEUE + "." + KEY_FEEDITEM
+ + " WHERE "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_READ + " = 0 AND " // unplayed
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_DOWNLOADED + " = 0 AND " // undownloaded
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_POSITION + " = 0 AND " // not partially played
+ + TABLE_NAME_QUEUE + "." + KEY_ID + " IS NULL"; // not in queue
Cursor c = db.rawQuery(query, null);
int result = 0;
if (c.moveToFirst()) {
@@ -1169,6 +1293,25 @@ public class PodDBAdapter {
return result;
}
+ public final LongIntMap getNumberOfUnreadFeedItems(long... feedIds) {
+ final String query = "SELECT " + KEY_FEED + ", COUNT(" + KEY_ID + ") AS count "
+ + " FROM " + TABLE_NAME_FEED_ITEMS
+ + " WHERE " + KEY_FEED + " IN (" + StringUtils.join(feedIds, ',') + ") "
+ + " AND " + KEY_READ + " = 0"
+ + " GROUP BY " + KEY_FEED;
+ Cursor c = db.rawQuery(query, null);
+ LongIntMap result = new LongIntMap(c.getCount());
+ if (c.moveToFirst()) {
+ do {
+ long feedId = c.getLong(0);
+ int count = c.getInt(1);
+ result.put(feedId, count);
+ } while(c.moveToNext());
+ }
+ c.close();
+ return result;
+ }
+
public final int getNumberOfDownloadedEpisodes() {
final String query = "SELECT COUNT(DISTINCT " + KEY_ID + ") AS count FROM " + TABLE_NAME_FEED_MEDIA +
" WHERE " + KEY_DOWNLOADED + " > 0";
@@ -1330,6 +1473,13 @@ public class PodDBAdapter {
db.execSQL(CREATE_TABLE_DOWNLOAD_LOG);
db.execSQL(CREATE_TABLE_QUEUE);
db.execSQL(CREATE_TABLE_SIMPLECHAPTERS);
+
+ db.execSQL(CREATE_INDEX_FEEDITEMS_FEED);
+ db.execSQL(CREATE_INDEX_FEEDITEMS_IMAGE);
+ db.execSQL(CREATE_INDEX_FEEDMEDIA_FEEDITEM);
+ db.execSQL(CREATE_INDEX_QUEUE_FEEDITEM);
+ db.execSQL(CREATE_INDEX_SIMPLECHAPTERS_FEEDITEM);
+
}
@Override
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java
index 6622eab73..b6df2dc85 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java
@@ -1,5 +1,7 @@
package de.danoeh.antennapod.core.util;
+import android.util.Log;
+
import org.apache.commons.lang3.StringUtils;
import java.text.ParsePosition;
@@ -11,45 +13,14 @@ import java.util.Locale;
* Parses several date formats.
*/
public class DateUtils {
- private static final String TAG = "DateUtils";
-
- private static final String[] RFC822DATES = {"dd MMM yy HH:mm:ss Z",
- "dd MMM yy HH:mm Z"};
-
- /**
- * RFC 3339 date format for UTC dates.
- */
- public static final String RFC3339UTC = "yyyy-MM-dd'T'HH:mm:ss'Z'";
-
- /**
- * RFC 3339 date format for localtime dates with offset.
- */
- public static final String RFC3339LOCAL = "yyyy-MM-dd'T'HH:mm:ssZ";
+
+ private static final String TAG = "DateUtils";
- public static final String ISO8601_SHORT = "yyyy-MM-dd";
-
- private static ThreadLocal<SimpleDateFormat> RFC822Formatter = new ThreadLocal<SimpleDateFormat>() {
- @Override
- protected SimpleDateFormat initialValue() {
- return new SimpleDateFormat("dd MMM yy HH:mm:ss Z", Locale.US);
- }
-
- };
-
- private static ThreadLocal<SimpleDateFormat> RFC3339Formatter = new ThreadLocal<SimpleDateFormat>() {
- @Override
- protected SimpleDateFormat initialValue() {
- return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
- }
-
- };
-
- public static Date parse(String date) {
- if(date == null) {
+ public static Date parse(final String input) {
+ if(input == null) {
throw new IllegalArgumentException("Date most not be null");
}
- date = date.replace('/', ' ');
- date = date.replace('-', ' ');
+ String date = input.replace('/', '-');
if(date.contains(".")) {
int start = date.indexOf('.');
int current = start+1;
@@ -75,15 +46,16 @@ public class DateUtils {
"dd MMM yy HH:mm:ss Z",
"dd MMM yy HH:mm Z",
"EEE, dd MMM yyyy HH:mm:ss Z",
+ "EEE, dd MMMM yyyy HH:mm:ss Z",
"EEEE, dd MMM yy HH:mm:ss Z",
"EEE MMM d HH:mm:ss yyyy",
- "yyyy MM dd'T'HH:mm:ss",
- "yyyy MM dd'T'HH:mm:ss.SSS",
- "yyyy MM dd'T'HH:mm:ss.SSS Z",
- "yyyy MM dd'T'HH:mm:ssZ",
- "yyyy MM dd'T'HH:mm:ss'Z'",
- "yyyy MM ddZ",
- "yyyy MM dd"
+ "yyyy-MM-dd'T'HH:mm:ss",
+ "yyyy-MM-dd'T'HH:mm:ss.SSS",
+ "yyyy-MM-dd'T'HH:mm:ss.SSS Z",
+ "yyyy-MM-dd'T'HH:mm:ssZ",
+ "yyyy-MM-dd'T'HH:mm:ss'Z'",
+ "yyyy-MM-ddZ",
+ "yyyy-MM-dd"
};
SimpleDateFormat parser = new SimpleDateFormat("", Locale.US);
parser.setLenient(false);
@@ -96,6 +68,8 @@ public class DateUtils {
return result;
}
}
+
+ Log.d(TAG, "Could not parse date string \"" + input + "\"");
return null;
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java b/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java
index 4c23b161b..029e7fe84 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java
@@ -1,11 +1,12 @@
package de.danoeh.antennapod.core.util;
-import de.danoeh.antennapod.core.feed.FeedItem;
-
import java.util.ArrayList;
import java.util.List;
+import de.danoeh.antennapod.core.feed.FeedItem;
+
public class EpisodeFilter {
+
private EpisodeFilter() {
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java b/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java
new file mode 100644
index 000000000..673c81235
--- /dev/null
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java
@@ -0,0 +1,240 @@
+package de.danoeh.antennapod.core.util;
+
+import java.util.Arrays;
+
+/**
+ * Fast and memory efficient int list
+ */
+public final class IntList {
+
+ private int[] values;
+ protected int size;
+
+ /**
+ * Constructs an empty instance with a default initial capacity.
+ */
+ public IntList() {
+ this(4);
+ }
+
+ /**
+ * Constructs an empty instance.
+ *
+ * @param initialCapacity {@code >= 0;} initial capacity of the list
+ */
+ public IntList(int initialCapacity) {
+ if(initialCapacity < 0) {
+ throw new IllegalArgumentException("initial capacity must be 0 or higher");
+ }
+ values = new int[initialCapacity];
+ size = 0;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+ for (int i = 0; i < size; i++) {
+ int value = values[i];
+ hashCode = 31 * hashCode + (int)(value ^ (value >>> 32));
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (! (other instanceof IntList)) {
+ return false;
+ }
+ IntList otherList = (IntList) other;
+ if (size != otherList.size) {
+ return false;
+ }
+ for (int i = 0; i < size; i++) {
+ if (values[i] != otherList.values[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer(size * 5 + 10);
+ sb.append("IntList{");
+ for (int i = 0; i < size; i++) {
+ if (i != 0) {
+ sb.append(", ");
+ }
+ sb.append(values[i]);
+ }
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Gets the number of elements in this list.
+ */
+ public int size() {
+ return size;
+ }
+
+ /**
+ * Gets the indicated value.
+ *
+ * @param n {@code >= 0, < size();} which element
+ * @return the indicated element's value
+ */
+ public int get(int n) {
+ if (n >= size) {
+ throw new IndexOutOfBoundsException("n >= size()");
+ } else if(n < 0) {
+ throw new IndexOutOfBoundsException("n < 0");
+ }
+ return values[n];
+ }
+
+ /**
+ * Sets the value at the given index.
+ *
+ * @param index the index at which to put the specified object.
+ * @param value the object to add.
+ * @return the previous element at the index.
+ */
+ public int set(int index, int value) {
+ if (index >= size) {
+ throw new IndexOutOfBoundsException("n >= size()");
+ } else if(index < 0) {
+ throw new IndexOutOfBoundsException("n < 0");
+ }
+ int result = values[index];
+ values[index] = value;
+ return result;
+ }
+
+ /**
+ * Adds an element to the end of the list. This will increase the
+ * list's capacity if necessary.
+ *
+ * @param value the value to add
+ */
+ public void add(int value) {
+ growIfNeeded();
+ values[size++] = value;
+ }
+
+ /**
+ * Inserts element into specified index, moving elements at and above
+ * that index up one. May not be used to insert at an index beyond the
+ * current size (that is, insertion as a last element is legal but
+ * no further).
+ *
+ * @param n {@code >= 0, <=size();} index of where to insert
+ * @param value value to insert
+ */
+ public void insert(int n, int value) {
+ if (n > size) {
+ throw new IndexOutOfBoundsException("n > size()");
+ } else if(n < 0) {
+ throw new IndexOutOfBoundsException("n < 0");
+ }
+
+ growIfNeeded();
+
+ System.arraycopy (values, n, values, n+1, size - n);
+ values[n] = value;
+ size++;
+ }
+
+ /**
+ * Removes value from this list.
+ *
+ * @param value value to remove
+ * return {@code true} if the value was removed, {@code false} otherwise
+ */
+ public boolean remove(int value) {
+ for (int i = 0; i < size; i++) {
+ if (values[i] == value) {
+ size--;
+ System.arraycopy(values, i+1, values, i, size-i);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Removes an element at a given index, shifting elements at greater
+ * indicies down one.
+ *
+ * @param index index of element to remove
+ */
+ public void removeIndex(int index) {
+ if (index >= size) {
+ throw new IndexOutOfBoundsException("n >= size()");
+ } else if(index < 0) {
+ throw new IndexOutOfBoundsException("n < 0");
+ }
+ size--;
+ System.arraycopy (values, index + 1, values, index, size - index);
+ }
+
+ /**
+ * Increases size of array if needed
+ */
+ private void growIfNeeded() {
+ if (size == values.length) {
+ // Resize.
+ int[] newArray = new int[size * 3 / 2 + 10];
+ System.arraycopy(values, 0, newArray, 0, size);
+ values = newArray;
+ }
+ }
+
+ /**
+ * Returns the index of the given value, or -1 if the value does not
+ * appear in the list.
+ *
+ * @param value value to find
+ * @return index of value or -1
+ */
+ public int indexOf(int value) {
+ for (int i = 0; i < size; i++) {
+ if (values[i] == value) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Removes all values from this list.
+ */
+ public void clear() {
+ values = new int[4];
+ size = 0;
+ }
+
+
+ /**
+ * Returns true if the given value is contained in the list
+ *
+ * @param value value to look for
+ * @return {@code true} if this list contains {@code value}, {@code false} otherwise
+ */
+ public boolean contains(int value) {
+ return indexOf(value) >= 0;
+ }
+
+ /**
+ * Returns an array with a copy of this list's values
+ *
+ * @return array with a copy of this list's values
+ */
+ public int[] toArray() {
+ return Arrays.copyOf(values, size);
+
+ }
+}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/LongIntMap.java b/core/src/main/java/de/danoeh/antennapod/core/util/LongIntMap.java
new file mode 100644
index 000000000..33fd252eb
--- /dev/null
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/LongIntMap.java
@@ -0,0 +1,252 @@
+package de.danoeh.antennapod.core.util;
+
+
+/**
+ * Fast and memory efficient long to long map
+ */
+public class LongIntMap {
+
+ private long[] keys;
+ private int[] values;
+ private int size;
+
+ /**
+ * Creates a new LongLongMap containing no mappings.
+ */
+ public LongIntMap() {
+ this(10);
+ }
+
+ /**
+ * Creates a new SparseLongArray containing no mappings that will not
+ * require any additional memory allocation to store the specified
+ * number of mappings. If you supply an initial capacity of 0, the
+ * sparse array will be initialized with a light-weight representation
+ * not requiring any additional array allocations.
+ */
+ public LongIntMap(int initialCapacity) {
+ if(initialCapacity < 0) {
+ throw new IllegalArgumentException("initial capacity must be 0 or higher");
+ }
+ keys = new long[initialCapacity];
+ values = new int[initialCapacity];
+ size = 0;
+ }
+
+ /**
+ * Increases size of array if needed
+ */
+ private void growIfNeeded() {
+ if (size == keys.length) {
+ // Resize.
+ long[] newKeysArray = new long[size * 3 / 2 + 10];
+ int[] newValuesArray = new int[size * 3 / 2 + 10];
+ System.arraycopy(keys, 0, newKeysArray, 0, size);
+ System.arraycopy(values, 0, newValuesArray, 0, size);
+ keys = newKeysArray;
+ values = newValuesArray;
+ }
+ }
+
+ /**
+ * Gets the long mapped from the specified key, or <code>0</code>
+ * if no such mapping has been made.
+ */
+ public int get(long key) {
+ return get(key, 0);
+ }
+
+ /**
+ * Gets the long mapped from the specified key, or the specified value
+ * if no such mapping has been made.
+ */
+ public int get(long key, int valueIfKeyNotFound) {
+ int index = indexOfKey(key);
+ if(index >= 0) {
+ return values[index];
+ } else {
+ return valueIfKeyNotFound;
+ }
+ }
+
+ /**
+ * Removes the mapping from the specified key, if there was any.
+ */
+ public boolean delete(long key) {
+ int index = indexOfKey(key);
+
+ if (index >= 0) {
+ removeAt(index);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Removes the mapping at the given index.
+ */
+ public void removeAt(int index) {
+ System.arraycopy(keys, index + 1, keys, index, size - (index + 1));
+ System.arraycopy(values, index + 1, values, index, size - (index + 1));
+ size--;
+ }
+
+ /**
+ * Adds a mapping from the specified key to the specified value,
+ * replacing the previous mapping from the specified key if there
+ * was one.
+ */
+ public void put(long key, int value) {
+ int index = indexOfKey(key);
+
+ if (index >= 0) {
+ values[index] = value;
+ } else {
+ growIfNeeded();
+ keys[size] = key;
+ values[size] = value;
+ size++;
+ }
+ }
+
+ /**
+ * Returns the number of key-value mappings that this SparseIntArray
+ * currently stores.
+ */
+ public int size() {
+ return size;
+ }
+
+ /**
+ * Given an index in the range <code>0...size()-1</code>, returns
+ * the key from the <code>index</code>th key-value mapping that this
+ * SparseLongArray stores.
+ *
+ * <p>The keys corresponding to indices in ascending order are guaranteed to
+ * be in ascending order, e.g., <code>keyAt(0)</code> will return the
+ * smallest key and <code>keyAt(size()-1)</code> will return the largest
+ * key.</p>
+ */
+ public long keyAt(int index) {
+ if (index >= size) {
+ throw new IndexOutOfBoundsException("n >= size()");
+ } else if(index < 0) {
+ throw new IndexOutOfBoundsException("n < 0");
+ }
+ return keys[index];
+ }
+
+ /**
+ * Given an index in the range <code>0...size()-1</code>, returns
+ * the value from the <code>index</code>th key-value mapping that this
+ * SparseLongArray stores.
+ *
+ * <p>The values corresponding to indices in ascending order are guaranteed
+ * to be associated with keys in ascending order, e.g.,
+ * <code>valueAt(0)</code> will return the value associated with the
+ * smallest key and <code>valueAt(size()-1)</code> will return the value
+ * associated with the largest key.</p>
+ */
+ public int valueAt(int index) {
+ if (index >= size) {
+ throw new IndexOutOfBoundsException("n >= size()");
+ } else if(index < 0) {
+ throw new IndexOutOfBoundsException("n < 0");
+ }
+ return values[index];
+ }
+
+ /**
+ * Returns the index for which {@link #keyAt} would return the
+ * specified key, or a negative number if the specified
+ * key is not mapped.
+ */
+ public int indexOfKey(long key) {
+ for(int i=0; i < size; i++) {
+ if(keys[i] == key) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns an index for which {@link #valueAt} would return the
+ * specified key, or a negative number if no keys map to the
+ * specified value.
+ * Beware that this is a linear search, unlike lookups by key,
+ * and that multiple keys can map to the same value and this will
+ * find only one of them.
+ */
+ public int indexOfValue(long value) {
+ for (int i = 0; i < size; i++) {
+ if (values[i] == value) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Removes all key-value mappings from this SparseIntArray.
+ */
+ public void clear() {
+ keys = new long[10];
+ values = new int[10];
+ size = 0;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (! (other instanceof LongIntMap)) {
+ return false;
+ }
+ LongIntMap otherMap = (LongIntMap) other;
+ if (size != otherMap.size) {
+ return false;
+ }
+ for (int i = 0; i < size; i++) {
+ if (keys[i] != otherMap.keys[i] ||
+ values[i] != otherMap.values[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+ for (int i = 0; i < size; i++) {
+ long value = values[i];
+ hashCode = 31 * hashCode + (int)(value ^ (value >>> 32));
+ }
+ return hashCode;
+ }
+
+ @Override
+ public String toString() {
+ if (size() <= 0) {
+ return "LongLongMap{}";
+ }
+
+ StringBuilder buffer = new StringBuilder(size * 28);
+ buffer.append("LongLongMap{");
+ for (int i=0; i < size; i++) {
+ if (i > 0) {
+ buffer.append(", ");
+ }
+ long key = keyAt(i);
+ buffer.append(key);
+ buffer.append('=');
+ long value = valueAt(i);
+ buffer.append(value);
+ }
+ buffer.append('}');
+ return buffer.toString();
+ }
+}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/LongList.java b/core/src/main/java/de/danoeh/antennapod/core/util/LongList.java
index f5d0cab0c..8934f3272 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/LongList.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/LongList.java
@@ -32,7 +32,6 @@ public final class LongList {
@Override
public int hashCode() {
- Arrays.hashCode(values);
int hashCode = 1;
for (int i = 0; i < size; i++) {
long value = values[i];
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java
index b321536a3..3a349e221 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java
@@ -6,12 +6,13 @@ import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.util.Log;
-import de.danoeh.antennapod.core.BuildConfig;
-import de.danoeh.antennapod.core.preferences.UserPreferences;
import java.util.Arrays;
import java.util.List;
+import de.danoeh.antennapod.core.BuildConfig;
+import de.danoeh.antennapod.core.preferences.UserPreferences;
+
public class NetworkUtils {
private static final String TAG = "NetworkUtils";
@@ -66,4 +67,18 @@ public class NetworkUtils {
NetworkInfo info = cm.getActiveNetworkInfo();
return info != null && info.isConnected();
}
+
+ public static boolean isDownloadAllowed(Context context) {
+ return UserPreferences.isAllowMobileUpdate() || NetworkUtils.connectedToWifi(context);
+ }
+
+ public static boolean connectedToWifi(Context context) {
+ ConnectivityManager connManager = (ConnectivityManager) context
+ .getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo mWifi = connManager
+ .getNetworkInfo(ConnectivityManager.TYPE_WIFI);
+
+ return mWifi.isConnected();
+ }
+
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java
index 90caad946..50792ae26 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java
@@ -26,7 +26,6 @@ import java.util.EnumSet;
import java.util.List;
import java.util.TimeZone;
-import de.danoeh.antennapod.core.BuildConfig;
import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.asynctask.FlattrTokenFetcher;
@@ -65,18 +64,15 @@ public class FlattrUtils {
private static AccessToken retrieveToken() {
if (cachedToken == null) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Retrieving access token");
+ Log.d(TAG, "Retrieving access token");
String token = PreferenceManager.getDefaultSharedPreferences(
ClientConfig.applicationCallbacks.getApplicationInstance())
.getString(PREF_ACCESS_TOKEN, null);
if (token != null) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Found access token. Caching.");
+ Log.d(TAG, "Found access token. Caching.");
cachedToken = new AccessToken(token);
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "No access token found");
+ Log.d(TAG, "No access token found");
return null;
}
}
@@ -97,8 +93,7 @@ public class FlattrUtils {
}
public static void storeToken(AccessToken token) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Storing token");
+ Log.d(TAG, "Storing token");
SharedPreferences.Editor editor = PreferenceManager
.getDefaultSharedPreferences(ClientConfig.applicationCallbacks.getApplicationInstance()).edit();
if (token != null) {
@@ -111,8 +106,7 @@ public class FlattrUtils {
}
public static void deleteToken() {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Deleting flattr token");
+ Log.d(TAG, "Deleting flattr token");
storeToken(null);
}
@@ -169,15 +163,11 @@ public class FlattrUtils {
}
}
- if (BuildConfig.DEBUG) {
- Log.d(TAG, "Got my flattrs list of length " + Integer.toString(myFlattrs.size()) + " comparison date" + firstOfMonthDate);
-
- for (Flattr fl : myFlattrs) {
- Thing thing = fl.getThing();
- Log.d(TAG, "Flattr thing: " + fl.getThingId() + " name: " + thing.getTitle() + " url: " + thing.getUrl() + " on: " + fl.getCreated());
- }
+ Log.d(TAG, "Got my flattrs list of length " + Integer.toString(myFlattrs.size()) + " comparison date" + firstOfMonthDate);
+ for (Flattr fl : myFlattrs) {
+ Thing thing = fl.getThing();
+ Log.d(TAG, "Flattr thing: " + fl.getThingId() + " name: " + thing.getTitle() + " url: " + thing.getUrl() + " on: " + fl.getCreated());
}
-
} else {
Log.e(TAG, "retrieveFlattrdThings was called with null access token");
}
@@ -191,8 +181,7 @@ public class FlattrUtils {
}
public static void revokeAccessToken(Context context) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Revoking access token");
+ Log.d(TAG, "Revoking access token");
deleteToken();
FlattrServiceCreator.deleteFlattrService();
showRevokeDialog(context);
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/gui/UndoBarController.java b/core/src/main/java/de/danoeh/antennapod/core/util/gui/UndoBarController.java
index 23d8cf7c7..26c712af3 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/gui/UndoBarController.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/gui/UndoBarController.java
@@ -88,7 +88,8 @@ public class UndoBarController<T> {
}
public void close() {
- mHideHandler.post(mHideRunnable);
+ hideUndoBar(true);
+ mUndoListener.onHide(mUndoToken);
}
public void hideUndoBar(boolean immediate) {
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java
index 17c752bb6..a0d12d3e7 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java
@@ -32,13 +32,11 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import de.danoeh.antennapod.core.BuildConfig;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.feed.Chapter;
import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.feed.MediaType;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
-import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer;
import de.danoeh.antennapod.core.service.playback.PlayerStatus;
@@ -174,8 +172,7 @@ public abstract class PlaybackController {
* as the arguments of the launch intent.
*/
private void bindToService() {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Trying to connect to service");
+ Log.d(TAG, "Trying to connect to service");
AsyncTask<Void, Void, Intent> intentLoader = new AsyncTask<Void, Void, Intent>() {
@Override
protected Intent doInBackground(Void... voids) {
@@ -211,8 +208,7 @@ public abstract class PlaybackController {
* played media or null if no last played media could be found.
*/
private Intent getPlayLastPlayedMediaIntent() {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Trying to restore last played media");
+ Log.d(TAG, "Trying to restore last played media");
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(activity.getApplicationContext());
long currentlyPlayingMedia = PlaybackPreferences
@@ -240,8 +236,7 @@ public abstract class PlaybackController {
return serviceIntent;
}
}
- if (BuildConfig.DEBUG)
- Log.d(TAG, "No last played media found");
+ Log.d(TAG, "No last played media found");
return null;
}
@@ -253,8 +248,7 @@ public abstract class PlaybackController {
|| (positionObserverFuture != null && positionObserverFuture
.isDone()) || positionObserverFuture == null) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Setting up position observer");
+ Log.d(TAG, "Setting up position observer");
positionObserver = new MediaPositionObserver();
positionObserverFuture = schedExecutor.scheduleWithFixedDelay(
positionObserver, MediaPositionObserver.WAITING_INTERVALL,
@@ -266,8 +260,7 @@ public abstract class PlaybackController {
private void cancelPositionObserver() {
if (positionObserverFuture != null) {
boolean result = positionObserverFuture.cancel(true);
- if (BuildConfig.DEBUG)
- Log.d(TAG, "PositionObserver cancelled. Result: " + result);
+ Log.d(TAG, "PositionObserver cancelled. Result: " + result);
}
}
@@ -295,8 +288,7 @@ public abstract class PlaybackController {
protected BroadcastReceiver statusUpdate = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Received statusUpdate Intent.");
+ Log.d(TAG, "Received statusUpdate Intent.");
if (isConnectedToPlaybackService()) {
PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo();
status = info.playerStatus;
@@ -353,8 +345,7 @@ public abstract class PlaybackController {
}
} else {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Bad arguments. Won't handle intent");
+ Log.d(TAG, "Bad arguments. Won't handle intent");
}
} else {
bindToService();
@@ -425,6 +416,7 @@ public abstract class PlaybackController {
pauseResource = R.drawable.ic_av_pause_circle_outline_80dp;
}
+ Log.d(TAG, "status: " + status.toString());
switch (status) {
case ERROR:
@@ -470,6 +462,7 @@ public abstract class PlaybackController {
updatePlayButtonAppearance(playResource, playText);
break;
case SEEKING:
+ onPositionObserverUpdate();
postStatusMsg(R.string.player_seeking_msg);
break;
case INITIALIZED:
@@ -505,8 +498,7 @@ public abstract class PlaybackController {
* information has to be refreshed
*/
void queryService() {
- if (BuildConfig.DEBUG)
- Log.d(TAG, "Querying service info");
+ Log.d(TAG, "Querying service info");
if (playbackService != null) {
status = playbackService.getStatus();
media = playbackService.getPlayable();
@@ -614,28 +606,6 @@ public abstract class PlaybackController {
};
}
- public OnClickListener newOnRevButtonClickListener() {
- return new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (status == PlayerStatus.PLAYING) {
- playbackService.seekDelta(-UserPreferences.getSeekDeltaMs());
- }
- }
- };
- }
-
- public OnClickListener newOnFFButtonClickListener() {
- return new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (status == PlayerStatus.PLAYING) {
- playbackService.seekDelta(UserPreferences.getSeekDeltaMs());
- }
- }
- };
- }
-
public boolean serviceAvailable() {
return playbackService != null;
}
diff --git a/core/src/main/res/drawable-hdpi/ic_feed_grey600_24dp.png b/core/src/main/res/drawable-hdpi/ic_feed_grey600_24dp.png
index 46be3e14e..0c3bb0757 100755
--- a/core/src/main/res/drawable-hdpi/ic_feed_grey600_24dp.png
+++ b/core/src/main/res/drawable-hdpi/ic_feed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-hdpi/ic_feed_white_24dp.png b/core/src/main/res/drawable-hdpi/ic_feed_white_24dp.png
index 3d57127f5..667300129 100755
--- a/core/src/main/res/drawable-hdpi/ic_feed_white_24dp.png
+++ b/core/src/main/res/drawable-hdpi/ic_feed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-hdpi/ic_filter_grey600_24dp.png b/core/src/main/res/drawable-hdpi/ic_filter_grey600_24dp.png
new file mode 100644
index 000000000..83c564377
--- /dev/null
+++ b/core/src/main/res/drawable-hdpi/ic_filter_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-hdpi/ic_filter_white_24dp.png b/core/src/main/res/drawable-hdpi/ic_filter_white_24dp.png
new file mode 100644
index 000000000..e3517a57d
--- /dev/null
+++ b/core/src/main/res/drawable-hdpi/ic_filter_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-hdpi/ic_lock_closed_grey600_24dp.png b/core/src/main/res/drawable-hdpi/ic_lock_closed_grey600_24dp.png
new file mode 100644
index 000000000..b6dba1002
--- /dev/null
+++ b/core/src/main/res/drawable-hdpi/ic_lock_closed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-hdpi/ic_lock_closed_white_24dp.png b/core/src/main/res/drawable-hdpi/ic_lock_closed_white_24dp.png
new file mode 100644
index 000000000..5c60ab08a
--- /dev/null
+++ b/core/src/main/res/drawable-hdpi/ic_lock_closed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-hdpi/ic_lock_open_grey600_24dp.png b/core/src/main/res/drawable-hdpi/ic_lock_open_grey600_24dp.png
new file mode 100644
index 000000000..a99e9f2b6
--- /dev/null
+++ b/core/src/main/res/drawable-hdpi/ic_lock_open_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-hdpi/ic_lock_open_white_24dp.png b/core/src/main/res/drawable-hdpi/ic_lock_open_white_24dp.png
new file mode 100644
index 000000000..61c623ce2
--- /dev/null
+++ b/core/src/main/res/drawable-hdpi/ic_lock_open_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-mdpi/ic_feed_grey600_24dp.png b/core/src/main/res/drawable-mdpi/ic_feed_grey600_24dp.png
index 79f082610..d46b325d8 100755
--- a/core/src/main/res/drawable-mdpi/ic_feed_grey600_24dp.png
+++ b/core/src/main/res/drawable-mdpi/ic_feed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-mdpi/ic_feed_white_24dp.png b/core/src/main/res/drawable-mdpi/ic_feed_white_24dp.png
index 15a4b16bf..ac94476c2 100755
--- a/core/src/main/res/drawable-mdpi/ic_feed_white_24dp.png
+++ b/core/src/main/res/drawable-mdpi/ic_feed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-mdpi/ic_filter_grey600_24dp.png b/core/src/main/res/drawable-mdpi/ic_filter_grey600_24dp.png
new file mode 100644
index 000000000..e1e55d72b
--- /dev/null
+++ b/core/src/main/res/drawable-mdpi/ic_filter_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-mdpi/ic_filter_white_24dp.png b/core/src/main/res/drawable-mdpi/ic_filter_white_24dp.png
new file mode 100644
index 000000000..7d72e7562
--- /dev/null
+++ b/core/src/main/res/drawable-mdpi/ic_filter_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-mdpi/ic_lock_closed_grey600_24dp.png b/core/src/main/res/drawable-mdpi/ic_lock_closed_grey600_24dp.png
new file mode 100644
index 000000000..f1627ce34
--- /dev/null
+++ b/core/src/main/res/drawable-mdpi/ic_lock_closed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-mdpi/ic_lock_closed_white_24dp.png b/core/src/main/res/drawable-mdpi/ic_lock_closed_white_24dp.png
new file mode 100644
index 000000000..8f18d11e6
--- /dev/null
+++ b/core/src/main/res/drawable-mdpi/ic_lock_closed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-mdpi/ic_lock_open_grey600_24dp.png b/core/src/main/res/drawable-mdpi/ic_lock_open_grey600_24dp.png
new file mode 100644
index 000000000..ada8d3be4
--- /dev/null
+++ b/core/src/main/res/drawable-mdpi/ic_lock_open_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-mdpi/ic_lock_open_white_24dp.png b/core/src/main/res/drawable-mdpi/ic_lock_open_white_24dp.png
new file mode 100644
index 000000000..72d01c406
--- /dev/null
+++ b/core/src/main/res/drawable-mdpi/ic_lock_open_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xhdpi/ic_feed_grey600_24dp.png b/core/src/main/res/drawable-xhdpi/ic_feed_grey600_24dp.png
index 5cb0262ee..b25d64863 100755
--- a/core/src/main/res/drawable-xhdpi/ic_feed_grey600_24dp.png
+++ b/core/src/main/res/drawable-xhdpi/ic_feed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xhdpi/ic_feed_white_24dp.png b/core/src/main/res/drawable-xhdpi/ic_feed_white_24dp.png
index 5f34b0492..3c3e74c1d 100755
--- a/core/src/main/res/drawable-xhdpi/ic_feed_white_24dp.png
+++ b/core/src/main/res/drawable-xhdpi/ic_feed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xhdpi/ic_filter_grey600_24dp.png b/core/src/main/res/drawable-xhdpi/ic_filter_grey600_24dp.png
new file mode 100644
index 000000000..fdbb8eb4e
--- /dev/null
+++ b/core/src/main/res/drawable-xhdpi/ic_filter_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xhdpi/ic_filter_white_24dp.png b/core/src/main/res/drawable-xhdpi/ic_filter_white_24dp.png
new file mode 100644
index 000000000..7e14f7fbf
--- /dev/null
+++ b/core/src/main/res/drawable-xhdpi/ic_filter_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xhdpi/ic_lock_closed_grey600_24dp.png b/core/src/main/res/drawable-xhdpi/ic_lock_closed_grey600_24dp.png
new file mode 100644
index 000000000..ca35f6d0a
--- /dev/null
+++ b/core/src/main/res/drawable-xhdpi/ic_lock_closed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xhdpi/ic_lock_closed_white_24dp.png b/core/src/main/res/drawable-xhdpi/ic_lock_closed_white_24dp.png
new file mode 100644
index 000000000..01fb55ca1
--- /dev/null
+++ b/core/src/main/res/drawable-xhdpi/ic_lock_closed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xhdpi/ic_lock_open_grey600_24dp.png b/core/src/main/res/drawable-xhdpi/ic_lock_open_grey600_24dp.png
new file mode 100644
index 000000000..11d9a4b8b
--- /dev/null
+++ b/core/src/main/res/drawable-xhdpi/ic_lock_open_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xhdpi/ic_lock_open_white_24dp.png b/core/src/main/res/drawable-xhdpi/ic_lock_open_white_24dp.png
new file mode 100644
index 000000000..01ca4b56c
--- /dev/null
+++ b/core/src/main/res/drawable-xhdpi/ic_lock_open_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxhdpi/ic_feed_grey600_24dp.png b/core/src/main/res/drawable-xxhdpi/ic_feed_grey600_24dp.png
index 01ef2ee4d..aacf24d28 100755
--- a/core/src/main/res/drawable-xxhdpi/ic_feed_grey600_24dp.png
+++ b/core/src/main/res/drawable-xxhdpi/ic_feed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxhdpi/ic_feed_white_24dp.png b/core/src/main/res/drawable-xxhdpi/ic_feed_white_24dp.png
index 6dd465852..625dbaa1f 100755
--- a/core/src/main/res/drawable-xxhdpi/ic_feed_white_24dp.png
+++ b/core/src/main/res/drawable-xxhdpi/ic_feed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxhdpi/ic_filter_grey600_24dp.png b/core/src/main/res/drawable-xxhdpi/ic_filter_grey600_24dp.png
new file mode 100644
index 000000000..43ec90ea5
--- /dev/null
+++ b/core/src/main/res/drawable-xxhdpi/ic_filter_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxhdpi/ic_filter_white_24dp.png b/core/src/main/res/drawable-xxhdpi/ic_filter_white_24dp.png
new file mode 100644
index 000000000..d3923efee
--- /dev/null
+++ b/core/src/main/res/drawable-xxhdpi/ic_filter_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxhdpi/ic_lock_closed_grey600_24dp.png b/core/src/main/res/drawable-xxhdpi/ic_lock_closed_grey600_24dp.png
new file mode 100644
index 000000000..311a7fa13
--- /dev/null
+++ b/core/src/main/res/drawable-xxhdpi/ic_lock_closed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxhdpi/ic_lock_closed_white_24dp.png b/core/src/main/res/drawable-xxhdpi/ic_lock_closed_white_24dp.png
new file mode 100644
index 000000000..39a163843
--- /dev/null
+++ b/core/src/main/res/drawable-xxhdpi/ic_lock_closed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxhdpi/ic_lock_open_grey600_24dp.png b/core/src/main/res/drawable-xxhdpi/ic_lock_open_grey600_24dp.png
new file mode 100644
index 000000000..c0552d564
--- /dev/null
+++ b/core/src/main/res/drawable-xxhdpi/ic_lock_open_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxhdpi/ic_lock_open_white_24dp.png b/core/src/main/res/drawable-xxhdpi/ic_lock_open_white_24dp.png
new file mode 100644
index 000000000..46852d54f
--- /dev/null
+++ b/core/src/main/res/drawable-xxhdpi/ic_lock_open_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxxhdpi/ic_filter_grey600_24dp.png b/core/src/main/res/drawable-xxxhdpi/ic_filter_grey600_24dp.png
new file mode 100644
index 000000000..5d14b5b25
--- /dev/null
+++ b/core/src/main/res/drawable-xxxhdpi/ic_filter_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxxhdpi/ic_filter_white_24dp.png b/core/src/main/res/drawable-xxxhdpi/ic_filter_white_24dp.png
new file mode 100644
index 000000000..e8b865e4a
--- /dev/null
+++ b/core/src/main/res/drawable-xxxhdpi/ic_filter_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxxhdpi/ic_lock_closed_grey600_24dp.png b/core/src/main/res/drawable-xxxhdpi/ic_lock_closed_grey600_24dp.png
new file mode 100644
index 000000000..e41d5b9ee
--- /dev/null
+++ b/core/src/main/res/drawable-xxxhdpi/ic_lock_closed_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxxhdpi/ic_lock_closed_white_24dp.png b/core/src/main/res/drawable-xxxhdpi/ic_lock_closed_white_24dp.png
new file mode 100644
index 000000000..2376b7334
--- /dev/null
+++ b/core/src/main/res/drawable-xxxhdpi/ic_lock_closed_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxxhdpi/ic_lock_open_grey600_24dp.png b/core/src/main/res/drawable-xxxhdpi/ic_lock_open_grey600_24dp.png
new file mode 100644
index 000000000..c281784dd
--- /dev/null
+++ b/core/src/main/res/drawable-xxxhdpi/ic_lock_open_grey600_24dp.png
Binary files differ
diff --git a/core/src/main/res/drawable-xxxhdpi/ic_lock_open_white_24dp.png b/core/src/main/res/drawable-xxxhdpi/ic_lock_open_white_24dp.png
new file mode 100644
index 000000000..25ea3ab99
--- /dev/null
+++ b/core/src/main/res/drawable-xxxhdpi/ic_lock_open_white_24dp.png
Binary files differ
diff --git a/core/src/main/res/values-az/strings.xml b/core/src/main/res/values-az/strings.xml
index 9640412c1..b52ecf4a4 100644
--- a/core/src/main/res/values-az/strings.xml
+++ b/core/src/main/res/values-az/strings.xml
@@ -76,7 +76,7 @@
<string name="download_error_connection_error">Əlaqə xətasi</string>
<string name="download_error_unknown_host">Naməlum xost</string>
<string name="cancel_all_downloads_label">Yükləmələrin hamısını ləğv et</string>
- <string name="download_cancelled_msg">Yükləmə ləğv olundu</string>
+ <string name="download_canceled_msg">Yükləmə ləğv olundu</string>
<string name="download_report_title">Yükləmə başa çatdı</string>
<string name="download_error_malformed_url">Yanlış URL</string>
<string name="download_error_io_error">IO xətasi</string>
diff --git a/core/src/main/res/values-ca/strings.xml b/core/src/main/res/values-ca/strings.xml
index 0fe3ae415..be7a73e6d 100644
--- a/core/src/main/res/values-ca/strings.xml
+++ b/core/src/main/res/values-ca/strings.xml
@@ -108,7 +108,7 @@
<string name="download_error_unknown_host">Amfitrió desconegut</string>
<string name="download_error_unauthorized">Error d\'autenticació</string>
<string name="cancel_all_downloads_label">Cancel·la totes les baixades</string>
- <string name="download_cancelled_msg">S\'ha cancel·lat la baixada</string>
+ <string name="download_canceled_msg">S\'ha cancel·lat la baixada</string>
<string name="download_report_title">Baixades completades</string>
<string name="download_error_malformed_url">URL mal formatada</string>
<string name="download_error_io_error">Error d\'E/S</string>
diff --git a/core/src/main/res/values-cs-rCZ/strings.xml b/core/src/main/res/values-cs-rCZ/strings.xml
index a67a6d10b..661faefbe 100644
--- a/core/src/main/res/values-cs-rCZ/strings.xml
+++ b/core/src/main/res/values-cs-rCZ/strings.xml
@@ -108,7 +108,7 @@
<string name="download_error_unknown_host">Neznámý host</string>
<string name="download_error_unauthorized">Chyba přihlášení</string>
<string name="cancel_all_downloads_label">Zrušit všechna stahování</string>
- <string name="download_cancelled_msg">Stahování zrušeno</string>
+ <string name="download_canceled_msg">Stahování zrušeno</string>
<string name="download_report_title">Všechna stahování dokončena</string>
<string name="download_error_malformed_url">Chybné URL</string>
<string name="download_error_io_error">IO chyba</string>
diff --git a/core/src/main/res/values-da/strings.xml b/core/src/main/res/values-da/strings.xml
index d31c65614..ba7fafca6 100644
--- a/core/src/main/res/values-da/strings.xml
+++ b/core/src/main/res/values-da/strings.xml
@@ -108,7 +108,7 @@
<string name="download_error_unknown_host">Ukendt vært</string>
<string name="download_error_unauthorized">Godkendelses fejl</string>
<string name="cancel_all_downloads_label">Annuller alle downloads</string>
- <string name="download_cancelled_msg">Download afbrudt</string>
+ <string name="download_canceled_msg">Download afbrudt</string>
<string name="download_report_title">Downloads afsluttet</string>
<string name="download_error_malformed_url">Misdannet URL</string>
<string name="download_error_io_error">IO fejl</string>
diff --git a/core/src/main/res/values-de/strings.xml b/core/src/main/res/values-de/strings.xml
index 1f1b519ab..f2d0a66ad 100644
--- a/core/src/main/res/values-de/strings.xml
+++ b/core/src/main/res/values-de/strings.xml
@@ -112,7 +112,7 @@
<string name="download_error_unknown_host">Unbekannter Host</string>
<string name="download_error_unauthorized">Authentifizierungsfehler</string>
<string name="cancel_all_downloads_label">Alle Downloads abbrechen</string>
- <string name="download_cancelled_msg">Download abgebrochen</string>
+ <string name="download_canceled_msg">Download abgebrochen</string>
<string name="download_report_title">Download abgeschlossen</string>
<string name="download_error_malformed_url">Fehler in URL</string>
<string name="download_error_io_error">E/A Error</string>
diff --git a/core/src/main/res/values-es-rES/strings.xml b/core/src/main/res/values-es-rES/strings.xml
index 48ff1570b..d05c34876 100644
--- a/core/src/main/res/values-es-rES/strings.xml
+++ b/core/src/main/res/values-es-rES/strings.xml
@@ -72,7 +72,7 @@
<string name="download_error_connection_error">Error de conexión</string>
<string name="download_error_unknown_host">Host desconocido</string>
<string name="cancel_all_downloads_label">Cancelar todas las descargas</string>
- <string name="download_cancelled_msg">Descarga cancelada</string>
+ <string name="download_canceled_msg">Descarga cancelada</string>
<string name="download_report_title">Descargas completadas</string>
<string name="download_error_malformed_url">URL malformada</string>
<string name="download_error_io_error">Error de E/S</string>
diff --git a/core/src/main/res/values-es/strings.xml b/core/src/main/res/values-es/strings.xml
index 44421240b..eb1d1631b 100644
--- a/core/src/main/res/values-es/strings.xml
+++ b/core/src/main/res/values-es/strings.xml
@@ -88,6 +88,7 @@
<string name="remove_episode_lable">Quitar episodio</string>
<string name="mark_read_label">Marcar como leído</string>
<string name="mark_unread_label">Marcar como no leído</string>
+ <string name="marked_as_read_label">Marcado como leído</string>
<string name="add_to_queue_label">Añadir a la cola</string>
<string name="remove_from_queue_label">Quitar de la cola</string>
<string name="visit_website_label">Visitar el sitio web</string>
@@ -111,7 +112,7 @@
<string name="download_error_unknown_host">Host desconocido</string>
<string name="download_error_unauthorized">Error de autenticación</string>
<string name="cancel_all_downloads_label">Cancelar todas las descargas</string>
- <string name="download_cancelled_msg">Descarga cancelada</string>
+ <string name="download_canceled_msg">Descarga cancelada</string>
<string name="download_report_title">Descargas completadas</string>
<string name="download_error_malformed_url">URL con formato incorrecto</string>
<string name="download_error_io_error">Error de E/S</string>
diff --git a/core/src/main/res/values-fr/strings.xml b/core/src/main/res/values-fr/strings.xml
index 617df3f8f..141b84bf7 100644
--- a/core/src/main/res/values-fr/strings.xml
+++ b/core/src/main/res/values-fr/strings.xml
@@ -112,7 +112,7 @@
<string name="download_error_unknown_host">Hôte inconnu</string>
<string name="download_error_unauthorized">Erreur d\'authentification</string>
<string name="cancel_all_downloads_label">Annuler tous les téléchargements</string>
- <string name="download_cancelled_msg">Téléchargement annulé</string>
+ <string name="download_canceled_msg">Téléchargement annulé</string>
<string name="download_report_title">Téléchargements terminés</string>
<string name="download_error_malformed_url">URL incorrecte</string>
<string name="download_error_io_error">Erreur d\'E/S</string>
diff --git a/core/src/main/res/values-hi-rIN/strings.xml b/core/src/main/res/values-hi-rIN/strings.xml
index 7a43ba15b..f32c7c02f 100644
--- a/core/src/main/res/values-hi-rIN/strings.xml
+++ b/core/src/main/res/values-hi-rIN/strings.xml
@@ -91,7 +91,7 @@
<string name="download_error_connection_error">कनेक्शन त्रुटि</string>
<string name="download_error_unknown_host">अज्ञात होस्ट</string>
<string name="cancel_all_downloads_label">सभी डाउनलोड रद्द करें</string>
- <string name="download_cancelled_msg">डाउनलोड रद्द</string>
+ <string name="download_canceled_msg">डाउनलोड रद्द</string>
<string name="download_report_title">डाउनलोड पूरा हो गया है</string>
<string name="download_error_malformed_url">गलत URL</string>
<string name="download_error_io_error">आईओ त्रुटि</string>
diff --git a/core/src/main/res/values-it-rIT/strings.xml b/core/src/main/res/values-it-rIT/strings.xml
index 52873d892..361657b6b 100644
--- a/core/src/main/res/values-it-rIT/strings.xml
+++ b/core/src/main/res/values-it-rIT/strings.xml
@@ -60,7 +60,7 @@
<string name="auto_download_label">Includi nei download automatici</string>
<!--'Add Feed' Activity labels-->
<string name="feedurl_label">URL del feed</string>
- <string name="etxtFeedurlHint">URL del feed o del sito web</string>
+ <string name="etxtFeedurlHint">www.example.com/feed</string>
<string name="txtvfeedurl_label">Aggiungi un Podcast tramite URL</string>
<string name="podcastdirectories_label">Trova un podcast nella directory</string>
<string name="podcastdirectories_descr">Puoi cercare dei nuovi podcast in base al nome, alla categoria o alla popolarità nella directory di gpodder.net.</string>
@@ -85,6 +85,7 @@
<string name="remove_episode_lable">Rimuovi l\'episodio</string>
<string name="mark_read_label">Segna come letto</string>
<string name="mark_unread_label">Segna come non letto</string>
+ <string name="marked_as_read_label">Segnato come letto</string>
<string name="add_to_queue_label">Aggiungi alla coda</string>
<string name="remove_from_queue_label">Rimuovi dalla coda</string>
<string name="visit_website_label">Visita il sito</string>
@@ -108,7 +109,7 @@
<string name="download_error_unknown_host">Host sconosciuto</string>
<string name="download_error_unauthorized">Errore di autenticazione</string>
<string name="cancel_all_downloads_label">Annulla tutti i download</string>
- <string name="download_cancelled_msg">Download annullato</string>
+ <string name="download_canceled_msg">Download annullato</string>
<string name="download_report_title">Download completati</string>
<string name="download_error_malformed_url">URL malformato</string>
<string name="download_error_io_error">Errore IO</string>
@@ -225,6 +226,7 @@
<string name="pref_autodl_wifi_filter_sum">Abilita il download automatico solo per alcune reti Wi-Fi selezionate.</string>
<string name="pref_automatic_download_on_battery_title">Scarica quando la batteria non è in carica</string>
<string name="pref_automatic_download_on_battery_sum">Permetti il download automatico quando la batteria non è in carica</string>
+ <string name="pref_parallel_downloads_title">Download paralleli</string>
<string name="pref_episode_cache_title">Cache degli episodi</string>
<string name="pref_theme_title_light">Light</string>
<string name="pref_theme_title_dark">Dark</string>
@@ -356,4 +358,5 @@
<string name="authentication_descr">Cambia il tuo nome utente e la tua password per questo podcast e i suoi episodi.</string>
<!--AntennaPodSP-->
<string name="sp_apps_importing_feeds_msg">Importazione di sottoscrizioni da applicazioni monouso in corso...</string>
+ <string name="search_itunes_label">Cerca su iTunes</string>
</resources>
diff --git a/core/src/main/res/values-iw-rIL/strings.xml b/core/src/main/res/values-iw-rIL/strings.xml
index dd129457d..9e9c0e6bc 100644
--- a/core/src/main/res/values-iw-rIL/strings.xml
+++ b/core/src/main/res/values-iw-rIL/strings.xml
@@ -58,6 +58,7 @@
<string name="close_label">סגור</string>
<string name="retry_label">נסה שוב</string>
<string name="auto_download_label">כלול בהורדות אוטומטיות</string>
+ <string name="parallel_downloads_suffix">\u0020הורדות במקביל</string>
<!--'Add Feed' Activity labels-->
<string name="feedurl_label">כתובת הזנה</string>
<string name="etxtFeedurlHint">כתובת של הזנה או אתר אינטרנט</string>
@@ -68,6 +69,8 @@
<!--Actions on feeds-->
<string name="mark_all_read_label">סמן הכל כנקרא</string>
<string name="mark_all_read_msg">סמן את כל הפרקים כנקרא</string>
+ <string name="mark_all_read_confirmation_msg">אנא אשר שאתה רוצה לסמן את כל פרקים כנקראים.</string>
+ <string name="mark_all_read_feed_confirmation_msg">אנא אשר שאתה רוצה לסמן את כל פרקים בהזנה זו כנקראים.</string>
<string name="show_info_label">הצג מידע</string>
<string name="remove_feed_label">הסר פודקאסט</string>
<string name="share_link_label">שתף קישור אתר</string>
@@ -85,6 +88,7 @@
<string name="remove_episode_lable">הסר פרק</string>
<string name="mark_read_label">סמן כנקרא</string>
<string name="mark_unread_label">סמן כלא נקרא</string>
+ <string name="marked_as_read_label">סומן כנקרא</string>
<string name="add_to_queue_label">הוסף לתור</string>
<string name="remove_from_queue_label">הסר מהתור</string>
<string name="visit_website_label">בקר באתר</string>
@@ -108,7 +112,7 @@
<string name="download_error_unknown_host">שרת לא ידוע</string>
<string name="download_error_unauthorized">שגיאת אימות</string>
<string name="cancel_all_downloads_label">בטל את כל ההורדות</string>
- <string name="download_cancelled_msg">הורדה בוטלה</string>
+ <string name="download_canceled_msg">הורדה בוטלה</string>
<string name="download_report_title">הורדות הושלמו</string>
<string name="download_error_malformed_url">כתובת אתר שגויה</string>
<string name="download_error_io_error">שגיאת קלט פלט</string>
@@ -150,6 +154,7 @@
<string name="duration">משך</string>
<string name="ascending">בסדר עולה</string>
<string name="descending">בסדר יורד</string>
+ <string name="clear_queue_confirmation_msg">אנא אשר שאתה רוצה לנקות את התור מכל הפרקים שבו</string>
<!--Flattr-->
<string name="flattr_auth_label">כניסה ל-Fattr</string>
<string name="flattr_auth_explanation">לחץ על הכפתור למטה כדי להתחיל את תהליך האימות. אתה תועבר למסך כניסת flattr בדפדפן שלך ותתבקש לתת לאנטנה-פוד רשות לתרום באמצעות flattr. לאחר שקבלת אישור, תוכל לחזור למסך זה באופן אוטומטי.</string>
@@ -226,6 +231,7 @@
<string name="pref_autodl_wifi_filter_sum">אפשר הורדה אוטומטית דרך רשתות אלחוטייות נבחרות.</string>
<string name="pref_automatic_download_on_battery_title">הורדה כשלא טוען</string>
<string name="pref_automatic_download_on_battery_sum">אפשר הורדה אוטומטית כשהסוללה אינה נטענת</string>
+ <string name="pref_parallel_downloads_title">הורדות במקביל</string>
<string name="pref_episode_cache_title">מטמון פרקים</string>
<string name="pref_theme_title_light">בהיר</string>
<string name="pref_theme_title_dark">כהה</string>
@@ -250,6 +256,8 @@
<string name="pref_persistNotify_title">פקדי הפעלה קבועים</string>
<string name="pref_persistNotify_sum">שמר בקרי הודעה ומסך נעילה בעת השהיית השמעה.</string>
<string name="pref_expand_notify_unsupport_toast">גרסאות אנדרויד לפני 4.1 לא תומכות בהודעות מורחבות.</string>
+ <string name="pref_queueAddToFront_sum">הוסף פרקים חדשים לראש התור.</string>
+ <string name="pref_queueAddToFront_title">הוסף לראש התור.</string>
<!--Auto-Flattr dialog-->
<string name="auto_flattr_enable">הפעל תרומות flattr אוטומטיות</string>
<string name="auto_flattr_after_percent">תרום באמצעות flattr כשנוגן %d אחוזים מהפרק</string>
@@ -264,6 +272,9 @@
<string name="found_in_title_label">נמצא בכותרת</string>
<!--OPML import and export-->
<string name="opml_import_txtv_button_lable">קבצי OPML יאפשרו לכך לנייד פודקאסטים מלוכד פודקאסטים אחד למשנו.</string>
+ <string name="opml_import_explanation_1">בחר נתיב קובץ ספציפי במערכת הקבצים המקומית.</string>
+ <string name="opml_import_explanation_2">השתמש ביישומים חיצוניים כמו Dropbox, Google Drive או מנהל הקבצים האהוב עליך לפתוח קובץ OPML.</string>
+ <string name="opml_import_explanation_3">יישומים רבים כמו Google Mail, Dropbox, Google Drive ורוב מנהלי הקבצים יכולים <i>לפתוח</i> קבצי OPML <i>עם</i> אנטנה-פוד.</string>
<string name="start_import_label">התחל יבוא</string>
<string name="opml_import_label">יבוא OPML</string>
<string name="opml_directory_error">שגיאה!</string>
@@ -272,6 +283,8 @@
<string name="opml_import_error_dir_empty">ספריית היבוא ריקה.</string>
<string name="select_all_label">בחר הכל</string>
<string name="deselect_all_label">בטל בחירות</string>
+ <string name="choose_file_from_filesystem">ממערכת הקבצים המקומית</string>
+ <string name="choose_file_from_external_application">השתמש באפליקציה חיצונית</string>
<string name="opml_export_label">יצוא OPML</string>
<string name="exporting_label">מייצא...</string>
<string name="export_error_label">שגיאת יצוא</string>
@@ -357,4 +370,5 @@
<string name="authentication_descr">שנה את שם המשתמש והסיסמה שלך לפודקאסט ופרקים שלו.</string>
<!--AntennaPodSP-->
<string name="sp_apps_importing_feeds_msg">מייבא רישום מאפליקציות יעודיות...</string>
+ <string name="search_itunes_label">חפש בiTunes</string>
</resources>
diff --git a/core/src/main/res/values-ja/strings.xml b/core/src/main/res/values-ja/strings.xml
index df73db23e..9021b2b42 100644
--- a/core/src/main/res/values-ja/strings.xml
+++ b/core/src/main/res/values-ja/strings.xml
@@ -112,7 +112,7 @@
<string name="download_error_unknown_host">ホスト不明</string>
<string name="download_error_unauthorized">認証エラー</string>
<string name="cancel_all_downloads_label">すべてのダウンロードをキャンセル</string>
- <string name="download_cancelled_msg">ダウンロードをキャンセルしました</string>
+ <string name="download_canceled_msg">ダウンロードをキャンセルしました</string>
<string name="download_report_title">ダウンロードが完了しました</string>
<string name="download_error_malformed_url">不正な形式のURL</string>
<string name="download_error_io_error">IOエラー</string>
diff --git a/core/src/main/res/values-ko/strings.xml b/core/src/main/res/values-ko/strings.xml
index 8e8a264f4..7830be329 100644
--- a/core/src/main/res/values-ko/strings.xml
+++ b/core/src/main/res/values-ko/strings.xml
@@ -58,16 +58,19 @@
<string name="close_label">닫기</string>
<string name="retry_label">다시 시도</string>
<string name="auto_download_label">자동 다운로드에 포함</string>
+ <string name="parallel_downloads_suffix">\u0020동시 다운로드</string>
<!--'Add Feed' Activity labels-->
<string name="feedurl_label">피드 URL</string>
<string name="etxtFeedurlHint">피드의 URL 또는 홈페이지</string>
<string name="txtvfeedurl_label">URL로 팟캐스트를 추가</string>
<string name="podcastdirectories_label">디렉터리에서 팟캐스트 찾기</string>
- <string name="podcastdirectories_descr">gpodder.net 디렉터리에서 이름, 분류, 인기에 따라 새 팟캐스트를 검색할 수 있습니다</string>
+ <string name="podcastdirectories_descr">gpodder.net 디렉터리에서 이름, 분류, 인기에 따라 새 팟캐스트를 검색할 수 있고, iTunes 스토어에서 검색할 수도 있습니다.</string>
<string name="browse_gpoddernet_label">gpodder.net 둘러보기</string>
<!--Actions on feeds-->
<string name="mark_all_read_label">모두 읽은 것으로 표시</string>
<string name="mark_all_read_msg">모든 에피소드 읽은 것으로 표시</string>
+ <string name="mark_all_read_confirmation_msg">에피소드 모두를 읽은 것으로 표시하는지 확인하십시오.</string>
+ <string name="mark_all_read_feed_confirmation_msg">이 피드의 에피소드 모두를 읽은 것으로 표시하는지 확인하십시오.</string>
<string name="show_info_label">정보 표시</string>
<string name="remove_feed_label">팟캐스트 제거</string>
<string name="share_link_label">홈페이지 링크 공유</string>
@@ -85,6 +88,7 @@
<string name="remove_episode_lable">에피소드 제거</string>
<string name="mark_read_label">읽은 것으로 표시</string>
<string name="mark_unread_label">읽지 않은 것으로 표시</string>
+ <string name="marked_as_read_label">읽은 것으로 표시</string>
<string name="add_to_queue_label">대기열에 추가</string>
<string name="remove_from_queue_label">대기열에서 제거</string>
<string name="visit_website_label">홈페이지 보기</string>
@@ -108,7 +112,7 @@
<string name="download_error_unknown_host">알 수 없는 호스트</string>
<string name="download_error_unauthorized">인증 오류</string>
<string name="cancel_all_downloads_label">모든 다운로드 취소</string>
- <string name="download_cancelled_msg">다운로드 취소됨</string>
+ <string name="download_canceled_msg">다운로드 취소됨</string>
<string name="download_report_title">다운로드 마침</string>
<string name="download_error_malformed_url">URL 형식 틀림</string>
<string name="download_error_io_error">입출력 오류</string>
@@ -150,6 +154,7 @@
<string name="duration">기간</string>
<string name="ascending">오름차순</string>
<string name="descending">내림차순</string>
+ <string name="clear_queue_confirmation_msg">내부의 모든 에피소드 대기열을 지울지 확인하십시오.</string>
<!--Flattr-->
<string name="flattr_auth_label">Flattr 로그인</string>
<string name="flattr_auth_explanation">인증 절차를 시작하려면 아래 버튼을 누르십시오. 브라우저의 Flattr 로그인 화면으로 이동하고, 안테나팟에 Flattr를 사용을 허락 여부를 물어봅니다. 허락을 하면 자동으로 이 화면으로 돌아옵니다.</string>
@@ -225,6 +230,7 @@
<string name="pref_autodl_wifi_filter_sum">선택한 Wi-Fi 네트워크에 대해서만 자동 다운로드를 허용합니다.</string>
<string name="pref_automatic_download_on_battery_title">충전하지 않을 때 다운로드</string>
<string name="pref_automatic_download_on_battery_sum">배터리 충전 중이 아닐 때 자동 다운로드 허용</string>
+ <string name="pref_parallel_downloads_title">동시 다운로드</string>
<string name="pref_episode_cache_title">에피소드 임시 저장</string>
<string name="pref_theme_title_light">밝게</string>
<string name="pref_theme_title_dark">어둡게</string>
@@ -249,6 +255,8 @@
<string name="pref_persistNotify_title">재생 조작 고정</string>
<string name="pref_persistNotify_sum">재생이 일시 중지했을 때에도 알림과 잠금 화면의 조작 기능 유지</string>
<string name="pref_expand_notify_unsupport_toast">안드로이드 4.1 전 버전에서는 알림 확장을 지원하지 않습니다.</string>
+ <string name="pref_queueAddToFront_sum">새 에피소드를 대기열 앞에 추가합니다.</string>
+ <string name="pref_queueAddToFront_title">대기열 앞에 추가</string>
<!--Auto-Flattr dialog-->
<string name="auto_flattr_enable">자동 flattr 사용</string>
<string name="auto_flattr_after_percent">%d 퍼센트를 재생하면 에피소드에 flattr합니다</string>
@@ -263,6 +271,9 @@
<string name="found_in_title_label">제목에서 발견</string>
<!--OPML import and export-->
<string name="opml_import_txtv_button_lable">OPML 파일을 이용하면 팟캐스트 목록을 한 팟캐스트 프로그램에서 다른 팟캐스트 프로그램으로 옮길 수 있습니다.</string>
+ <string name="opml_import_explanation_1">로컬 파일시스템의 특정 파일 경로를 선택하십시오.</string>
+ <string name="opml_import_explanation_2">OPML 파일을 여는데 Dropbox, Google Drive, 또는 파일 관리자 와 같은 외부 앱을 사용합니다.</string>
+ <string name="opml_import_explanation_3">Google Mail, Dropbox, Google Drive 및 대부분의 파일 관리자는 OPML 파일을 안테나팟<i>으로</i> <i>열 수</i> 있습니다.</string>
<string name="start_import_label">가져오기 시작</string>
<string name="opml_import_label">OPML 가져오기</string>
<string name="opml_directory_error">오류!</string>
@@ -271,6 +282,8 @@
<string name="opml_import_error_dir_empty">가져오기 디렉터리가 비어 있습니다.</string>
<string name="select_all_label">모두 선택</string>
<string name="deselect_all_label">모두 선택 해제</string>
+ <string name="choose_file_from_filesystem">로컬 파일시스템에서</string>
+ <string name="choose_file_from_external_application">외부 앱 사용</string>
<string name="opml_export_label">OPML 내보내기</string>
<string name="exporting_label">내보내는 중...</string>
<string name="export_error_label">내보내기 오류</string>
@@ -356,4 +369,5 @@
<string name="authentication_descr">이 팟캐스트와 에피소드에 대한 사용자 이름과 비밀번호를 바꿉니다.</string>
<!--AntennaPodSP-->
<string name="sp_apps_importing_feeds_msg">단일 용도 앱에서 구독 정보를 가져옵니다...</string>
+ <string name="search_itunes_label">iTunes 검색</string>
</resources>
diff --git a/core/src/main/res/values-nl/strings.xml b/core/src/main/res/values-nl/strings.xml
index 66ffaaf87..0f447d54a 100644
--- a/core/src/main/res/values-nl/strings.xml
+++ b/core/src/main/res/values-nl/strings.xml
@@ -86,7 +86,7 @@
<string name="download_error_unknown_host">Onbekende host</string>
<string name="download_error_unauthorized">Authenticatie fout</string>
<string name="cancel_all_downloads_label">Alle downloads annuleren</string>
- <string name="download_cancelled_msg">Download geannuleerd</string>
+ <string name="download_canceled_msg">Download geannuleerd</string>
<string name="download_report_title">Downloads afgerond</string>
<string name="download_error_malformed_url">Misvormde URL</string>
<string name="download_error_io_error">IO fout</string>
diff --git a/core/src/main/res/values-pl-rPL/strings.xml b/core/src/main/res/values-pl-rPL/strings.xml
index 6e5c2ce44..ba1a0bb91 100644
--- a/core/src/main/res/values-pl-rPL/strings.xml
+++ b/core/src/main/res/values-pl-rPL/strings.xml
@@ -108,7 +108,7 @@
<string name="download_error_unknown_host">Nieznany host</string>
<string name="download_error_unauthorized">Błąd autoryzacji</string>
<string name="cancel_all_downloads_label">Anuluj wszystkie pobierania</string>
- <string name="download_cancelled_msg">Pobieranie anulowane</string>
+ <string name="download_canceled_msg">Pobieranie anulowane</string>
<string name="download_report_title">Pobieranie ukończone</string>
<string name="download_error_malformed_url">Niepoprawny adres</string>
<string name="download_error_io_error">Błąd wejścia/wyjścia</string>
diff --git a/core/src/main/res/values-pt-rBR/strings.xml b/core/src/main/res/values-pt-rBR/strings.xml
index aba186c1a..c3523acfb 100644
--- a/core/src/main/res/values-pt-rBR/strings.xml
+++ b/core/src/main/res/values-pt-rBR/strings.xml
@@ -85,7 +85,7 @@
<string name="download_error_connection_error">Erro de conexão</string>
<string name="download_error_unknown_host">Host desconhecido</string>
<string name="cancel_all_downloads_label">Cancelar todos os downloads</string>
- <string name="download_cancelled_msg">Download cancelado</string>
+ <string name="download_canceled_msg">Download cancelado</string>
<string name="download_report_title">Downloads finalizados</string>
<string name="download_error_malformed_url">URL inválida</string>
<string name="download_error_io_error">Erro de IO</string>
diff --git a/core/src/main/res/values-pt/strings.xml b/core/src/main/res/values-pt/strings.xml
index 9ef8474ee..d9e201e21 100644
--- a/core/src/main/res/values-pt/strings.xml
+++ b/core/src/main/res/values-pt/strings.xml
@@ -112,7 +112,7 @@
<string name="download_error_unknown_host">Servidor desconhecido</string>
<string name="download_error_unauthorized">Erro de autenticação</string>
<string name="cancel_all_downloads_label">Cancelar transferências</string>
- <string name="download_cancelled_msg">Transferência cancelada</string>
+ <string name="download_canceled_msg">Transferência cancelada</string>
<string name="download_report_title">Transferências terminadas</string>
<string name="download_error_malformed_url">URL inválido</string>
<string name="download_error_io_error">Erro I/O</string>
diff --git a/core/src/main/res/values-ro-rRO/strings.xml b/core/src/main/res/values-ro-rRO/strings.xml
index 7bfb99f9d..390f50767 100644
--- a/core/src/main/res/values-ro-rRO/strings.xml
+++ b/core/src/main/res/values-ro-rRO/strings.xml
@@ -80,7 +80,7 @@
<string name="download_error_connection_error">Eroare de conexiune</string>
<string name="download_error_unknown_host">Host necunoscut</string>
<string name="cancel_all_downloads_label">Anulează toate descărcările</string>
- <string name="download_cancelled_msg">Descărcare anulată</string>
+ <string name="download_canceled_msg">Descărcare anulată</string>
<string name="download_report_title">Descărcări terminate</string>
<string name="download_error_malformed_url">URL malformat</string>
<string name="download_error_io_error">Eroare IO</string>
diff --git a/core/src/main/res/values-ru/strings.xml b/core/src/main/res/values-ru/strings.xml
index 8e209a5ad..187a92861 100644
--- a/core/src/main/res/values-ru/strings.xml
+++ b/core/src/main/res/values-ru/strings.xml
@@ -58,20 +58,26 @@
<string name="close_label">Закрыть</string>
<string name="retry_label">Повторить</string>
<string name="auto_download_label">Добавить в автозагрузки</string>
+ <string name="parallel_downloads_suffix">\u0020одновременных загрузок</string>
<!--'Add Feed' Activity labels-->
<string name="feedurl_label">URL канала</string>
+ <string name="etxtFeedurlHint">www.example.com/feed</string>
<string name="txtvfeedurl_label">Добавить подкаст по URL</string>
<string name="podcastdirectories_label">Найти подкаст в каталоге</string>
+ <string name="podcastdirectories_descr">Вы можете искать новые подкасты по имени, категории или популярности в каталоге gpodder.net и в магазине iTunes.</string>
<string name="browse_gpoddernet_label">Просмотр gpodder.net</string>
<!--Actions on feeds-->
<string name="mark_all_read_label">Отметить как прослушанное</string>
<string name="mark_all_read_msg">Отметить все выпуски как прослушанные</string>
+ <string name="mark_all_read_confirmation_msg">Подтвердите, что хотите пометить все эпизоды как прослушанные.</string>
+ <string name="mark_all_read_feed_confirmation_msg">Подтвердите, что хотите пометить все эпизоды в этом канале как прослушанные.</string>
<string name="show_info_label">Показать информацию</string>
<string name="remove_feed_label">Удалить подкаст</string>
<string name="share_link_label">Поделиться ссылкой на сайт</string>
<string name="share_source_label">Ссылка на канал</string>
<string name="feed_delete_confirmation_msg">Подтвердите удаление канала и всех выпусков, загруженных с этого канала.</string>
<string name="feed_remover_msg">Удаление канала</string>
+ <string name="load_complete_feed">Обновить весь канал</string>
<!--actions on feeditems-->
<string name="download_label">Загрузить</string>
<string name="play_label">Воспроизвести</string>
@@ -82,6 +88,7 @@
<string name="remove_episode_lable">Удалить</string>
<string name="mark_read_label">Отметить как прочитанное</string>
<string name="mark_unread_label">Отметить как непрочитанное</string>
+ <string name="marked_as_read_label">Помечено как прослушанное</string>
<string name="add_to_queue_label">Добавить в очередь</string>
<string name="remove_from_queue_label">Удалить из очереди</string>
<string name="visit_website_label">Посетить сайт</string>
@@ -105,7 +112,7 @@
<string name="download_error_unknown_host">Неизвестный узел</string>
<string name="download_error_unauthorized">Ошибка авторизации</string>
<string name="cancel_all_downloads_label">Отменить все загрузки</string>
- <string name="download_cancelled_msg">Загрузка отменена</string>
+ <string name="download_canceled_msg">Загрузка отменена</string>
<string name="download_report_title">Загрузки завершены</string>
<string name="download_error_malformed_url">Неправильный адрес</string>
<string name="download_error_io_error">Ошибка ввода-вывода</string>
@@ -146,6 +153,7 @@
<string name="duration">По продолжительности</string>
<string name="ascending">По возрастанию</string>
<string name="descending">По убыванию</string>
+ <string name="clear_queue_confirmation_msg">Подтвердите, что хотите очистить очередь от ВСЕХ эпизодов.</string>
<!--Flattr-->
<string name="flattr_auth_label">Авторизоваться в Flattr</string>
<string name="flattr_auth_explanation">Нажмите кнопку, чтобы начать процесс авторизации. Вы будете перенаправлены на сайт Flattr, где нужно будет разрешить AntennaPod использовать ваш аккаунт. После этого вы автоматически будете перенаправлены обратно.</string>
@@ -218,6 +226,7 @@
<string name="pref_autodl_wifi_filter_sum">Разрешать автоматическую загрузку только для выбранных сетей Wi-Fi.</string>
<string name="pref_automatic_download_on_battery_title">Загружать без зарядки</string>
<string name="pref_automatic_download_on_battery_sum">Разрешать автоматическую загрузку когда батарея не заряжается</string>
+ <string name="pref_parallel_downloads_title">Одновременные загрузки</string>
<string name="pref_episode_cache_title">Кэш выпусков</string>
<string name="pref_theme_title_light">Светлая</string>
<string name="pref_theme_title_dark">Тёмная</string>
@@ -243,6 +252,9 @@
<string name="pref_persistNotify_sum">Сохранять уведомление и кнопки воспроизведения на экране блокировки во время паузы.</string>
<string name="pref_expand_notify_unsupport_toast">Версии Android ниже 4.1 не поддерживают расширенные уведомления.</string>
<!--Auto-Flattr dialog-->
+ <string name="auto_flattr_after_percent">Поддерживать через Flattr эпизоды, прослушанные на %d процентов</string>
+ <string name="auto_flattr_ater_beginning">Поддерживать эпизод через Flattr в начале воспроизведения</string>
+ <string name="auto_flattr_ater_end">Поддерживать эпизод через Flattr в конце воспроизведения</string>
<!--Search-->
<string name="search_hint">Поиск каналов или выпусков</string>
<string name="found_in_shownotes_label">Найдено в описании выпуска</string>
@@ -252,6 +264,7 @@
<string name="found_in_title_label">Найдено в заголовке</string>
<!--OPML import and export-->
<string name="opml_import_txtv_button_lable">OPML файлы позволяют перемещать ваши подкасты из одного менеджера подкастов в другой.</string>
+ <string name="opml_import_explanation_1">Укажите путь к файлу на устройстве</string>
<string name="start_import_label">Начать импорт</string>
<string name="opml_import_label">Импорт OPML</string>
<string name="opml_directory_error">Ошибка</string>
@@ -282,6 +295,7 @@
<string name="gpodnetauth_login_title">Войти</string>
<string name="gpodnetauth_login_descr">Добро пожаловать в процесс авторизации на gpodder.net. Сначала введите вашу информацию для авторизации:</string>
<string name="gpodnetauth_login_butLabel">Войти</string>
+ <string name="gpodnetauth_login_register">Если у вас ещё нет аккаунта, вы можете создать его здесь:\nhttps://gpodder.net/register/</string>
<string name="username_label">Имя пользователя</string>
<string name="password_label">Пароль</string>
<string name="gpodnetauth_device_title">Выбор устройства</string>
@@ -342,4 +356,5 @@
<string name="authentication_label">Авторизация</string>
<!--AntennaPodSP-->
<string name="sp_apps_importing_feeds_msg">Импорт подписок из одноцелевых приложений…</string>
+ <string name="search_itunes_label">Поиск в iTunes</string>
</resources>
diff --git a/core/src/main/res/values-sv-rSE/strings.xml b/core/src/main/res/values-sv-rSE/strings.xml
index 4e468c1e1..e70ca5d3f 100644
--- a/core/src/main/res/values-sv-rSE/strings.xml
+++ b/core/src/main/res/values-sv-rSE/strings.xml
@@ -112,7 +112,7 @@
<string name="download_error_unknown_host">Okänd värd</string>
<string name="download_error_unauthorized">Autentiseringsproblem</string>
<string name="cancel_all_downloads_label">Avbryt alla nedladdningar</string>
- <string name="download_cancelled_msg">Nedladdning avbruten</string>
+ <string name="download_canceled_msg">Nedladdning avbruten</string>
<string name="download_report_title">Nedladdningar färdiga</string>
<string name="download_error_malformed_url">Felaktig webbadress</string>
<string name="download_error_io_error">IO fel</string>
diff --git a/core/src/main/res/values-tr/strings.xml b/core/src/main/res/values-tr/strings.xml
index 52b92157e..e83c9b48e 100644
--- a/core/src/main/res/values-tr/strings.xml
+++ b/core/src/main/res/values-tr/strings.xml
@@ -58,14 +58,19 @@
<string name="close_label">Kapat</string>
<string name="retry_label">Yeniden dene</string>
<string name="auto_download_label">Otomatik indirmelere dahil et</string>
+ <string name="parallel_downloads_suffix">\u0020paralel indirmeler</string>
<!--'Add Feed' Activity labels-->
<string name="feedurl_label">Besleme Adresi</string>
+ <string name="etxtFeedurlHint">www.example.com/feed</string>
<string name="txtvfeedurl_label">URL ile cep yayını ekle</string>
<string name="podcastdirectories_label">Dizinde cep yayını bul</string>
+ <string name="podcastdirectories_descr">gdpodder.net dizininde yeni cep yayınlarını isme, kategoriye veya popülerliğe göre arayabilirsiniz veya iTunes mağazasında arama yapabilirsiniz.</string>
<string name="browse_gpoddernet_label">gpodder.net\'e gözat</string>
<!--Actions on feeds-->
<string name="mark_all_read_label">Hepsini okundu olarak işaretle</string>
<string name="mark_all_read_msg">Tüm bölümler okundu olarak işaretlendi</string>
+ <string name="mark_all_read_confirmation_msg">Lütfen tüm bölümleri okundu olarak işaretlemek istediğinizi onaylayın.</string>
+ <string name="mark_all_read_feed_confirmation_msg">Lütfen bu besleme içindeki tüm bölümleri okundu olarak işaretlemek istediğinizi onaylayın.</string>
<string name="show_info_label">Bilgiyi göster</string>
<string name="remove_feed_label">Cep yayını kaldır</string>
<string name="share_link_label">Web sayfası bağlantısı paylaş</string>
@@ -83,6 +88,7 @@
<string name="remove_episode_lable">Bölümü kaldır</string>
<string name="mark_read_label">Okundu olarak işaretle</string>
<string name="mark_unread_label">Okunmadı olarak işaretle</string>
+ <string name="marked_as_read_label">Okundu olarak işaretlendi</string>
<string name="add_to_queue_label">Kuyruğa Ekle</string>
<string name="remove_from_queue_label">Kuyruktan Kaldır</string>
<string name="visit_website_label">Siteyi Ziyaret Et</string>
@@ -106,7 +112,7 @@
<string name="download_error_unknown_host">Bilinmeyen sunucu</string>
<string name="download_error_unauthorized">Yetkilendirme hatası</string>
<string name="cancel_all_downloads_label">Bütün indirmeleri iptal et</string>
- <string name="download_cancelled_msg">İndirme iptal edildi</string>
+ <string name="download_canceled_msg">İndirme iptal edildi</string>
<string name="download_report_title">İndirme tamamlandı</string>
<string name="download_error_malformed_url">Bozuk URL</string>
<string name="download_error_io_error">G/Ç Hatası</string>
@@ -148,6 +154,7 @@
<string name="duration">Süre</string>
<string name="ascending">Artan</string>
<string name="descending">Azalan</string>
+ <string name="clear_queue_confirmation_msg">Lütfen içerisindeki BÜTÜN ölümlerle birlikte kuyruğu temizleme isteğinizi onaylayın.</string>
<!--Flattr-->
<string name="flattr_auth_label">Flattr giriş</string>
<string name="flattr_auth_explanation">Yetkilendirme işlemini başlatmak için aşağıdaki butona basın. Tarayıcınızda flattr giriş ekranına yönlendirileceksiniz ve AntennaPod\'un flattr ile etkileşime girebilmesi için izniniz istenecek. İzin verdikten sonra otomatik olarak bu ekrana döneceksiniz.</string>
@@ -223,6 +230,7 @@
<string name="pref_autodl_wifi_filter_sum">Seçilen kablosuz ağlar için otomatik indirmeye izin ver.</string>
<string name="pref_automatic_download_on_battery_title">Şarj olmuyorken indir</string>
<string name="pref_automatic_download_on_battery_sum">Pil şarj olmuyorken otomatik indirmeye izin ver</string>
+ <string name="pref_parallel_downloads_title">Paralel indirmeler</string>
<string name="pref_episode_cache_title">Bölüm ön belleği</string>
<string name="pref_theme_title_light">Aydınlık</string>
<string name="pref_theme_title_dark">Karanlık</string>
@@ -247,6 +255,8 @@
<string name="pref_persistNotify_title">Kalıcı oynatma kontrolleri</string>
<string name="pref_persistNotify_sum">Çalma duraklatıldığında bildirim ve ekran kilidi ayarlarını sakla.</string>
<string name="pref_expand_notify_unsupport_toast">Android 4.1 öncesi sürümler genişletilmiş bildirimleri desteklememektedir.</string>
+ <string name="pref_queueAddToFront_sum">Yeni bölümleri kuyruğun önüne ekle.</string>
+ <string name="pref_queueAddToFront_title">Kuyruğun önüne ekle.</string>
<!--Auto-Flattr dialog-->
<string name="auto_flattr_enable">Otomatik Flattr\'lamayı etkinleştir</string>
<string name="auto_flattr_after_percent">Bölümün yüzde %d kısmı oynatıldığında Flattr\'la</string>
@@ -261,6 +271,9 @@
<string name="found_in_title_label">Başlıkta bulundu</string>
<!--OPML import and export-->
<string name="opml_import_txtv_button_lable">OPML dosyaları cep yayınlarını bir cihazdan diğerine aktarmanıza yarar.</string>
+ <string name="opml_import_explanation_1">Yerel dosya sisteminden belirli bir yol seçin.</string>
+ <string name="opml_import_explanation_2">OPML dosyasını açmak için harici uygulamalardan Dropbox, Google Drive veya kendi favori dosya yöneticinizi kullanın.</string>
+ <string name="opml_import_explanation_3">Google Mail, Dropbox, Google Drive gibi birçok uygulama ve çoğu dosya yöneticisi OPML dosyalarını AntennaPod <i>ile</i> <i>açabilir.</i></string>
<string name="start_import_label">İçe aktarmayı başlat</string>
<string name="opml_import_label">OPML içe aktar</string>
<string name="opml_directory_error">HATA!</string>
@@ -269,9 +282,12 @@
<string name="opml_import_error_dir_empty">İça aktarma dizini boş</string>
<string name="select_all_label">Hepsini seç</string>
<string name="deselect_all_label">Tüm seçimleri geri al</string>
+ <string name="choose_file_from_filesystem">Yerel dosya sisteminden</string>
+ <string name="choose_file_from_external_application">Harici uygulama kullan</string>
<string name="opml_export_label">OPML dışa aktar</string>
<string name="exporting_label">Dışa aktarılıyor...</string>
<string name="export_error_label">Dışa aktarma hatası</string>
+ <string name="opml_export_success_title">Opml dışa aktarma başarılı.</string>
<string name="opml_export_success_sum">.opml dosyasy yazıldı: \u0020</string>
<!--Sleep timer-->
<string name="set_sleeptimer_label">Zamanlayıcıyı ayarla</string>
@@ -353,4 +369,5 @@
<string name="authentication_descr">Bu cep yayını ve içerdiği bölümler için kullanıcı adı şifreyi değiştir.</string>
<!--AntennaPodSP-->
<string name="sp_apps_importing_feeds_msg">Üyelikler tek-amaçlı uygulamalardan içe aktarılıyor...</string>
+ <string name="search_itunes_label">iTunes\'da Arama</string>
</resources>
diff --git a/core/src/main/res/values-uk-rUA/strings.xml b/core/src/main/res/values-uk-rUA/strings.xml
index 9ceab72f6..20374232a 100644
--- a/core/src/main/res/values-uk-rUA/strings.xml
+++ b/core/src/main/res/values-uk-rUA/strings.xml
@@ -58,6 +58,7 @@
<string name="close_label">Закрити</string>
<string name="retry_label">Повторити знову</string>
<string name="auto_download_label">Включити до автозавантаження</string>
+ <string name="parallel_downloads_suffix">\u0020паралельні завантаження</string>
<!--'Add Feed' Activity labels-->
<string name="feedurl_label">Посилання на канал</string>
<string name="etxtFeedurlHint">URL канала або сайта</string>
@@ -68,6 +69,8 @@
<!--Actions on feeds-->
<string name="mark_all_read_label">Позначити всі як переглянуті</string>
<string name="mark_all_read_msg">Позначено всі епізоди як переглянуті</string>
+ <string name="mark_all_read_confirmation_msg">Будь ласка, підтвердіть що ви бажаєте позначити всі епізоди як прочитані.</string>
+ <string name="mark_all_read_feed_confirmation_msg">Будь ласка, підтвердіть що ви бажаєте позначити всі епізоди цього канала як прочитані.</string>
<string name="show_info_label">Інформація</string>
<string name="remove_feed_label">Видалити подкаст</string>
<string name="share_link_label">Поділитися URL сайту</string>
@@ -85,6 +88,7 @@
<string name="remove_episode_lable">Видалити епізод</string>
<string name="mark_read_label">Позначити як переглянутий</string>
<string name="mark_unread_label">Позначити як не переглянутий</string>
+ <string name="marked_as_read_label">Позначено як прочитане</string>
<string name="add_to_queue_label">Додати до черги</string>
<string name="remove_from_queue_label">Видалити з черги</string>
<string name="visit_website_label">Відкрити сайт</string>
@@ -108,7 +112,7 @@
<string name="download_error_unknown_host">Невідомий host</string>
<string name="download_error_unauthorized">Помилка автентифікації</string>
<string name="cancel_all_downloads_label">Скасувати всі завантаження</string>
- <string name="download_cancelled_msg">Відмінено завантаження</string>
+ <string name="download_canceled_msg">Відмінено завантаження</string>
<string name="download_report_title">Завантажили</string>
<string name="download_error_malformed_url">Невірний URL</string>
<string name="download_error_io_error">Помилка IO</string>
@@ -150,6 +154,7 @@
<string name="duration">За тривалістю</string>
<string name="ascending">За зростанням</string>
<string name="descending">За спаданням</string>
+ <string name="clear_queue_confirmation_msg">Будь ласка, підтвердіть що ви бажаєте вилучити всі епізоди з черги.</string>
<!--Flattr-->
<string name="flattr_auth_label">Увійти до Flattr</string>
<string name="flattr_auth_explanation">Нажміть цю кнопку для початку авторізації. Буде відкрито flattr в браузері, буде запит на дозвіл доступу Antennapod до flattr. Після надання доступу ви повернетесь до цього екрану автоматично</string>
@@ -225,6 +230,7 @@
<string name="pref_autodl_wifi_filter_sum">Дозволити автоматичне завантаження тільки в цих Wi-Fi мережах</string>
<string name="pref_automatic_download_on_battery_title">Завантаження без зарядного пристрою</string>
<string name="pref_automatic_download_on_battery_sum">Дозволити завантаження коли зарядний пристрій не підключено</string>
+ <string name="pref_parallel_downloads_title">Паралельні завантаження</string>
<string name="pref_episode_cache_title">Кеш епізодів</string>
<string name="pref_theme_title_light">Світла</string>
<string name="pref_theme_title_dark">Темна</string>
@@ -249,6 +255,8 @@
<string name="pref_persistNotify_title">Завжди показувати елементи керування відтворенням</string>
<string name="pref_persistNotify_sum">Показувати повідомлення та елементи керування на lockscreen в режимі паузи.</string>
<string name="pref_expand_notify_unsupport_toast">Android до версії 4.1 не підтримує розширені повідомлення.</string>
+ <string name="pref_queueAddToFront_sum">Додавати нові епізоди до початку черги.</string>
+ <string name="pref_queueAddToFront_title">Додавати в початок черги.</string>
<!--Auto-Flattr dialog-->
<string name="auto_flattr_enable">Включити автоматичне заохочення авторів через сервіс flattr</string>
<string name="auto_flattr_after_percent">Заохотити автора через Flattr щойно %d відсотків епізода було відтворено</string>
@@ -263,6 +271,9 @@
<string name="found_in_title_label">Знайдено у назві</string>
<!--OPML import and export-->
<string name="opml_import_txtv_button_lable">OPML файли дозволяют вам перенести подкасти з однієї программи до іншої</string>
+ <string name="opml_import_explanation_1">Виберіть локальну папку.</string>
+ <string name="opml_import_explanation_2">Вибрати OPML файл за допомогою таких додатків як Dropbox, Google Drive або файловий менеджер.</string>
+ <string name="opml_import_explanation_3">Багато додатків таких як Google Mail, Dropbox, Google Drive та більшість файлових менеджерів здатні <i>відкрити</i> OPML файли <i>для</i> AntennaPod.</string>
<string name="start_import_label">Почати імпорт</string>
<string name="opml_import_label">OPML імпорт</string>
<string name="opml_directory_error">Помилка!</string>
@@ -271,6 +282,8 @@
<string name="opml_import_error_dir_empty">Директорія імпорту пуста</string>
<string name="select_all_label">Обрати все</string>
<string name="deselect_all_label">Убрати виділення</string>
+ <string name="choose_file_from_filesystem">З локальної файлової системи</string>
+ <string name="choose_file_from_external_application">За допомогою додатка</string>
<string name="opml_export_label">OPML экспорт</string>
<string name="exporting_label">Експорт ...</string>
<string name="export_error_label">Помилка експорту</string>
@@ -356,4 +369,5 @@
<string name="authentication_descr">Змінити ваші логін та пароль для подкаста та епізодів</string>
<!--AntennaPodSP-->
<string name="sp_apps_importing_feeds_msg">Імпорт подкастів з інших програм...</string>
+ <string name="search_itunes_label">Пошук в iTunes</string>
</resources>
diff --git a/core/src/main/res/values-zh-rCN/strings.xml b/core/src/main/res/values-zh-rCN/strings.xml
index d857ea194..0a2b9355e 100644
--- a/core/src/main/res/values-zh-rCN/strings.xml
+++ b/core/src/main/res/values-zh-rCN/strings.xml
@@ -103,7 +103,7 @@
<string name="download_error_unknown_host">未知主机</string>
<string name="download_error_unauthorized">认证错误</string>
<string name="cancel_all_downloads_label">取消所有下载</string>
- <string name="download_cancelled_msg">已取消下载</string>
+ <string name="download_canceled_msg">已取消下载</string>
<string name="download_report_title">下载完成</string>
<string name="download_error_malformed_url">畸形 URL</string>
<string name="download_error_io_error">IO 错误</string>
diff --git a/core/src/main/res/values/arrays.xml b/core/src/main/res/values/arrays.xml
index 4bb29ac85..4ecf2cf61 100644
--- a/core/src/main/res/values/arrays.xml
+++ b/core/src/main/res/values/arrays.xml
@@ -10,7 +10,7 @@
</string-array>
- <string-array name="seek_delta_values">
+ <integer-array name="seek_delta_values">
<item>5</item>
<item>10</item>
<item>15</item>
@@ -18,7 +18,7 @@
<item>30</item>
<item>45</item>
<item>60</item>
- </string-array>
+ </integer-array>
<string-array name="update_intervall_options">
<item>Manual</item>
@@ -118,6 +118,7 @@
<string-array name="autodl_select_networks_default_values">
<item>0</item>
</string-array>
+
<string-array name="theme_options">
<item>@string/pref_theme_title_light</item>
<item>@string/pref_theme_title_dark</item>
@@ -126,4 +127,34 @@
<item>0</item>
<item>1</item>
</string-array>
+
+ <string-array name="nav_drawer_titles">
+ <item>@string/queue_label</item>
+ <item>@string/new_episodes_label</item>
+ <item>@string/all_episodes_label</item>
+ <item>@string/downloads_label</item>
+ <item>@string/playback_history_label</item>
+ <item>@string/add_feed_label</item>
+ </string-array>
+
+ <string-array name="episode_hide_options">
+ <item>@string/hide_unplayed_episodes_label</item>
+ <item>@string/hide_paused_episodes_label</item>
+ <item>@string/hide_played_episodes_label</item>
+ <item>@string/hide_queued_episodes_label</item>
+ <item>@string/hide_not_queued_episodes_label</item>
+ <item>@string/hide_downloaded_episodes_label</item>
+ <item>@string/hide_not_downloaded_episodes_label</item>
+ </string-array>
+
+ <string-array name="episode_hide_values">
+ <item>unplayed</item>
+ <item>paused</item>
+ <item>played</item>
+ <item>queued</item>
+ <item>not_queued</item>
+ <item>downloaded</item>
+ <item>not_downloaded</item>
+ </string-array>
+
</resources>
diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml
index 368921f76..2bdda2378 100644
--- a/core/src/main/res/values/attrs.xml
+++ b/core/src/main/res/values/attrs.xml
@@ -37,6 +37,9 @@
<attr name="av_ff_big" format="reference"/>
<attr name="av_rew_big" format="reference"/>
<attr name="ic_settings" format="reference"/>
+ <attr name="ic_lock_open" format="reference"/>
+ <attr name="ic_lock_closed" format="reference"/>
+ <attr name="ic_filter" format="reference"/>
<!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference"/>
diff --git a/core/src/main/res/values/dimens.xml b/core/src/main/res/values/dimens.xml
index 81a55142a..c46537b3e 100644
--- a/core/src/main/res/values/dimens.xml
+++ b/core/src/main/res/values/dimens.xml
@@ -16,10 +16,10 @@
<dimen name="thumbnail_length_downloaded_item">64dp</dimen>
<dimen name="thumbnail_length_onlinefeedview">100dp</dimen>
<dimen name="feeditemlist_header_height">132dp</dimen>
- <dimen name="thumbnail_length_navlist">42dp</dimen>
+ <dimen name="thumbnail_length_navlist">40dp</dimen>
<dimen name="listview_secondary_button_width">48dp</dimen>
<dimen name="drawer_width">280dp</dimen>
- <dimen name="listitem_iconwithtext_height">56dp</dimen>
+ <dimen name="listitem_iconwithtext_height">48dp</dimen>
<dimen name="listitem_iconwithtext_textleftpadding">14dp</dimen>
<dimen name="listitem_iconwithtext_textverticalpadding">16dp</dimen>
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index bdb3ad606..c6308fa7b 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -32,6 +32,7 @@
<!-- Main activity -->
<string name="drawer_open">Open menu</string>
<string name="drawer_close">Close menu</string>
+ <string name="drawer_preferences">Drawer Preferences</string>
<!-- Webview actions -->
<string name="open_in_browser_label">Open in browser</string>
@@ -48,6 +49,7 @@
<string name="cancel_label">Cancel</string>
<string name="author_label">Author</string>
<string name="language_label">Language</string>
+ <string name="url_label">URL</string>
<string name="podcast_settings_label">Settings</string>
<string name="cover_label">Picture</string>
<string name="error_label">Error</string>
@@ -78,10 +80,10 @@
<string name="browse_gpoddernet_label">Browse gpodder.net</string>
<!-- Actions on feeds -->
- <string name="mark_all_read_label">Mark all as read</string>
- <string name="mark_all_read_msg">Marked all episodes as read</string>
- <string name="mark_all_read_confirmation_msg">Please confirm that you want to mark all episodes as being read.</string>
- <string name="mark_all_read_feed_confirmation_msg">Please confirm that you want to mark all episodes in this feed as being read.</string>
+ <string name="mark_all_read_label">Mark all as played</string>
+ <string name="mark_all_read_msg">Marked all episodes as played</string>
+ <string name="mark_all_read_confirmation_msg">Please confirm that you want to mark all episodes as being played.</string>
+ <string name="mark_all_read_feed_confirmation_msg">Please confirm that you want to mark all episodes in this feed as being played.</string>
<string name="show_info_label">Show information</string>
<string name="remove_feed_label">Remove podcast</string>
<string name="share_link_label">Share website link</string>
@@ -89,6 +91,16 @@
<string name="feed_delete_confirmation_msg">Please confirm that you want to delete this feed and ALL episodes of this feed that you have downloaded.</string>
<string name="feed_remover_msg">Removing feed</string>
<string name="load_complete_feed">Refresh complete feed</string>
+ <string name="hide_episodes_title">Hide episodes</string>
+ <string name="hide_unplayed_episodes_label">Unplayed</string>
+ <string name="hide_paused_episodes_label">Paused</string>
+ <string name="hide_played_episodes_label">Played</string>
+ <string name="hide_queued_episodes_label">Queued</string>
+ <string name="hide_not_queued_episodes_label">Not queued</string>
+ <string name="hide_downloaded_episodes_label">Downloaded</string>
+ <string name="hide_not_downloaded_episodes_label">Not downloaded</string>
+ <string name="filtered_label">Filtered</string>
+ <string name="refresh_failed_msg">{fa-exclamation-circle} Last refresh failed</string>
<!-- actions on feeditems -->
<string name="download_label">Download</string>
@@ -102,12 +114,16 @@
<string name="mark_unread_label">Mark as unplayed</string>
<string name="marked_as_read_label">Marked as played</string>
<string name="add_to_queue_label">Add to Queue</string>
+ <string name="added_to_queue_label">Added to Queue</string>
<string name="remove_from_queue_label">Remove from Queue</string>
<string name="visit_website_label">Visit Website</string>
<string name="support_label">Flattr this</string>
<string name="enqueue_all_new">Enqueue all</string>
<string name="download_all">Download all</string>
<string name="skip_episode_label">Skip episode</string>
+ <string name="activate_auto_download">Activate auto download</string>
+ <string name="deactivate_auto_download">Deactivate auto download</string>
+ <string name="reset_position">Reset playback position</string>
<!-- Download messages and labels -->
<string name="download_successful">successful</string>
@@ -125,8 +141,10 @@
<string name="download_error_unknown_host">Unknown host</string>
<string name="download_error_unauthorized">Authentication error</string>
<string name="cancel_all_downloads_label">Cancel all downloads</string>
- <string name="download_cancelled_msg">Download cancelled</string>
- <string name="download_report_title">Downloads completed</string>
+ <string name="download_canceled_msg">Download canceled</string>
+ <string name="download_canceled_autodownload_enabled_msg">Download canceled\nDisabled <i>Auto Download</i> for this item</string>
+ <string name="download_report_title">Downloads completed with error(s)</string>
+ <string name="download_report_content_title">Download report</string>
<string name="download_error_malformed_url">Malformed URL</string>
<string name="download_error_io_error">IO Error</string>
<string name="download_error_request_error">Request error</string>
@@ -142,6 +160,11 @@
<string name="download_request_error_dialog_message_prefix">An error occurred when trying to download the file:\u0020</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>
+ <string name="confirm_mobile_download_dialog_message_not_in_queue">Downloading over mobile data connection is disabled in the settings.\n\nEnable temporarily or just add to queue?\n\n<small>Your choice will be remember for 10 minutes.</small></string>
+ <string name="confirm_mobile_download_dialog_message">Downloading over mobile data connection is disabled in the settings.\n\nEnable temporarily?\n\n<small>Your choice will be remember for 10 minutes.</small></string>
+ <string name="confirm_mobile_download_dialog_only_add_to_queue">Only add to Queue</string>
+ <string name="confirm_mobile_download_dialog_enable_temporarily">Enable temporarily</string>
<!-- Mediaplayer messages -->
<string name="player_error_msg">Error!</string>
@@ -158,6 +181,8 @@
<string name="unknown_media_key">AntennaPod - Unknown media key: %1$d</string>
<!-- Queue operations -->
+ <string name="lock_queue">Lock queue</string>
+ <string name="unlock_queue">Unlock queue</string>
<string name="clear_queue_label">Clear queue</string>
<string name="undo">Undo</string>
<string name="removed_from_queue">Item removed</string>
@@ -245,6 +270,8 @@
<string name="pref_auto_flattr_sum">Configure automatic flattring</string>
<string name="user_interface_label">User Interface</string>
<string name="pref_set_theme_title">Select theme</string>
+ <string name="pref_nav_drawer_items_title">Change navigation drawer</string>
+ <string name="pref_nav_drawer_items_sum">Change which items appear in the navigation drawer.</string>
<string name="pref_set_theme_sum">Change the appearance of AntennaPod.</string>
<string name="pref_automatic_download_title">Automatic download</string>
<string name="pref_automatic_download_sum">Configure the automatic download of episodes.</string>
@@ -268,8 +295,8 @@
<string name="pref_gpodnet_setlogin_information_sum">Change the login information for your gpodder.net account.</string>
<string name="pref_playback_speed_title">Playback Speeds</string>
<string name="pref_playback_speed_sum">Customize the speeds available for variable speed audio playback</string>
- <string name="pref_seek_delta_title">Seek time</string>
- <string name="pref_seek_delta_sum">Seek this many seconds when rewinding or fast-forwarding</string>
+ <string name="pref_fast_forward">Fast forward time</string>
+ <string name="pref_rewind">Rewind time</string>
<string name="pref_gpodnet_sethostname_title">Set hostname</string>
<string name="pref_gpodnet_sethostname_use_default_host">Use default host</string>
<string name="pref_expandNotify_title">Expand Notification</string>
@@ -372,6 +399,8 @@
<string name="set_to_default_folder">Choose default folder</string>
<string name="pref_pausePlaybackForFocusLoss_sum">Pause playback instead of lowering volume when another app wants to play sounds</string>
<string name="pref_pausePlaybackForFocusLoss_title">Pause for interruptions</string>
+ <string name="pref_resumeAfterCall_sum">Resume playback after a phone call completes</string>
+ <string name="pref_resumeAfterCall_title">Resume after call</string>
<!-- Online feed view -->
<string name="subscribe_label">Subscribe</string>
diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml
index 4ac4a79fd..8619869c8 100644
--- a/core/src/main/res/values/styles.xml
+++ b/core/src/main/res/values/styles.xml
@@ -42,6 +42,9 @@
<item name="attr/av_ff_big">@drawable/ic_fast_forward_grey600_36dp</item>
<item name="attr/av_rew_big">@drawable/ic_fast_rewind_grey600_36dp</item>
<item name="attr/ic_settings">@drawable/ic_settings_grey600_24dp</item>
+ <item name="attr/ic_lock_open">@drawable/ic_lock_open_grey600_24dp</item>
+ <item name="attr/ic_lock_closed">@drawable/ic_lock_closed_grey600_24dp</item>
+ <item name="attr/ic_filter">@drawable/ic_filter_grey600_24dp</item>
</style>
<style name="Theme.AntennaPod.Dark" parent="@style/Theme.AppCompat">
@@ -84,6 +87,9 @@
<item name="attr/av_ff_big">@drawable/ic_fast_forward_white_36dp</item>
<item name="attr/av_rew_big">@drawable/ic_fast_rewind_white_36dp</item>
<item name="attr/ic_settings">@drawable/ic_settings_white_24dp</item>
+ <item name="attr/ic_lock_open">@drawable/ic_lock_open_white_24dp</item>
+ <item name="attr/ic_lock_closed">@drawable/ic_lock_closed_white_24dp</item>
+ <item name="attr/ic_filter">@drawable/ic_filter_white_24dp</item>
</style>
<style name="Theme.AntennaPod.Light.NoTitle" parent="@style/Theme.AppCompat.Light.NoActionBar">
@@ -129,6 +135,9 @@
<item name="attr/av_ff_big">@drawable/ic_fast_forward_grey600_36dp</item>
<item name="attr/av_rew_big">@drawable/ic_fast_rewind_grey600_36dp</item>
<item name="attr/ic_settings">@drawable/ic_settings_grey600_24dp</item>
+ <item name="attr/ic_lock_open">@drawable/ic_lock_open_grey600_24dp</item>
+ <item name="attr/ic_lock_closed">@drawable/ic_lock_closed_grey600_24dp</item>
+ <item name="attr/ic_filter">@drawable/ic_filter_grey600_24dp</item>
</style>
<style name="Theme.AntennaPod.Dark.NoTitle" parent="@style/Theme.AppCompat.NoActionBar">
@@ -173,6 +182,9 @@
<item name="attr/av_ff_big">@drawable/ic_fast_forward_white_36dp</item>
<item name="attr/av_rew_big">@drawable/ic_fast_rewind_white_36dp</item>
<item name="attr/ic_settings">@drawable/ic_settings_white_24dp</item>
+ <item name="attr/ic_lock_open">@drawable/ic_lock_open_white_24dp</item>
+ <item name="attr/ic_lock_closed">@drawable/ic_lock_closed_white_24dp</item>
+ <item name="attr/ic_filter">@drawable/ic_filter_white_24dp</item>
</style>
<style name="Theme.AntennaPod.VideoPlayer" parent="@style/Theme.AntennaPod.Dark">