diff --git a/.gitmodules b/.gitmodules index 17dac28b0..2529169ca 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "submodules/dslv"] path = submodules/dslv url = git://github.com/danieloeh/drag-sort-listview.git +[submodule "app/dslv"] + path = app/dslv + url = https://github.com/danieloeh/drag-sort-listview.git diff --git a/.tx/config b/.tx/config index e45dcd70c..ee84a774e 100644 --- a/.tx/config +++ b/.tx/config @@ -2,31 +2,31 @@ host = https://www.transifex.com [antennapod.english] -source_file = res/values/strings.xml +source_file = core/src/main/res/values/strings.xml source_lang = en -trans.az = res/values-az/strings.xml -trans.ca = res/values-ca/strings.xml -trans.cs_CZ = res/values-cs-rCZ/strings.xml -trans.da = res/values-da/strings.xml -trans.de = res/values-de/strings.xml -trans.es = res/values-es/strings.xml -trans.es_ES = res/values-es-rES/strings.xml -trans.fr = res/values-fr/strings.xml -trans.he_IL = res/values-iw-rIL/strings.xml -trans.hi_IN = res/values-hi-rIN/strings.xml -trans.it_IT = res/values-it-rIT/strings.xml -trans.ko = res/values-ko/strings.xml -trans.nl = res/values-nl/strings.xml -trans.pl_PL = res/values-pl-rPL/strings.xml -trans.pt = res/values-pt/strings.xml -trans.pt_BR = res/values-pt-rBR/strings.xml -trans.ro_RO = res/values-ro-rRO/strings.xml -trans.ru = res/values-ru/strings.xml -trans.ru-RU = res/values-ru/strings.xml -trans.ru_RU = res/values-ru/strings.xml -trans.uk_UA = res/values-uk-rUA/strings.xml -trans.zh_CN = res/values-zh-rCN/strings.xml -trans.sv_SE = res/values-sv-rSE/strings.xml +trans.az = core/src/main/res/values-az/strings.xml +trans.ca = core/src/main/res/values-ca/strings.xml +trans.cs_CZ = core/src/main/res/values-cs-rCZ/strings.xml +trans.da = core/src/main/res/values-da/strings.xml +trans.de = core/src/main/res/values-de/strings.xml +trans.es = core/src/main/res/values-es/strings.xml +trans.es_ES = core/src/main/res/values-es-rES/strings.xml +trans.fr = core/src/main/res/values-fr/strings.xml +trans.he_IL = core/src/main/res/values-iw-rIL/strings.xml +trans.hi_IN = core/src/main/res/values-hi-rIN/strings.xml +trans.it_IT = core/src/main/res/values-it-rIT/strings.xml +trans.ko = core/src/main/res/values-ko/strings.xml +trans.nl = core/src/main/res/values-nl/strings.xml +trans.pl_PL = core/src/main/res/values-pl-rPL/strings.xml +trans.pt = core/src/main/res/values-pt/strings.xml +trans.pt_BR = core/src/main/res/values-pt-rBR/strings.xml +trans.ro_RO = core/src/main/res/values-ro-rRO/strings.xml +trans.ru = core/src/main/res/values-ru/strings.xml +trans.ru-RU = core/src/main/res/values-ru/strings.xml +trans.ru_RU = core/src/main/res/values-ru/strings.xml +trans.uk_UA = core/src/main/res/values-uk-rUA/strings.xml +trans.zh_CN = core/src/main/res/values-zh-rCN/strings.xml +trans.sv_SE = core/src/main/res/values-sv-rSE/strings.xml [antennapod.description] file_filter = description/.txt diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 000000000..d780ed9dd --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,100 @@ +apply plugin: 'com.android.application' + +repositories { + mavenCentral() +} +dependencies { + compile 'com.android.support:support-v4:20.0.0' + compile 'com.android.support:appcompat-v7:20.0.0' + compile 'org.apache.commons:commons-lang3:3.3.2' + compile('org.shredzone.flattr4j:flattr4j-core:2.10') { + exclude group: 'org.apache.httpcomponents', module: 'httpcore' + exclude group: 'org.apache.httpcomponents', module: 'httpclient' + exclude group: 'org.json', module: 'json' + } + compile 'commons-io:commons-io:2.4' + compile 'com.nineoldandroids:library:2.4.0' + compile project('dslv:library') + compile 'com.jayway.android.robotium:robotium-solo:5.2.1' + compile('com.doomonafireball.betterpickers:library:1.5.2') { + exclude group: 'com.android.support', module: 'support-v4' + } + compile 'org.jsoup:jsoup:1.7.3' + compile 'com.squareup.picasso:picasso:2.3.4' + compile 'com.squareup.okhttp:okhttp:2.0.0' + compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' + compile 'com.squareup.okio:okio:1.0.0' + compile project(':core') +} + +android { + compileSdkVersion 20 + buildToolsVersion "20.0" + + defaultConfig { + minSdkVersion 10 + targetSdkVersion 20 + testApplicationId "de.test.antennapod" + testInstrumentationRunner "de.test.antennapod.AntennaPodTestRunner" + } + + signingConfigs { + releaseConfig { + if (project.hasProperty('releaseStoreFile')) { + storeFile file(releaseStoreFile) + } else { + storeFile file('keystore') + } + if (project.hasProperty('releaseStorePassword')) { + storePassword releaseStorePassword + } else { + storePassword "password" + } + if (project.hasProperty('releaseKeyAlias')) { + keyAlias releaseKeyAlias + } else { + keyAlias "alias" + } + if (project.hasProperty('releaseKeyPassword')) { + keyPassword releaseKeyPassword + } else { + keyPassword "password" + } + } + } + + buildTypes { + def STRING = "String" + def FLATTR_APP_KEY = "FLATTR_APP_KEY" + def FLATTR_APP_SECRET = "FLATTR_APP_SECRET" + def mFlattrAppKey = (project.hasProperty('flattrAppKey')) ? flattrAppKey : "\"\"" + def mFlattrAppSecret = (project.hasProperty('flattrAppSecret')) ? flattrAppSecret : "\"\"" + + debug { + applicationIdSuffix ".debug" + buildConfigField STRING, FLATTR_APP_KEY, mFlattrAppKey + buildConfigField STRING, FLATTR_APP_SECRET, mFlattrAppSecret + } + release { + runProguard true + proguardFile 'proguard.cfg' + signingConfig signingConfigs.releaseConfig + buildConfigField STRING, FLATTR_APP_KEY, mFlattrAppKey + buildConfigField STRING, FLATTR_APP_SECRET, mFlattrAppSecret + } + } + + packagingOptions { + exclude 'META-INF/LICENSE.txt' + exclude 'META-INF/NOTICE.txt' + } + + lintOptions { + abortOnError false + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } +} \ No newline at end of file diff --git a/app/dslv b/app/dslv new file mode 160000 index 000000000..80011c50e --- /dev/null +++ b/app/dslv @@ -0,0 +1 @@ +Subproject commit 80011c50e444e1c7d5e13b57bdb127b524a1ff92 diff --git a/lint.xml b/app/lint.xml similarity index 100% rename from lint.xml rename to app/lint.xml diff --git a/proguard.cfg b/app/proguard.cfg similarity index 100% rename from proguard.cfg rename to app/proguard.cfg diff --git a/app/settings.gradle b/app/settings.gradle new file mode 100644 index 000000000..e2d4f844d --- /dev/null +++ b/app/settings.gradle @@ -0,0 +1 @@ +include ':app:dslv:library' diff --git a/assets/testfile.mp3 b/app/src/androidTest/assets/testfile.mp3 similarity index 100% rename from assets/testfile.mp3 rename to app/src/androidTest/assets/testfile.mp3 diff --git a/src/instrumentationTest/de/test/antennapod/AntennaPodTestRunner.java b/app/src/androidTest/java/de/test/antennapod/AntennaPodTestRunner.java similarity index 75% rename from src/instrumentationTest/de/test/antennapod/AntennaPodTestRunner.java rename to app/src/androidTest/java/de/test/antennapod/AntennaPodTestRunner.java index cc8494632..24cd6e669 100644 --- a/src/instrumentationTest/de/test/antennapod/AntennaPodTestRunner.java +++ b/app/src/androidTest/java/de/test/antennapod/AntennaPodTestRunner.java @@ -1,4 +1,4 @@ -package instrumentationTest.de.test.antennapod; +package de.test.antennapod; import android.test.InstrumentationTestRunner; import android.test.suitebuilder.TestSuiteBuilder; @@ -10,7 +10,7 @@ public class AntennaPodTestRunner extends InstrumentationTestRunner { public TestSuite getAllTests() { return new TestSuiteBuilder(AntennaPodTestRunner.class) .includeAllPackagesUnderHere() - .excludePackages("instrumentationTest.de.test.antennapod.gpodnet") + .excludePackages("de.test.antennapod.gpodnet") .build(); } } diff --git a/src/instrumentationTest/de/test/antennapod/gpodnet/GPodnetServiceTest.java b/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java similarity index 91% rename from src/instrumentationTest/de/test/antennapod/gpodnet/GPodnetServiceTest.java rename to app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java index a96fc7aab..14a3b27b0 100644 --- a/src/instrumentationTest/de/test/antennapod/gpodnet/GPodnetServiceTest.java +++ b/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java @@ -1,11 +1,11 @@ -package instrumentationTest.de.test.antennapod.gpodnet; +package de.test.antennapod.gpodnet; import android.test.AndroidTestCase; -import android.util.Log; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetDevice; -import de.danoeh.antennapod.gpoddernet.model.GpodnetTag; + +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetDevice; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/instrumentationTest/de/test/antennapod/syndication/handler/FeedHandlerTest.java b/app/src/androidTest/java/de/test/antennapod/handler/FeedHandlerTest.java similarity index 93% rename from src/instrumentationTest/de/test/antennapod/syndication/handler/FeedHandlerTest.java rename to app/src/androidTest/java/de/test/antennapod/handler/FeedHandlerTest.java index 213dac66a..52067c971 100644 --- a/src/instrumentationTest/de/test/antennapod/syndication/handler/FeedHandlerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/handler/FeedHandlerTest.java @@ -1,13 +1,13 @@ -package instrumentationTest.de.test.antennapod.syndication.handler; +package de.test.antennapod.handler; import android.content.Context; import android.test.InstrumentationTestCase; -import de.danoeh.antennapod.feed.*; -import de.danoeh.antennapod.syndication.handler.FeedHandler; -import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException; -import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.AtomGenerator; -import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.FeedGenerator; -import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.RSS2Generator; +import de.danoeh.antennapod.core.feed.*; +import de.danoeh.antennapod.core.syndication.handler.FeedHandler; +import de.danoeh.antennapod.core.syndication.handler.UnsupportedFeedtypeException; +import de.test.antennapod.util.syndication.feedgenerator.AtomGenerator; +import de.test.antennapod.util.syndication.feedgenerator.FeedGenerator; +import de.test.antennapod.util.syndication.feedgenerator.RSS2Generator; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; diff --git a/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java b/app/src/androidTest/java/de/test/antennapod/service/download/HttpDownloaderTest.java similarity index 92% rename from src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java rename to app/src/androidTest/java/de/test/antennapod/service/download/HttpDownloaderTest.java index 6e44c8a0f..1a561f282 100644 --- a/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/download/HttpDownloaderTest.java @@ -1,14 +1,14 @@ -package instrumentationTest.de.test.antennapod.service.download; +package de.test.antennapod.service.download; import android.test.InstrumentationTestCase; import android.util.Log; -import de.danoeh.antennapod.feed.FeedFile; -import de.danoeh.antennapod.service.download.DownloadRequest; -import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.service.download.Downloader; -import de.danoeh.antennapod.service.download.HttpDownloader; -import de.danoeh.antennapod.util.DownloadError; -import instrumentationTest.de.test.antennapod.util.service.download.HTTPBin; +import de.danoeh.antennapod.core.feed.FeedFile; +import de.danoeh.antennapod.core.service.download.DownloadRequest; +import de.danoeh.antennapod.core.service.download.DownloadStatus; +import de.danoeh.antennapod.core.service.download.Downloader; +import de.danoeh.antennapod.core.service.download.HttpDownloader; +import de.danoeh.antennapod.core.util.DownloadError; +import de.test.antennapod.util.service.download.HTTPBin; import java.io.File; import java.io.IOException; diff --git a/src/instrumentationTest/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java similarity index 98% rename from src/instrumentationTest/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java rename to app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java index 71747dae8..aac4c245a 100644 --- a/src/instrumentationTest/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java @@ -1,16 +1,16 @@ -package instrumentationTest.de.test.antennapod.service.playback; +package de.test.antennapod.service.playback; import android.content.Context; import android.media.RemoteControlClient; import android.test.InstrumentationTestCase; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.service.playback.PlaybackServiceMediaPlayer; -import de.danoeh.antennapod.service.playback.PlayerStatus; -import de.danoeh.antennapod.storage.PodDBAdapter; -import de.danoeh.antennapod.util.playback.Playable; -import instrumentationTest.de.test.antennapod.util.service.download.HTTPBin; +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.service.playback.PlaybackServiceMediaPlayer; +import de.danoeh.antennapod.core.service.playback.PlayerStatus; +import de.danoeh.antennapod.core.storage.PodDBAdapter; +import de.danoeh.antennapod.core.util.playback.Playable; +import de.test.antennapod.util.service.download.HTTPBin; import junit.framework.AssertionFailedError; import org.apache.commons.io.IOUtils; @@ -69,7 +69,7 @@ public class PlaybackServiceMediaPlayerTest extends InstrumentationTestCase { assertTrue(cacheDir.canWrite()); assertTrue(cacheDir.canRead()); if (!dest.exists()) { - InputStream i = getInstrumentation().getTargetContext().getAssets().open("testfile.mp3"); + InputStream i = getInstrumentation().getContext().getAssets().open("testfile.mp3"); OutputStream o = new FileOutputStream(new File(cacheDir, PLAYABLE_DEST_URL)); IOUtils.copy(i, o); o.flush(); diff --git a/src/instrumentationTest/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java similarity index 96% rename from src/instrumentationTest/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java rename to app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java index 19f64b4cf..81d684595 100644 --- a/src/instrumentationTest/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java @@ -1,13 +1,13 @@ -package instrumentationTest.de.test.antennapod.service.playback; +package de.test.antennapod.service.playback; import android.content.Context; import android.test.InstrumentationTestCase; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.service.playback.PlaybackServiceTaskManager; -import de.danoeh.antennapod.storage.PodDBAdapter; -import de.danoeh.antennapod.util.playback.Playable; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager; +import de.danoeh.antennapod.core.storage.PodDBAdapter; +import de.danoeh.antennapod.core.util.playback.Playable; import java.util.ArrayList; import java.util.Date; diff --git a/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java similarity index 96% rename from src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java rename to app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java index c42c7a0cc..63286d11d 100644 --- a/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java @@ -1,22 +1,21 @@ -package instrumentationTest.de.test.antennapod.storage; +package de.test.antennapod.storage; import android.content.Context; import android.test.InstrumentationTestCase; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.FeedItemStatistics; -import de.danoeh.antennapod.storage.PodDBAdapter; -import de.danoeh.antennapod.util.flattr.FlattrStatus; -import static instrumentationTest.de.test.antennapod.storage.DBTestUtils.*; +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.storage.DBReader; +import de.danoeh.antennapod.core.storage.FeedItemStatistics; +import de.danoeh.antennapod.core.storage.PodDBAdapter; +import de.danoeh.antennapod.core.util.flattr.FlattrStatus; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Random; -import static instrumentationTest.de.test.antennapod.storage.DBTestUtils.saveFeedlist; +import static de.test.antennapod.storage.DBTestUtils.saveFeedlist; /** * Test class for DBReader diff --git a/src/instrumentationTest/de/test/antennapod/storage/DBTasksTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java similarity index 96% rename from src/instrumentationTest/de/test/antennapod/storage/DBTasksTest.java rename to app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java index 1e5afd0e3..fd5b1c393 100644 --- a/src/instrumentationTest/de/test/antennapod/storage/DBTasksTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java @@ -1,17 +1,17 @@ -package instrumentationTest.de.test.antennapod.storage; +package de.test.antennapod.storage; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.test.InstrumentationTestCase; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.PodDBAdapter; -import de.danoeh.antennapod.util.flattr.FlattrStatus; +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.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.PodDBAdapter; +import de.danoeh.antennapod.core.util.flattr.FlattrStatus; import java.io.File; import java.io.IOException; @@ -20,7 +20,7 @@ import java.util.Collections; import java.util.Date; import java.util.List; -import static instrumentationTest.de.test.antennapod.storage.DBTestUtils.*; +import static de.test.antennapod.storage.DBTestUtils.*; /** * Test class for DBTasks diff --git a/src/instrumentationTest/de/test/antennapod/storage/DBTestUtils.java b/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java similarity index 82% rename from src/instrumentationTest/de/test/antennapod/storage/DBTestUtils.java rename to app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java index 7e9e1b908..e7d6396f5 100644 --- a/src/instrumentationTest/de/test/antennapod/storage/DBTestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java @@ -1,12 +1,12 @@ -package instrumentationTest.de.test.antennapod.storage; +package de.test.antennapod.storage; import android.content.Context; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.storage.PodDBAdapter; -import de.danoeh.antennapod.util.comparator.FeedItemPubdateComparator; -import de.danoeh.antennapod.util.flattr.FlattrStatus; +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.storage.PodDBAdapter; +import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator; +import de.danoeh.antennapod.core.util.flattr.FlattrStatus; import junit.framework.Assert; import java.util.ArrayList; diff --git a/src/instrumentationTest/de/test/antennapod/storage/DBWriterTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java similarity index 98% rename from src/instrumentationTest/de/test/antennapod/storage/DBWriterTest.java rename to app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java index 67d99f9fc..4678a843b 100644 --- a/src/instrumentationTest/de/test/antennapod/storage/DBWriterTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java @@ -1,16 +1,16 @@ -package instrumentationTest.de.test.antennapod.storage; +package de.test.antennapod.storage; import android.content.Context; import android.database.Cursor; import android.test.InstrumentationTestCase; import android.util.Log; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.PodDBAdapter; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedImage; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.PodDBAdapter; import java.io.File; import java.io.IOException; diff --git a/src/instrumentationTest/de/test/antennapod/ui/MainActivityTest.java b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java similarity index 94% rename from src/instrumentationTest/de/test/antennapod/ui/MainActivityTest.java rename to app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java index 23fc224c8..3656582e1 100644 --- a/src/instrumentationTest/de/test/antennapod/ui/MainActivityTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java @@ -1,8 +1,7 @@ -package instrumentationTest.de.test.antennapod.ui; +package de.test.antennapod.ui; import android.content.Context; import android.content.SharedPreferences; -import android.content.res.Resources; import android.test.ActivityInstrumentationTestCase2; import android.view.View; import com.robotium.solo.Solo; @@ -10,9 +9,8 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.PreferenceActivity; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.storage.PodDBAdapter; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.storage.PodDBAdapter; /** * User interface tests for MainActivity diff --git a/src/instrumentationTest/de/test/antennapod/ui/PlaybackTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PlaybackTest.java similarity index 93% rename from src/instrumentationTest/de/test/antennapod/ui/PlaybackTest.java rename to app/src/androidTest/java/de/test/antennapod/ui/PlaybackTest.java index 98d93a35d..daae4bd62 100644 --- a/src/instrumentationTest/de/test/antennapod/ui/PlaybackTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/PlaybackTest.java @@ -1,4 +1,4 @@ -package instrumentationTest.de.test.antennapod.ui; +package de.test.antennapod.ui; import android.content.Intent; import android.content.SharedPreferences; @@ -9,12 +9,12 @@ import com.robotium.solo.Solo; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.AudioplayerActivity; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.PodDBAdapter; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.PodDBAdapter; import java.util.List; diff --git a/src/instrumentationTest/de/test/antennapod/ui/UITestUtils.java b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java similarity index 95% rename from src/instrumentationTest/de/test/antennapod/ui/UITestUtils.java rename to app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java index 8877d46d6..55fffb80a 100644 --- a/src/instrumentationTest/de/test/antennapod/ui/UITestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java @@ -1,4 +1,4 @@ -package instrumentationTest.de.test.antennapod.ui; +package de.test.antennapod.ui; import android.annotation.TargetApi; import android.content.Context; @@ -6,11 +6,10 @@ import android.graphics.Bitmap; import android.os.Build; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.*; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.PodDBAdapter; -import instrumentationTest.de.test.antennapod.util.service.download.HTTPBin; -import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.RSS2Generator; +import de.danoeh.antennapod.core.feed.*; +import de.danoeh.antennapod.core.storage.PodDBAdapter; +import de.test.antennapod.util.service.download.HTTPBin; +import de.test.antennapod.util.syndication.feedgenerator.RSS2Generator; import junit.framework.Assert; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; diff --git a/src/instrumentationTest/de/test/antennapod/ui/UITestUtilsTest.java b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtilsTest.java similarity index 95% rename from src/instrumentationTest/de/test/antennapod/ui/UITestUtilsTest.java rename to app/src/androidTest/java/de/test/antennapod/ui/UITestUtilsTest.java index 88180152c..6c5a350de 100644 --- a/src/instrumentationTest/de/test/antennapod/ui/UITestUtilsTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtilsTest.java @@ -1,8 +1,8 @@ -package instrumentationTest.de.test.antennapod.ui; +package de.test.antennapod.ui; import android.test.InstrumentationTestCase; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedItem; import org.apache.http.HttpStatus; import java.io.File; diff --git a/src/instrumentationTest/de/test/antennapod/ui/VideoplayerActivityTest.java b/app/src/androidTest/java/de/test/antennapod/ui/VideoplayerActivityTest.java similarity index 94% rename from src/instrumentationTest/de/test/antennapod/ui/VideoplayerActivityTest.java rename to app/src/androidTest/java/de/test/antennapod/ui/VideoplayerActivityTest.java index 807552571..da6f07cab 100644 --- a/src/instrumentationTest/de/test/antennapod/ui/VideoplayerActivityTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/VideoplayerActivityTest.java @@ -1,4 +1,4 @@ -package instrumentationTest.de.test.antennapod.ui; +package de.test.antennapod.ui; import android.test.ActivityInstrumentationTestCase2; diff --git a/src/instrumentationTest/de/test/antennapod/util/ConverterTest.java b/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java similarity index 90% rename from src/instrumentationTest/de/test/antennapod/util/ConverterTest.java rename to app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java index 8e5674b06..47fca41ba 100644 --- a/src/instrumentationTest/de/test/antennapod/util/ConverterTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java @@ -1,8 +1,8 @@ -package instrumentationTest.de.test.antennapod.util; +package de.test.antennapod.util; import android.test.AndroidTestCase; -import de.danoeh.antennapod.util.Converter; +import de.danoeh.antennapod.core.util.Converter; /** * Test class for converter diff --git a/src/instrumentationTest/de/test/antennapod/util/FilenameGeneratorTest.java b/app/src/androidTest/java/de/test/antennapod/util/FilenameGeneratorTest.java similarity index 93% rename from src/instrumentationTest/de/test/antennapod/util/FilenameGeneratorTest.java rename to app/src/androidTest/java/de/test/antennapod/util/FilenameGeneratorTest.java index 552d34941..6d24fa526 100644 --- a/src/instrumentationTest/de/test/antennapod/util/FilenameGeneratorTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/FilenameGeneratorTest.java @@ -1,9 +1,9 @@ -package instrumentationTest.de.test.antennapod.util; +package de.test.antennapod.util; import java.io.File; import java.io.IOException; -import de.danoeh.antennapod.util.FileNameGenerator; +import de.danoeh.antennapod.core.util.FileNameGenerator; import android.test.AndroidTestCase; public class FilenameGeneratorTest extends AndroidTestCase { diff --git a/src/instrumentationTest/de/test/antennapod/util/URIUtilTest.java b/app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java similarity index 87% rename from src/instrumentationTest/de/test/antennapod/util/URIUtilTest.java rename to app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java index a7cba4c03..7bdcfb898 100644 --- a/src/instrumentationTest/de/test/antennapod/util/URIUtilTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java @@ -1,7 +1,7 @@ -package instrumentationTest.de.test.antennapod.util; +package de.test.antennapod.util; import android.test.AndroidTestCase; -import de.danoeh.antennapod.util.URIUtil; +import de.danoeh.antennapod.core.util.URIUtil; /** * Test class for URIUtil diff --git a/src/instrumentationTest/de/test/antennapod/util/URLCheckerTest.java b/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java similarity index 96% rename from src/instrumentationTest/de/test/antennapod/util/URLCheckerTest.java rename to app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java index fa99303b1..47b58268b 100644 --- a/src/instrumentationTest/de/test/antennapod/util/URLCheckerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java @@ -1,7 +1,7 @@ -package instrumentationTest.de.test.antennapod.util; +package de.test.antennapod.util; import android.test.AndroidTestCase; -import de.danoeh.antennapod.util.URLChecker; +import de.danoeh.antennapod.core.util.URLChecker; /** * Test class for URLChecker diff --git a/src/instrumentationTest/de/test/antennapod/util/playback/TimelineTest.java b/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java similarity index 94% rename from src/instrumentationTest/de/test/antennapod/util/playback/TimelineTest.java rename to app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java index 1b1d011d4..2c56b71cc 100644 --- a/src/instrumentationTest/de/test/antennapod/util/playback/TimelineTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java @@ -1,4 +1,4 @@ -package instrumentationTest.de.test.antennapod.util.playback; +package de.test.antennapod.util.playback; import android.content.Context; import android.test.InstrumentationTestCase; @@ -11,11 +11,11 @@ import org.jsoup.select.Elements; import java.util.Date; import java.util.List; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.util.playback.Playable; -import de.danoeh.antennapod.util.playback.Timeline; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.core.util.playback.Timeline; /** * Test class for timeline diff --git a/src/instrumentationTest/de/test/antennapod/util/service/download/HTTPBin.java b/app/src/androidTest/java/de/test/antennapod/util/service/download/HTTPBin.java similarity index 99% rename from src/instrumentationTest/de/test/antennapod/util/service/download/HTTPBin.java rename to app/src/androidTest/java/de/test/antennapod/util/service/download/HTTPBin.java index fc5025b14..5cb723446 100644 --- a/src/instrumentationTest/de/test/antennapod/util/service/download/HTTPBin.java +++ b/app/src/androidTest/java/de/test/antennapod/util/service/download/HTTPBin.java @@ -1,4 +1,4 @@ -package instrumentationTest.de.test.antennapod.util.service.download; +package de.test.antennapod.util.service.download; import android.util.Base64; import android.util.Log; diff --git a/src/instrumentationTest/de/test/antennapod/util/service/download/NanoHTTPD.java b/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java similarity index 99% rename from src/instrumentationTest/de/test/antennapod/util/service/download/NanoHTTPD.java rename to app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java index 916a2af6c..4a5818479 100644 --- a/src/instrumentationTest/de/test/antennapod/util/service/download/NanoHTTPD.java +++ b/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java @@ -1,4 +1,4 @@ -package instrumentationTest.de.test.antennapod.util.service.download; +package de.test.antennapod.util.service.download; import java.io.*; import java.net.InetAddress; diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/FeedDiscovererTest.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/FeedDiscovererTest.java similarity index 96% rename from src/instrumentationTest/de/test/antennapod/util/syndication/FeedDiscovererTest.java rename to app/src/androidTest/java/de/test/antennapod/util/syndication/FeedDiscovererTest.java index 51a28089d..4e5d0297f 100644 --- a/src/instrumentationTest/de/test/antennapod/util/syndication/FeedDiscovererTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/FeedDiscovererTest.java @@ -1,7 +1,7 @@ -package instrumentationTest.de.test.antennapod.util.syndication; +package de.test.antennapod.util.syndication; import android.test.InstrumentationTestCase; -import de.danoeh.antennapod.util.syndication.FeedDiscoverer; +import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java similarity index 94% rename from src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java rename to app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java index 0e3440030..69cc827ec 100644 --- a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java @@ -1,10 +1,10 @@ -package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator; +package de.test.antennapod.util.syndication.feedgenerator; import android.util.Xml; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.syndication.util.SyndDateUtils; +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.syndication.util.SyndDateUtils; import org.xmlpull.v1.XmlSerializer; import java.io.IOException; diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java similarity index 90% rename from src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java rename to app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java index e6b0f0697..fe5afd847 100644 --- a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/FeedGenerator.java @@ -1,6 +1,6 @@ -package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator; +package de.test.antennapod.util.syndication.feedgenerator; -import de.danoeh.antennapod.feed.Feed; +import de.danoeh.antennapod.core.feed.Feed; import java.io.IOException; import java.io.OutputStream; diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java similarity index 88% rename from src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java rename to app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java index d8bef2354..e7cbb1b42 100644 --- a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java @@ -1,4 +1,4 @@ -package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator; +package de.test.antennapod.util.syndication.feedgenerator; import org.xmlpull.v1.XmlSerializer; diff --git a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java similarity index 94% rename from src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java rename to app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java index 824a84a66..d37434f06 100644 --- a/src/instrumentationTest/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java @@ -1,9 +1,9 @@ -package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator; +package de.test.antennapod.util.syndication.feedgenerator; import android.util.Xml; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.syndication.util.SyndDateUtils; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.syndication.util.SyndDateUtils; import org.xmlpull.v1.XmlSerializer; import java.io.IOException; diff --git a/AndroidManifest.xml b/app/src/main/AndroidManifest.xml similarity index 90% rename from AndroidManifest.xml rename to app/src/main/AndroidManifest.xml index ee87cc8b5..cce3d2dc0 100644 --- a/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,13 +1,12 @@ + package="de.danoeh.antennapod" + android:versionCode="41" + android:versionName="0.9.9.4"> - @@ -70,20 +69,6 @@ android:name=".activity.DownloadAuthenticationActivity" android:launchMode="singleInstance"/> - - - - - - - - - - - - - - - - @@ -129,11 +103,6 @@ - - - - - @@ -320,13 +289,18 @@ android:value="de.danoeh.antennapod.activity.PreferenceActivity"/> - - + + + + + + + @@ -338,11 +312,6 @@ android:scheme="package"/> - - - - - diff --git a/assets/LICENSE.html b/app/src/main/assets/LICENSE.html similarity index 100% rename from assets/LICENSE.html rename to app/src/main/assets/LICENSE.html diff --git a/assets/LICENSE_APACHE_COMMONS.txt b/app/src/main/assets/LICENSE_APACHE_COMMONS.txt similarity index 100% rename from assets/LICENSE_APACHE_COMMONS.txt rename to app/src/main/assets/LICENSE_APACHE_COMMONS.txt diff --git a/assets/LICENSE_BETTERPICKERS.txt b/app/src/main/assets/LICENSE_BETTERPICKERS.txt similarity index 100% rename from assets/LICENSE_BETTERPICKERS.txt rename to app/src/main/assets/LICENSE_BETTERPICKERS.txt diff --git a/assets/LICENSE_DSLV.txt b/app/src/main/assets/LICENSE_DSLV.txt similarity index 100% rename from assets/LICENSE_DSLV.txt rename to app/src/main/assets/LICENSE_DSLV.txt diff --git a/assets/LICENSE_FLATTR4J.txt b/app/src/main/assets/LICENSE_FLATTR4J.txt similarity index 100% rename from assets/LICENSE_FLATTR4J.txt rename to app/src/main/assets/LICENSE_FLATTR4J.txt diff --git a/assets/LICENSE_JSOUP.txt b/app/src/main/assets/LICENSE_JSOUP.txt similarity index 100% rename from assets/LICENSE_JSOUP.txt rename to app/src/main/assets/LICENSE_JSOUP.txt diff --git a/assets/LICENSE_NINE_OLD_ANDROIDS.txt b/app/src/main/assets/LICENSE_NINE_OLD_ANDROIDS.txt similarity index 100% rename from assets/LICENSE_NINE_OLD_ANDROIDS.txt rename to app/src/main/assets/LICENSE_NINE_OLD_ANDROIDS.txt diff --git a/assets/LICENSE_OKHTTP.txt b/app/src/main/assets/LICENSE_OKHTTP.txt similarity index 100% rename from assets/LICENSE_OKHTTP.txt rename to app/src/main/assets/LICENSE_OKHTTP.txt diff --git a/assets/LICENSE_OKIO.txt b/app/src/main/assets/LICENSE_OKIO.txt similarity index 100% rename from assets/LICENSE_OKIO.txt rename to app/src/main/assets/LICENSE_OKIO.txt diff --git a/assets/LICENSE_PICASSO.txt b/app/src/main/assets/LICENSE_PICASSO.txt similarity index 100% rename from assets/LICENSE_PICASSO.txt rename to app/src/main/assets/LICENSE_PICASSO.txt diff --git a/assets/LICENSE_PRESTO.txt b/app/src/main/assets/LICENSE_PRESTO.txt similarity index 100% rename from assets/LICENSE_PRESTO.txt rename to app/src/main/assets/LICENSE_PRESTO.txt diff --git a/assets/Roboto-Light.ttf b/app/src/main/assets/Roboto-Light.ttf similarity index 100% rename from assets/Roboto-Light.ttf rename to app/src/main/assets/Roboto-Light.ttf diff --git a/assets/Roboto.ttf b/app/src/main/assets/Roboto.ttf similarity index 100% rename from assets/Roboto.ttf rename to app/src/main/assets/Roboto.ttf diff --git a/assets/about.html b/app/src/main/assets/about.html similarity index 100% rename from assets/about.html rename to app/src/main/assets/about.html diff --git a/assets/logo.png b/app/src/main/assets/logo.png similarity index 100% rename from assets/logo.png rename to app/src/main/assets/logo.png diff --git a/app/src/main/assets/testfile.mp3 b/app/src/main/assets/testfile.mp3 new file mode 100644 index 000000000..f15faadf3 Binary files /dev/null and b/app/src/main/assets/testfile.mp3 differ diff --git a/src/de/danoeh/antennapod/AppConfig.java b/app/src/main/java/de/danoeh/antennapod/AppConfig.java similarity index 100% rename from src/de/danoeh/antennapod/AppConfig.java rename to app/src/main/java/de/danoeh/antennapod/AppConfig.java diff --git a/src/de/danoeh/antennapod/PodcastApp.java b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java similarity index 70% rename from src/de/danoeh/antennapod/PodcastApp.java rename to app/src/main/java/de/danoeh/antennapod/PodcastApp.java index 74628f3d6..87474dbdd 100644 --- a/src/de/danoeh/antennapod/PodcastApp.java +++ b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java @@ -2,17 +2,25 @@ package de.danoeh.antennapod; import android.app.Application; import android.content.res.Configuration; -import android.util.Log; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.preferences.PlaybackPreferences; -import de.danoeh.antennapod.preferences.UserPreferences; + +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.preferences.PlaybackPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.spa.SPAUtil; /** Main application class. */ public class PodcastApp extends Application { + // make sure that ClientConfigurator executes its static code + static { + try { + Class.forName("de.danoeh.antennapod.config.ClientConfigurator"); + } catch (Exception e) { + throw new RuntimeException("ClientConfigurator not found"); + } + } + private static final String TAG = "PodcastApp"; - public static final String EXPORT_DIR = "export/"; private static float LOGICAL_DENSITY; diff --git a/src/de/danoeh/antennapod/activity/AboutActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java similarity index 100% rename from src/de/danoeh/antennapod/activity/AboutActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java diff --git a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java similarity index 97% rename from src/de/danoeh/antennapod/activity/AudioplayerActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java index 18d27ddda..f9001adad 100644 --- a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java @@ -31,23 +31,23 @@ import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.ChapterListAdapter; import de.danoeh.antennapod.adapter.NavListAdapter; -import de.danoeh.antennapod.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; import de.danoeh.antennapod.dialog.VariableSpeedDialog; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.MediaType; -import de.danoeh.antennapod.feed.SimpleChapter; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.core.feed.SimpleChapter; import de.danoeh.antennapod.fragment.CoverFragment; import de.danoeh.antennapod.fragment.ItemDescriptionFragment; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; -import de.danoeh.antennapod.util.playback.ExternalMedia; -import de.danoeh.antennapod.util.playback.Playable; -import de.danoeh.antennapod.util.playback.PlaybackController; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.util.playback.ExternalMedia; +import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.core.util.playback.PlaybackController; /** * Activity for playing audio files. diff --git a/src/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java similarity index 95% rename from src/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java index e8bc75293..5e3817796 100644 --- a/src/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/DefaultOnlineFeedViewActivity.java @@ -30,14 +30,14 @@ import java.util.Map; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; /** * Default implementation of OnlineFeedViewActivity. Shows the downloaded feed's items with their descriptions, diff --git a/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java similarity index 99% rename from src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java index 06a11c775..559fa0574 100644 --- a/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java @@ -19,7 +19,7 @@ import android.widget.*; import android.widget.AdapterView.OnItemClickListener; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; import java.io.File; import java.util.ArrayList; diff --git a/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java similarity index 95% rename from src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java index c5f25d813..365c4216d 100644 --- a/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java @@ -14,9 +14,9 @@ import org.apache.commons.lang3.Validate; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.download.DownloadRequest; -import de.danoeh.antennapod.storage.DownloadRequester; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.download.DownloadRequest; +import de.danoeh.antennapod.core.storage.DownloadRequester; /** * Shows a username and a password text field. diff --git a/src/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java similarity index 92% rename from src/de/danoeh/antennapod/activity/FeedInfoActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index 5cf187eb6..3000cfaeb 100644 --- a/src/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -12,16 +12,16 @@ import android.view.MenuItem; import android.widget.*; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedPreferences; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.util.LangUtils; -import de.danoeh.antennapod.util.menuhandler.FeedMenuHandler; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.util.LangUtils; +import de.danoeh.antennapod.menuhandler.FeedMenuHandler; /** * Displays information about a feed. diff --git a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java similarity index 96% rename from src/de/danoeh/antennapod/activity/FlattrAuthActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java index 8dde14d3b..f4a973fac 100644 --- a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java @@ -14,8 +14,8 @@ import android.widget.Button; import android.widget.TextView; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.util.flattr.FlattrUtils; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.util.flattr.FlattrUtils; import org.shredzone.flattr4j.exception.FlattrException; /** Guides the user through the authentication process */ diff --git a/src/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java similarity index 97% rename from src/de/danoeh/antennapod/activity/MainActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index b7014dab2..7029fd32c 100644 --- a/src/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -25,13 +25,13 @@ import org.apache.commons.lang3.Validate; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.NavListAdapter; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.Feed; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.fragment.*; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.StorageUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.util.StorageUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; import java.util.List; diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java similarity index 96% rename from src/de/danoeh/antennapod/activity/MediaplayerActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index 2e5372b60..14cb2727f 100644 --- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -3,13 +3,11 @@ package de.danoeh.antennapod.activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; -import android.content.res.TypedArray; import android.graphics.PixelFormat; import android.media.AudioManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.v4.app.DialogFragment; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.Menu; @@ -25,18 +23,17 @@ import com.doomonafireball.betterpickers.hmspicker.HmsPickerDialogFragment; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.dialog.TimeDialog; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.ShareUtils; -import de.danoeh.antennapod.util.StorageUtils; -import de.danoeh.antennapod.util.playback.MediaPlayerError; -import de.danoeh.antennapod.util.playback.Playable; -import de.danoeh.antennapod.util.playback.PlaybackController; -import org.shredzone.flattr4j.model.User; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.ShareUtils; +import de.danoeh.antennapod.core.util.StorageUtils; +import de.danoeh.antennapod.core.util.playback.MediaPlayerError; +import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.core.util.playback.PlaybackController; /** * Provides general features which are both needed for playing audio and video diff --git a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java similarity index 94% rename from src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index 2c6d75cd8..d84e6cc03 100644 --- a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -16,21 +16,21 @@ import android.widget.RelativeLayout; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.dialog.AuthenticationDialog; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedPreferences; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.download.DownloadRequest; -import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.service.download.Downloader; -import de.danoeh.antennapod.service.download.HttpDownloader; -import de.danoeh.antennapod.syndication.handler.FeedHandler; -import de.danoeh.antennapod.syndication.handler.FeedHandlerResult; -import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException; -import de.danoeh.antennapod.util.DownloadError; -import de.danoeh.antennapod.util.FileNameGenerator; -import de.danoeh.antennapod.util.StorageUtils; -import de.danoeh.antennapod.util.URLChecker; -import de.danoeh.antennapod.util.syndication.FeedDiscoverer; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.download.DownloadRequest; +import de.danoeh.antennapod.core.service.download.DownloadStatus; +import de.danoeh.antennapod.core.service.download.Downloader; +import de.danoeh.antennapod.core.service.download.HttpDownloader; +import de.danoeh.antennapod.core.syndication.handler.FeedHandler; +import de.danoeh.antennapod.core.syndication.handler.FeedHandlerResult; +import de.danoeh.antennapod.core.syndication.handler.UnsupportedFeedtypeException; +import de.danoeh.antennapod.core.util.DownloadError; +import de.danoeh.antennapod.core.util.FileNameGenerator; +import de.danoeh.antennapod.core.util.StorageUtils; +import de.danoeh.antennapod.core.util.URLChecker; +import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer; import org.apache.commons.lang3.StringUtils; import org.xml.sax.SAXException; diff --git a/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java similarity index 97% rename from src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java index e09941abf..8a9ec58d3 100644 --- a/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java @@ -13,8 +13,8 @@ import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.opml.OpmlElement; -import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.core.opml.OpmlElement; +import de.danoeh.antennapod.core.preferences.UserPreferences; import java.util.ArrayList; import java.util.List; diff --git a/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java similarity index 98% rename from src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java index d3fd3949c..d974e0e1b 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java @@ -6,7 +6,7 @@ import android.util.Log; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.asynctask.OpmlFeedQueuer; import de.danoeh.antennapod.asynctask.OpmlImportWorker; -import de.danoeh.antennapod.opml.OpmlElement; +import de.danoeh.antennapod.core.opml.OpmlElement; import java.io.Reader; import java.util.ArrayList; diff --git a/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java similarity index 90% rename from src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java index 16e663fac..e42072ead 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java @@ -2,8 +2,8 @@ package de.danoeh.antennapod.activity; import android.app.AlertDialog; import android.os.Bundle; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.util.LangUtils; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.util.LangUtils; import java.io.BufferedReader; import java.io.InputStreamReader; diff --git a/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java similarity index 95% rename from src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java index 94f100321..162a8f2e5 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java @@ -13,9 +13,9 @@ import android.widget.TextView; import android.widget.Toast; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.util.LangUtils; -import de.danoeh.antennapod.util.StorageUtils; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.util.LangUtils; +import de.danoeh.antennapod.core.util.StorageUtils; import java.io.*; @@ -23,7 +23,6 @@ import java.io.*; * Lets the user start the OPML-import process from a path */ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { - public static final String IMPORT_DIR = "import/"; private static final String TAG = "OpmlImportFromPathActivity"; private TextView txtvPath; private Button butStart; @@ -61,7 +60,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { * directory. */ private void setImportPath() { - File importDir = UserPreferences.getDataFolder(this, IMPORT_DIR); + File importDir = UserPreferences.getDataFolder(this, UserPreferences.IMPORT_DIR); boolean success = true; if (!importDir.exists()) { if (BuildConfig.DEBUG) diff --git a/src/de/danoeh/antennapod/activity/OpmlImportHolder.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportHolder.java similarity index 91% rename from src/de/danoeh/antennapod/activity/OpmlImportHolder.java rename to app/src/main/java/de/danoeh/antennapod/activity/OpmlImportHolder.java index ec53ed7b6..7afa270cc 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportHolder.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.activity; -import de.danoeh.antennapod.opml.OpmlElement; +import de.danoeh.antennapod.core.opml.OpmlElement; import java.util.ArrayList; diff --git a/src/de/danoeh/antennapod/activity/PreferenceActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java similarity index 98% rename from src/de/danoeh/antennapod/activity/PreferenceActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java index a21985bb8..95e352874 100644 --- a/src/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -22,17 +22,17 @@ import android.view.MenuItem; import android.widget.Toast; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.FlattrClickWorker; +import de.danoeh.antennapod.core.asynctask.FlattrClickWorker; import de.danoeh.antennapod.asynctask.OpmlExportWorker; import de.danoeh.antennapod.dialog.AuthenticationDialog; import de.danoeh.antennapod.dialog.AutoFlattrPreferenceDialog; import de.danoeh.antennapod.dialog.GpodnetSetHostnameDialog; import de.danoeh.antennapod.dialog.VariableSpeedDialog; -import de.danoeh.antennapod.preferences.GpodnetPreferences; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.util.flattr.FlattrStatus; -import de.danoeh.antennapod.util.flattr.FlattrUtils; -import de.danoeh.antennapod.util.flattr.SimpleFlattrThing; +import de.danoeh.antennapod.core.preferences.GpodnetPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.util.flattr.FlattrStatus; +import de.danoeh.antennapod.core.util.flattr.FlattrUtils; +import de.danoeh.antennapod.core.util.flattr.SimpleFlattrThing; import java.io.File; import java.util.ArrayList; diff --git a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java similarity index 93% rename from src/de/danoeh/antennapod/activity/StorageErrorActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java index d8a137eb9..173bec6b2 100644 --- a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java @@ -12,8 +12,8 @@ import org.apache.commons.lang3.StringUtils; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.util.StorageUtils; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.util.StorageUtils; /** Is show if there is now external storage available. */ public class StorageErrorActivity extends ActionBarActivity { diff --git a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java similarity index 97% rename from src/de/danoeh/antennapod/activity/VideoplayerActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index 81661a288..d3df40afb 100644 --- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -21,11 +21,11 @@ import android.widget.SeekBar; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.MediaType; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.service.playback.PlayerStatus; -import de.danoeh.antennapod.util.playback.ExternalMedia; -import de.danoeh.antennapod.util.playback.Playable; +import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.service.playback.PlayerStatus; +import de.danoeh.antennapod.core.util.playback.ExternalMedia; +import de.danoeh.antennapod.core.util.playback.Playable; import de.danoeh.antennapod.view.AspectRatioVideoView; /** diff --git a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java similarity index 97% rename from src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java rename to app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java index 6a60f65fe..d7b069b19 100644 --- a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java @@ -15,12 +15,12 @@ import android.widget.*; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetDevice; -import de.danoeh.antennapod.preferences.GpodnetPreferences; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.GpodnetSyncService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetDevice; +import de.danoeh.antennapod.core.preferences.GpodnetPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.GpodnetSyncService; import java.security.SecureRandom; import java.util.ArrayList; diff --git a/src/de/danoeh/antennapod/adapter/ActionButtonCallback.java b/app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonCallback.java similarity index 81% rename from src/de/danoeh/antennapod/adapter/ActionButtonCallback.java rename to app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonCallback.java index 30ad2d03f..a75789815 100644 --- a/src/de/danoeh/antennapod/adapter/ActionButtonCallback.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonCallback.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.adapter; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedItem; public interface ActionButtonCallback { /** Is called when the action button of a list item has been pressed. */ diff --git a/src/de/danoeh/antennapod/adapter/ActionButtonUtils.java b/app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonUtils.java similarity index 95% rename from src/de/danoeh/antennapod/adapter/ActionButtonUtils.java rename to app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonUtils.java index 1de071a73..fecddeaf4 100644 --- a/src/de/danoeh/antennapod/adapter/ActionButtonUtils.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonUtils.java @@ -8,9 +8,9 @@ import android.widget.ImageButton; import org.apache.commons.lang3.Validate; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.storage.DownloadRequester; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.storage.DownloadRequester; /** * Utility methods for the action button that is displayed on the right hand side diff --git a/src/de/danoeh/antennapod/adapter/AdapterUtils.java b/app/src/main/java/de/danoeh/antennapod/adapter/AdapterUtils.java similarity index 92% rename from src/de/danoeh/antennapod/adapter/AdapterUtils.java rename to app/src/main/java/de/danoeh/antennapod/adapter/AdapterUtils.java index f393fb7d7..c3902639a 100644 --- a/src/de/danoeh/antennapod/adapter/AdapterUtils.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/AdapterUtils.java @@ -5,9 +5,9 @@ import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.util.Converter; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.util.Converter; /** * Utility methods for adapters diff --git a/src/de/danoeh/antennapod/adapter/ChapterListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/ChapterListAdapter.java similarity index 95% rename from src/de/danoeh/antennapod/adapter/ChapterListAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/ChapterListAdapter.java index c12de6ebd..9e59a2a1a 100644 --- a/src/de/danoeh/antennapod/adapter/ChapterListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ChapterListAdapter.java @@ -16,10 +16,10 @@ import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.util.ChapterUtils; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.playback.Playable; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.util.ChapterUtils; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.playback.Playable; import java.util.List; diff --git a/src/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java similarity index 81% rename from src/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java rename to app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java index 0c4cbe685..800462023 100644 --- a/src/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java @@ -6,13 +6,13 @@ import android.widget.Toast; import org.apache.commons.lang3.Validate; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; +import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; /** * Default implementation of an ActionButtonCallback diff --git a/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java similarity index 94% rename from src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java index 2cc216227..f982e86ce 100644 --- a/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java @@ -8,10 +8,10 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.service.download.DownloadStatus; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedImage; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.service.download.DownloadStatus; /** Displays a list of DownloadStatus entries. */ public class DownloadLogAdapter extends BaseAdapter { diff --git a/src/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java similarity index 95% rename from src/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java index ef5af67de..8785916a0 100644 --- a/src/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java @@ -11,9 +11,9 @@ import android.widget.ImageView; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.util.Converter; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.util.Converter; /** * Shows a list of downloaded episodes diff --git a/src/de/danoeh/antennapod/adapter/DownloadlistAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java similarity index 93% rename from src/de/danoeh/antennapod/adapter/DownloadlistAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java index 658af9e4e..4257c6eb9 100644 --- a/src/de/danoeh/antennapod/adapter/DownloadlistAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java @@ -9,11 +9,11 @@ import android.widget.ImageButton; import android.widget.ProgressBar; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.service.download.DownloadRequest; -import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.service.download.Downloader; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.ThemeUtils; +import de.danoeh.antennapod.core.service.download.DownloadRequest; +import de.danoeh.antennapod.core.service.download.DownloadStatus; +import de.danoeh.antennapod.core.service.download.Downloader; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.ThemeUtils; public class DownloadlistAdapter extends BaseAdapter { diff --git a/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java similarity index 97% rename from src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java index 3f666eb8b..8b1ed9112 100644 --- a/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java @@ -13,11 +13,11 @@ import android.widget.ProgressBar; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.Converter; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.Converter; /** * Displays unread items and items in the queue in one combined list. The diff --git a/src/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java similarity index 96% rename from src/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java index 357b5f8b4..2f69e6580 100644 --- a/src/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java @@ -9,12 +9,11 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.*; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.feed.MediaType; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.ThemeUtils; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.ThemeUtils; /** * List adapter for items of feeds that the user has already subscribed to. diff --git a/src/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java similarity index 97% rename from src/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java index c2c2285ac..9011c8b02 100644 --- a/src/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java @@ -7,7 +7,7 @@ import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedItem; import java.util.List; diff --git a/src/de/danoeh/antennapod/adapter/NavListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java similarity index 98% rename from src/de/danoeh/antennapod/adapter/NavListAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java index ef8e8ce07..a917633e6 100644 --- a/src/de/danoeh/antennapod/adapter/NavListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java @@ -11,8 +11,8 @@ import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.feed.Feed; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.feed.Feed; /** * BaseAdapter for the navigation drawer diff --git a/src/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java similarity index 95% rename from src/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java index 8abe49133..a0829286c 100644 --- a/src/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java @@ -12,11 +12,11 @@ import android.widget.ProgressBar; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.Converter; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.Converter; /** * List adapter for the list of new episodes diff --git a/src/de/danoeh/antennapod/adapter/QueueListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java similarity index 94% rename from src/de/danoeh/antennapod/adapter/QueueListAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java index ebe519592..bc42ad063 100644 --- a/src/de/danoeh/antennapod/adapter/QueueListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java @@ -6,10 +6,10 @@ import android.view.View; import android.view.ViewGroup; import android.widget.*; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.storage.DownloadRequester; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.storage.DownloadRequester; /** * List adapter for the queue. diff --git a/src/de/danoeh/antennapod/adapter/SearchlistAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/SearchlistAdapter.java similarity index 92% rename from src/de/danoeh/antennapod/adapter/SearchlistAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/SearchlistAdapter.java index 2314c2269..79c1f6f99 100644 --- a/src/de/danoeh/antennapod/adapter/SearchlistAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/SearchlistAdapter.java @@ -9,11 +9,11 @@ import android.widget.ImageView; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedComponent; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.SearchResult; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedComponent; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.SearchResult; /** * List adapter for search activity. diff --git a/src/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java similarity index 94% rename from src/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java rename to app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java index aeb1fc53a..7bee8e861 100644 --- a/src/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java @@ -13,8 +13,8 @@ import org.apache.commons.lang3.StringUtils; import java.util.List; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast; /** * Adapter for displaying a list of GPodnetPodcast-Objects. diff --git a/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java new file mode 100644 index 000000000..6bba956a6 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java @@ -0,0 +1,118 @@ +package de.danoeh.antennapod.asynctask; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.os.AsyncTask; +import android.util.Log; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; + +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.opml.OpmlWriter; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.util.LangUtils; + +/** + * Writes an OPML file into the export directory in the background. + */ +public class OpmlExportWorker extends AsyncTask { + private static final String TAG = "OpmlExportWorker"; + private static final String DEFAULT_OUTPUT_NAME = "antennapod-feeds.opml"; + public static final String EXPORT_DIR = "export/"; + + private Context context; + private File output; + + private ProgressDialog progDialog; + private Exception exception; + + public OpmlExportWorker(Context context, File output) { + this.context = context; + this.output = output; + } + + public OpmlExportWorker(Context context) { + this.context = context; + } + + @Override + protected Void doInBackground(Void... params) { + OpmlWriter opmlWriter = new OpmlWriter(); + if (output == null) { + output = new File( + UserPreferences.getDataFolder(context, EXPORT_DIR), + DEFAULT_OUTPUT_NAME); + if (output.exists()) { + Log.w(TAG, "Overwriting previously exported file."); + output.delete(); + } + } + OutputStreamWriter writer = null; + try { + writer = new OutputStreamWriter(new FileOutputStream(output), LangUtils.UTF_8); + opmlWriter.writeDocument(DBReader.getFeedList(context), writer); + } catch (IOException e) { + e.printStackTrace(); + exception = e; + } finally { + if (writer != null) { + try { + writer.close(); + } catch (IOException ioe) { + exception = ioe; + } + } + } + return null; + } + + @Override + protected void onPostExecute(Void result) { + progDialog.dismiss(); + AlertDialog.Builder alert = new AlertDialog.Builder(context) + .setNeutralButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, + int which) { + dialog.dismiss(); + } + }); + if (exception != null) { + alert.setTitle(R.string.export_error_label); + alert.setMessage(exception.getMessage()); + } else { + alert.setTitle(R.string.opml_export_success_title); + alert.setMessage(context + .getString(R.string.opml_export_success_sum) + + output.toString()); + } + alert.create().show(); + } + + @Override + protected void onPreExecute() { + progDialog = new ProgressDialog(context); + progDialog.setMessage(context.getString(R.string.exporting_label)); + progDialog.setIndeterminate(true); + progDialog.show(); + } + + @SuppressLint("NewApi") + public void executeAsync() { + if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { + executeOnExecutor(THREAD_POOL_EXECUTOR); + } else { + execute(); + } + } + +} diff --git a/src/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java similarity index 87% rename from src/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java rename to app/src/main/java/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java index 038b8dcc5..cb9197b8e 100644 --- a/src/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java +++ b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java @@ -4,12 +4,12 @@ import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; -import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.activity.OpmlImportHolder; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.opml.OpmlElement; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.opml.OpmlElement; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; import java.util.Arrays; import java.util.Date; diff --git a/src/de/danoeh/antennapod/asynctask/OpmlImportWorker.java b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlImportWorker.java similarity index 93% rename from src/de/danoeh/antennapod/asynctask/OpmlImportWorker.java rename to app/src/main/java/de/danoeh/antennapod/asynctask/OpmlImportWorker.java index 13534fa64..cfe0703ca 100644 --- a/src/de/danoeh/antennapod/asynctask/OpmlImportWorker.java +++ b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlImportWorker.java @@ -8,10 +8,10 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.AsyncTask; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.opml.OpmlElement; -import de.danoeh.antennapod.opml.OpmlReader; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.opml.OpmlElement; +import de.danoeh.antennapod.core.opml.OpmlReader; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; diff --git a/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java new file mode 100644 index 000000000..4d9be5d78 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java @@ -0,0 +1,29 @@ +package de.danoeh.antennapod.config; + + +import android.app.Application; +import android.content.Context; +import android.content.Intent; + +import de.danoeh.antennapod.PodcastApp; +import de.danoeh.antennapod.activity.StorageErrorActivity; +import de.danoeh.antennapod.core.ApplicationCallbacks; +import de.danoeh.antennapod.core.preferences.UserPreferences; + +public class ApplicationCallbacksImpl implements ApplicationCallbacks { + + @Override + public Application getApplicationInstance() { + return PodcastApp.getInstance(); + } + + @Override + public Intent getStorageErrorActivity(Context context) { + return new Intent(context, StorageErrorActivity.class); + } + + @Override + public void setUpdateInterval(long updateInterval) { + UserPreferences.restartUpdateAlarm(updateInterval, updateInterval); + } +} diff --git a/app/src/main/java/de/danoeh/antennapod/config/ClientConfigurator.java b/app/src/main/java/de/danoeh/antennapod/config/ClientConfigurator.java new file mode 100644 index 000000000..169ae3ac8 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/config/ClientConfigurator.java @@ -0,0 +1,19 @@ +package de.danoeh.antennapod.config; + +import de.danoeh.antennapod.core.ClientConfig; + +/** + * Configures the ClientConfig class of the core package. + */ +public class ClientConfigurator { + + static { + ClientConfig.USER_AGENT = "AntennaPod/0.9.9.4"; + ClientConfig.applicationCallbacks = new ApplicationCallbacksImpl(); + ClientConfig.downloadServiceCallbacks = new DownloadServiceCallbacksImpl(); + ClientConfig.gpodnetCallbacks = new GpodnetCallbacksImpl(); + ClientConfig.playbackServiceCallbacks = new PlaybackServiceCallbacksImpl(); + ClientConfig.storageCallbacks = new StorageCallbacksImpl(); + ClientConfig.flattrCallbacks = new FlattrCallbacksImpl(); + } +} diff --git a/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java new file mode 100644 index 000000000..3a9e62435 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java @@ -0,0 +1,60 @@ +package de.danoeh.antennapod.config; + +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; + +import de.danoeh.antennapod.activity.DownloadAuthenticationActivity; +import de.danoeh.antennapod.activity.MainActivity; +import de.danoeh.antennapod.adapter.NavListAdapter; +import de.danoeh.antennapod.core.DownloadServiceCallbacks; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.service.download.DownloadRequest; +import de.danoeh.antennapod.fragment.DownloadsFragment; + + +public class DownloadServiceCallbacksImpl implements DownloadServiceCallbacks { + + @Override + public PendingIntent getNotificationContentIntent(Context context) { + Intent intent = new Intent(context, MainActivity.class); + intent.putExtra(MainActivity.EXTRA_NAV_TYPE, NavListAdapter.VIEW_TYPE_NAV); + intent.putExtra(MainActivity.EXTRA_NAV_INDEX, MainActivity.POS_DOWNLOADS); + Bundle args = new Bundle(); + args.putInt(DownloadsFragment.ARG_SELECTED_TAB, DownloadsFragment.POS_RUNNING); + intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args); + + return PendingIntent.getActivity(context, 0, intent, + PendingIntent.FLAG_UPDATE_CURRENT); + } + + @Override + public PendingIntent getAuthentificationNotificationContentIntent(Context context, DownloadRequest request) { + final Intent activityIntent = new Intent(context.getApplicationContext(), DownloadAuthenticationActivity.class); + activityIntent.putExtra(DownloadAuthenticationActivity.ARG_DOWNLOAD_REQUEST, request); + activityIntent.putExtra(DownloadAuthenticationActivity.ARG_SEND_TO_DOWNLOAD_REQUESTER_BOOL, true); + return PendingIntent.getActivity(context.getApplicationContext(), 0, activityIntent, PendingIntent.FLAG_ONE_SHOT); + } + + @Override + public PendingIntent getReportNotificationContentIntent(Context context) { + Intent intent = new Intent(context, MainActivity.class); + intent.putExtra(MainActivity.EXTRA_NAV_TYPE, NavListAdapter.VIEW_TYPE_NAV); + intent.putExtra(MainActivity.EXTRA_NAV_INDEX, MainActivity.POS_DOWNLOADS); + Bundle args = new Bundle(); + args.putInt(DownloadsFragment.ARG_SELECTED_TAB, DownloadsFragment.POS_LOG); + intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args); + return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); + } + + @Override + public void onFeedParsed(Context context, Feed feed) { + // do nothing + } + + @Override + public boolean shouldCreateReport() { + return true; + } +} diff --git a/app/src/main/java/de/danoeh/antennapod/config/FlattrCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/FlattrCallbacksImpl.java new file mode 100644 index 000000000..3817db6de --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/config/FlattrCallbacksImpl.java @@ -0,0 +1,53 @@ +package de.danoeh.antennapod.config; + + +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +import org.shredzone.flattr4j.oauth.AccessToken; + +import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.activity.FlattrAuthActivity; +import de.danoeh.antennapod.activity.MainActivity; +import de.danoeh.antennapod.core.FlattrCallbacks; + +public class FlattrCallbacksImpl implements FlattrCallbacks { + private static final String TAG = "FlattrCallbacksImpl"; + + @Override + public boolean flattrEnabled() { + return true; + } + + @Override + public Intent getFlattrAuthenticationActivityIntent(Context context) { + return new Intent(context, FlattrAuthActivity.class); + } + + @Override + public PendingIntent getFlattrFailedNotificationContentIntent(Context context) { + return PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0); + } + + @Override + public String getFlattrAppKey() { + return BuildConfig.FLATTR_APP_KEY; + } + + @Override + public String getFlattrAppSecret() { + return BuildConfig.FLATTR_APP_SECRET; + } + + @Override + public void handleFlattrAuthenticationSuccess(AccessToken token) { + FlattrAuthActivity instance = FlattrAuthActivity.getInstance(); + if (instance != null) { + instance.handleAuthenticationSuccess(); + } else { + Log.e(TAG, "FlattrAuthActivity instance was null"); + } + } +} diff --git a/app/src/main/java/de/danoeh/antennapod/config/GpodnetCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/GpodnetCallbacksImpl.java new file mode 100644 index 000000000..5f8da6894 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/config/GpodnetCallbacksImpl.java @@ -0,0 +1,22 @@ +package de.danoeh.antennapod.config; + +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; + +import de.danoeh.antennapod.activity.MainActivity; +import de.danoeh.antennapod.core.GpodnetCallbacks; + + +public class GpodnetCallbacksImpl implements GpodnetCallbacks { + @Override + public boolean gpodnetEnabled() { + return true; + } + + @Override + public PendingIntent getGpodnetSyncServiceErrorNotificationPendingIntent(Context context) { + return PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), + PendingIntent.FLAG_UPDATE_CURRENT); + } +} diff --git a/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java new file mode 100644 index 000000000..997befe99 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java @@ -0,0 +1,32 @@ +package de.danoeh.antennapod.config; + +import android.content.Context; +import android.content.Intent; + +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.activity.AudioplayerActivity; +import de.danoeh.antennapod.activity.VideoplayerActivity; +import de.danoeh.antennapod.core.PlaybackServiceCallbacks; +import de.danoeh.antennapod.core.feed.MediaType; + + +public class PlaybackServiceCallbacksImpl implements PlaybackServiceCallbacks { + @Override + public Intent getPlayerActivityIntent(Context context, MediaType mediaType) { + if (mediaType == MediaType.VIDEO) { + return new Intent(context, VideoplayerActivity.class); + } else { + return new Intent(context, AudioplayerActivity.class); + } + } + + @Override + public boolean useQueue() { + return true; + } + + @Override + public int getNotificationIconResource(Context context) { + return R.drawable.ic_stat_antenna_default; + } +} diff --git a/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java new file mode 100644 index 000000000..ec133aed1 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java @@ -0,0 +1,107 @@ +package de.danoeh.antennapod.config; + + +import android.content.ContentValues; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.util.Log; + +import de.danoeh.antennapod.core.StorageCallbacks; +import de.danoeh.antennapod.core.storage.PodDBAdapter; + +public class StorageCallbacksImpl implements StorageCallbacks { + + @Override + public int getDatabaseVersion() { + return 12; + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + Log.w("DBAdapter", "Upgrading from version " + oldVersion + " to " + + newVersion + "."); + if (oldVersion <= 1) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + " ADD COLUMN " + + PodDBAdapter.KEY_TYPE + " TEXT"); + } + if (oldVersion <= 2) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_SIMPLECHAPTERS + + " ADD COLUMN " + PodDBAdapter.KEY_LINK + " TEXT"); + } + if (oldVersion <= 3) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_ITEMS + + " ADD COLUMN " + PodDBAdapter.KEY_ITEM_IDENTIFIER + " TEXT"); + } + if (oldVersion <= 4) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + " ADD COLUMN " + + PodDBAdapter.KEY_FEED_IDENTIFIER + " TEXT"); + } + if (oldVersion <= 5) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_DOWNLOAD_LOG + + " ADD COLUMN " + PodDBAdapter.KEY_REASON_DETAILED + " TEXT"); + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_DOWNLOAD_LOG + + " ADD COLUMN " + PodDBAdapter.KEY_DOWNLOADSTATUS_TITLE + " TEXT"); + } + if (oldVersion <= 6) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_SIMPLECHAPTERS + + " ADD COLUMN " + PodDBAdapter.KEY_CHAPTER_TYPE + " INTEGER"); + } + if (oldVersion <= 7) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_MEDIA + + " ADD COLUMN " + PodDBAdapter.KEY_PLAYBACK_COMPLETION_DATE + + " INTEGER"); + } + if (oldVersion <= 8) { + final int KEY_ID_POSITION = 0; + final int KEY_MEDIA_POSITION = 1; + + // Add feeditem column to feedmedia table + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_MEDIA + + " ADD COLUMN " + PodDBAdapter.KEY_FEEDITEM + + " INTEGER"); + Cursor feeditemCursor = db.query(PodDBAdapter.TABLE_NAME_FEED_ITEMS, + new String[]{PodDBAdapter.KEY_ID, PodDBAdapter.KEY_MEDIA}, "? > 0", + new String[]{PodDBAdapter.KEY_MEDIA}, null, null, null); + if (feeditemCursor.moveToFirst()) { + db.beginTransaction(); + ContentValues contentValues = new ContentValues(); + do { + long mediaId = feeditemCursor.getLong(KEY_MEDIA_POSITION); + contentValues.put(PodDBAdapter.KEY_FEEDITEM, feeditemCursor.getLong(KEY_ID_POSITION)); + db.update(PodDBAdapter.TABLE_NAME_FEED_MEDIA, contentValues, PodDBAdapter.KEY_ID + "=?", new String[]{String.valueOf(mediaId)}); + contentValues.clear(); + } while (feeditemCursor.moveToNext()); + db.setTransactionSuccessful(); + db.endTransaction(); + } + feeditemCursor.close(); + } + if (oldVersion <= 9) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + + " ADD COLUMN " + PodDBAdapter.KEY_AUTO_DOWNLOAD + + " INTEGER DEFAULT 1"); + } + if (oldVersion <= 10) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + + " ADD COLUMN " + PodDBAdapter.KEY_FLATTR_STATUS + + " INTEGER"); + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_ITEMS + + " ADD COLUMN " + PodDBAdapter.KEY_FLATTR_STATUS + + " INTEGER"); + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_MEDIA + + " ADD COLUMN " + PodDBAdapter.KEY_PLAYED_DURATION + + " INTEGER"); + } + if (oldVersion <= 11) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + + " ADD COLUMN " + PodDBAdapter.KEY_USERNAME + + " TEXT"); + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + + " ADD COLUMN " + PodDBAdapter.KEY_PASSWORD + + " TEXT"); + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_ITEMS + + " ADD COLUMN " + PodDBAdapter.KEY_IMAGE + + " INTEGER"); + } + } +} diff --git a/src/de/danoeh/antennapod/dialog/AuthenticationDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java similarity index 100% rename from src/de/danoeh/antennapod/dialog/AuthenticationDialog.java rename to app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java diff --git a/src/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java similarity index 98% rename from src/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java rename to app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java index d1ed795dc..1585f9b86 100644 --- a/src/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java @@ -13,7 +13,7 @@ import android.widget.TextView; import org.apache.commons.lang3.Validate; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; /** * Creates a new AlertDialog that displays preferences for auto-flattring to the user. diff --git a/src/de/danoeh/antennapod/dialog/FeedItemDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/FeedItemDialog.java similarity index 96% rename from src/de/danoeh/antennapod/dialog/FeedItemDialog.java rename to app/src/main/java/de/danoeh/antennapod/dialog/FeedItemDialog.java index 4cd6a379e..613cd1fec 100644 --- a/src/de/danoeh/antennapod/dialog/FeedItemDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/FeedItemDialog.java @@ -34,16 +34,16 @@ import java.util.concurrent.Callable; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.DefaultActionButtonCallback; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.ShownotesProvider; -import de.danoeh.antennapod.util.menuhandler.FeedItemMenuHandler; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.core.util.ShownotesProvider; +import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler; /** * Shows information about a specific FeedItem and provides actions like playing, downloading, etc. diff --git a/src/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java similarity index 95% rename from src/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java rename to app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java index a9c596d2e..16fb77f2a 100644 --- a/src/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java @@ -10,8 +10,8 @@ import android.view.ViewGroup; import android.widget.EditText; import android.widget.LinearLayout; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.preferences.GpodnetPreferences; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.preferences.GpodnetPreferences; /** * Creates a dialog that lets the user change the hostname for the gpodder.net service. diff --git a/src/de/danoeh/antennapod/dialog/TimeDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/TimeDialog.java similarity index 99% rename from src/de/danoeh/antennapod/dialog/TimeDialog.java rename to app/src/main/java/de/danoeh/antennapod/dialog/TimeDialog.java index bbd514640..6561d501e 100644 --- a/src/de/danoeh/antennapod/dialog/TimeDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/TimeDialog.java @@ -10,7 +10,7 @@ import android.view.View; import android.view.Window; import android.view.inputmethod.InputMethodManager; import android.widget.*; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.R; import java.util.concurrent.TimeUnit; diff --git a/src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java similarity index 98% rename from src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java rename to app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java index b009e76a7..8eba51540 100644 --- a/src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java @@ -7,7 +7,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.core.preferences.UserPreferences; import java.util.Arrays; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/AddFeedFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java similarity index 100% rename from src/de/danoeh/antennapod/fragment/AddFeedFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java diff --git a/src/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java similarity index 95% rename from src/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java index 082fe93fc..21e4cbd80 100644 --- a/src/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java @@ -9,11 +9,11 @@ import android.view.View; import android.widget.ListView; import de.danoeh.antennapod.adapter.DownloadedEpisodesListAdapter; import de.danoeh.antennapod.dialog.FeedItemDialog; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.util.QueueAccess; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.util.QueueAccess; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java similarity index 96% rename from src/de/danoeh/antennapod/fragment/CoverFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index ffce518bf..69bd2b099 100644 --- a/src/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -12,8 +12,8 @@ import android.widget.ImageView; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.AudioplayerActivity.AudioplayerContentFragment; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.util.playback.Playable; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.util.playback.Playable; /** * Displays the cover and the title of a FeedItem. diff --git a/src/de/danoeh/antennapod/fragment/DownloadLogFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java similarity index 94% rename from src/de/danoeh/antennapod/fragment/DownloadLogFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java index d81ba4b86..9c7fade67 100644 --- a/src/de/danoeh/antennapod/fragment/DownloadLogFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java @@ -6,9 +6,9 @@ import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.View; import de.danoeh.antennapod.adapter.DownloadLogAdapter; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.storage.DBReader; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.service.download.DownloadStatus; +import de.danoeh.antennapod.core.storage.DBReader; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/DownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java similarity index 100% rename from src/de/danoeh/antennapod/fragment/DownloadsFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java diff --git a/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java similarity index 95% rename from src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index 985673dd3..99320cffa 100644 --- a/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -13,11 +13,11 @@ import android.widget.TextView; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.playback.Playable; -import de.danoeh.antennapod.util.playback.PlaybackController; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.core.util.playback.PlaybackController; /** * Fragment which is supposed to be displayed outside of the MediaplayerActivity diff --git a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java similarity index 97% rename from src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index 04c7fbf8e..f0e73a372 100644 --- a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -28,15 +28,15 @@ import android.widget.Toast; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.ShareUtils; -import de.danoeh.antennapod.util.ShownotesProvider; -import de.danoeh.antennapod.util.playback.Playable; -import de.danoeh.antennapod.util.playback.PlaybackController; -import de.danoeh.antennapod.util.playback.Timeline; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.ShareUtils; +import de.danoeh.antennapod.core.util.ShownotesProvider; +import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.core.util.playback.PlaybackController; +import de.danoeh.antennapod.core.util.playback.Timeline; /** * Displays the description of a Playable object in a Webview. diff --git a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java similarity index 93% rename from src/de/danoeh/antennapod/fragment/ItemlistFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java index 909774467..9eaeb56dd 100644 --- a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -32,25 +32,25 @@ import de.danoeh.antennapod.activity.FeedInfoActivity; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.DefaultActionButtonCallback; import de.danoeh.antennapod.adapter.FeedItemlistAdapter; -import de.danoeh.antennapod.asynctask.DownloadObserver; -import de.danoeh.antennapod.asynctask.FeedRemover; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.dialog.ConfirmationDialog; -import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; +import de.danoeh.antennapod.core.asynctask.DownloadObserver; +import de.danoeh.antennapod.core.asynctask.FeedRemover; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.dialog.ConfirmationDialog; +import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.dialog.FeedItemDialog; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.service.download.DownloadService; -import de.danoeh.antennapod.service.download.Downloader; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.menuhandler.FeedMenuHandler; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.feed.EventDistributor; +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.service.download.DownloadService; +import de.danoeh.antennapod.core.service.download.Downloader; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.menuhandler.FeedMenuHandler; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; /** * Displays a list of FeedItems. diff --git a/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java similarity index 94% rename from src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java index fe995256b..d126f2980 100644 --- a/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java @@ -19,22 +19,22 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.DefaultActionButtonCallback; import de.danoeh.antennapod.adapter.NewEpisodesListAdapter; -import de.danoeh.antennapod.asynctask.DownloadObserver; +import de.danoeh.antennapod.core.asynctask.DownloadObserver; import de.danoeh.antennapod.dialog.FeedItemDialog; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.download.DownloadService; -import de.danoeh.antennapod.service.download.Downloader; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.feed.EventDistributor; +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.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.download.DownloadService; +import de.danoeh.antennapod.core.service.download.Downloader; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; import java.util.List; import java.util.concurrent.atomic.AtomicReference; diff --git a/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java similarity index 94% rename from src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java index 470186180..4a07ce2b7 100644 --- a/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java @@ -16,17 +16,17 @@ import android.widget.ListView; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.DefaultActionButtonCallback; import de.danoeh.antennapod.adapter.FeedItemlistAdapter; -import de.danoeh.antennapod.asynctask.DownloadObserver; +import de.danoeh.antennapod.core.asynctask.DownloadObserver; import de.danoeh.antennapod.dialog.FeedItemDialog; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.service.download.Downloader; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.service.download.Downloader; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; import java.util.List; import java.util.concurrent.atomic.AtomicReference; diff --git a/src/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java similarity index 95% rename from src/de/danoeh/antennapod/fragment/QueueFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 2f322f75b..3192a84de 100644 --- a/src/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -28,17 +28,17 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.DefaultActionButtonCallback; import de.danoeh.antennapod.adapter.QueueListAdapter; -import de.danoeh.antennapod.asynctask.DownloadObserver; +import de.danoeh.antennapod.core.asynctask.DownloadObserver; import de.danoeh.antennapod.dialog.FeedItemDialog; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.service.download.Downloader; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.service.download.Downloader; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; /** * Shows all items in the queue diff --git a/src/de/danoeh/antennapod/fragment/RunningDownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/RunningDownloadsFragment.java similarity index 92% rename from src/de/danoeh/antennapod/fragment/RunningDownloadsFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/RunningDownloadsFragment.java index 89c30e34b..514b05efd 100644 --- a/src/de/danoeh/antennapod/fragment/RunningDownloadsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/RunningDownloadsFragment.java @@ -5,9 +5,9 @@ import android.os.Handler; import android.support.v4.app.ListFragment; import android.view.View; import de.danoeh.antennapod.adapter.DownloadlistAdapter; -import de.danoeh.antennapod.asynctask.DownloadObserver; -import de.danoeh.antennapod.service.download.Downloader; -import de.danoeh.antennapod.storage.DownloadRequester; +import de.danoeh.antennapod.core.asynctask.DownloadObserver; +import de.danoeh.antennapod.core.service.download.Downloader; +import de.danoeh.antennapod.core.storage.DownloadRequester; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/SearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java similarity index 96% rename from src/de/danoeh/antennapod/fragment/SearchFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java index b1411cf0a..7419b42ab 100644 --- a/src/de/danoeh/antennapod/fragment/SearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java @@ -16,12 +16,12 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.SearchlistAdapter; import de.danoeh.antennapod.dialog.FeedItemDialog; -import de.danoeh.antennapod.feed.*; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.FeedSearcher; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.feed.*; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.FeedSearcher; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java similarity index 100% rename from src/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java similarity index 93% rename from src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java index 1b4616207..15a0b55b1 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java @@ -5,23 +5,21 @@ import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; -import android.support.v7.widget.*; import android.util.Log; import android.view.*; import android.widget.*; -import android.widget.SearchView; + import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.OnlineFeedViewActivity; import de.danoeh.antennapod.adapter.gpodnet.PodcastListAdapter; -import de.danoeh.antennapod.fragment.SearchFragment; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java similarity index 69% rename from src/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java index 5717a74e7..33a35fa90 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java @@ -1,8 +1,8 @@ package de.danoeh.antennapod.fragment.gpodnet; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java similarity index 87% rename from src/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java index 801024787..635842196 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java @@ -10,11 +10,11 @@ import org.apache.commons.lang3.Validate; import java.util.List; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; /** * Performs a search on the gpodder.net directory and displays the results. diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java similarity index 72% rename from src/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java index 45fe25580..133bb0281 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SuggestionListFragment.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.fragment.gpodnet; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; -import de.danoeh.antennapod.preferences.GpodnetPreferences; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast; +import de.danoeh.antennapod.core.preferences.GpodnetPreferences; import java.util.ArrayList; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java similarity index 84% rename from src/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java index 204dda992..7e02b647f 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java @@ -5,10 +5,10 @@ import android.os.Bundle; import org.apache.commons.lang3.Validate; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; -import de.danoeh.antennapod.gpoddernet.model.GpodnetTag; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag; import java.util.List; diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java similarity index 94% rename from src/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java rename to app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java index a7e1033df..24e0e4caa 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java @@ -18,11 +18,11 @@ import java.util.List; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetTag; -import de.danoeh.antennapod.util.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag; +import de.danoeh.antennapod.menuhandler.MenuItemUtils; +import de.danoeh.antennapod.menuhandler.NavDrawerActivity; public class TagListFragment extends ListFragment { private static final String TAG = "TagListFragment"; diff --git a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java similarity index 93% rename from src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java rename to app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java index 2c7a7f074..8ccbdafc6 100644 --- a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -1,19 +1,19 @@ -package de.danoeh.antennapod.util.menuhandler; +package de.danoeh.antennapod.menuhandler; import android.content.Context; import android.content.Intent; import android.net.Uri; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.ShareUtils; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.core.util.ShareUtils; /** * Handles interactions with the FeedItemMenu. diff --git a/src/de/danoeh/antennapod/util/menuhandler/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java similarity index 81% rename from src/de/danoeh/antennapod/util/menuhandler/FeedMenuHandler.java rename to app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java index a3adec66d..62ae28820 100644 --- a/src/de/danoeh/antennapod/util/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.menuhandler; +package de.danoeh.antennapod.menuhandler; import android.content.Context; import android.content.Intent; @@ -7,16 +7,15 @@ import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.FeedInfoActivity; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.service.download.DownloadService; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.ShareUtils; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.service.download.DownloadService; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.ShareUtils; /** Handles interactions with the FeedItemMenu. */ public class FeedMenuHandler { diff --git a/src/de/danoeh/antennapod/util/menuhandler/MenuItemUtils.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java similarity index 92% rename from src/de/danoeh/antennapod/util/menuhandler/MenuItemUtils.java rename to app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java index 7aa04d24c..c4a96ac3f 100644 --- a/src/de/danoeh/antennapod/util/menuhandler/MenuItemUtils.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java @@ -1,11 +1,11 @@ -package de.danoeh.antennapod.util.menuhandler; +package de.danoeh.antennapod.menuhandler; import android.support.v4.view.MenuItemCompat; import android.support.v7.widget.SearchView; import android.view.Menu; import android.view.MenuItem; -import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.R; /** * Utilities for menu items diff --git a/src/de/danoeh/antennapod/util/menuhandler/NavDrawerActivity.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/NavDrawerActivity.java similarity index 76% rename from src/de/danoeh/antennapod/util/menuhandler/NavDrawerActivity.java rename to app/src/main/java/de/danoeh/antennapod/menuhandler/NavDrawerActivity.java index 9c611a452..6ceaaada4 100644 --- a/src/de/danoeh/antennapod/util/menuhandler/NavDrawerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/NavDrawerActivity.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.menuhandler; +package de.danoeh.antennapod.menuhandler; /** * Defines useful methods for activities that have a navigation drawer diff --git a/src/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java b/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java similarity index 87% rename from src/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java rename to app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java index 4dcf0b6aa..f55a7603f 100644 --- a/src/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java +++ b/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java @@ -9,10 +9,10 @@ import android.util.Log; import org.apache.commons.lang3.StringUtils; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.NetworkUtils; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.NetworkUtils; public class ConnectivityActionReceiver extends BroadcastReceiver { private static final String TAG = "ConnectivityActionReceiver"; diff --git a/src/de/danoeh/antennapod/receiver/PlayerWidget.java b/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java similarity index 69% rename from src/de/danoeh/antennapod/receiver/PlayerWidget.java rename to app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java index 9f8892181..7ab386edf 100644 --- a/src/de/danoeh/antennapod/receiver/PlayerWidget.java +++ b/app/src/main/java/de/danoeh/antennapod/receiver/PlayerWidget.java @@ -8,19 +8,18 @@ import android.util.Log; import org.apache.commons.lang3.StringUtils; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.service.playback.PlayerWidgetService; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.service.PlayerWidgetService; public class PlayerWidget extends AppWidgetProvider { private static final String TAG = "PlayerWidget"; - public static final String FORCE_WIDGET_UPDATE = "de.danoeh.antennapod.FORCE_WIDGET_UPDATE"; - public static final String STOP_WIDGET_UPDATE = "de.danoeh.antennapod.STOP_WIDGET_UPDATE"; - @Override + @Override public void onReceive(Context context, Intent intent) { - if (StringUtils.equals(intent.getAction(), FORCE_WIDGET_UPDATE)) { + if (StringUtils.equals(intent.getAction(), PlaybackService.FORCE_WIDGET_UPDATE)) { startUpdate(context); - } else if (StringUtils.equals(intent.getAction(), STOP_WIDGET_UPDATE)) { + } else if (StringUtils.equals(intent.getAction(), PlaybackService.STOP_WIDGET_UPDATE)) { stopUpdate(context); } diff --git a/src/de/danoeh/antennapod/receiver/SPAReceiver.java b/app/src/main/java/de/danoeh/antennapod/receiver/SPAReceiver.java similarity index 93% rename from src/de/danoeh/antennapod/receiver/SPAReceiver.java rename to app/src/main/java/de/danoeh/antennapod/receiver/SPAReceiver.java index b0430d170..359a546f6 100644 --- a/src/de/danoeh/antennapod/receiver/SPAReceiver.java +++ b/app/src/main/java/de/danoeh/antennapod/receiver/SPAReceiver.java @@ -7,9 +7,9 @@ import android.util.Log; import android.widget.Toast; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; import org.apache.commons.lang3.StringUtils; import java.util.Arrays; diff --git a/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java b/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java similarity index 93% rename from src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java rename to app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java index ec28724ed..4622e2f79 100644 --- a/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java +++ b/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.service.playback; +package de.danoeh.antennapod.service; import android.app.PendingIntent; import android.app.Service; @@ -12,12 +12,14 @@ import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.RemoteViews; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.receiver.MediaButtonReceiver; +import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.receiver.PlayerWidget; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.playback.Playable; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.service.playback.PlayerStatus; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.playback.Playable; /** Updates the state of the player widget */ public class PlayerWidgetService extends Service { diff --git a/src/de/danoeh/antennapod/spa/SPAUtil.java b/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java similarity index 100% rename from src/de/danoeh/antennapod/spa/SPAUtil.java rename to app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java diff --git a/src/de/danoeh/antennapod/view/AspectRatioVideoView.java b/app/src/main/java/de/danoeh/antennapod/view/AspectRatioVideoView.java similarity index 100% rename from src/de/danoeh/antennapod/view/AspectRatioVideoView.java rename to app/src/main/java/de/danoeh/antennapod/view/AspectRatioVideoView.java diff --git a/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml similarity index 100% rename from res/anim/fade_in.xml rename to app/src/main/res/anim/fade_in.xml diff --git a/res/anim/fade_out.xml b/app/src/main/res/anim/fade_out.xml similarity index 100% rename from res/anim/fade_out.xml rename to app/src/main/res/anim/fade_out.xml diff --git a/res/layout-land/audioplayer_activity.xml b/app/src/main/res/layout-land/audioplayer_activity.xml similarity index 100% rename from res/layout-land/audioplayer_activity.xml rename to app/src/main/res/layout-land/audioplayer_activity.xml diff --git a/res/layout-land/videoplayer_activity.xml b/app/src/main/res/layout-land/videoplayer_activity.xml similarity index 100% rename from res/layout-land/videoplayer_activity.xml rename to app/src/main/res/layout-land/videoplayer_activity.xml diff --git a/res/layout-v14/authentication_dialog.xml b/app/src/main/res/layout-v14/authentication_dialog.xml similarity index 100% rename from res/layout-v14/authentication_dialog.xml rename to app/src/main/res/layout-v14/authentication_dialog.xml diff --git a/res/layout-v14/directory_chooser.xml b/app/src/main/res/layout-v14/directory_chooser.xml similarity index 100% rename from res/layout-v14/directory_chooser.xml rename to app/src/main/res/layout-v14/directory_chooser.xml diff --git a/res/layout-v14/download_authentication_activity.xml b/app/src/main/res/layout-v14/download_authentication_activity.xml similarity index 100% rename from res/layout-v14/download_authentication_activity.xml rename to app/src/main/res/layout-v14/download_authentication_activity.xml diff --git a/res/layout-v14/opml_selection.xml b/app/src/main/res/layout-v14/opml_selection.xml similarity index 100% rename from res/layout-v14/opml_selection.xml rename to app/src/main/res/layout-v14/opml_selection.xml diff --git a/res/layout-v14/time_dialog.xml b/app/src/main/res/layout-v14/time_dialog.xml similarity index 100% rename from res/layout-v14/time_dialog.xml rename to app/src/main/res/layout-v14/time_dialog.xml diff --git a/res/layout/about.xml b/app/src/main/res/layout/about.xml similarity index 100% rename from res/layout/about.xml rename to app/src/main/res/layout/about.xml diff --git a/res/layout/addfeed.xml b/app/src/main/res/layout/addfeed.xml similarity index 100% rename from res/layout/addfeed.xml rename to app/src/main/res/layout/addfeed.xml diff --git a/res/layout/audioplayer_activity.xml b/app/src/main/res/layout/audioplayer_activity.xml similarity index 100% rename from res/layout/audioplayer_activity.xml rename to app/src/main/res/layout/audioplayer_activity.xml diff --git a/res/layout/authentication_dialog.xml b/app/src/main/res/layout/authentication_dialog.xml similarity index 100% rename from res/layout/authentication_dialog.xml rename to app/src/main/res/layout/authentication_dialog.xml diff --git a/res/layout/autoflattr_preference_dialog.xml b/app/src/main/res/layout/autoflattr_preference_dialog.xml similarity index 100% rename from res/layout/autoflattr_preference_dialog.xml rename to app/src/main/res/layout/autoflattr_preference_dialog.xml diff --git a/res/layout/cover_fragment.xml b/app/src/main/res/layout/cover_fragment.xml similarity index 100% rename from res/layout/cover_fragment.xml rename to app/src/main/res/layout/cover_fragment.xml diff --git a/res/layout/directory_chooser.xml b/app/src/main/res/layout/directory_chooser.xml similarity index 100% rename from res/layout/directory_chooser.xml rename to app/src/main/res/layout/directory_chooser.xml diff --git a/res/layout/download_authentication_activity.xml b/app/src/main/res/layout/download_authentication_activity.xml similarity index 100% rename from res/layout/download_authentication_activity.xml rename to app/src/main/res/layout/download_authentication_activity.xml diff --git a/res/layout/downloaded_episodeslist_item.xml b/app/src/main/res/layout/downloaded_episodeslist_item.xml similarity index 100% rename from res/layout/downloaded_episodeslist_item.xml rename to app/src/main/res/layout/downloaded_episodeslist_item.xml diff --git a/res/layout/downloadlist_item.xml b/app/src/main/res/layout/downloadlist_item.xml similarity index 100% rename from res/layout/downloadlist_item.xml rename to app/src/main/res/layout/downloadlist_item.xml diff --git a/res/layout/downloadlog_item.xml b/app/src/main/res/layout/downloadlog_item.xml similarity index 100% rename from res/layout/downloadlog_item.xml rename to app/src/main/res/layout/downloadlog_item.xml diff --git a/res/layout/ellipsize_start_listitem.xml b/app/src/main/res/layout/ellipsize_start_listitem.xml similarity index 100% rename from res/layout/ellipsize_start_listitem.xml rename to app/src/main/res/layout/ellipsize_start_listitem.xml diff --git a/res/layout/external_itemlist_item.xml b/app/src/main/res/layout/external_itemlist_item.xml similarity index 100% rename from res/layout/external_itemlist_item.xml rename to app/src/main/res/layout/external_itemlist_item.xml diff --git a/res/layout/external_player_fragment.xml b/app/src/main/res/layout/external_player_fragment.xml similarity index 100% rename from res/layout/external_player_fragment.xml rename to app/src/main/res/layout/external_player_fragment.xml diff --git a/res/layout/feedinfo.xml b/app/src/main/res/layout/feedinfo.xml similarity index 100% rename from res/layout/feedinfo.xml rename to app/src/main/res/layout/feedinfo.xml diff --git a/res/layout/feeditem_dialog.xml b/app/src/main/res/layout/feeditem_dialog.xml similarity index 100% rename from res/layout/feeditem_dialog.xml rename to app/src/main/res/layout/feeditem_dialog.xml diff --git a/res/layout/feeditemlist_header.xml b/app/src/main/res/layout/feeditemlist_header.xml similarity index 100% rename from res/layout/feeditemlist_header.xml rename to app/src/main/res/layout/feeditemlist_header.xml diff --git a/res/layout/feeditemlist_item.xml b/app/src/main/res/layout/feeditemlist_item.xml similarity index 100% rename from res/layout/feeditemlist_item.xml rename to app/src/main/res/layout/feeditemlist_item.xml diff --git a/res/layout/flattr_auth.xml b/app/src/main/res/layout/flattr_auth.xml similarity index 100% rename from res/layout/flattr_auth.xml rename to app/src/main/res/layout/flattr_auth.xml diff --git a/res/layout/gpodnet_podcast_list.xml b/app/src/main/res/layout/gpodnet_podcast_list.xml similarity index 100% rename from res/layout/gpodnet_podcast_list.xml rename to app/src/main/res/layout/gpodnet_podcast_list.xml diff --git a/res/layout/gpodnet_podcast_listitem.xml b/app/src/main/res/layout/gpodnet_podcast_listitem.xml similarity index 100% rename from res/layout/gpodnet_podcast_listitem.xml rename to app/src/main/res/layout/gpodnet_podcast_listitem.xml diff --git a/res/layout/gpodnetauth_activity.xml b/app/src/main/res/layout/gpodnetauth_activity.xml similarity index 100% rename from res/layout/gpodnetauth_activity.xml rename to app/src/main/res/layout/gpodnetauth_activity.xml diff --git a/res/layout/gpodnetauth_credentials.xml b/app/src/main/res/layout/gpodnetauth_credentials.xml similarity index 100% rename from res/layout/gpodnetauth_credentials.xml rename to app/src/main/res/layout/gpodnetauth_credentials.xml diff --git a/res/layout/gpodnetauth_device.xml b/app/src/main/res/layout/gpodnetauth_device.xml similarity index 100% rename from res/layout/gpodnetauth_device.xml rename to app/src/main/res/layout/gpodnetauth_device.xml diff --git a/res/layout/gpodnetauth_finish.xml b/app/src/main/res/layout/gpodnetauth_finish.xml similarity index 100% rename from res/layout/gpodnetauth_finish.xml rename to app/src/main/res/layout/gpodnetauth_finish.xml diff --git a/res/layout/itemdescription_listitem.xml b/app/src/main/res/layout/itemdescription_listitem.xml similarity index 100% rename from res/layout/itemdescription_listitem.xml rename to app/src/main/res/layout/itemdescription_listitem.xml diff --git a/res/layout/listview_activity.xml b/app/src/main/res/layout/listview_activity.xml similarity index 100% rename from res/layout/listview_activity.xml rename to app/src/main/res/layout/listview_activity.xml diff --git a/res/layout/main.xml b/app/src/main/res/layout/main.xml similarity index 100% rename from res/layout/main.xml rename to app/src/main/res/layout/main.xml diff --git a/res/layout/nav_feedlistitem.xml b/app/src/main/res/layout/nav_feedlistitem.xml similarity index 100% rename from res/layout/nav_feedlistitem.xml rename to app/src/main/res/layout/nav_feedlistitem.xml diff --git a/res/layout/nav_listitem.xml b/app/src/main/res/layout/nav_listitem.xml similarity index 100% rename from res/layout/nav_listitem.xml rename to app/src/main/res/layout/nav_listitem.xml diff --git a/res/layout/nav_section_item.xml b/app/src/main/res/layout/nav_section_item.xml similarity index 100% rename from res/layout/nav_section_item.xml rename to app/src/main/res/layout/nav_section_item.xml diff --git a/res/layout/new_episodes_fragment.xml b/app/src/main/res/layout/new_episodes_fragment.xml similarity index 100% rename from res/layout/new_episodes_fragment.xml rename to app/src/main/res/layout/new_episodes_fragment.xml diff --git a/res/layout/new_episodes_listitem.xml b/app/src/main/res/layout/new_episodes_listitem.xml similarity index 100% rename from res/layout/new_episodes_listitem.xml rename to app/src/main/res/layout/new_episodes_listitem.xml diff --git a/res/layout/onlinefeedview_header.xml b/app/src/main/res/layout/onlinefeedview_header.xml similarity index 100% rename from res/layout/onlinefeedview_header.xml rename to app/src/main/res/layout/onlinefeedview_header.xml diff --git a/res/layout/opml_import.xml b/app/src/main/res/layout/opml_import.xml similarity index 100% rename from res/layout/opml_import.xml rename to app/src/main/res/layout/opml_import.xml diff --git a/res/layout/opml_selection.xml b/app/src/main/res/layout/opml_selection.xml similarity index 100% rename from res/layout/opml_selection.xml rename to app/src/main/res/layout/opml_selection.xml diff --git a/res/layout/pager_fragment.xml b/app/src/main/res/layout/pager_fragment.xml similarity index 100% rename from res/layout/pager_fragment.xml rename to app/src/main/res/layout/pager_fragment.xml diff --git a/res/layout/player_widget.xml b/app/src/main/res/layout/player_widget.xml similarity index 100% rename from res/layout/player_widget.xml rename to app/src/main/res/layout/player_widget.xml diff --git a/res/layout/queue_fragment.xml b/app/src/main/res/layout/queue_fragment.xml similarity index 100% rename from res/layout/queue_fragment.xml rename to app/src/main/res/layout/queue_fragment.xml diff --git a/res/layout/queue_listitem.xml b/app/src/main/res/layout/queue_listitem.xml similarity index 100% rename from res/layout/queue_listitem.xml rename to app/src/main/res/layout/queue_listitem.xml diff --git a/res/layout/searchlist_item.xml b/app/src/main/res/layout/searchlist_item.xml similarity index 100% rename from res/layout/searchlist_item.xml rename to app/src/main/res/layout/searchlist_item.xml diff --git a/res/layout/simplechapter_item.xml b/app/src/main/res/layout/simplechapter_item.xml similarity index 100% rename from res/layout/simplechapter_item.xml rename to app/src/main/res/layout/simplechapter_item.xml diff --git a/res/layout/storage_error.xml b/app/src/main/res/layout/storage_error.xml similarity index 100% rename from res/layout/storage_error.xml rename to app/src/main/res/layout/storage_error.xml diff --git a/res/layout/time_dialog.xml b/app/src/main/res/layout/time_dialog.xml similarity index 100% rename from res/layout/time_dialog.xml rename to app/src/main/res/layout/time_dialog.xml diff --git a/res/menu/directory_chooser.xml b/app/src/main/res/menu/directory_chooser.xml similarity index 100% rename from res/menu/directory_chooser.xml rename to app/src/main/res/menu/directory_chooser.xml diff --git a/res/menu/feedinfo.xml b/app/src/main/res/menu/feedinfo.xml similarity index 100% rename from res/menu/feedinfo.xml rename to app/src/main/res/menu/feedinfo.xml diff --git a/res/menu/feeditem.xml b/app/src/main/res/menu/feeditem.xml similarity index 100% rename from res/menu/feeditem.xml rename to app/src/main/res/menu/feeditem.xml diff --git a/res/menu/feeditem_dialog.xml b/app/src/main/res/menu/feeditem_dialog.xml similarity index 100% rename from res/menu/feeditem_dialog.xml rename to app/src/main/res/menu/feeditem_dialog.xml diff --git a/res/menu/feedlist.xml b/app/src/main/res/menu/feedlist.xml similarity index 100% rename from res/menu/feedlist.xml rename to app/src/main/res/menu/feedlist.xml diff --git a/res/menu/main.xml b/app/src/main/res/menu/main.xml similarity index 100% rename from res/menu/main.xml rename to app/src/main/res/menu/main.xml diff --git a/res/menu/mediaplayer.xml b/app/src/main/res/menu/mediaplayer.xml similarity index 100% rename from res/menu/mediaplayer.xml rename to app/src/main/res/menu/mediaplayer.xml diff --git a/res/menu/new_episodes.xml b/app/src/main/res/menu/new_episodes.xml similarity index 100% rename from res/menu/new_episodes.xml rename to app/src/main/res/menu/new_episodes.xml diff --git a/res/menu/queue_context.xml b/app/src/main/res/menu/queue_context.xml similarity index 100% rename from res/menu/queue_context.xml rename to app/src/main/res/menu/queue_context.xml diff --git a/res/xml/player_widget_info.xml b/app/src/main/res/xml/player_widget_info.xml similarity index 100% rename from res/xml/player_widget_info.xml rename to app/src/main/res/xml/player_widget_info.xml diff --git a/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml similarity index 100% rename from res/xml/preferences.xml rename to app/src/main/res/xml/preferences.xml diff --git a/res/xml/searchable.xml b/app/src/main/res/xml/searchable.xml similarity index 100% rename from res/xml/searchable.xml rename to app/src/main/res/xml/searchable.xml diff --git a/build.gradle b/build.gradle index 673eff508..d59e200b9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,130 +1,23 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + buildscript { repositories { - mavenCentral() + jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:0.13.2' + classpath 'com.android.tools.build:gradle:0.13.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files } } -apply plugin: 'com.android.application' -repositories { - mavenCentral() -} -dependencies { - def libsdir = new File('libs'); - if (!libsdir.exists()) { - println "Creating libs directory" - libsdir.mkdir() - } - compile 'com.android.support:support-v4:20.0.0' - compile 'com.android.support:appcompat-v7:20.0.0' - compile 'org.apache.commons:commons-lang3:3.3.2' - compile ('org.shredzone.flattr4j:flattr4j-core:2.11') { - exclude group: 'org.apache.httpcomponents', module: 'httpcore' - exclude group: 'org.apache.httpcomponents', module: 'httpclient' - exclude group: 'org.json', module: 'json' - } - compile 'commons-io:commons-io:2.4' - compile 'com.nineoldandroids:library:2.4.0' - compile project(':submodules:dslv:library') - - compile 'com.jayway.android.robotium:robotium-solo:5.2.1' - compile ("com.doomonafireball.betterpickers:library:1.5.2") { - exclude group: 'com.android.support', module: 'support-v4' - } - compile 'org.jsoup:jsoup:1.8.1' - compile 'com.squareup.picasso:picasso:2.3.4' - compile 'com.squareup.okhttp:okhttp:2.0.0' - compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' - compile 'com.squareup.okio:okio:1.0.1' -} - -android { - compileSdkVersion 20 - buildToolsVersion "20.0" - - defaultConfig { - minSdkVersion 10 - targetSdkVersion 20 - testApplicationId "de.test.antennapod" - testInstrumentationRunner "instrumentationTest.de.test.antennapod.AntennaPodTestRunner" - } - - signingConfigs { - releaseConfig { - if (project.hasProperty('releaseStoreFile')) { - storeFile file(releaseStoreFile) - } else { - storeFile file('keystore') - } - if (project.hasProperty('releaseStorePassword')) { - storePassword releaseStorePassword - } else { - storePassword "password" - } - if (project.hasProperty('releaseKeyAlias')) { - keyAlias releaseKeyAlias - } else { - keyAlias "alias" - } - if (project.hasProperty('releaseKeyPassword')) { - keyPassword releaseKeyPassword - } else { - keyPassword "password" - } - } - } - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src'] - resources.srcDirs = ['src'] - aidl.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['jniLibs'] - } - } - - buildTypes { - def STRING = "String" - def FLATTR_APP_KEY = "FLATTR_APP_KEY" - def FLATTR_APP_SECRET = "FLATTR_APP_SECRET" - def mFlattrAppKey = (project.hasProperty('flattrAppKey')) ? flattrAppKey : "\"\"" - def mFlattrAppSecret = (project.hasProperty('flattrAppSecret')) ? flattrAppSecret : "\"\"" - - debug { - applicationIdSuffix ".debug" - buildConfigField STRING, FLATTR_APP_KEY, mFlattrAppKey - buildConfigField STRING, FLATTR_APP_SECRET, mFlattrAppSecret - } - release { - runProguard true - proguardFile 'proguard.cfg' - signingConfig signingConfigs.releaseConfig - buildConfigField STRING, FLATTR_APP_KEY, mFlattrAppKey - buildConfigField STRING, FLATTR_APP_SECRET, mFlattrAppSecret - } - } - - packagingOptions { - exclude 'META-INF/LICENSE.txt' - exclude 'META-INF/NOTICE.txt' - } - - lintOptions { - abortOnError false - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 +allprojects { + repositories { + jcenter() } } task wrapper(type: Wrapper) { gradleVersion = '2.1' -} +} \ No newline at end of file diff --git a/core/.gitignore b/core/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/core/.gitignore @@ -0,0 +1 @@ +/build diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 000000000..132d68084 --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,43 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 20 + buildToolsVersion "20.0.0" + + defaultConfig { + applicationId "de.danoeh.antennapod.core" + minSdkVersion 10 + targetSdkVersion 20 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:20.0.0' + compile 'com.android.support:support-v4:20.0.0' + compile 'org.apache.commons:commons-lang3:3.3.2' + compile ('org.shredzone.flattr4j:flattr4j-core:2.10') { + exclude group: 'org.apache.httpcomponents', module: 'httpcore' + exclude group: 'org.apache.httpcomponents', module: 'httpclient' + exclude group: 'org.json', module: 'json' + } + compile 'commons-io:commons-io:2.4' + compile 'com.nineoldandroids:library:2.4.0' + compile 'com.jayway.android.robotium:robotium-solo:5.2.1' + compile ("com.doomonafireball.betterpickers:library:1.5.2") { + exclude group: 'com.android.support', module: 'support-v4' + } + compile 'org.jsoup:jsoup:1.7.3' + compile 'com.squareup.picasso:picasso:2.3.4' + compile 'com.squareup.okhttp:okhttp:2.0.0' + compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' + compile 'com.squareup.okio:okio:1.0.0' +} diff --git a/tests/proguard-project.txt b/core/proguard-rules.pro similarity index 62% rename from tests/proguard-project.txt rename to core/proguard-rules.pro index f2fe1559a..41a9efda7 100644 --- a/tests/proguard-project.txt +++ b/core/proguard-rules.pro @@ -1,11 +1,8 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. +# in /Users/daniel/bin/android-sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/ApplicationTest.java b/core/src/androidTest/java/de/danoeh/antennapod/core/ApplicationTest.java new file mode 100644 index 000000000..894bcfa63 --- /dev/null +++ b/core/src/androidTest/java/de/danoeh/antennapod/core/ApplicationTest.java @@ -0,0 +1,13 @@ +package de.danoeh.antennapod.core; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml new file mode 100644 index 000000000..c660cd805 --- /dev/null +++ b/core/src/main/AndroidManifest.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aocate/presto/service/IDeathCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IDeathCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IDeathCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IDeathCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IOnBufferingUpdateListenerCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IOnBufferingUpdateListenerCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IOnBufferingUpdateListenerCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IOnBufferingUpdateListenerCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IOnCompletionListenerCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IOnCompletionListenerCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IOnCompletionListenerCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IOnCompletionListenerCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IOnErrorListenerCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IOnErrorListenerCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IOnErrorListenerCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IOnErrorListenerCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IOnInfoListenerCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IOnInfoListenerCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IOnInfoListenerCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IOnInfoListenerCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IOnPitchAdjustmentAvailableChangedListenerCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IOnPitchAdjustmentAvailableChangedListenerCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IOnPitchAdjustmentAvailableChangedListenerCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IOnPitchAdjustmentAvailableChangedListenerCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IOnPreparedListenerCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IOnPreparedListenerCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IOnPreparedListenerCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IOnPreparedListenerCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IOnSeekCompleteListenerCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IOnSeekCompleteListenerCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IOnSeekCompleteListenerCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IOnSeekCompleteListenerCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IOnSpeedAdjustmentAvailableChangedListenerCallback_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IOnSpeedAdjustmentAvailableChangedListenerCallback_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IOnSpeedAdjustmentAvailableChangedListenerCallback_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IOnSpeedAdjustmentAvailableChangedListenerCallback_0_8.aidl diff --git a/src/com/aocate/presto/service/IPlayMedia_0_8.aidl b/core/src/main/aidl/com/aocate/presto/service/IPlayMedia_0_8.aidl similarity index 100% rename from src/com/aocate/presto/service/IPlayMedia_0_8.aidl rename to core/src/main/aidl/com/aocate/presto/service/IPlayMedia_0_8.aidl diff --git a/src/com/aocate/media/AndroidMediaPlayer.java b/core/src/main/java/com/aocate/media/AndroidMediaPlayer.java similarity index 100% rename from src/com/aocate/media/AndroidMediaPlayer.java rename to core/src/main/java/com/aocate/media/AndroidMediaPlayer.java diff --git a/core/src/main/java/com/aocate/media/MediaPlayer.java b/core/src/main/java/com/aocate/media/MediaPlayer.java new file mode 100644 index 000000000..c73c5219e --- /dev/null +++ b/core/src/main/java/com/aocate/media/MediaPlayer.java @@ -0,0 +1,1278 @@ +// Copyright 2011, Aocate, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.aocate.media; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.media.AudioManager; +import android.net.Uri; +import android.os.Handler; +import android.os.Handler.Callback; +import android.os.IBinder; +import android.os.Message; +import android.util.Log; + +import java.io.IOException; +import java.util.List; +import java.util.concurrent.locks.ReentrantLock; + +import de.danoeh.antennapod.core.BuildConfig; + +public class MediaPlayer { + public interface OnBufferingUpdateListener { + public abstract void onBufferingUpdate(MediaPlayer arg0, int percent); + } + + public interface OnCompletionListener { + public abstract void onCompletion(MediaPlayer arg0); + } + + public interface OnErrorListener { + public abstract boolean onError(MediaPlayer arg0, int what, int extra); + } + + public interface OnInfoListener { + public abstract boolean onInfo(MediaPlayer arg0, int what, int extra); + } + + public interface OnPitchAdjustmentAvailableChangedListener { + /** + * @param arg0 The owning media player + * @param pitchAdjustmentAvailable True if pitch adjustment is available, false if not + */ + public abstract void onPitchAdjustmentAvailableChanged( + MediaPlayer arg0, boolean pitchAdjustmentAvailable); + } + + public interface OnPreparedListener { + public abstract void onPrepared(MediaPlayer arg0); + } + + public interface OnSeekCompleteListener { + public abstract void onSeekComplete(MediaPlayer arg0); + } + + public interface OnSpeedAdjustmentAvailableChangedListener { + /** + * @param arg0 The owning media player + * @param speedAdjustmentAvailable True if speed adjustment is available, false if not + */ + public abstract void onSpeedAdjustmentAvailableChanged( + MediaPlayer arg0, boolean speedAdjustmentAvailable); + } + + public enum State { + IDLE, INITIALIZED, PREPARED, STARTED, PAUSED, STOPPED, PREPARING, PLAYBACK_COMPLETED, END, ERROR + } + + private static Uri SPEED_ADJUSTMENT_MARKET_URI = Uri + .parse("market://details?id=com.aocate.presto"); + + private static Intent prestoMarketIntent = null; + + public static final int MEDIA_ERROR_SERVER_DIED = android.media.MediaPlayer.MEDIA_ERROR_SERVER_DIED; + public static final int MEDIA_ERROR_UNKNOWN = android.media.MediaPlayer.MEDIA_ERROR_UNKNOWN; + public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = android.media.MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK; + + /** + * Indicates whether the specified action can be used as an intent. This + * method queries the package manager for installed packages that can + * respond to an intent with the specified action. If no suitable package is + * found, this method returns false. + * + * @param context The application's environment. + * @param action The Intent action to check for availability. + * @return True if an Intent with the specified action can be sent and + * responded to, false otherwise. + */ + public static boolean isIntentAvailable(Context context, String action) { + final PackageManager packageManager = context.getPackageManager(); + final Intent intent = new Intent(action); + List list = packageManager.queryIntentServices(intent, + PackageManager.MATCH_DEFAULT_ONLY); + return list.size() > 0; + } + + /** + * Indicates whether the Presto library is installed + * + * @param context The context to use to query the package manager. + * @return True if the Presto library is installed, false if not. + */ + public static boolean isPrestoLibraryInstalled(Context context) { + return isIntentAvailable(context, ServiceBackedMediaPlayer.INTENT_NAME); + } + + /** + * Return an Intent that opens the Android Market page for the speed + * alteration library + * + * @return The Intent for the Presto library on the Android Market + */ + public static Intent getPrestoMarketIntent() { + if (prestoMarketIntent == null) { + prestoMarketIntent = new Intent(Intent.ACTION_VIEW, + SPEED_ADJUSTMENT_MARKET_URI); + } + return prestoMarketIntent; + } + + /** + * Open the Android Market page for the Presto library + * + * @param context The context from which to open the Android Market page + */ + public static void openPrestoMarketIntent(Context context) { + context.startActivity(getPrestoMarketIntent()); + } + + private static final String MP_TAG = "AocateReplacementMediaPlayer"; + + private static final double PITCH_STEP_CONSTANT = 1.0594630943593; + + private AndroidMediaPlayer amp = null; + // This is whether speed adjustment should be enabled (by the Service) + // To avoid the Service entirely, set useService to false + protected boolean enableSpeedAdjustment = true; + private int lastKnownPosition = 0; + // In some cases, we're going to have to replace the + // android.media.MediaPlayer on the fly, and we don't want to touch the + // wrong media player, so lock it way too much. + ReentrantLock lock = new ReentrantLock(); + private int mAudioStreamType = AudioManager.STREAM_MUSIC; + private Context mContext; + private boolean mIsLooping = false; + private float mLeftVolume = 1f; + private float mPitchStepsAdjustment = 0f; + private float mRightVolume = 1f; + private float mSpeedMultiplier = 1f; + private int mWakeMode = 0; + MediaPlayerImpl mpi = null; + protected boolean pitchAdjustmentAvailable = false; + private ServiceBackedMediaPlayer sbmp = null; + protected boolean speedAdjustmentAvailable = false; + + private Handler mServiceDisconnectedHandler = null; + + // Some parts of state cannot be found by calling MediaPlayerImpl functions, + // so store our own state. This also helps copy state when changing + // implementations + State state = State.INITIALIZED; + String stringDataSource = null; + Uri uriDataSource = null; + private boolean useService = false; + + // Naming Convention for Listeners + // Most listeners can both be set by clients and called by MediaPlayImpls + // There are a few that have to do things in this class as well as calling + // the function. In all cases, onX is what is called by MediaPlayerImpl + // If there is work to be done in this class, then the listener that is + // set by setX is X (with the first letter lowercase). + OnBufferingUpdateListener onBufferingUpdateListener = null; + OnCompletionListener onCompletionListener = null; + OnErrorListener onErrorListener = null; + OnInfoListener onInfoListener = null; + + // Special case. Pitch adjustment ceases to be available when we switch + // to the android.media.MediaPlayer (though it is not guaranteed to be + // available when using the ServiceBackedMediaPlayer) + OnPitchAdjustmentAvailableChangedListener onPitchAdjustmentAvailableChangedListener = new OnPitchAdjustmentAvailableChangedListener() { + public void onPitchAdjustmentAvailableChanged(MediaPlayer arg0, + boolean pitchAdjustmentAvailable) { + lock.lock(); + try { + Log + .d( + MP_TAG, + "onPitchAdjustmentAvailableChangedListener.onPitchAdjustmentAvailableChanged being called"); + if (MediaPlayer.this.pitchAdjustmentAvailable != pitchAdjustmentAvailable) { + Log.d(MP_TAG, "Pitch adjustment state has changed from " + + MediaPlayer.this.pitchAdjustmentAvailable + + " to " + pitchAdjustmentAvailable); + MediaPlayer.this.pitchAdjustmentAvailable = pitchAdjustmentAvailable; + if (MediaPlayer.this.pitchAdjustmentAvailableChangedListener != null) { + MediaPlayer.this.pitchAdjustmentAvailableChangedListener + .onPitchAdjustmentAvailableChanged(arg0, + pitchAdjustmentAvailable); + } + } + } finally { + lock.unlock(); + } + } + }; + OnPitchAdjustmentAvailableChangedListener pitchAdjustmentAvailableChangedListener = null; + + MediaPlayer.OnPreparedListener onPreparedListener = new MediaPlayer.OnPreparedListener() { + public void onPrepared(MediaPlayer arg0) { + Log.d(MP_TAG, "onPreparedListener 242 setting state to PREPARED"); + MediaPlayer.this.state = State.PREPARED; + if (MediaPlayer.this.preparedListener != null) { + Log.d(MP_TAG, "Calling preparedListener"); + MediaPlayer.this.preparedListener.onPrepared(arg0); + } + Log.d(MP_TAG, "Wrap up onPreparedListener"); + } + }; + + OnPreparedListener preparedListener = null; + OnSeekCompleteListener onSeekCompleteListener = null; + + // Special case. Speed adjustment ceases to be available when we switch + // to the android.media.MediaPlayer (though it is not guaranteed to be + // available when using the ServiceBackedMediaPlayer) + OnSpeedAdjustmentAvailableChangedListener onSpeedAdjustmentAvailableChangedListener = new OnSpeedAdjustmentAvailableChangedListener() { + public void onSpeedAdjustmentAvailableChanged(MediaPlayer arg0, + boolean speedAdjustmentAvailable) { + lock.lock(); + try { + Log + .d( + MP_TAG, + "onSpeedAdjustmentAvailableChangedListener.onSpeedAdjustmentAvailableChanged being called"); + if (MediaPlayer.this.speedAdjustmentAvailable != speedAdjustmentAvailable) { + Log.d(MP_TAG, "Speed adjustment state has changed from " + + MediaPlayer.this.speedAdjustmentAvailable + + " to " + speedAdjustmentAvailable); + MediaPlayer.this.speedAdjustmentAvailable = speedAdjustmentAvailable; + if (MediaPlayer.this.speedAdjustmentAvailableChangedListener != null) { + MediaPlayer.this.speedAdjustmentAvailableChangedListener + .onSpeedAdjustmentAvailableChanged(arg0, + speedAdjustmentAvailable); + } + } + } finally { + lock.unlock(); + } + } + }; + OnSpeedAdjustmentAvailableChangedListener speedAdjustmentAvailableChangedListener = null; + + private int speedAdjustmentAlgorithm = SpeedAdjustmentAlgorithm.SONIC; + + public MediaPlayer(final Context context) { + this(context, true); + } + + public MediaPlayer(final Context context, boolean useService) { + this.mContext = context; + this.useService = useService; + + // So here's the major problem + // Sometimes the service won't exist or won't be connected, + // so start with an android.media.MediaPlayer, and when + // the service is connected, use that from then on + this.mpi = this.amp = new AndroidMediaPlayer(this, context); + + // setupMpi will go get the Service, if it can, then bring that + // implementation into sync + Log.d(MP_TAG, "setupMpi"); + setupMpi(context); + } + + private boolean invalidServiceConnectionConfiguration() { + if (!(this.mpi instanceof ServiceBackedMediaPlayer)) { + if (this.useService && isPrestoLibraryInstalled()) { + // In this case, the Presto library has been installed + // or something while playing sound + // We could be using the service, but we're not + Log.d(MP_TAG, "We could be using the service, but we're not 316"); + return true; + } + // If useService is false, then we shouldn't be using the SBMP + // If the Presto library isn't installed, ditto + Log.d(MP_TAG, "this.mpi is not a ServiceBackedMediaPlayer, but we couldn't use it anyway 321"); + return false; + } else { + if (BuildConfig.DEBUG && !(this.mpi instanceof ServiceBackedMediaPlayer)) + throw new AssertionError(); + if (this.useService && isPrestoLibraryInstalled()) { + // We should be using the service, and we are. Great! + Log.d(MP_TAG, "We could be using a ServiceBackedMediaPlayer and we are 327"); + return false; + } + // We're trying to use the service when we shouldn't, + // that's an invalid configuration + Log.d(MP_TAG, "We're trying to use a ServiceBackedMediaPlayer but we shouldn't be 332"); + return true; + } + } + + private void setupMpi(final Context context) { + lock.lock(); + try { + Log.d(MP_TAG, "setupMpi 336"); + // Check if the client wants to use the service at all, + // then if we're already using the right kind of media player + if (this.useService && isPrestoLibraryInstalled()) { + if ((this.mpi != null) + && (this.mpi instanceof ServiceBackedMediaPlayer)) { + Log.d(MP_TAG, "Already using ServiceBackedMediaPlayer"); + return; + } + if (this.sbmp == null) { + Log.d(MP_TAG, "Instantiating new ServiceBackedMediaPlayer 346"); + this.sbmp = new ServiceBackedMediaPlayer(this, context, + new ServiceConnection() { + public void onServiceConnected( + ComponentName className, + final IBinder service) { + Thread t = new Thread(new Runnable() { + public void run() { + // This lock probably isn't granular + // enough + MediaPlayer.this.lock.lock(); + Log.d(MP_TAG, + "onServiceConnected 257"); + try { + MediaPlayer.this + .switchMediaPlayerImpl( + MediaPlayer.this.amp, + MediaPlayer.this.sbmp); + Log.d(MP_TAG, "End onServiceConnected 362"); + } finally { + MediaPlayer.this.lock.unlock(); + } + } + }); + t.start(); + } + + public void onServiceDisconnected( + ComponentName className) { + MediaPlayer.this.lock.lock(); + try { + // Can't get any more useful information + // out of sbmp + if (MediaPlayer.this.sbmp != null) { + MediaPlayer.this.sbmp.release(); + } + // Unlike most other cases, sbmp gets set + // to null since there's nothing useful + // backing it now + MediaPlayer.this.sbmp = null; + + if (mServiceDisconnectedHandler == null) { + mServiceDisconnectedHandler = new Handler(new Callback() { + public boolean handleMessage(Message msg) { + // switchMediaPlayerImpl won't try to + // clone anything from null + lock.lock(); + try { + if (MediaPlayer.this.amp == null) { + // This should never be in this state + MediaPlayer.this.amp = new AndroidMediaPlayer( + MediaPlayer.this, + MediaPlayer.this.mContext); + } + // Use sbmp instead of null in case by some miracle it's + // been restored in the meantime + MediaPlayer.this.switchMediaPlayerImpl( + MediaPlayer.this.sbmp, + MediaPlayer.this.amp); + return true; + } finally { + lock.unlock(); + } + } + }); + } + + // This code needs to execute on the + // original thread to instantiate + // the new object in the right place + mServiceDisconnectedHandler + .sendMessage( + mServiceDisconnectedHandler + .obtainMessage()); + // Note that we do NOT want to set + // useService. useService is about + // what the user wants, not what they + // get + } finally { + MediaPlayer.this.lock.unlock(); + } + } + } + ); + } + switchMediaPlayerImpl(this.amp, this.sbmp); + } else { + if ((this.mpi != null) + && (this.mpi instanceof AndroidMediaPlayer)) { + Log.d(MP_TAG, "Already using AndroidMediaPlayer"); + return; + } + if (this.amp == null) { + Log.d(MP_TAG, "Instantiating new AndroidMediaPlayer (this should be impossible)"); + this.amp = new AndroidMediaPlayer(this, context); + } + switchMediaPlayerImpl(this.sbmp, this.amp); + } + } finally { + lock.unlock(); + } + } + + private void switchMediaPlayerImpl(MediaPlayerImpl from, MediaPlayerImpl to) { + lock.lock(); + try { + Log.d(MP_TAG, "switchMediaPlayerImpl"); + if ((from == to) + // Same object, nothing to synchronize + || (to == null) + // Nothing to copy to (maybe this should throw an error?) + || ((to instanceof ServiceBackedMediaPlayer) && !((ServiceBackedMediaPlayer) to).isConnected()) + // ServiceBackedMediaPlayer hasn't yet connected, onServiceConnected will take care of the transition + || (MediaPlayer.this.state == State.END)) { + // State.END is after a release(), no further functions should + // be called on this class and from is likely to have problems + // retrieving state that won't be used anyway + return; + } + // Extract all that we can from the existing implementation + // and copy it to the new implementation + + Log.d(MP_TAG, "switchMediaPlayerImpl(), current state is " + + this.state.toString()); + + to.reset(); + + // Do this first so we don't have to prepare the same + // data file twice + to.setEnableSpeedAdjustment(MediaPlayer.this.enableSpeedAdjustment); + + // This is a reasonable place to set all of these, + // none of them require prepare() or the like first + to.setAudioStreamType(this.mAudioStreamType); + to.setSpeedAdjustmentAlgorithm(this.speedAdjustmentAlgorithm); + to.setLooping(this.mIsLooping); + to.setPitchStepsAdjustment(this.mPitchStepsAdjustment); + Log.d(MP_TAG, "Setting playback speed to " + this.mSpeedMultiplier); + to.setPlaybackSpeed(this.mSpeedMultiplier); + to.setVolume(MediaPlayer.this.mLeftVolume, + MediaPlayer.this.mRightVolume); + to.setWakeMode(this.mContext, this.mWakeMode); + + Log.d(MP_TAG, "asserting at least one data source is null"); + assert ((MediaPlayer.this.stringDataSource == null) || (MediaPlayer.this.uriDataSource == null)); + + if (uriDataSource != null) { + Log.d(MP_TAG, "switchMediaPlayerImpl(): uriDataSource != null"); + try { + to.setDataSource(this.mContext, uriDataSource); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalStateException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + if (stringDataSource != null) { + Log.d(MP_TAG, + "switchMediaPlayerImpl(): stringDataSource != null"); + try { + to.setDataSource(stringDataSource); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalStateException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + if ((this.state == State.PREPARED) + || (this.state == State.PREPARING) + || (this.state == State.PAUSED) + || (this.state == State.STOPPED) + || (this.state == State.STARTED) + || (this.state == State.PLAYBACK_COMPLETED)) { + Log.d(MP_TAG, "switchMediaPlayerImpl(): prepare and seek"); + // Use prepare here instead of prepareAsync so that + // we wait for it to be ready before we try to use it + try { + to.muteNextOnPrepare(); + to.prepare(); + } catch (IllegalStateException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + int seekPos = 0; + if (from != null) { + seekPos = from.getCurrentPosition(); + } else if (this.lastKnownPosition < to.getDuration()) { + // This can happen if the Service unexpectedly + // disconnected. Because it would result in too much + // information being passed around, we don't constantly + // poll for the lastKnownPosition, but we'll save it + // when getCurrentPosition is called + seekPos = this.lastKnownPosition; + } + to.muteNextSeek(); + to.seekTo(seekPos); + } + if ((from != null) + && from.isPlaying()) { + from.pause(); + } + if ((this.state == State.STARTED) + || (this.state == State.PAUSED) + || (this.state == State.STOPPED)) { + Log.d(MP_TAG, "switchMediaPlayerImpl(): start"); + if (to != null) { + to.start(); + } + } + + if (this.state == State.PAUSED) { + Log.d(MP_TAG, "switchMediaPlayerImpl(): paused"); + if (to != null) { + to.pause(); + } + } else if (this.state == State.STOPPED) { + Log.d(MP_TAG, "switchMediaPlayerImpl(): stopped"); + if (to != null) { + to.stop(); + } + } + + this.mpi = to; + + // Cheating here by relying on the side effect in + // on(Pitch|Speed)AdjustmentAvailableChanged + if ((to.canSetPitch() != this.pitchAdjustmentAvailable) + && (this.onPitchAdjustmentAvailableChangedListener != null)) { + this.onPitchAdjustmentAvailableChangedListener + .onPitchAdjustmentAvailableChanged(this, to + .canSetPitch()); + } + if ((to.canSetSpeed() != this.speedAdjustmentAvailable) + && (this.onSpeedAdjustmentAvailableChangedListener != null)) { + this.onSpeedAdjustmentAvailableChangedListener + .onSpeedAdjustmentAvailableChanged(this, to + .canSetSpeed()); + } + Log.d(MP_TAG, "switchMediaPlayerImpl() 625 " + this.state.toString()); + } finally { + lock.unlock(); + } + } + + /** + * Returns true if pitch can be changed at this moment + * + * @return True if pitch can be changed + */ + public boolean canSetPitch() { + lock.lock(); + try { + return this.mpi.canSetPitch(); + } finally { + lock.unlock(); + } + } + + /** + * Returns true if speed can be changed at this moment + * + * @return True if speed can be changed + */ + public boolean canSetSpeed() { + lock.lock(); + try { + return this.mpi.canSetSpeed(); + } finally { + lock.unlock(); + } + } + + protected void finalize() throws Throwable { + lock.lock(); + try { + Log.d(MP_TAG, "finalize() 626"); + this.release(); + } finally { + lock.unlock(); + } + } + + /** + * Returns the number of steps (in a musical scale) by which playback is + * currently shifted. When greater than zero, pitch is shifted up. When less + * than zero, pitch is shifted down. + * + * @return The number of steps pitch is currently shifted by + */ + public float getCurrentPitchStepsAdjustment() { + lock.lock(); + try { + return this.mpi.getCurrentPitchStepsAdjustment(); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.getCurrentPosition() + * Accurate only to frame size of encoded data (26 ms for MP3s) + * + * @return Current position (in milliseconds) + */ + public int getCurrentPosition() { + lock.lock(); + try { + return (this.lastKnownPosition = this.mpi.getCurrentPosition()); + } finally { + lock.unlock(); + } + } + + /** + * Returns the current speed multiplier. Defaults to 1.0 (normal speed) + * + * @return The current speed multiplier + */ + public float getCurrentSpeedMultiplier() { + lock.lock(); + try { + return this.mpi.getCurrentSpeedMultiplier(); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.getDuration() + * + * @return Length of the track (in milliseconds) + */ + public int getDuration() { + lock.lock(); + try { + return this.mpi.getDuration(); + } finally { + lock.unlock(); + } + } + + /** + * Get the maximum value that can be passed to setPlaybackSpeed + * + * @return The maximum speed multiplier + */ + public float getMaxSpeedMultiplier() { + lock.lock(); + try { + return this.mpi.getMaxSpeedMultiplier(); + } finally { + lock.unlock(); + } + } + + /** + * Get the minimum value that can be passed to setPlaybackSpeed + * + * @return The minimum speed multiplier + */ + public float getMinSpeedMultiplier() { + lock.lock(); + try { + return this.mpi.getMinSpeedMultiplier(); + } finally { + lock.unlock(); + } + } + + /** + * Gets the version code of the backing service + * + * @return -1 if ServiceBackedMediaPlayer is not used, 0 if the service is not + * connected, otherwise the version code retrieved from the service + */ + public int getServiceVersionCode() { + lock.lock(); + try { + if (this.mpi instanceof ServiceBackedMediaPlayer) { + return ((ServiceBackedMediaPlayer) this.mpi).getServiceVersionCode(); + } else { + return -1; + } + } finally { + lock.unlock(); + } + } + + /** + * Gets the version name of the backing service + * + * @return null if ServiceBackedMediaPlayer is not used, empty string if + * the service is not connected, otherwise the version name retrieved from + * the service + */ + public String getServiceVersionName() { + lock.lock(); + try { + if (this.mpi instanceof ServiceBackedMediaPlayer) { + return ((ServiceBackedMediaPlayer) this.mpi).getServiceVersionName(); + } else { + return null; + } + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.isLooping() + * + * @return True if the track is looping + */ + public boolean isLooping() { + lock.lock(); + try { + return this.mpi.isLooping(); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.isPlaying() + * + * @return True if the track is playing + */ + public boolean isPlaying() { + lock.lock(); + try { + return this.mpi.isPlaying(); + } finally { + lock.unlock(); + } + } + + /** + * Returns true if this MediaPlayer has access to the Presto + * library + * + * @return True if the Presto library is installed + */ + public boolean isPrestoLibraryInstalled() { + if ((this.mpi == null) || (this.mpi.mContext == null)) { + return false; + } + return isPrestoLibraryInstalled(this.mpi.mContext); + } + + /** + * Open the Android Market page in the same context as this MediaPlayer + */ + public void openPrestoMarketIntent() { + if ((this.mpi != null) && (this.mpi.mContext != null)) { + openPrestoMarketIntent(this.mpi.mContext); + } + } + + /** + * Functions identically to android.media.MediaPlayer.pause() Pauses the + * track + */ + public void pause() { + lock.lock(); + try { + if (invalidServiceConnectionConfiguration()) { + setupMpi(this.mpi.mContext); + } + this.state = State.PAUSED; + this.mpi.pause(); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.prepare() Prepares the + * track. This or prepareAsync must be called before start() + */ + public void prepare() throws IllegalStateException, IOException { + lock.lock(); + try { + Log.d(MP_TAG, "prepare() 746 using " + ((this.mpi == null) ? "null (this shouldn't happen)" : this.mpi.getClass().toString()) + " state " + this.state.toString()); + Log.d(MP_TAG, "onPreparedListener is: " + ((this.onPreparedListener == null) ? "null" : "non-null")); + Log.d(MP_TAG, "preparedListener is: " + ((this.preparedListener == null) ? "null" : "non-null")); + if (invalidServiceConnectionConfiguration()) { + setupMpi(this.mpi.mContext); + } + this.mpi.prepare(); + this.state = State.PREPARED; + Log.d(MP_TAG, "prepare() finished 778"); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.prepareAsync() + * Prepares the track. This or prepare must be called before start() + */ + public void prepareAsync() { + lock.lock(); + try { + Log.d(MP_TAG, "prepareAsync() 779"); + if (invalidServiceConnectionConfiguration()) { + setupMpi(this.mpi.mContext); + } + this.state = State.PREPARING; + this.mpi.prepareAsync(); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.release() Releases the + * underlying resources used by the media player. + */ + public void release() { + lock.lock(); + try { + Log.d(MP_TAG, "Releasing MediaPlayer 791"); + + this.state = State.END; + if (this.amp != null) { + this.amp.release(); + } + if (this.sbmp != null) { + this.sbmp.release(); + } + + this.onBufferingUpdateListener = null; + this.onCompletionListener = null; + this.onErrorListener = null; + this.onInfoListener = null; + this.preparedListener = null; + this.onPitchAdjustmentAvailableChangedListener = null; + this.pitchAdjustmentAvailableChangedListener = null; + Log.d(MP_TAG, "Setting onSeekCompleteListener to null 871"); + this.onSeekCompleteListener = null; + this.onSpeedAdjustmentAvailableChangedListener = null; + this.speedAdjustmentAvailableChangedListener = null; + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.reset() Resets the + * track to idle state + */ + public void reset() { + lock.lock(); + try { + this.state = State.IDLE; + this.stringDataSource = null; + this.uriDataSource = null; + this.mpi.reset(); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.seekTo(int msec) Seeks + * to msec in the track + */ + public void seekTo(int msec) throws IllegalStateException { + lock.lock(); + try { + this.mpi.seekTo(msec); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.setAudioStreamType(int + * streamtype) Sets the audio stream type. + */ + public void setAudioStreamType(int streamtype) { + lock.lock(); + try { + this.mAudioStreamType = streamtype; + this.mpi.setAudioStreamType(streamtype); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.setDataSource(Context + * context, Uri uri) Sets uri as data source in the context given + */ + public void setDataSource(Context context, Uri uri) + throws IllegalArgumentException, IllegalStateException, IOException { + lock.lock(); + try { + Log.d(MP_TAG, "In setDataSource(context, " + uri.toString() + "), using " + this.mpi.getClass().toString()); + if (invalidServiceConnectionConfiguration()) { + setupMpi(this.mpi.mContext); + } + this.state = State.INITIALIZED; + this.stringDataSource = null; + this.uriDataSource = uri; + this.mpi.setDataSource(context, uri); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.setDataSource(String + * path) Sets the data source of the track to a file given. + */ + public void setDataSource(String path) throws IllegalArgumentException, + IllegalStateException, IOException { + lock.lock(); + try { + Log.d(MP_TAG, "In setDataSource(context, " + path + ")"); + if (invalidServiceConnectionConfiguration()) { + setupMpi(this.mpi.mContext); + } + this.state = State.INITIALIZED; + this.stringDataSource = path; + this.uriDataSource = null; + this.mpi.setDataSource(path); + } finally { + lock.unlock(); + } + } + + /** + * Sets whether to use speed adjustment or not. Speed adjustment on is more + * computation-intensive than with it off. + * + * @param enableSpeedAdjustment Whether speed adjustment should be supported. + */ + public void setEnableSpeedAdjustment(boolean enableSpeedAdjustment) { + lock.lock(); + try { + this.enableSpeedAdjustment = enableSpeedAdjustment; + this.mpi.setEnableSpeedAdjustment(enableSpeedAdjustment); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.setLooping(boolean + * loop) Sets the track to loop infinitely if loop is true, play once if + * loop is false + */ + public void setLooping(boolean loop) { + lock.lock(); + try { + this.mIsLooping = loop; + this.mpi.setLooping(loop); + } finally { + lock.unlock(); + } + } + + /** + * Sets the number of steps (in a musical scale) by which playback is + * currently shifted. When greater than zero, pitch is shifted up. When less + * than zero, pitch is shifted down. + * + * @param pitchSteps The number of steps by which to shift playback + */ + public void setPitchStepsAdjustment(float pitchSteps) { + lock.lock(); + try { + this.mPitchStepsAdjustment = pitchSteps; + this.mpi.setPitchStepsAdjustment(pitchSteps); + } finally { + lock.unlock(); + } + } + + /** + * Set the algorithm to use for changing the speed and pitch of audio + * See SpeedAdjustmentAlgorithm constants for more details + * + * @param algorithm The algorithm to use. + */ + public void setSpeedAdjustmentAlgorithm(int algorithm) { + lock.lock(); + try { + this.speedAdjustmentAlgorithm = algorithm; + if (this.mpi != null) { + this.mpi.setSpeedAdjustmentAlgorithm(algorithm); + } + } finally { + lock.unlock(); + } + } + + private static float getPitchStepsAdjustment(float pitch) { + return (float) (Math.log(pitch) / (2 * Math.log(PITCH_STEP_CONSTANT))); + } + + /** + * Sets the percentage by which pitch is currently shifted. When greater + * than zero, pitch is shifted up. When less than zero, pitch is shifted + * down + * + * @param f The percentage to shift pitch + */ + public void setPlaybackPitch(float pitch) { + lock.lock(); + try { + this.mPitchStepsAdjustment = getPitchStepsAdjustment(pitch); + this.mpi.setPlaybackPitch(pitch); + } finally { + lock.unlock(); + } + } + + /** + * Set playback speed. 1.0 is normal speed, 2.0 is double speed, and so on. + * Speed should never be set to 0 or below. + * + * @param f The speed multiplier to use for further playback + */ + public void setPlaybackSpeed(float f) { + lock.lock(); + try { + this.mSpeedMultiplier = f; + this.mpi.setPlaybackSpeed(f); + } finally { + lock.unlock(); + } + } + + /** + * Sets whether to use speed adjustment or not. Speed adjustment on is more + * computation-intensive than with it off. + * + * @param enableSpeedAdjustment Whether speed adjustment should be supported. + */ + public void setUseService(boolean useService) { + lock.lock(); + try { + this.useService = useService; + setupMpi(this.mpi.mContext); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.setVolume(float + * leftVolume, float rightVolume) Sets the stereo volume + */ + public void setVolume(float leftVolume, float rightVolume) { + lock.lock(); + try { + this.mLeftVolume = leftVolume; + this.mRightVolume = rightVolume; + this.mpi.setVolume(leftVolume, rightVolume); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.setWakeMode(Context + * context, int mode) Acquires a wake lock in the context given. You must + * request the appropriate permissions in your AndroidManifest.xml file. + */ + public void setWakeMode(Context context, int mode) { + lock.lock(); + try { + this.mWakeMode = mode; + this.mpi.setWakeMode(context, mode); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to + * android.media.MediaPlayer.setOnCompletionListener(OnCompletionListener + * listener) Sets a listener to be used when a track completes playing. + */ + public void setOnBufferingUpdateListener(OnBufferingUpdateListener listener) { + lock.lock(); + try { + this.onBufferingUpdateListener = listener; + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to + * android.media.MediaPlayer.setOnCompletionListener(OnCompletionListener + * listener) Sets a listener to be used when a track completes playing. + */ + public void setOnCompletionListener(OnCompletionListener listener) { + lock.lock(); + try { + this.onCompletionListener = listener; + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to + * android.media.MediaPlayer.setOnErrorListener(OnErrorListener listener) + * Sets a listener to be used when a track encounters an error. + */ + public void setOnErrorListener(OnErrorListener listener) { + lock.lock(); + try { + this.onErrorListener = listener; + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to + * android.media.MediaPlayer.setOnInfoListener(OnInfoListener listener) Sets + * a listener to be used when a track has info. + */ + public void setOnInfoListener(OnInfoListener listener) { + lock.lock(); + try { + this.onInfoListener = listener; + } finally { + lock.unlock(); + } + } + + /** + * Sets a listener that will fire when pitch adjustment becomes available or + * stops being available + */ + public void setOnPitchAdjustmentAvailableChangedListener( + OnPitchAdjustmentAvailableChangedListener listener) { + lock.lock(); + try { + this.pitchAdjustmentAvailableChangedListener = listener; + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to + * android.media.MediaPlayer.setOnPreparedListener(OnPreparedListener + * listener) Sets a listener to be used when a track finishes preparing. + */ + public void setOnPreparedListener(OnPreparedListener listener) { + lock.lock(); + Log.d(MP_TAG, " ++++++++++++++++++++++++++++++++++++++++++++ setOnPreparedListener"); + try { + this.preparedListener = listener; + // For this one, we do not explicitly set the MediaPlayer or the + // Service listener. This is because in addition to calling the + // listener provided by the client, it's necessary to change + // state to PREPARED. See prepareAsync for implementation details + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to + * android.media.MediaPlayer.setOnSeekCompleteListener + * (OnSeekCompleteListener listener) Sets a listener to be used when a track + * finishes seeking. + */ + public void setOnSeekCompleteListener(OnSeekCompleteListener listener) { + lock.lock(); + try { + this.onSeekCompleteListener = listener; + } finally { + lock.unlock(); + } + } + + /** + * Sets a listener that will fire when speed adjustment becomes available or + * stops being available + */ + public void setOnSpeedAdjustmentAvailableChangedListener( + OnSpeedAdjustmentAvailableChangedListener listener) { + lock.lock(); + try { + this.speedAdjustmentAvailableChangedListener = listener; + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.start() Starts a track + * playing + */ + public void start() { + lock.lock(); + try { + Log.d(MP_TAG, "start() 1149"); + if (invalidServiceConnectionConfiguration()) { + setupMpi(this.mpi.mContext); + } + this.state = State.STARTED; + Log.d(MP_TAG, "start() 1154"); + this.mpi.start(); + } finally { + lock.unlock(); + } + } + + /** + * Functions identically to android.media.MediaPlayer.stop() Stops a track + * playing and resets its position to the start. + */ + public void stop() { + lock.lock(); + try { + if (invalidServiceConnectionConfiguration()) { + setupMpi(this.mpi.mContext); + } + this.state = State.STOPPED; + this.mpi.stop(); + } finally { + lock.unlock(); + } + } +} \ No newline at end of file diff --git a/src/com/aocate/media/MediaPlayerImpl.java b/core/src/main/java/com/aocate/media/MediaPlayerImpl.java similarity index 100% rename from src/com/aocate/media/MediaPlayerImpl.java rename to core/src/main/java/com/aocate/media/MediaPlayerImpl.java diff --git a/src/com/aocate/media/ServiceBackedMediaPlayer.java b/core/src/main/java/com/aocate/media/ServiceBackedMediaPlayer.java similarity index 99% rename from src/com/aocate/media/ServiceBackedMediaPlayer.java rename to core/src/main/java/com/aocate/media/ServiceBackedMediaPlayer.java index 8d08867ef..702a23b0f 100644 --- a/src/com/aocate/media/ServiceBackedMediaPlayer.java +++ b/core/src/main/java/com/aocate/media/ServiceBackedMediaPlayer.java @@ -46,7 +46,7 @@ import com.aocate.presto.service.IOnSeekCompleteListenerCallback_0_8; import com.aocate.presto.service.IOnSpeedAdjustmentAvailableChangedListenerCallback_0_8; import com.aocate.presto.service.IPlayMedia_0_8; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; /** * Class for connecting to remote speed-altering, media playing Service diff --git a/src/com/aocate/media/SpeedAdjustmentAlgorithm.java b/core/src/main/java/com/aocate/media/SpeedAdjustmentAlgorithm.java similarity index 100% rename from src/com/aocate/media/SpeedAdjustmentAlgorithm.java rename to core/src/main/java/com/aocate/media/SpeedAdjustmentAlgorithm.java diff --git a/core/src/main/java/de/danoeh/antennapod/core/ApplicationCallbacks.java b/core/src/main/java/de/danoeh/antennapod/core/ApplicationCallbacks.java new file mode 100644 index 000000000..3bc1ce4eb --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/ApplicationCallbacks.java @@ -0,0 +1,24 @@ +package de.danoeh.antennapod.core; + +import android.app.Application; +import android.content.Context; +import android.content.Intent; + +/** + * Callbacks related to the application in general + */ +public interface ApplicationCallbacks { + + /** + * Returns a non-null instance of the application class + */ + public Application getApplicationInstance(); + + /** + * Returns a non-null intent that starts the storage error + * activity. + */ + public Intent getStorageErrorActivity(Context context); + + public void setUpdateInterval(long updateInterval); +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/ClientConfig.java b/core/src/main/java/de/danoeh/antennapod/core/ClientConfig.java new file mode 100644 index 000000000..e5e609f5f --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/ClientConfig.java @@ -0,0 +1,25 @@ +package de.danoeh.antennapod.core; + +/** + * Stores callbacks for core classes like Services, DB classes etc. and other configuration variables. + * Apps using the core module of AntennaPod should register implementations of all interfaces here. + */ +public class ClientConfig { + + /** + * Should be used when setting User-Agent header for HTTP-requests. + */ + public static String USER_AGENT; + + public static ApplicationCallbacks applicationCallbacks; + + public static DownloadServiceCallbacks downloadServiceCallbacks; + + public static PlaybackServiceCallbacks playbackServiceCallbacks; + + public static GpodnetCallbacks gpodnetCallbacks; + + public static FlattrCallbacks flattrCallbacks; + + public static StorageCallbacks storageCallbacks; +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/DownloadServiceCallbacks.java b/core/src/main/java/de/danoeh/antennapod/core/DownloadServiceCallbacks.java new file mode 100644 index 000000000..286e830c5 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/DownloadServiceCallbacks.java @@ -0,0 +1,58 @@ +package de.danoeh.antennapod.core; + +import android.app.PendingIntent; +import android.content.Context; + +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.service.download.DownloadRequest; + +/** + * Callbacks for the DownloadService of the core module + */ +public interface DownloadServiceCallbacks { + + /** + * Returns a PendingIntent for a notification the main notification of the DownloadService. + *

+ * The PendingIntent takes the users to a screen where they can observe all currently running + * downloads. + * + * @return A non-null PendingIntent for the notification. + */ + public PendingIntent getNotificationContentIntent(Context context); + + /** + * Returns a PendingIntent for a notification that tells the user to enter a username + * or a password for a requested download. + *

+ * The PendingIntent takes users to an Activity that lets the user enter their username + * and password to retry the download. + * + * @return A non-null PendingIntent for the notification. + */ + public PendingIntent getAuthentificationNotificationContentIntent(Context context, DownloadRequest request); + + /** + * Returns a PendingIntent for notification that notifies the user about the completion of downloads + * along with information about failed and successful downloads. + *

+ * The PendingIntent takes users to an activity where they can look at all successful and failed downloads. + * + * @return A non-null PendingIntent for the notification or null if shouldCreateReport()==false + */ + public PendingIntent getReportNotificationContentIntent(Context context); + + /** + * Called by the FeedSyncThread after a feed has been downloaded and parsed. + * + * @param feed The non-null feed that has been parsed. + */ + public void onFeedParsed(Context context, Feed feed); + + /** + * Returns true if the DownloadService should create a report that shows the number of failed + * downloads when the service shuts down. + * */ + public boolean shouldCreateReport(); +} + diff --git a/core/src/main/java/de/danoeh/antennapod/core/FlattrCallbacks.java b/core/src/main/java/de/danoeh/antennapod/core/FlattrCallbacks.java new file mode 100644 index 000000000..cee1029d8 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/FlattrCallbacks.java @@ -0,0 +1,36 @@ +package de.danoeh.antennapod.core; + +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; + +import org.shredzone.flattr4j.oauth.AccessToken; + +/** + * Callbacks for the flattr integration of the app. + */ +public interface FlattrCallbacks { + + /** + * Returns if true if the flattr integration should be activated, + * false otherwise. + */ + public boolean flattrEnabled(); + + /** + * Returns an intent that starts the activity that is responsible for + * letting users log into their flattr account. + * + * @return The intent that starts the authentication activity or null + * if flattr integration is disabled (i.e. flattrEnabled() == false). + */ + public Intent getFlattrAuthenticationActivityIntent(Context context); + + public PendingIntent getFlattrFailedNotificationContentIntent(Context context); + + public String getFlattrAppKey(); + + public String getFlattrAppSecret(); + + public void handleFlattrAuthenticationSuccess(AccessToken token); +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/GpodnetCallbacks.java b/core/src/main/java/de/danoeh/antennapod/core/GpodnetCallbacks.java new file mode 100644 index 000000000..6174bce29 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/GpodnetCallbacks.java @@ -0,0 +1,27 @@ +package de.danoeh.antennapod.core; + +import android.app.PendingIntent; +import android.content.Context; + +/** + * Callbacks related to the gpodder.net integration of the core module + */ +public interface GpodnetCallbacks { + + + /** + * Returns if true if the gpodder.net integration should be activated, + * false otherwise. + */ + public boolean gpodnetEnabled(); + + /** + * Returns a PendingIntent for the error notification of the GpodnetSyncService. + *

+ * What the PendingIntent does may be implementation-specific. + * + * @return A PendingIntent for the notification or null if gpodder.net integration + * has been disabled (i.e. gpodnetEnabled() == false). + */ + public PendingIntent getGpodnetSyncServiceErrorNotificationPendingIntent(Context context); +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/PlaybackServiceCallbacks.java b/core/src/main/java/de/danoeh/antennapod/core/PlaybackServiceCallbacks.java new file mode 100644 index 000000000..fb01fa703 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/PlaybackServiceCallbacks.java @@ -0,0 +1,33 @@ +package de.danoeh.antennapod.core; + +import android.content.Context; +import android.content.Intent; + +import de.danoeh.antennapod.core.feed.MediaType; + +/** + * Callbacks for the PlaybackService of the core module + */ +public interface PlaybackServiceCallbacks { + + /** + * Returns an intent which starts an audio- or videoplayer, depending on the + * type of media that is being played. + * + * @param mediaType The type of media that is being played. + * @return A non-null activity intent. + */ + public Intent getPlayerActivityIntent(Context context, MediaType mediaType); + + /** + * Returns true if the PlaybackService should load new episodes from the queue when playback ends + * and false if the PlaybackService should ignore the queue and load no more episodes when playback + * finishes. + */ + public boolean useQueue(); + + /** + * Returns a drawable resource that is used for the notification of the playback service. + */ + public int getNotificationIconResource(Context context); +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/StorageCallbacks.java b/core/src/main/java/de/danoeh/antennapod/core/StorageCallbacks.java new file mode 100644 index 000000000..5d1a0fffc --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/StorageCallbacks.java @@ -0,0 +1,27 @@ +package de.danoeh.antennapod.core; + +import android.database.sqlite.SQLiteDatabase; + +/** + * Callbacks for the classes in the storage package of the core module. + */ +public interface StorageCallbacks { + + /** + * Returns the current version of the database. + * + * @return The non-negative version number of the database. + */ + public int getDatabaseVersion(); + + /** + * Upgrades the given database from an old version to a newer version. + * + * @param db The database that is supposed to be upgraded. + * @param oldVersion The old version of the database. + * @param newVersion The version that the database is supposed to be upgraded to. + */ + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); + + +} diff --git a/src/de/danoeh/antennapod/asynctask/DownloadObserver.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/DownloadObserver.java similarity index 96% rename from src/de/danoeh/antennapod/asynctask/DownloadObserver.java rename to core/src/main/java/de/danoeh/antennapod/core/asynctask/DownloadObserver.java index 21ae5291e..a13130082 100644 --- a/src/de/danoeh/antennapod/asynctask/DownloadObserver.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/DownloadObserver.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.asynctask; +package de.danoeh.antennapod.core.asynctask; import android.app.Activity; import android.content.*; @@ -8,9 +8,9 @@ import android.util.Log; import org.apache.commons.lang3.Validate; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.service.download.DownloadService; -import de.danoeh.antennapod.service.download.Downloader; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.service.download.DownloadService; +import de.danoeh.antennapod.core.service.download.Downloader; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/src/de/danoeh/antennapod/asynctask/FeedRemover.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FeedRemover.java similarity index 89% rename from src/de/danoeh/antennapod/asynctask/FeedRemover.java rename to core/src/main/java/de/danoeh/antennapod/core/asynctask/FeedRemover.java index 0549a4255..255b95119 100644 --- a/src/de/danoeh/antennapod/asynctask/FeedRemover.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FeedRemover.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.asynctask; +package de.danoeh.antennapod.core.asynctask; import android.annotation.SuppressLint; import android.app.ProgressDialog; @@ -6,9 +6,9 @@ import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.os.AsyncTask; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.storage.DBWriter; +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.storage.DBWriter; import java.util.concurrent.ExecutionException; diff --git a/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrClickWorker.java similarity index 92% rename from src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java rename to core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrClickWorker.java index 9210ac1d1..5d2d5d441 100644 --- a/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrClickWorker.java @@ -1,11 +1,10 @@ -package de.danoeh.antennapod.asynctask; +package de.danoeh.antennapod.core.asynctask; import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; -import android.content.Intent; import android.os.AsyncTask; import android.support.v4.app.NotificationCompat; import android.util.Log; @@ -19,15 +18,14 @@ import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.FlattrAuthActivity; -import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.util.NetworkUtils; -import de.danoeh.antennapod.util.flattr.FlattrThing; -import de.danoeh.antennapod.util.flattr.FlattrUtils; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.util.NetworkUtils; +import de.danoeh.antennapod.core.util.flattr.FlattrThing; +import de.danoeh.antennapod.core.util.flattr.FlattrUtils; /** * Performs a click action in a background thread. @@ -177,7 +175,8 @@ public class FlattrClickWorker extends AsyncTask { + private static final String TAG = "FlattrTokenFetcher"; + Context context; + AndroidAuthenticator auth; + AccessToken token; + Uri uri; + ProgressDialog dialog; + FlattrException exception; + + public FlattrTokenFetcher(Context context, AndroidAuthenticator auth, Uri uri) { + super(); + this.context = context; + this.auth = auth; + this.uri = uri; + } + + @Override + protected void onPostExecute(AccessToken result) { + if (result != null) { + FlattrUtils.storeToken(result); + } + dialog.dismiss(); + if (exception == null) { + ClientConfig.flattrCallbacks.handleFlattrAuthenticationSuccess(result); + } else { + FlattrUtils.showErrorDialog(context, exception.getMessage()); + } + } + + + @Override + protected void onPreExecute() { + super.onPreExecute(); + dialog = new ProgressDialog(context); + dialog.setMessage(context.getString(R.string.processing_label)); + dialog.setIndeterminate(true); + dialog.setCancelable(false); + dialog.show(); + } + + + @Override + protected AccessToken doInBackground(Void... params) { + try { + token = auth.fetchAccessToken(uri); + } catch (FlattrException e) { + e.printStackTrace(); + exception = e; + return null; + } + if (token != null) { + if (BuildConfig.DEBUG) Log.d(TAG, "Successfully got token"); + return token; + } else { + Log.w(TAG, "Flattr token was null"); + return null; + } + } + + @SuppressLint("NewApi") + public void executeAsync() { + if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { + executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } else { + execute(); + } + } + +} diff --git a/src/de/danoeh/antennapod/asynctask/PicassoImageResource.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoImageResource.java similarity index 96% rename from src/de/danoeh/antennapod/asynctask/PicassoImageResource.java rename to core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoImageResource.java index 26f9d9278..c0d8049db 100644 --- a/src/de/danoeh/antennapod/asynctask/PicassoImageResource.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoImageResource.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.asynctask; +package de.danoeh.antennapod.core.asynctask; import android.net.Uri; diff --git a/src/de/danoeh/antennapod/asynctask/PicassoProvider.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoProvider.java similarity index 99% rename from src/de/danoeh/antennapod/asynctask/PicassoProvider.java rename to core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoProvider.java index 849725630..6ace92800 100644 --- a/src/de/danoeh/antennapod/asynctask/PicassoProvider.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/PicassoProvider.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.asynctask; +package de.danoeh.antennapod.core.asynctask; import android.content.Context; import android.media.MediaMetadataRetriever; diff --git a/src/de/danoeh/antennapod/backup/OpmlBackupAgent.java b/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java similarity index 93% rename from src/de/danoeh/antennapod/backup/OpmlBackupAgent.java rename to core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java index 56d1ca092..1535e2e9a 100644 --- a/src/de/danoeh/antennapod/backup/OpmlBackupAgent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.backup; +package de.danoeh.antennapod.core.backup; import android.app.backup.BackupAgentHelper; import android.app.backup.BackupDataInputStream; @@ -8,7 +8,7 @@ import android.content.Context; import android.os.ParcelFileDescriptor; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import org.xmlpull.v1.XmlPullParserException; import java.io.ByteArrayOutputStream; @@ -28,15 +28,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; -import de.danoeh.antennapod.AppConfig; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.opml.OpmlElement; -import de.danoeh.antennapod.opml.OpmlReader; -import de.danoeh.antennapod.opml.OpmlWriter; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.LangUtils; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.opml.OpmlElement; +import de.danoeh.antennapod.core.opml.OpmlReader; +import de.danoeh.antennapod.core.opml.OpmlWriter; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.LangUtils; public class OpmlBackupAgent extends BackupAgentHelper { private static final String OPML_BACKUP_KEY = "opml"; diff --git a/src/de/danoeh/antennapod/dialog/ConfirmationDialog.java b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java similarity index 92% rename from src/de/danoeh/antennapod/dialog/ConfirmationDialog.java rename to core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java index df71fff77..ba1add895 100644 --- a/src/de/danoeh/antennapod/dialog/ConfirmationDialog.java +++ b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java @@ -1,11 +1,11 @@ -package de.danoeh.antennapod.dialog; +package de.danoeh.antennapod.core.dialog; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.R; /** * Creates an AlertDialog which asks the user to confirm something. Other diff --git a/src/de/danoeh/antennapod/dialog/DownloadRequestErrorDialogCreator.java b/core/src/main/java/de/danoeh/antennapod/core/dialog/DownloadRequestErrorDialogCreator.java similarity index 91% rename from src/de/danoeh/antennapod/dialog/DownloadRequestErrorDialogCreator.java rename to core/src/main/java/de/danoeh/antennapod/core/dialog/DownloadRequestErrorDialogCreator.java index e363a6911..3d174bd8e 100644 --- a/src/de/danoeh/antennapod/dialog/DownloadRequestErrorDialogCreator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/dialog/DownloadRequestErrorDialogCreator.java @@ -1,9 +1,9 @@ -package de.danoeh.antennapod.dialog; +package de.danoeh.antennapod.core.dialog; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; -import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.R; /** Creates Alert Dialogs if a DownloadRequestException has happened. */ public class DownloadRequestErrorDialogCreator { diff --git a/src/de/danoeh/antennapod/feed/Chapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java similarity index 95% rename from src/de/danoeh/antennapod/feed/Chapter.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java index d6151ee9f..ce3352ed6 100644 --- a/src/de/danoeh/antennapod/feed/Chapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; public abstract class Chapter extends FeedComponent { diff --git a/src/de/danoeh/antennapod/feed/EventDistributor.java b/core/src/main/java/de/danoeh/antennapod/core/feed/EventDistributor.java similarity index 97% rename from src/de/danoeh/antennapod/feed/EventDistributor.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/EventDistributor.java index 5fb72048e..f8815dcf0 100644 --- a/src/de/danoeh/antennapod/feed/EventDistributor.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/EventDistributor.java @@ -1,11 +1,11 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; import android.os.Handler; import android.util.Log; import org.apache.commons.lang3.Validate; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import java.util.AbstractQueue; import java.util.Observable; diff --git a/src/de/danoeh/antennapod/feed/Feed.java b/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java similarity index 97% rename from src/de/danoeh/antennapod/feed/Feed.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java index b5415c69c..3f83ab8b6 100644 --- a/src/de/danoeh/antennapod/feed/Feed.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java @@ -1,14 +1,14 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; import android.content.Context; import android.net.Uri; -import de.danoeh.antennapod.asynctask.PicassoImageResource; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.util.EpisodeFilter; -import de.danoeh.antennapod.util.flattr.FlattrStatus; -import de.danoeh.antennapod.util.flattr.FlattrThing; +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; import java.util.ArrayList; import java.util.Date; diff --git a/src/de/danoeh/antennapod/feed/FeedComponent.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java similarity index 97% rename from src/de/danoeh/antennapod/feed/FeedComponent.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java index 48b243770..05115c1ea 100644 --- a/src/de/danoeh/antennapod/feed/FeedComponent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; /** * Represents every possible component of a feed diff --git a/src/de/danoeh/antennapod/feed/FeedFile.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java similarity index 98% rename from src/de/danoeh/antennapod/feed/FeedFile.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java index a05533ebc..3dc58654b 100644 --- a/src/de/danoeh/antennapod/feed/FeedFile.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; import java.io.File; diff --git a/src/de/danoeh/antennapod/feed/FeedImage.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedImage.java similarity index 79% rename from src/de/danoeh/antennapod/feed/FeedImage.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/FeedImage.java index c588f5e71..b01747f7f 100644 --- a/src/de/danoeh/antennapod/feed/FeedImage.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedImage.java @@ -1,16 +1,10 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; import android.net.Uri; -import de.danoeh.antennapod.asynctask.PicassoImageResource; - -import org.apache.commons.io.IOUtils; +import de.danoeh.antennapod.core.asynctask.PicassoImageResource; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - public class FeedImage extends FeedFile implements PicassoImageResource { @@ -19,10 +13,11 @@ public class FeedImage extends FeedFile implements PicassoImageResource { protected String title; protected FeedComponent owner; - public FeedImage(String download_url, String title) { + public FeedImage(FeedComponent owner, String download_url, String title) { super(null, download_url, false); this.download_url = download_url; this.title = title; + this.owner = owner; } public FeedImage(long id, String title, String file_url, @@ -32,6 +27,10 @@ public class FeedImage extends FeedFile implements PicassoImageResource { this.title = title; } + public FeedImage() { + super(); + } + @Override public String getHumanReadableIdentifier() { if (owner != null && owner.getHumanReadableIdentifier() != null) { @@ -46,10 +45,6 @@ public class FeedImage extends FeedFile implements PicassoImageResource { return FEEDFILETYPE_FEEDIMAGE; } - public FeedImage() { - super(); - } - public String getTitle() { return title; } diff --git a/src/de/danoeh/antennapod/feed/FeedItem.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java similarity index 92% rename from src/de/danoeh/antennapod/feed/FeedItem.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java index 78091ea33..d056917e1 100644 --- a/src/de/danoeh/antennapod/feed/FeedItem.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java @@ -1,19 +1,18 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; import android.net.Uri; -import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.asynctask.PicassoImageResource; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.ShownotesProvider; -import de.danoeh.antennapod.util.flattr.FlattrStatus; -import de.danoeh.antennapod.util.flattr.FlattrThing; - -import java.io.InputStream; import java.util.Date; import java.util.List; import java.util.concurrent.Callable; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.asynctask.PicassoImageResource; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.util.ShownotesProvider; +import de.danoeh.antennapod.core.util.flattr.FlattrStatus; +import de.danoeh.antennapod.core.util.flattr.FlattrThing; + /** * Data Object for a XML message * @@ -254,7 +253,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr public String call() throws Exception { if (contentEncoded == null || description == null) { - DBReader.loadExtraInformationOfFeedItem(PodcastApp.getInstance(), FeedItem.this); + DBReader.loadExtraInformationOfFeedItem(ClientConfig.applicationCallbacks.getApplicationInstance(), FeedItem.this); } return (contentEncoded != null) ? contentEncoded : description; @@ -264,7 +263,9 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr @Override public Uri getImageUri() { - if (hasMedia()) { + if (hasItemImageDownloaded()) { + return image.getImageUri(); + } else if (hasMedia()) { return media.getImageUri(); } else if (feed != null) { return feed.getImageUri(); diff --git a/src/de/danoeh/antennapod/feed/FeedMedia.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java similarity index 90% rename from src/de/danoeh/antennapod/feed/FeedMedia.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java index 9298ebe8a..defcfd598 100644 --- a/src/de/danoeh/antennapod/feed/FeedMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; @@ -6,19 +6,16 @@ import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; import java.util.Date; import java.util.List; import java.util.concurrent.Callable; -import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.preferences.PlaybackPreferences; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.util.ChapterUtils; -import de.danoeh.antennapod.util.playback.Playable; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.preferences.PlaybackPreferences; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.util.ChapterUtils; +import de.danoeh.antennapod.core.util.playback.Playable; public class FeedMedia extends FeedFile implements Playable { private static final String TAG = "FeedMedia"; @@ -242,7 +239,7 @@ public class FeedMedia extends FeedFile implements Playable { @Override public void loadMetadata() throws PlayableException { if (item == null && itemID != 0) { - item = DBReader.getFeedItem(PodcastApp.getInstance(), itemID); + item = DBReader.getFeedItem(ClientConfig.applicationCallbacks.getApplicationInstance(), itemID); } } @@ -251,7 +248,7 @@ public class FeedMedia extends FeedFile implements Playable { if (getChapters() == null && !localFileAvailable()) { ChapterUtils.loadChaptersFromStreamUrl(this); if (getChapters() != null && item != null) { - DBWriter.setFeedItem(PodcastApp.getInstance(), + DBWriter.setFeedItem(ClientConfig.applicationCallbacks.getApplicationInstance(), item); } } @@ -330,7 +327,7 @@ public class FeedMedia extends FeedFile implements Playable { @Override public void saveCurrentPosition(SharedPreferences pref, int newPosition) { setPosition(newPosition); - DBWriter.setFeedMediaPlaybackInformation(PodcastApp.getInstance(), this); + DBWriter.setFeedMediaPlaybackInformation(ClientConfig.applicationCallbacks.getApplicationInstance(), this); } @Override @@ -358,10 +355,12 @@ public class FeedMedia extends FeedFile implements Playable { @Override public String call() throws Exception { if (item == null) { - item = DBReader.getFeedItem(PodcastApp.getInstance(), itemID); + item = DBReader.getFeedItem( + ClientConfig.applicationCallbacks.getApplicationInstance(), itemID); } if (item.getContentEncoded() == null || item.getDescription() == null) { - DBReader.loadExtraInformationOfFeedItem(PodcastApp.getInstance(), item); + DBReader.loadExtraInformationOfFeedItem( + ClientConfig.applicationCallbacks.getApplicationInstance(), item); } return (item.getContentEncoded() != null) ? item.getContentEncoded() : item.getDescription(); @@ -396,6 +395,8 @@ public class FeedMedia extends FeedFile implements Playable { builder.appendQueryParameter(PARAM_FALLBACK, feedImgUri.toString()); } return builder.build(); + } else if (item.hasItemImageDownloaded()) { + return item.getImage().getImageUri(); } else { return feedImgUri; } diff --git a/src/de/danoeh/antennapod/feed/FeedPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java similarity index 95% rename from src/de/danoeh/antennapod/feed/FeedPreferences.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java index 29bc5ef0c..2f0304182 100644 --- a/src/de/danoeh/antennapod/feed/FeedPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java @@ -1,7 +1,7 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; import android.content.Context; -import de.danoeh.antennapod.storage.DBWriter; +import de.danoeh.antennapod.core.storage.DBWriter; import org.apache.commons.lang3.StringUtils; /** diff --git a/src/de/danoeh/antennapod/feed/ID3Chapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/ID3Chapter.java similarity index 94% rename from src/de/danoeh/antennapod/feed/ID3Chapter.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/ID3Chapter.java index 6dde7854e..f0ff03a93 100644 --- a/src/de/danoeh/antennapod/feed/ID3Chapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/ID3Chapter.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; public class ID3Chapter extends Chapter { public static final int CHAPTERTYPE_ID3CHAPTER = 2; diff --git a/src/de/danoeh/antennapod/feed/MediaType.java b/core/src/main/java/de/danoeh/antennapod/core/feed/MediaType.java similarity index 55% rename from src/de/danoeh/antennapod/feed/MediaType.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/MediaType.java index 324d0a221..7b3cb829d 100644 --- a/src/de/danoeh/antennapod/feed/MediaType.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/MediaType.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; public enum MediaType { AUDIO, VIDEO, UNKNOWN diff --git a/src/de/danoeh/antennapod/feed/SearchResult.java b/core/src/main/java/de/danoeh/antennapod/core/feed/SearchResult.java similarity index 94% rename from src/de/danoeh/antennapod/feed/SearchResult.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/SearchResult.java index 1cba389ec..9aa8d3170 100644 --- a/src/de/danoeh/antennapod/feed/SearchResult.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/SearchResult.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; public class SearchResult { private FeedComponent component; diff --git a/src/de/danoeh/antennapod/feed/SimpleChapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/SimpleChapter.java similarity index 92% rename from src/de/danoeh/antennapod/feed/SimpleChapter.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/SimpleChapter.java index 3dab1b74d..2dadd3ec8 100644 --- a/src/de/danoeh/antennapod/feed/SimpleChapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/SimpleChapter.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; public class SimpleChapter extends Chapter { public static final int CHAPTERTYPE_SIMPLECHAPTER = 0; diff --git a/src/de/danoeh/antennapod/feed/VorbisCommentChapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/VorbisCommentChapter.java similarity index 95% rename from src/de/danoeh/antennapod/feed/VorbisCommentChapter.java rename to core/src/main/java/de/danoeh/antennapod/core/feed/VorbisCommentChapter.java index 59844ae1f..5b54a2d59 100644 --- a/src/de/danoeh/antennapod/feed/VorbisCommentChapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/VorbisCommentChapter.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.feed; +package de.danoeh.antennapod.core.feed; -import de.danoeh.antennapod.util.vorbiscommentreader.VorbisCommentReaderException; +import de.danoeh.antennapod.core.util.vorbiscommentreader.VorbisCommentReaderException; import java.util.concurrent.TimeUnit; diff --git a/src/de/danoeh/antennapod/gpoddernet/GpodnetService.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetService.java similarity index 97% rename from src/de/danoeh/antennapod/gpoddernet/GpodnetService.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetService.java index 038b2a367..117cbf96b 100644 --- a/src/de/danoeh/antennapod/gpoddernet/GpodnetService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetService.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet; +package de.danoeh.antennapod.core.gpoddernet; import org.apache.commons.lang3.Validate; import org.apache.http.Header; @@ -30,13 +30,13 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; -import de.danoeh.antennapod.gpoddernet.model.GpodnetDevice; -import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; -import de.danoeh.antennapod.gpoddernet.model.GpodnetSubscriptionChange; -import de.danoeh.antennapod.gpoddernet.model.GpodnetTag; -import de.danoeh.antennapod.gpoddernet.model.GpodnetUploadChangesResponse; -import de.danoeh.antennapod.preferences.GpodnetPreferences; -import de.danoeh.antennapod.service.download.AntennapodHttpClient; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetDevice; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetSubscriptionChange; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetUploadChangesResponse; +import de.danoeh.antennapod.core.preferences.GpodnetPreferences; +import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; /** * Communicates with the gpodder.net service. @@ -396,10 +396,10 @@ public class GpodnetService { * @param deviceId The ID of the device whose subscriptions should be updated. * @param added Collection of feed URLs of added feeds. This Collection MUST NOT contain any duplicates * @param removed Collection of feed URLs of removed feeds. This Collection MUST NOT contain any duplicates - * @return a GpodnetUploadChangesResponse. See {@link de.danoeh.antennapod.gpoddernet.model.GpodnetUploadChangesResponse} + * @return a GpodnetUploadChangesResponse. See {@link de.danoeh.antennapod.core.gpoddernet.model.GpodnetUploadChangesResponse} * for details. * @throws java.lang.IllegalArgumentException if username, deviceId, added or removed is null. - * @throws de.danoeh.antennapod.gpoddernet.GpodnetServiceException if added or removed contain duplicates or if there + * @throws de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException if added or removed contain duplicates or if there * is an authentication error. */ public GpodnetUploadChangesResponse uploadChanges(String username, String deviceId, Collection added, diff --git a/src/de/danoeh/antennapod/gpoddernet/GpodnetServiceAuthenticationException.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceAuthenticationException.java similarity index 91% rename from src/de/danoeh/antennapod/gpoddernet/GpodnetServiceAuthenticationException.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceAuthenticationException.java index 3b0140826..8bd56218c 100644 --- a/src/de/danoeh/antennapod/gpoddernet/GpodnetServiceAuthenticationException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceAuthenticationException.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet; +package de.danoeh.antennapod.core.gpoddernet; public class GpodnetServiceAuthenticationException extends GpodnetServiceException { diff --git a/src/de/danoeh/antennapod/gpoddernet/GpodnetServiceBadStatusCodeException.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceBadStatusCodeException.java similarity index 84% rename from src/de/danoeh/antennapod/gpoddernet/GpodnetServiceBadStatusCodeException.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceBadStatusCodeException.java index a32e9357b..16f01f0f4 100644 --- a/src/de/danoeh/antennapod/gpoddernet/GpodnetServiceBadStatusCodeException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceBadStatusCodeException.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet; +package de.danoeh.antennapod.core.gpoddernet; public class GpodnetServiceBadStatusCodeException extends GpodnetServiceException { int statusCode; diff --git a/src/de/danoeh/antennapod/gpoddernet/GpodnetServiceException.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceException.java similarity index 89% rename from src/de/danoeh/antennapod/gpoddernet/GpodnetServiceException.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceException.java index bdb394454..ce704f7e3 100644 --- a/src/de/danoeh/antennapod/gpoddernet/GpodnetServiceException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceException.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet; +package de.danoeh.antennapod.core.gpoddernet; public class GpodnetServiceException extends Exception { diff --git a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetDevice.java similarity index 96% rename from src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetDevice.java index 86a2171fa..4885a243a 100644 --- a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetDevice.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet.model; +package de.danoeh.antennapod.core.gpoddernet.model; import org.apache.commons.lang3.Validate; diff --git a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetPodcast.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetPodcast.java similarity index 96% rename from src/de/danoeh/antennapod/gpoddernet/model/GpodnetPodcast.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetPodcast.java index b002035c9..afebf66ac 100644 --- a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetPodcast.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetPodcast.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet.model; +package de.danoeh.antennapod.core.gpoddernet.model; import org.apache.commons.lang3.Validate; diff --git a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetSubscriptionChange.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetSubscriptionChange.java similarity index 94% rename from src/de/danoeh/antennapod/gpoddernet/model/GpodnetSubscriptionChange.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetSubscriptionChange.java index a4617118d..a5cb8c0f0 100644 --- a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetSubscriptionChange.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetSubscriptionChange.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet.model; +package de.danoeh.antennapod.core.gpoddernet.model; import org.apache.commons.lang3.Validate; diff --git a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetTag.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetTag.java similarity index 94% rename from src/de/danoeh/antennapod/gpoddernet/model/GpodnetTag.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetTag.java index 80b84095e..7178f4be5 100644 --- a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetTag.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetTag.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet.model; +package de.danoeh.antennapod.core.gpoddernet.model; import org.apache.commons.lang3.Validate; diff --git a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetUploadChangesResponse.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetUploadChangesResponse.java similarity index 91% rename from src/de/danoeh/antennapod/gpoddernet/model/GpodnetUploadChangesResponse.java rename to core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetUploadChangesResponse.java index fee8c7d28..5a37efa5e 100644 --- a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetUploadChangesResponse.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetUploadChangesResponse.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.gpoddernet.model; +package de.danoeh.antennapod.core.gpoddernet.model; import org.json.JSONArray; import org.json.JSONException; @@ -8,7 +8,7 @@ import java.util.HashMap; import java.util.Map; /** - * Object returned by {@link de.danoeh.antennapod.gpoddernet.GpodnetService} in uploadChanges method. + * Object returned by {@link de.danoeh.antennapod.core.gpoddernet.GpodnetService} in uploadChanges method. */ public class GpodnetUploadChangesResponse { diff --git a/src/de/danoeh/antennapod/opml/OpmlElement.java b/core/src/main/java/de/danoeh/antennapod/core/opml/OpmlElement.java similarity index 94% rename from src/de/danoeh/antennapod/opml/OpmlElement.java rename to core/src/main/java/de/danoeh/antennapod/core/opml/OpmlElement.java index 4cb563c04..8d0a4a842 100644 --- a/src/de/danoeh/antennapod/opml/OpmlElement.java +++ b/core/src/main/java/de/danoeh/antennapod/core/opml/OpmlElement.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.opml; +package de.danoeh.antennapod.core.opml; /** Represents a single feed in an OPML file. */ public class OpmlElement { diff --git a/src/de/danoeh/antennapod/opml/OpmlReader.java b/core/src/main/java/de/danoeh/antennapod/core/opml/OpmlReader.java similarity index 96% rename from src/de/danoeh/antennapod/opml/OpmlReader.java rename to core/src/main/java/de/danoeh/antennapod/core/opml/OpmlReader.java index 19a980dee..775129d09 100644 --- a/src/de/danoeh/antennapod/opml/OpmlReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/opml/OpmlReader.java @@ -1,7 +1,7 @@ -package de.danoeh.antennapod.opml; +package de.danoeh.antennapod.core.opml; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; diff --git a/src/de/danoeh/antennapod/opml/OpmlSymbols.java b/core/src/main/java/de/danoeh/antennapod/core/opml/OpmlSymbols.java similarity index 93% rename from src/de/danoeh/antennapod/opml/OpmlSymbols.java rename to core/src/main/java/de/danoeh/antennapod/core/opml/OpmlSymbols.java index 4b0b7316a..2b831ca2a 100644 --- a/src/de/danoeh/antennapod/opml/OpmlSymbols.java +++ b/core/src/main/java/de/danoeh/antennapod/core/opml/OpmlSymbols.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.opml; +package de.danoeh.antennapod.core.opml; /** Contains symbols for reading and writing OPML documents. */ public final class OpmlSymbols { diff --git a/src/de/danoeh/antennapod/opml/OpmlWriter.java b/core/src/main/java/de/danoeh/antennapod/core/opml/OpmlWriter.java similarity index 93% rename from src/de/danoeh/antennapod/opml/OpmlWriter.java rename to core/src/main/java/de/danoeh/antennapod/core/opml/OpmlWriter.java index 405a5e35a..641190f62 100644 --- a/src/de/danoeh/antennapod/opml/OpmlWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/opml/OpmlWriter.java @@ -1,9 +1,9 @@ -package de.danoeh.antennapod.opml; +package de.danoeh.antennapod.core.opml; import android.util.Log; import android.util.Xml; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Feed; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.Feed; import org.xmlpull.v1.XmlSerializer; import java.io.IOException; diff --git a/src/de/danoeh/antennapod/preferences/GpodnetPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java similarity index 93% rename from src/de/danoeh/antennapod/preferences/GpodnetPreferences.java rename to core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java index bdfe297a6..af04df017 100644 --- a/src/de/danoeh/antennapod/preferences/GpodnetPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java @@ -1,18 +1,19 @@ -package de.danoeh.antennapod.preferences; +package de.danoeh.antennapod.core.preferences; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.service.GpodnetSyncService; import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.service.GpodnetSyncService; + /** * Manages preferences for accessing gpodder.net service */ @@ -48,7 +49,7 @@ public class GpodnetPreferences { private static boolean preferencesLoaded = false; private static SharedPreferences getPreferences() { - return PodcastApp.getInstance().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); + return ClientConfig.applicationCallbacks.getApplicationInstance().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); } private static synchronized void ensurePreferencesLoaded() { @@ -148,7 +149,7 @@ public class GpodnetPreferences { writePreference(PREF_SYNC_REMOVED, removedFeeds); } feedListLock.unlock(); - GpodnetSyncService.sendSyncIntent(PodcastApp.getInstance()); + GpodnetSyncService.sendSyncIntent(ClientConfig.applicationCallbacks.getApplicationInstance()); } public static void addRemovedFeed(String feed) { @@ -161,7 +162,7 @@ public class GpodnetPreferences { writePreference(PREF_SYNC_ADDED, addedFeeds); } feedListLock.unlock(); - GpodnetSyncService.sendSyncIntent(PodcastApp.getInstance()); + GpodnetSyncService.sendSyncIntent(ClientConfig.applicationCallbacks.getApplicationInstance()); } public static Set getAddedFeedsCopy() { diff --git a/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/PlaybackPreferences.java similarity index 98% rename from src/de/danoeh/antennapod/preferences/PlaybackPreferences.java rename to core/src/main/java/de/danoeh/antennapod/core/preferences/PlaybackPreferences.java index 1d1ab052f..d88543f73 100644 --- a/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/PlaybackPreferences.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.preferences; +package de.danoeh.antennapod.core.preferences; import android.content.Context; import android.content.SharedPreferences; @@ -7,7 +7,7 @@ import android.util.Log; import org.apache.commons.lang3.Validate; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; /** * Provides access to preferences set by the playback service. A private diff --git a/src/de/danoeh/antennapod/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java similarity index 96% rename from src/de/danoeh/antennapod/preferences/UserPreferences.java rename to core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index 73a4a1a14..f4d44c4da 100644 --- a/src/de/danoeh/antennapod/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.preferences; +package de.danoeh.antennapod.core.preferences; import android.app.AlarmManager; import android.app.PendingIntent; @@ -20,10 +20,10 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.OpmlImportFromPathActivity; -import de.danoeh.antennapod.receiver.FeedUpdateReceiver; +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; /** * Provides access to preferences set by the user in the settings screen. A @@ -33,6 +33,7 @@ import de.danoeh.antennapod.receiver.FeedUpdateReceiver; */ public class UserPreferences implements SharedPreferences.OnSharedPreferenceChangeListener { + public static final String IMPORT_DIR = "import/"; private static final String TAG = "UserPreferences"; public static final String PREF_PAUSE_ON_HEADSET_DISCONNECT = "prefPauseOnHeadsetDisconnect"; @@ -352,7 +353,7 @@ public class UserPreferences implements } else if (key.equals(PREF_UPDATE_INTERVAL)) { updateInterval = readUpdateInterval(sp.getString( PREF_UPDATE_INTERVAL, "0")); - restartUpdateAlarm(updateInterval); + ClientConfig.applicationCallbacks.setUpdateInterval(updateInterval); } else if (key.equals(PREF_AUTO_DELETE)) { autoDelete = sp.getBoolean(PREF_AUTO_DELETE, false); @@ -555,7 +556,7 @@ public class UserPreferences implements */ private static void createImportDirectory() { File importDir = getDataFolder(instance.context, - OpmlImportFromPathActivity.IMPORT_DIR); + IMPORT_DIR); if (importDir != null) { if (importDir.exists()) { if (BuildConfig.DEBUG) @@ -573,23 +574,19 @@ public class UserPreferences implements /** * Updates alarm registered with the AlarmManager service or deactivates it. - * - * @param millis new value to register with AlarmManager. If millis is 0, the - * alarm is deactivated. */ - public static void restartUpdateAlarm(long millis) { + public static void restartUpdateAlarm(long triggerAtMillis, long intervalMillis) { instanceAvailable(); if (BuildConfig.DEBUG) - Log.d(TAG, "Restarting update alarm. New value: " + millis); + Log.d(TAG, "Restarting update alarm."); AlarmManager alarmManager = (AlarmManager) instance.context .getSystemService(Context.ALARM_SERVICE); PendingIntent updateIntent = PendingIntent.getBroadcast( instance.context, 0, new Intent( - FeedUpdateReceiver.ACTION_REFRESH_FEEDS), 0 - ); + FeedUpdateReceiver.ACTION_REFRESH_FEEDS), 0); alarmManager.cancel(updateIntent); - if (millis != 0) { - alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, millis, millis, + if (intervalMillis != 0) { + alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, triggerAtMillis, intervalMillis, updateIntent); if (BuildConfig.DEBUG) Log.d(TAG, "Changed alarm to new interval"); @@ -599,6 +596,7 @@ public class UserPreferences implements } } + /** * Reads episode cache size as it is saved in the episode_cache_size_values array. */ diff --git a/src/de/danoeh/antennapod/receiver/AlarmUpdateReceiver.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/AlarmUpdateReceiver.java similarity index 74% rename from src/de/danoeh/antennapod/receiver/AlarmUpdateReceiver.java rename to core/src/main/java/de/danoeh/antennapod/core/receiver/AlarmUpdateReceiver.java index a0539e276..84277b6d5 100644 --- a/src/de/danoeh/antennapod/receiver/AlarmUpdateReceiver.java +++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/AlarmUpdateReceiver.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.receiver; +package de.danoeh.antennapod.core.receiver; import android.content.BroadcastReceiver; import android.content.Context; @@ -7,8 +7,9 @@ import android.util.Log; import org.apache.commons.lang3.StringUtils; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.preferences.UserPreferences; /** Listens for events that make it necessary to reset the update alarm. */ public class AlarmUpdateReceiver extends BroadcastReceiver { @@ -26,7 +27,7 @@ public class AlarmUpdateReceiver extends BroadcastReceiver { Log.d(TAG, "Resetting update alarm after app upgrade"); } - UserPreferences.restartUpdateAlarm(UserPreferences.getUpdateInterval()); + ClientConfig.applicationCallbacks.setUpdateInterval(UserPreferences.getUpdateInterval()); } diff --git a/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java similarity index 86% rename from src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java rename to core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java index 3c283a30b..6ce30763d 100644 --- a/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java +++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.receiver; +package de.danoeh.antennapod.core.receiver; import android.content.BroadcastReceiver; import android.content.Context; @@ -9,9 +9,9 @@ import android.util.Log; import org.apache.commons.lang3.StringUtils; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.storage.DBTasks; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.DBTasks; /** Refreshes all feeds when it receives an intent */ public class FeedUpdateReceiver extends BroadcastReceiver { diff --git a/src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java similarity index 82% rename from src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java rename to core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java index 1edebd275..a900248d2 100644 --- a/src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java +++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java @@ -1,17 +1,17 @@ -package de.danoeh.antennapod.receiver; +package de.danoeh.antennapod.core.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import android.view.KeyEvent; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.service.playback.PlaybackService; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.service.playback.PlaybackService; /** Receives media button events. */ public class MediaButtonReceiver extends BroadcastReceiver { private static final String TAG = "MediaButtonReceiver"; - public static final String EXTRA_KEYCODE = "de.danoeh.antennapod.service.extra.MediaButtonReceiver.KEYCODE"; + public static final String EXTRA_KEYCODE = "de.danoeh.antennapod.core.service.extra.MediaButtonReceiver.KEYCODE"; public static final String NOTIFY_BUTTON_RECEIVER = "de.danoeh.antennapod.NOTIFY_BUTTON_RECEIVER"; diff --git a/src/de/danoeh/antennapod/service/GpodnetSyncService.java b/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java similarity index 81% rename from src/de/danoeh/antennapod/service/GpodnetSyncService.java rename to core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java index c8c9fc31e..0f2a81dfb 100644 --- a/src/de/danoeh/antennapod/service/GpodnetSyncService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.service; +package de.danoeh.antennapod.core.service; import android.app.Notification; import android.app.NotificationManager; @@ -9,27 +9,28 @@ import android.content.Intent; import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceAuthenticationException; -import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.gpoddernet.model.GpodnetSubscriptionChange; -import de.danoeh.antennapod.gpoddernet.model.GpodnetUploadChangesResponse; -import de.danoeh.antennapod.preferences.GpodnetPreferences; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.util.NetworkUtils; import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.Set; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.gpoddernet.GpodnetService; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceAuthenticationException; +import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetSubscriptionChange; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetUploadChangesResponse; +import de.danoeh.antennapod.core.preferences.GpodnetPreferences; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.NetworkUtils; + /** * Synchronizes local subscriptions with gpodder.net service. The service should be started with ACTION_SYNC as an action argument. * This class also provides static methods for starting the GpodnetSyncService. @@ -89,14 +90,17 @@ public class GpodnetSyncService extends Service { // first sync: download all subscriptions... GpodnetSubscriptionChange changes = service.getSubscriptionChanges(GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID(), 0); - if (BuildConfig.DEBUG) Log.d(TAG, "Downloaded subscription changes: " + changes); + if (BuildConfig.DEBUG) + Log.d(TAG, "Downloaded subscription changes: " + changes); processSubscriptionChanges(localSubscriptions, changes); // ... then upload all local subscriptions - if (BuildConfig.DEBUG) Log.d(TAG, "Uploading subscription list: " + localSubscriptions); + if (BuildConfig.DEBUG) + Log.d(TAG, "Uploading subscription list: " + localSubscriptions); GpodnetUploadChangesResponse uploadChangesResponse = service.uploadChanges(GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID(), localSubscriptions, new LinkedList()); - if (BuildConfig.DEBUG) Log.d(TAG, "Uploading changes response: " + uploadChangesResponse); + if (BuildConfig.DEBUG) + Log.d(TAG, "Uploading changes response: " + uploadChangesResponse); GpodnetPreferences.removeAddedFeeds(localSubscriptions); GpodnetPreferences.removeRemovedFeeds(GpodnetPreferences.getRemovedFeedsCopy()); GpodnetPreferences.setLastSyncTimestamp(uploadChangesResponse.timestamp); @@ -106,14 +110,17 @@ public class GpodnetSyncService extends Service { // download remote changes first... GpodnetSubscriptionChange subscriptionChanges = service.getSubscriptionChanges(GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID(), timestamp); - if (BuildConfig.DEBUG) Log.d(TAG, "Downloaded subscription changes: " + subscriptionChanges); + if (BuildConfig.DEBUG) + Log.d(TAG, "Downloaded subscription changes: " + subscriptionChanges); processSubscriptionChanges(localSubscriptions, subscriptionChanges); // ... then upload changes local changes - if (BuildConfig.DEBUG) Log.d(TAG, String.format("Uploading subscriptions, Added: %s\nRemoved: %s", - added.toString(), removed)); + if (BuildConfig.DEBUG) + Log.d(TAG, String.format("Uploading subscriptions, Added: %s\nRemoved: %s", + added.toString(), removed)); GpodnetUploadChangesResponse uploadChangesResponse = service.uploadChanges(GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID(), added, removed); - if (BuildConfig.DEBUG) Log.d(TAG, "Upload subscriptions response: " + uploadChangesResponse); + if (BuildConfig.DEBUG) + Log.d(TAG, "Upload subscriptions response: " + uploadChangesResponse); GpodnetPreferences.removeAddedFeeds(added); GpodnetPreferences.removeRemovedFeeds(removed); @@ -165,8 +172,7 @@ public class GpodnetSyncService extends Service { id = R.id.notification_gpodnet_sync_error; } - PendingIntent activityIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); - + PendingIntent activityIntent = ClientConfig.gpodnetCallbacks.getGpodnetSyncServiceErrorNotificationPendingIntent(this); Notification notification = builder.setContentTitle(title) .setContentText(description) .setContentIntent(activityIntent) diff --git a/src/de/danoeh/antennapod/service/download/APRedirectHandler.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/APRedirectHandler.java similarity index 94% rename from src/de/danoeh/antennapod/service/download/APRedirectHandler.java rename to core/src/main/java/de/danoeh/antennapod/core/service/download/APRedirectHandler.java index ddf8d605d..3efcf4da8 100644 --- a/src/de/danoeh/antennapod/service/download/APRedirectHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/APRedirectHandler.java @@ -1,7 +1,7 @@ -package de.danoeh.antennapod.service.download; +package de.danoeh.antennapod.core.service.download; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import org.apache.http.Header; import org.apache.http.HttpResponse; import org.apache.http.impl.client.DefaultRedirectHandler; diff --git a/src/de/danoeh/antennapod/service/download/AntennapodHttpClient.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java similarity index 93% rename from src/de/danoeh/antennapod/service/download/AntennapodHttpClient.java rename to core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java index be331ce9b..67f059d7d 100644 --- a/src/de/danoeh/antennapod/service/download/AntennapodHttpClient.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java @@ -1,8 +1,7 @@ -package de.danoeh.antennapod.service.download; +package de.danoeh.antennapod.core.service.download; import android.util.Log; -import de.danoeh.antennapod.AppConfig; -import de.danoeh.antennapod.BuildConfig; + import org.apache.http.client.HttpClient; import org.apache.http.client.params.HttpClientParams; import org.apache.http.conn.ClientConnectionManager; @@ -21,6 +20,9 @@ import org.apache.http.params.HttpParams; import java.util.concurrent.TimeUnit; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; + /** * Provides access to a HttpClient singleton. */ @@ -46,7 +48,7 @@ public class AntennapodHttpClient { if (BuildConfig.DEBUG) Log.d(TAG, "Creating new instance of HTTP client"); HttpParams params = new BasicHttpParams(); - params.setParameter(CoreProtocolPNames.USER_AGENT, AppConfig.USER_AGENT); + params.setParameter(CoreProtocolPNames.USER_AGENT, ClientConfig.USER_AGENT); params.setIntParameter("http.protocol.max-redirects", MAX_REDIRECTS); params.setBooleanParameter("http.protocol.reject-relative-redirect", false); diff --git a/src/de/danoeh/antennapod/service/download/DownloadRequest.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java similarity index 99% rename from src/de/danoeh/antennapod/service/download/DownloadRequest.java rename to core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java index e803d30d4..c79da0a48 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadRequest.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.service.download; +package de.danoeh.antennapod.core.service.download; import android.os.Parcel; import android.os.Parcelable; diff --git a/src/de/danoeh/antennapod/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java similarity index 92% rename from src/de/danoeh/antennapod/service/download/DownloadService.java rename to core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index 63be91b57..b8db5a387 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -1,9 +1,8 @@ -package de.danoeh.antennapod.service.download; +package de.danoeh.antennapod.core.service.download; import android.annotation.SuppressLint; import android.app.Notification; import android.app.NotificationManager; -import android.app.PendingIntent; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; @@ -13,7 +12,6 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.media.MediaMetadataRetriever; import android.os.Binder; -import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.support.v4.app.NotificationCompat; @@ -34,7 +32,6 @@ import java.util.Collections; import java.util.Date; import java.util.LinkedList; import java.util.List; -import java.util.Queue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.CompletionService; @@ -54,28 +51,25 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.xml.parsers.ParserConfigurationException; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.DownloadAuthenticationActivity; -import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.adapter.NavListAdapter; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.feed.FeedPreferences; -import de.danoeh.antennapod.fragment.DownloadsFragment; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.storage.DownloadRequestException; -import de.danoeh.antennapod.storage.DownloadRequester; -import de.danoeh.antennapod.syndication.handler.FeedHandler; -import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException; -import de.danoeh.antennapod.util.ChapterUtils; -import de.danoeh.antennapod.util.DownloadError; -import de.danoeh.antennapod.util.InvalidFeedException; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedImage; +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.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.storage.DownloadRequestException; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.syndication.handler.FeedHandler; +import de.danoeh.antennapod.core.syndication.handler.UnsupportedFeedtypeException; +import de.danoeh.antennapod.core.util.ChapterUtils; +import de.danoeh.antennapod.core.util.DownloadError; +import de.danoeh.antennapod.core.util.InvalidFeedException; /** * Manages the download of feedfiles in the app. Downloads can be enqueued viathe startService intent. @@ -91,12 +85,12 @@ public class DownloadService extends Service { * Cancels one download. The intent MUST have an EXTRA_DOWNLOAD_URL extra that contains the download URL of the * object whose download should be cancelled. */ - public static final String ACTION_CANCEL_DOWNLOAD = "action.de.danoeh.antennapod.service.cancelDownload"; + public static final String ACTION_CANCEL_DOWNLOAD = "action.de.danoeh.antennapod.core.service.cancelDownload"; /** * Cancels all running downloads. */ - public static final String ACTION_CANCEL_ALL_DOWNLOADS = "action.de.danoeh.antennapod.service.cancelAllDownloads"; + public static final String ACTION_CANCEL_ALL_DOWNLOADS = "action.de.danoeh.antennapod.core.service.cancelAllDownloads"; /** * Extra for ACTION_CANCEL_DOWNLOAD @@ -107,7 +101,7 @@ public class DownloadService extends Service { * Sent by the DownloadService when the content of the downloads list * changes. */ - public static final String ACTION_DOWNLOADS_CONTENT_CHANGED = "action.de.danoeh.antennapod.service.downloadsContentChanged"; + public static final String ACTION_DOWNLOADS_CONTENT_CHANGED = "action.de.danoeh.antennapod.core.service.downloadsContentChanged"; /** * Extra for ACTION_ENQUEUE_DOWNLOAD intent. @@ -311,7 +305,10 @@ public class DownloadService extends Service { if (BuildConfig.DEBUG) Log.d(TAG, "Service shutting down"); isRunning = false; - updateReport(); + + if (ClientConfig.downloadServiceCallbacks.shouldCreateReport()) { + updateReport(); + } stopForeground(true); NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); @@ -332,30 +329,18 @@ public class DownloadService extends Service { @SuppressLint("NewApi") private void setupNotificationBuilders() { - Intent intent = new Intent(this, MainActivity.class); - intent.putExtra(MainActivity.EXTRA_NAV_TYPE, NavListAdapter.VIEW_TYPE_NAV); - intent.putExtra(MainActivity.EXTRA_NAV_INDEX, MainActivity.POS_DOWNLOADS); - Bundle args = new Bundle(); - args.putInt(DownloadsFragment.ARG_SELECTED_TAB, DownloadsFragment.POS_RUNNING); - intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args); - - PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, - PendingIntent.FLAG_UPDATE_CURRENT - ); - - Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.stat_notify_sync); if (android.os.Build.VERSION.SDK_INT >= 16) { notificationBuilder = new Notification.BigTextStyle( new Notification.Builder(this).setOngoing(true) - .setContentIntent(pIntent).setLargeIcon(icon) + .setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(this)).setLargeIcon(icon) .setSmallIcon(R.drawable.stat_notify_sync) ); } else { notificationCompatBuilder = new NotificationCompat.Builder(this) - .setOngoing(true).setContentIntent(pIntent) + .setOngoing(true).setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(this)) .setLargeIcon(icon) .setSmallIcon(R.drawable.stat_notify_sync); } @@ -559,19 +544,12 @@ public class DownloadService extends Service { if (createReport) { if (BuildConfig.DEBUG) Log.d(TAG, "Creating report"); - Intent intent = new Intent(this, MainActivity.class); - intent.putExtra(MainActivity.EXTRA_NAV_TYPE, NavListAdapter.VIEW_TYPE_NAV); - intent.putExtra(MainActivity.EXTRA_NAV_INDEX, MainActivity.POS_DOWNLOADS); - Bundle args = new Bundle(); - args.putInt(DownloadsFragment.ARG_SELECTED_TAB, DownloadsFragment.POS_LOG); - intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args); - // create notification object Notification notification = new NotificationCompat.Builder(this) .setTicker( - getString(de.danoeh.antennapod.R.string.download_report_title)) + getString(R.string.download_report_title)) .setContentTitle( - getString(de.danoeh.antennapod.R.string.download_report_title)) + getString(R.string.download_report_title)) .setContentText( String.format( getString(R.string.download_report_content), @@ -583,7 +561,7 @@ public class DownloadService extends Service { R.drawable.stat_notify_sync) ) .setContentIntent( - PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT) + ClientConfig.downloadServiceCallbacks.getReportNotificationContentIntent(this) ) .setAutoCancel(true).build(); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); @@ -633,11 +611,6 @@ public class DownloadService extends Service { final String resourceTitle = (downloadRequest.getTitle() != null) ? downloadRequest.getTitle() : downloadRequest.getSource(); - final Intent activityIntent = new Intent(getApplicationContext(), DownloadAuthenticationActivity.class); - activityIntent.putExtra(DownloadAuthenticationActivity.ARG_DOWNLOAD_REQUEST, downloadRequest); - activityIntent.putExtra(DownloadAuthenticationActivity.ARG_SEND_TO_DOWNLOAD_REQUESTER_BOOL, true); - final PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, activityIntent, PendingIntent.FLAG_ONE_SHOT); - NotificationCompat.Builder builder = new NotificationCompat.Builder(DownloadService.this); builder.setTicker(getText(R.string.authentication_notification_title)) .setContentTitle(getText(R.string.authentication_notification_title)) @@ -647,7 +620,7 @@ public class DownloadService extends Service { .setSmallIcon(R.drawable.ic_stat_authentication) .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_stat_authentication)) .setAutoCancel(true) - .setContentIntent(contentIntent); + .setContentIntent(ClientConfig.downloadServiceCallbacks.getAuthentificationNotificationContentIntent(DownloadService.this, downloadRequest)); Notification n = builder.build(); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(downloadRequest.getSource().hashCode(), n); @@ -843,6 +816,9 @@ public class DownloadService extends Service { } } + ClientConfig.downloadServiceCallbacks.onFeedParsed(DownloadService.this, + savedFeed); + numberOfDownloads.decrementAndGet(); } @@ -863,6 +839,8 @@ public class DownloadService extends Service { } } + + if (BuildConfig.DEBUG) Log.d(TAG, "Shutting down"); } diff --git a/src/de/danoeh/antennapod/service/download/DownloadStatus.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java similarity index 97% rename from src/de/danoeh/antennapod/service/download/DownloadStatus.java rename to core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java index 1d76770bb..d05650d10 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadStatus.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java @@ -1,9 +1,9 @@ -package de.danoeh.antennapod.service.download; +package de.danoeh.antennapod.core.service.download; import org.apache.commons.lang3.Validate; -import de.danoeh.antennapod.feed.FeedFile; -import de.danoeh.antennapod.util.DownloadError; +import de.danoeh.antennapod.core.feed.FeedFile; +import de.danoeh.antennapod.core.util.DownloadError; import java.util.Date; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/Downloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/Downloader.java new file mode 100644 index 000000000..d8042d202 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/Downloader.java @@ -0,0 +1,73 @@ +package de.danoeh.antennapod.core.service.download; + +import android.content.Context; +import android.net.wifi.WifiManager; + +import java.util.concurrent.Callable; + +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.R; + +/** + * Downloads files + */ +public abstract class Downloader implements Callable { + private static final String TAG = "Downloader"; + + protected volatile boolean finished; + + protected volatile boolean cancelled; + + protected DownloadRequest request; + protected DownloadStatus result; + + public Downloader(DownloadRequest request) { + super(); + this.request = request; + this.request.setStatusMsg(R.string.download_pending); + this.cancelled = false; + this.result = new DownloadStatus(request, null, false, false, null); + } + + protected abstract void download(); + + public final Downloader call() { + WifiManager wifiManager = (WifiManager) + ClientConfig.applicationCallbacks.getApplicationInstance().getSystemService(Context.WIFI_SERVICE); + WifiManager.WifiLock wifiLock = null; + if (wifiManager != null) { + wifiLock = wifiManager.createWifiLock(TAG); + wifiLock.acquire(); + } + + download(); + + if (wifiLock != null) { + wifiLock.release(); + } + + if (result == null) { + throw new IllegalStateException( + "Downloader hasn't created DownloadStatus object"); + } + finished = true; + return this; + } + + public DownloadRequest getDownloadRequest() { + return request; + } + + public DownloadStatus getResult() { + return result; + } + + public boolean isFinished() { + return finished; + } + + public void cancel() { + cancelled = true; + } + +} \ No newline at end of file diff --git a/src/de/danoeh/antennapod/service/download/DownloaderCallback.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloaderCallback.java similarity index 80% rename from src/de/danoeh/antennapod/service/download/DownloaderCallback.java rename to core/src/main/java/de/danoeh/antennapod/core/service/download/DownloaderCallback.java index 08420e83a..2d9347b0a 100644 --- a/src/de/danoeh/antennapod/service/download/DownloaderCallback.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloaderCallback.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.service.download; +package de.danoeh.antennapod.core.service.download; /** * Callback used by the Downloader-classes to notify the requester that the diff --git a/src/de/danoeh/antennapod/service/download/HttpDownloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java similarity index 93% rename from src/de/danoeh/antennapod/service/download/HttpDownloader.java rename to core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java index 7ae96dc07..32d0d351a 100644 --- a/src/de/danoeh/antennapod/service/download/HttpDownloader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java @@ -1,14 +1,8 @@ -package de.danoeh.antennapod.service.download; +package de.danoeh.antennapod.core.service.download; import android.net.http.AndroidHttpClient; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.util.DownloadError; -import de.danoeh.antennapod.util.StorageUtils; -import de.danoeh.antennapod.util.URIUtil; + import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.Header; @@ -21,11 +15,23 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.auth.BasicScheme; import org.apache.http.message.BasicHeader; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.RandomAccessFile; import java.net.HttpURLConnection; import java.net.SocketTimeoutException; import java.net.UnknownHostException; +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; + public class HttpDownloader extends Downloader { private static final String TAG = "HttpDownloader"; @@ -104,7 +110,7 @@ public class HttpDownloader extends Downloader { return; } - if (!StorageUtils.storageAvailable(PodcastApp.getInstance())) { + if (!StorageUtils.storageAvailable(ClientConfig.applicationCallbacks.getApplicationInstance())) { onFail(DownloadError.ERROR_DEVICE_NOT_FOUND, null); return; } diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java similarity index 91% rename from src/de/danoeh/antennapod/service/playback/PlaybackService.java rename to core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index 6c292c08a..1261c21fe 100644 --- a/src/de/danoeh/antennapod/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.service.playback; +package de.danoeh.antennapod.core.service.playback; import android.annotation.SuppressLint; import android.app.Notification; @@ -34,29 +34,29 @@ import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.util.List; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.AudioplayerActivity; -import de.danoeh.antennapod.activity.VideoplayerActivity; -import de.danoeh.antennapod.asynctask.PicassoProvider; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.feed.MediaType; -import de.danoeh.antennapod.preferences.PlaybackPreferences; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.receiver.MediaButtonReceiver; -import de.danoeh.antennapod.receiver.PlayerWidget; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.storage.DBWriter; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.flattr.FlattrUtils; -import de.danoeh.antennapod.util.playback.Playable; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.asynctask.PicassoProvider; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.FeedItem; +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.receiver.MediaButtonReceiver; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.core.util.flattr.FlattrUtils; +import de.danoeh.antennapod.core.util.playback.Playable; /** * Controls the MediaPlayer that plays a FeedMedia-file */ public class PlaybackService extends Service { + public static final String FORCE_WIDGET_UPDATE = "de.danoeh.antennapod.FORCE_WIDGET_UPDATE"; + public static final String STOP_WIDGET_UPDATE = "de.danoeh.antennapod.STOP_WIDGET_UPDATE"; /** * Logging tag */ @@ -69,34 +69,35 @@ public class PlaybackService extends Service { /** * True if media should be streamed. */ - public static final String EXTRA_SHOULD_STREAM = "extra.de.danoeh.antennapod.service.shouldStream"; + public static final String EXTRA_SHOULD_STREAM = "extra.de.danoeh.antennapod.core.service.shouldStream"; /** * True if playback should be started immediately after media has been * prepared. */ - public static final String EXTRA_START_WHEN_PREPARED = "extra.de.danoeh.antennapod.service.startWhenPrepared"; + public static final String EXTRA_START_WHEN_PREPARED = "extra.de.danoeh.antennapod.core.service.startWhenPrepared"; - public static final String EXTRA_PREPARE_IMMEDIATELY = "extra.de.danoeh.antennapod.service.prepareImmediately"; + public static final String EXTRA_PREPARE_IMMEDIATELY = "extra.de.danoeh.antennapod.core.service.prepareImmediately"; - public static final String ACTION_PLAYER_STATUS_CHANGED = "action.de.danoeh.antennapod.service.playerStatusChanged"; + public static final String ACTION_PLAYER_STATUS_CHANGED = "action.de.danoeh.antennapod.core.service.playerStatusChanged"; + public static final String EXTRA_NEW_PLAYER_STATUS = "extra.de.danoeh.antennapod.service.playerStatusChanged.newStatus"; private static final String AVRCP_ACTION_PLAYER_STATUS_CHANGED = "com.android.music.playstatechanged"; private static final String AVRCP_ACTION_META_CHANGED = "com.android.music.metachanged"; - public static final String ACTION_PLAYER_NOTIFICATION = "action.de.danoeh.antennapod.service.playerNotification"; - public static final String EXTRA_NOTIFICATION_CODE = "extra.de.danoeh.antennapod.service.notificationCode"; - public static final String EXTRA_NOTIFICATION_TYPE = "extra.de.danoeh.antennapod.service.notificationType"; + public static final String ACTION_PLAYER_NOTIFICATION = "action.de.danoeh.antennapod.core.service.playerNotification"; + public static final String EXTRA_NOTIFICATION_CODE = "extra.de.danoeh.antennapod.core.service.notificationCode"; + public static final String EXTRA_NOTIFICATION_TYPE = "extra.de.danoeh.antennapod.core.service.notificationType"; /** * If the PlaybackService receives this action, it will stop playback and * try to shutdown. */ - public static final String ACTION_SHUTDOWN_PLAYBACK_SERVICE = "action.de.danoeh.antennapod.service.actionShutdownPlaybackService"; + public static final String ACTION_SHUTDOWN_PLAYBACK_SERVICE = "action.de.danoeh.antennapod.core.service.actionShutdownPlaybackService"; /** * If the PlaybackService receives this action, it will end playback of the * current episode and load the next episode if there is one available. */ - public static final String ACTION_SKIP_CURRENT_EPISODE = "action.de.danoeh.antennapod.service.skipCurrentEpisode"; + public static final String ACTION_SKIP_CURRENT_EPISODE = "action.de.danoeh.antennapod.core.service.skipCurrentEpisode"; /** * Used in NOTIFICATION_TYPE_RELOAD. @@ -173,16 +174,12 @@ public class PlaybackService extends Service { */ public static Intent getPlayerActivityIntent(Context context) { if (isRunning) { - if (currentMediaType == MediaType.VIDEO) { - return new Intent(context, VideoplayerActivity.class); - } else { - return new Intent(context, AudioplayerActivity.class); - } + return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, currentMediaType); } else { if (PlaybackPreferences.getCurrentEpisodeIsVideo()) { - return new Intent(context, VideoplayerActivity.class); + return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, MediaType.VIDEO); } else { - return new Intent(context, AudioplayerActivity.class); + return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, MediaType.AUDIO); } } } @@ -193,11 +190,7 @@ public class PlaybackService extends Service { */ public static Intent getPlayerActivityIntent(Context context, Playable media) { MediaType mt = media.getMediaType(); - if (mt == MediaType.VIDEO) { - return new Intent(context, VideoplayerActivity.class); - } else { - return new Intent(context, AudioplayerActivity.class); - } + return ClientConfig.playbackServiceCallbacks.getPlayerActivityIntent(context, mt); } @SuppressLint("NewApi") @@ -447,6 +440,9 @@ public class PlaybackService extends Service { } + Intent statusUpdate = new Intent(ACTION_PLAYER_STATUS_CHANGED); + statusUpdate.putExtra(EXTRA_NEW_PLAYER_STATUS, newInfo.playerStatus.ordinal()); + sendBroadcast(statusUpdate); sendBroadcast(new Intent(ACTION_PLAYER_STATUS_CHANGED)); updateWidget(); refreshRemoteControlClientState(newInfo); @@ -551,9 +547,14 @@ public class PlaybackService extends Service { // is an episode in the queue left. // Start playback immediately if continuous playback is enabled Playable nextMedia = null; - boolean loadNextItem = isInQueue && nextItem != null; - playNextEpisode = playNextEpisode && loadNextItem - && UserPreferences.isFollowQueue(); + boolean loadNextItem = ClientConfig.playbackServiceCallbacks.useQueue() && + isInQueue && + nextItem != null; + + playNextEpisode = playNextEpisode && + loadNextItem && + UserPreferences.isFollowQueue(); + if (loadNextItem) { if (BuildConfig.DEBUG) Log.d(TAG, "Loading next item in queue"); @@ -719,8 +720,8 @@ public class PlaybackService extends Service { } if (icon == null) { - icon = BitmapFactory.decodeResource(getResources(), - R.drawable.ic_stat_antenna); + icon = BitmapFactory.decodeResource(getApplicationContext().getResources(), + ClientConfig.playbackServiceCallbacks.getNotificationIconResource(getApplicationContext())); } return null; @@ -729,6 +730,12 @@ public class PlaybackService extends Service { @Override protected void onPostExecute(Void result) { super.onPostExecute(result); + if (mediaPlayer == null) { + return; + } + PlaybackServiceMediaPlayer.PSMPInfo newInfo = mediaPlayer.getPSMPInfo(); + final int smallIcon = ClientConfig.playbackServiceCallbacks.getNotificationIconResource(getApplicationContext()); + if (!isCancelled() && info.playerStatus == PlayerStatus.PLAYING && info.playable != null) { String contentText = info.playable.getFeedTitle(); @@ -769,7 +776,7 @@ public class PlaybackService extends Service { .setOngoing(true) .setContentIntent(pIntent) .setLargeIcon(icon) - .setSmallIcon(R.drawable.ic_stat_antenna) + .setSmallIcon(smallIcon) .setPriority(UserPreferences.getNotifyPriority()) // set notification priority .addAction(android.R.drawable.ic_media_play, //play action getString(R.string.play_label), @@ -787,10 +794,12 @@ public class PlaybackService extends Service { .setContentTitle(contentTitle) .setContentText(contentText).setOngoing(true) .setContentIntent(pIntent).setLargeIcon(icon) - .setSmallIcon(R.drawable.ic_stat_antenna); + .setSmallIcon(smallIcon); notification = notificationBuilder.getNotification(); } - startForeground(NOTIFICATION_ID, notification); + if (newInfo.playerStatus == PlayerStatus.PLAYING) { + startForeground(NOTIFICATION_ID, notification); + } if (BuildConfig.DEBUG) Log.d(TAG, "Notification set up"); } @@ -843,12 +852,12 @@ public class PlaybackService extends Service { private void stopWidgetUpdater() { taskManager.cancelWidgetUpdater(); - sendBroadcast(new Intent(PlayerWidget.STOP_WIDGET_UPDATE)); + sendBroadcast(new Intent(STOP_WIDGET_UPDATE)); } private void updateWidget() { PlaybackService.this.sendBroadcast(new Intent( - PlayerWidget.FORCE_WIDGET_UPDATE)); + FORCE_WIDGET_UPDATE)); } public boolean sleepTimerActive() { @@ -1090,7 +1099,7 @@ public class PlaybackService extends Service { } /** - * @see de.danoeh.antennapod.service.playback.PlaybackServiceMediaPlayer#seekToChapter(de.danoeh.antennapod.feed.Chapter) + * @see de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer#seekToChapter(de.danoeh.antennapod.core.feed.Chapter) */ public void seekToChapter(Chapter c) { mediaPlayer.seekToChapter(c); diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java similarity index 98% rename from src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java rename to core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java index 9978fff3c..dbf870eac 100644 --- a/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.service.playback; +package de.danoeh.antennapod.core.service.playback; import android.content.ComponentName; import android.content.Context; @@ -21,15 +21,15 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.ReentrantLock; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.MediaType; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.receiver.MediaButtonReceiver; -import de.danoeh.antennapod.util.playback.AudioPlayer; -import de.danoeh.antennapod.util.playback.IPlayer; -import de.danoeh.antennapod.util.playback.Playable; -import de.danoeh.antennapod.util.playback.VideoPlayer; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; +import de.danoeh.antennapod.core.util.playback.AudioPlayer; +import de.danoeh.antennapod.core.util.playback.IPlayer; +import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.core.util.playback.VideoPlayer; /** * Manages the MediaPlayer object of the PlaybackService. @@ -149,7 +149,7 @@ public class PlaybackServiceMediaPlayer { *

* This method requires the playerLock and is executed on the caller's thread. * - * @see #playMediaObject(de.danoeh.antennapod.util.playback.Playable, boolean, boolean, boolean) + * @see #playMediaObject(de.danoeh.antennapod.core.util.playback.Playable, boolean, boolean, boolean) */ private void playMediaObject(final Playable playable, final boolean forceReset, final boolean stream, final boolean startWhenPrepared, final boolean prepareImmediately) { Validate.notNull(playable); diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java similarity index 97% rename from src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java rename to core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java index 680ec2e2f..1865afa6f 100644 --- a/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java @@ -1,15 +1,15 @@ -package de.danoeh.antennapod.service.playback; +package de.danoeh.antennapod.core.service.playback; import android.content.Context; import android.util.Log; import org.apache.commons.lang3.Validate; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.EventDistributor; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.playback.Playable; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.EventDistributor; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.util.playback.Playable; import java.util.List; import java.util.concurrent.*; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlayerStatus.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlayerStatus.java new file mode 100644 index 000000000..7c666abd5 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlayerStatus.java @@ -0,0 +1,24 @@ +package de.danoeh.antennapod.core.service.playback; + +public enum PlayerStatus { + INDETERMINATE, // player is currently changing its state, listeners should wait until the player has left this state. + ERROR, + PREPARING, + PAUSED, + PLAYING, + STOPPED, + PREPARED, + SEEKING, + INITIALIZING, // playback service is loading the Playable's metadata + INITIALIZED; // playback service was started, data source of media player was set. + + private static final PlayerStatus[] fromOrdinalLookup; + + static { + fromOrdinalLookup = PlayerStatus.values(); + } + + public static PlayerStatus fromOrdinal(int o) { + return fromOrdinalLookup[o]; + } +} diff --git a/src/de/danoeh/antennapod/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java similarity index 96% rename from src/de/danoeh/antennapod/storage/DBReader.java rename to core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index e49ea4f83..62edaae29 100644 --- a/src/de/danoeh/antennapod/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -1,18 +1,18 @@ -package de.danoeh.antennapod.storage; +package de.danoeh.antennapod.core.storage; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.*; -import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.util.DownloadError; -import de.danoeh.antennapod.util.comparator.DownloadStatusComparator; -import de.danoeh.antennapod.util.comparator.FeedItemPubdateComparator; -import de.danoeh.antennapod.util.comparator.PlaybackCompletionDateComparator; -import de.danoeh.antennapod.util.flattr.FlattrStatus; -import de.danoeh.antennapod.util.flattr.FlattrThing; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.*; +import de.danoeh.antennapod.core.service.download.DownloadStatus; +import de.danoeh.antennapod.core.util.DownloadError; +import de.danoeh.antennapod.core.util.comparator.DownloadStatusComparator; +import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator; +import de.danoeh.antennapod.core.util.comparator.PlaybackCompletionDateComparator; +import de.danoeh.antennapod.core.util.flattr.FlattrStatus; +import de.danoeh.antennapod.core.util.flattr.FlattrThing; import java.util.ArrayList; import java.util.Collections; @@ -23,7 +23,7 @@ import java.util.List; * Provides methods for reading data from the AntennaPod database. * In general, all database calls in DBReader-methods are executed on the caller's thread. * This means that the caller should make sure that DBReader-methods are not executed on the GUI-thread. - * This class will use the {@link de.danoeh.antennapod.feed.EventDistributor} to notify listeners about changes in the database. + * This class will use the {@link de.danoeh.antennapod.core.feed.EventDistributor} to notify listeners about changes in the database. */ public final class DBReader { private static final String TAG = "DBReader"; @@ -48,7 +48,7 @@ public final class DBReader { * @param context A context that is used for opening a database connection. * @return A list of Feeds, sorted alphabetically by their title. A Feed-object * of the returned list does NOT have its list of FeedItems yet. The FeedItem-list - * can be loaded separately with {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.feed.Feed)}. + * can be loaded separately with {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.core.feed.Feed)}. */ public static List getFeedList(final Context context) { if (BuildConfig.DEBUG) @@ -108,7 +108,7 @@ public final class DBReader { * A Feed is considered expired if 'lastUpdate < (currentTime - expirationTime)' evaluates to true. * @return A list of Feeds, sorted alphabetically by their title. A Feed-object * of the returned list does NOT have its list of FeedItems yet. The FeedItem-list - * can be loaded separately with {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.feed.Feed)}. + * can be loaded separately with {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.core.feed.Feed)}. */ public static List getExpiredFeedsList(final Context context, final long expirationTime) { if (BuildConfig.DEBUG) @@ -394,7 +394,7 @@ public final class DBReader { * * @param context A context that is used for opening a database connection. * @return A list of IDs sorted by the same order as the queue. The caller can wrap the returned - * list in a {@link de.danoeh.antennapod.util.QueueAccess} object for easier access to the queue's properties. + * list in a {@link de.danoeh.antennapod.core.util.QueueAccess} object for easier access to the queue's properties. */ public static List getQueueIDList(Context context) { PodDBAdapter adapter = new PodDBAdapter(context); @@ -426,7 +426,7 @@ public final class DBReader { * * @param context A context that is used for opening a database connection. * @return A list of FeedItems sorted by the same order as the queue. The caller can wrap the returned - * list in a {@link de.danoeh.antennapod.util.QueueAccess} object for easier access to the queue's properties. + * list in a {@link de.danoeh.antennapod.core.util.QueueAccess} object for easier access to the queue's properties. */ public static List getQueue(Context context) { if (BuildConfig.DEBUG) @@ -619,7 +619,7 @@ public final class DBReader { /** * Loads the FeedItemStatistics objects of all Feeds in the database. This method should be preferred over - * {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.feed.Feed)} if only metadata about + * {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.core.feed.Feed)} if only metadata about * the FeedItems is needed. * * @param context A context that is used for opening a database connection. diff --git a/src/de/danoeh/antennapod/storage/DBTasks.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java similarity index 97% rename from src/de/danoeh/antennapod/storage/DBTasks.java rename to core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java index a230ba797..cc0a3d058 100644 --- a/src/de/danoeh/antennapod/storage/DBTasks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java @@ -1,23 +1,24 @@ -package de.danoeh.antennapod.storage; +package de.danoeh.antennapod.core.storage; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.asynctask.FlattrClickWorker; -import de.danoeh.antennapod.asynctask.FlattrStatusFetcher; -import de.danoeh.antennapod.feed.*; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.GpodnetSyncService; -import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.util.DownloadError; -import de.danoeh.antennapod.util.NetworkUtils; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.comparator.FeedItemPubdateComparator; -import de.danoeh.antennapod.util.exception.MediaFileNotFoundException; -import de.danoeh.antennapod.util.flattr.FlattrUtils; +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; +import de.danoeh.antennapod.core.feed.*; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.GpodnetSyncService; +import de.danoeh.antennapod.core.service.download.DownloadStatus; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.util.DownloadError; +import de.danoeh.antennapod.core.util.NetworkUtils; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator; +import de.danoeh.antennapod.core.util.exception.MediaFileNotFoundException; +import de.danoeh.antennapod.core.util.flattr.FlattrUtils; import java.util.*; import java.util.concurrent.*; @@ -162,7 +163,9 @@ public final class DBTasks { new FlattrStatusFetcher(context).start(); } - GpodnetSyncService.sendSyncIntent(context); + if (ClientConfig.gpodnetCallbacks.gpodnetEnabled()) { + GpodnetSyncService.sendSyncIntent(context); + } autodownloadUndownloadedItems(context); } }.start(); diff --git a/src/de/danoeh/antennapod/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java similarity index 97% rename from src/de/danoeh/antennapod/storage/DBWriter.java rename to core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index 9916ac97f..d71d19433 100644 --- a/src/de/danoeh/antennapod/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.storage; +package de.danoeh.antennapod.core.storage; import android.app.backup.BackupManager; import android.content.Context; @@ -7,17 +7,18 @@ import android.content.SharedPreferences; import android.database.Cursor; import android.preference.PreferenceManager; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.asynctask.FlattrClickWorker; -import de.danoeh.antennapod.feed.*; -import de.danoeh.antennapod.preferences.GpodnetPreferences; -import de.danoeh.antennapod.preferences.PlaybackPreferences; -import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.util.QueueAccess; -import de.danoeh.antennapod.util.flattr.FlattrStatus; -import de.danoeh.antennapod.util.flattr.FlattrThing; -import de.danoeh.antennapod.util.flattr.SimpleFlattrThing; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.asynctask.FlattrClickWorker; +import de.danoeh.antennapod.core.feed.*; +import de.danoeh.antennapod.core.preferences.GpodnetPreferences; +import de.danoeh.antennapod.core.preferences.PlaybackPreferences; +import de.danoeh.antennapod.core.service.download.DownloadStatus; +import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.core.util.flattr.FlattrStatus; +import de.danoeh.antennapod.core.util.flattr.FlattrThing; +import de.danoeh.antennapod.core.util.flattr.SimpleFlattrThing; import org.shredzone.flattr4j.model.Flattr; import java.io.File; @@ -196,7 +197,9 @@ public class DBWriter { adapter.removeFeed(feed); adapter.close(); - GpodnetPreferences.addRemovedFeed(feed.getDownload_url()); + if (ClientConfig.gpodnetCallbacks.gpodnetEnabled()) { + GpodnetPreferences.addRemovedFeed(feed.getDownload_url()); + } EventDistributor.getInstance().sendFeedUpdateBroadcast(); BackupManager backupManager = new BackupManager(context); @@ -697,8 +700,10 @@ public class DBWriter { adapter.setCompleteFeed(feeds); adapter.close(); - for (Feed feed : feeds) { - GpodnetPreferences.addAddedFeed(feed.getDownload_url()); + if (ClientConfig.gpodnetCallbacks.gpodnetEnabled()) { + for (Feed feed : feeds) { + GpodnetPreferences.addAddedFeed(feed.getDownload_url()); + } } BackupManager backupManager = new BackupManager(context); diff --git a/src/de/danoeh/antennapod/storage/DownloadRequestException.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequestException.java similarity index 92% rename from src/de/danoeh/antennapod/storage/DownloadRequestException.java rename to core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequestException.java index 0ef766e58..c85559e20 100644 --- a/src/de/danoeh/antennapod/storage/DownloadRequestException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequestException.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.storage; +package de.danoeh.antennapod.core.storage; /** * Thrown by the DownloadRequester if a download request contains invalid data diff --git a/src/de/danoeh/antennapod/storage/DownloadRequester.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java similarity index 96% rename from src/de/danoeh/antennapod/storage/DownloadRequester.java rename to core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java index 0eae52137..f0331e997 100644 --- a/src/de/danoeh/antennapod/storage/DownloadRequester.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java @@ -1,18 +1,17 @@ -package de.danoeh.antennapod.storage; +package de.danoeh.antennapod.core.storage; import android.content.Context; import android.content.Intent; import android.util.Log; import android.webkit.URLUtil; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.*; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.download.DownloadRequest; -import de.danoeh.antennapod.service.download.DownloadService; -import de.danoeh.antennapod.util.FileNameGenerator; -import de.danoeh.antennapod.util.URLChecker; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.*; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.download.DownloadRequest; +import de.danoeh.antennapod.core.service.download.DownloadService; +import de.danoeh.antennapod.core.util.FileNameGenerator; +import de.danoeh.antennapod.core.util.URLChecker; import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; diff --git a/src/de/danoeh/antennapod/storage/FeedItemStatistics.java b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedItemStatistics.java similarity index 98% rename from src/de/danoeh/antennapod/storage/FeedItemStatistics.java rename to core/src/main/java/de/danoeh/antennapod/core/storage/FeedItemStatistics.java index 8cb040756..f6a59836b 100644 --- a/src/de/danoeh/antennapod/storage/FeedItemStatistics.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedItemStatistics.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.storage; +package de.danoeh.antennapod.core.storage; import java.util.Date; diff --git a/src/de/danoeh/antennapod/storage/FeedSearcher.java b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java similarity index 88% rename from src/de/danoeh/antennapod/storage/FeedSearcher.java rename to core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java index e7aa93f83..3a63685ba 100644 --- a/src/de/danoeh/antennapod/storage/FeedSearcher.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java @@ -1,10 +1,10 @@ -package de.danoeh.antennapod.storage; +package de.danoeh.antennapod.core.storage; import android.content.Context; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.SearchResult; -import de.danoeh.antennapod.util.comparator.SearchResultValueComparator; +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.SearchResult; +import de.danoeh.antennapod.core.util.comparator.SearchResultValueComparator; import java.util.ArrayList; import java.util.Collections; diff --git a/src/de/danoeh/antennapod/storage/PodDBAdapter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java similarity index 90% rename from src/de/danoeh/antennapod/storage/PodDBAdapter.java rename to core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java index 671ac30d5..6b6e09369 100644 --- a/src/de/danoeh/antennapod/storage/PodDBAdapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.storage; +package de.danoeh.antennapod.core.storage; import android.content.ContentValues; import android.content.Context; @@ -16,16 +16,17 @@ import org.apache.commons.lang3.Validate; import java.util.Arrays; import java.util.List; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedComponent; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.feed.FeedPreferences; -import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.util.flattr.FlattrStatus; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedComponent; +import de.danoeh.antennapod.core.feed.FeedImage; +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.flattr.FlattrStatus; // TODO Remove media column from feeditem table @@ -34,7 +35,6 @@ import de.danoeh.antennapod.util.flattr.FlattrStatus; */ public class PodDBAdapter { private static final String TAG = "PodDBAdapter"; - private static final int DATABASE_VERSION = 12; public static final String DATABASE_NAME = "Antennapod.db"; /** @@ -158,7 +158,7 @@ public class PodDBAdapter { private static final String TABLE_PRIMARY_KEY = KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"; - private static final String CREATE_TABLE_FEEDS = "CREATE TABLE " + public static final String CREATE_TABLE_FEEDS = "CREATE TABLE " + TABLE_NAME_FEEDS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT," + KEY_DOWNLOADED + " INTEGER," + KEY_LINK + " TEXT," @@ -170,7 +170,7 @@ public class PodDBAdapter { + KEY_USERNAME + " TEXT," + KEY_PASSWORD + " TEXT)"; - private static final String CREATE_TABLE_FEED_ITEMS = "CREATE TABLE " + public static final String CREATE_TABLE_FEED_ITEMS = "CREATE TABLE " + TABLE_NAME_FEED_ITEMS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_CONTENT_ENCODED + " TEXT," + KEY_PUBDATE + " INTEGER," + KEY_READ + " INTEGER," + KEY_LINK + " TEXT," @@ -180,12 +180,12 @@ public class PodDBAdapter { + KEY_FLATTR_STATUS + " INTEGER," + KEY_IMAGE + " INTEGER)"; - private static final String CREATE_TABLE_FEED_IMAGES = "CREATE TABLE " + public static final String CREATE_TABLE_FEED_IMAGES = "CREATE TABLE " + TABLE_NAME_FEED_IMAGES + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT," + KEY_DOWNLOADED + " INTEGER)"; - private static final String CREATE_TABLE_FEED_MEDIA = "CREATE TABLE " + public static final String CREATE_TABLE_FEED_MEDIA = "CREATE TABLE " + TABLE_NAME_FEED_MEDIA + " (" + TABLE_PRIMARY_KEY + KEY_DURATION + " INTEGER," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT," + KEY_DOWNLOADED + " INTEGER," + KEY_POSITION @@ -194,18 +194,18 @@ public class PodDBAdapter { + KEY_FEEDITEM + " INTEGER," + KEY_PLAYED_DURATION + " INTEGER)"; - private static final String CREATE_TABLE_DOWNLOAD_LOG = "CREATE TABLE " + public static final String CREATE_TABLE_DOWNLOAD_LOG = "CREATE TABLE " + TABLE_NAME_DOWNLOAD_LOG + " (" + TABLE_PRIMARY_KEY + KEY_FEEDFILE + " INTEGER," + KEY_FEEDFILETYPE + " INTEGER," + KEY_REASON + " INTEGER," + KEY_SUCCESSFUL + " INTEGER," + KEY_COMPLETION_DATE + " INTEGER," + KEY_REASON_DETAILED + " TEXT," + KEY_DOWNLOADSTATUS_TITLE + " TEXT)"; - private static final String CREATE_TABLE_QUEUE = "CREATE TABLE " + public static final String CREATE_TABLE_QUEUE = "CREATE TABLE " + TABLE_NAME_QUEUE + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_FEEDITEM + " INTEGER," + KEY_FEED + " INTEGER)"; - private static final String CREATE_TABLE_SIMPLECHAPTERS = "CREATE TABLE " + public static final String CREATE_TABLE_SIMPLECHAPTERS = "CREATE TABLE " + TABLE_NAME_SIMPLECHAPTERS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_START + " INTEGER," + KEY_FEEDITEM + " INTEGER," + KEY_LINK + " TEXT," + KEY_CHAPTER_TYPE + " INTEGER)"; @@ -318,7 +318,8 @@ public class PodDBAdapter { private static synchronized PodDBHelper getDbHelperSingleton(Context appContext) { if (dbHelperSingleton == null) { - dbHelperSingleton = new PodDBHelper(appContext, DATABASE_NAME, null, DATABASE_VERSION); + dbHelperSingleton = new PodDBHelper(appContext, DATABASE_NAME, null, + ClientConfig.storageCallbacks.getDatabaseVersion()); } return dbHelperSingleton; } @@ -1303,89 +1304,7 @@ public class PodDBAdapter { @Override public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) { - Log.w("DBAdapter", "Upgrading from version " + oldVersion + " to " - + newVersion + "."); - if (oldVersion <= 1) { - db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS + " ADD COLUMN " - + KEY_TYPE + " TEXT"); - } - if (oldVersion <= 2) { - db.execSQL("ALTER TABLE " + TABLE_NAME_SIMPLECHAPTERS - + " ADD COLUMN " + KEY_LINK + " TEXT"); - } - if (oldVersion <= 3) { - db.execSQL("ALTER TABLE " + TABLE_NAME_FEED_ITEMS - + " ADD COLUMN " + KEY_ITEM_IDENTIFIER + " TEXT"); - } - if (oldVersion <= 4) { - db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS + " ADD COLUMN " - + KEY_FEED_IDENTIFIER + " TEXT"); - } - if (oldVersion <= 5) { - db.execSQL("ALTER TABLE " + TABLE_NAME_DOWNLOAD_LOG - + " ADD COLUMN " + KEY_REASON_DETAILED + " TEXT"); - db.execSQL("ALTER TABLE " + TABLE_NAME_DOWNLOAD_LOG - + " ADD COLUMN " + KEY_DOWNLOADSTATUS_TITLE + " TEXT"); - } - if (oldVersion <= 6) { - db.execSQL("ALTER TABLE " + TABLE_NAME_SIMPLECHAPTERS - + " ADD COLUMN " + KEY_CHAPTER_TYPE + " INTEGER"); - } - if (oldVersion <= 7) { - db.execSQL("ALTER TABLE " + TABLE_NAME_FEED_MEDIA - + " ADD COLUMN " + KEY_PLAYBACK_COMPLETION_DATE - + " INTEGER"); - } - if (oldVersion <= 8) { - final int KEY_ID_POSITION = 0; - final int KEY_MEDIA_POSITION = 1; - - // Add feeditem column to feedmedia table - db.execSQL("ALTER TABLE " + TABLE_NAME_FEED_MEDIA - + " ADD COLUMN " + KEY_FEEDITEM - + " INTEGER"); - Cursor feeditemCursor = db.query(TABLE_NAME_FEED_ITEMS, new String[]{KEY_ID, KEY_MEDIA}, "? > 0", new String[]{KEY_MEDIA}, null, null, null); - if (feeditemCursor.moveToFirst()) { - db.beginTransaction(); - ContentValues contentValues = new ContentValues(); - do { - long mediaId = feeditemCursor.getLong(KEY_MEDIA_POSITION); - contentValues.put(KEY_FEEDITEM, feeditemCursor.getLong(KEY_ID_POSITION)); - db.update(TABLE_NAME_FEED_MEDIA, contentValues, KEY_ID + "=?", new String[]{String.valueOf(mediaId)}); - contentValues.clear(); - } while (feeditemCursor.moveToNext()); - db.setTransactionSuccessful(); - db.endTransaction(); - } - feeditemCursor.close(); - } - if (oldVersion <= 9) { - db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS - + " ADD COLUMN " + KEY_AUTO_DOWNLOAD - + " INTEGER DEFAULT 1"); - } - if (oldVersion <= 10) { - db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS - + " ADD COLUMN " + KEY_FLATTR_STATUS - + " INTEGER"); - db.execSQL("ALTER TABLE " + TABLE_NAME_FEED_ITEMS - + " ADD COLUMN " + KEY_FLATTR_STATUS - + " INTEGER"); - db.execSQL("ALTER TABLE " + TABLE_NAME_FEED_MEDIA - + " ADD COLUMN " + KEY_PLAYED_DURATION - + " INTEGER"); - } - if (oldVersion <= 11) { - db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS - + " ADD COLUMN " + KEY_USERNAME - + " TEXT"); - db.execSQL("ALTER TABLE " + TABLE_NAME_FEEDS - + " ADD COLUMN " + KEY_PASSWORD - + " TEXT"); - db.execSQL("ALTER TABLE " + TABLE_NAME_FEED_ITEMS - + " ADD COLUMN " + KEY_IMAGE - + " INTEGER"); - } + ClientConfig.storageCallbacks.onUpgrade(db, oldVersion, newVersion); } } } diff --git a/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandler.java similarity index 91% rename from src/de/danoeh/antennapod/syndication/handler/FeedHandler.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandler.java index aafa1c209..9efc5888f 100644 --- a/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandler.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.syndication.handler; +package de.danoeh.antennapod.core.syndication.handler; -import de.danoeh.antennapod.feed.Feed; +import de.danoeh.antennapod.core.feed.Feed; import org.apache.commons.io.input.XmlStreamReader; import org.xml.sax.InputSource; import org.xml.sax.SAXException; diff --git a/src/de/danoeh/antennapod/syndication/handler/FeedHandlerResult.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java similarity index 78% rename from src/de/danoeh/antennapod/syndication/handler/FeedHandlerResult.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java index 41aa29b52..45d1413bf 100644 --- a/src/de/danoeh/antennapod/syndication/handler/FeedHandlerResult.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.syndication.handler; +package de.danoeh.antennapod.core.syndication.handler; -import de.danoeh.antennapod.feed.Feed; +import de.danoeh.antennapod.core.feed.Feed; import java.util.Map; diff --git a/src/de/danoeh/antennapod/syndication/handler/HandlerState.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java similarity index 78% rename from src/de/danoeh/antennapod/syndication/handler/HandlerState.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java index 17f84724f..413a11f8e 100644 --- a/src/de/danoeh/antennapod/syndication/handler/HandlerState.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java @@ -1,11 +1,15 @@ -package de.danoeh.antennapod.syndication.handler; +package de.danoeh.antennapod.core.syndication.handler; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.syndication.namespace.Namespace; -import de.danoeh.antennapod.syndication.namespace.SyndElement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Stack; -import java.util.*; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.syndication.namespace.Namespace; +import de.danoeh.antennapod.core.syndication.namespace.SyndElement; /** * Contains all relevant information to describe the current state of a @@ -35,6 +39,11 @@ public class HandlerState { */ protected StringBuffer contentBuf; + /** + * Temporarily saved objects. + */ + protected HashMap tempObjects; + public HandlerState(Feed feed) { this.feed = feed; alternateUrls = new LinkedHashMap(); @@ -42,6 +51,7 @@ public class HandlerState { tagstack = new Stack(); namespaces = new HashMap(); defaultNamespaces = new Stack(); + tempObjects = new HashMap(); } public Feed getFeed() { @@ -95,4 +105,7 @@ public class HandlerState { alternateUrls.put(url, title); } + public HashMap getTempObjects() { + return tempObjects; + } } diff --git a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java similarity index 92% rename from src/de/danoeh/antennapod/syndication/handler/SyndHandler.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java index 15dc94d65..1dda24944 100644 --- a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java @@ -1,10 +1,10 @@ -package de.danoeh.antennapod.syndication.handler; +package de.danoeh.antennapod.core.syndication.handler; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.syndication.namespace.*; -import de.danoeh.antennapod.syndication.namespace.atom.NSAtom; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.syndication.namespace.*; +import de.danoeh.antennapod.core.syndication.namespace.atom.NSAtom; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; diff --git a/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java similarity index 95% rename from src/de/danoeh/antennapod/syndication/handler/TypeGetter.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java index 2496e112a..32cd538d5 100644 --- a/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java @@ -1,11 +1,10 @@ -package de.danoeh.antennapod.syndication.handler; +package de.danoeh.antennapod.core.syndication.handler; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Feed; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.Feed; import org.apache.commons.io.input.XmlStreamReader; import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; diff --git a/src/de/danoeh/antennapod/syndication/handler/UnsupportedFeedtypeException.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java similarity index 85% rename from src/de/danoeh/antennapod/syndication/handler/UnsupportedFeedtypeException.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java index 605dad2fb..3da9251d9 100644 --- a/src/de/danoeh/antennapod/syndication/handler/UnsupportedFeedtypeException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.syndication.handler; +package de.danoeh.antennapod.core.syndication.handler; -import de.danoeh.antennapod.syndication.handler.TypeGetter.Type; +import de.danoeh.antennapod.core.syndication.handler.TypeGetter.Type; public class UnsupportedFeedtypeException extends Exception { private static final long serialVersionUID = 9105878964928170669L; diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSContent.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSContent.java similarity index 83% rename from src/de/danoeh/antennapod/syndication/namespace/NSContent.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSContent.java index 9ad3026be..71bf69ffa 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/NSContent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSContent.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.syndication.namespace; +package de.danoeh.antennapod.core.syndication.namespace; -import de.danoeh.antennapod.syndication.handler.HandlerState; +import de.danoeh.antennapod.core.syndication.handler.HandlerState; import org.xml.sax.Attributes; public class NSContent extends Namespace { diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSITunes.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSITunes.java similarity index 52% rename from src/de/danoeh/antennapod/syndication/namespace/NSITunes.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSITunes.java index d8cbe040b..70e1126b9 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/NSITunes.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSITunes.java @@ -1,9 +1,11 @@ -package de.danoeh.antennapod.syndication.namespace; +package de.danoeh.antennapod.core.syndication.namespace; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.syndication.handler.HandlerState; +import de.danoeh.antennapod.core.feed.FeedImage; +import de.danoeh.antennapod.core.syndication.handler.HandlerState; import org.xml.sax.Attributes; +import java.util.concurrent.TimeUnit; + public class NSITunes extends Namespace { public static final String NSTAG = "itunes"; public static final String NSURI = "http://www.itunes.com/dtds/podcast-1.0.dtd"; @@ -13,6 +15,7 @@ public class NSITunes extends Namespace { private static final String IMAGE_HREF = "href"; private static final String AUTHOR = "author"; + public static final String DURATION = "duration"; @Override @@ -25,12 +28,14 @@ public class NSITunes extends Namespace { if (state.getCurrentItem() != null) { // this is an items image - image.setTitle(state.getCurrentItem().getTitle() + IMAGE_TITLE); + image.setTitle(state.getCurrentItem().getTitle()+IMAGE_TITLE); + image.setOwner(state.getCurrentItem()); state.getCurrentItem().setImage(image); - } else { + } else { // this is the feed image if (state.getFeed().getImage() == null) { + image.setOwner(state.getFeed()); state.getFeed().setImage(image); } } @@ -44,6 +49,25 @@ public class NSITunes extends Namespace { public void handleElementEnd(String localName, HandlerState state) { if (localName.equals(AUTHOR)) { state.getFeed().setAuthor(state.getContentBuf().toString()); + } else if (localName.equals(DURATION)) { + String[] parts = state.getContentBuf().toString().split(":"); + try { + int duration = 0; + if (parts.length == 2) { + duration += TimeUnit.MINUTES.toMillis(Long.valueOf(parts[0])) + + TimeUnit.SECONDS.toMillis(Long.valueOf(parts[1])); + } else if (parts.length >= 3) { + duration += TimeUnit.HOURS.toMillis(Long.valueOf(parts[0])) + + TimeUnit.MINUTES.toMillis(Long.valueOf(parts[1])) + + TimeUnit.SECONDS.toMillis(Long.valueOf(parts[2])); + } else { + return; + } + + state.getTempObjects().put(DURATION, duration); + } catch (NumberFormatException e) { + e.printStackTrace(); + } } } diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java similarity index 87% rename from src/de/danoeh/antennapod/syndication/namespace/NSMedia.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java index cc23167c1..7f03f1139 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java @@ -1,10 +1,10 @@ -package de.danoeh.antennapod.syndication.namespace; +package de.danoeh.antennapod.core.syndication.namespace; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.syndication.handler.HandlerState; -import de.danoeh.antennapod.syndication.util.SyndTypeUtils; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.syndication.handler.HandlerState; +import de.danoeh.antennapod.core.syndication.util.SyndTypeUtils; import org.xml.sax.Attributes; import java.util.concurrent.TimeUnit; diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java similarity index 83% rename from src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java index 9572f87ae..0ca261a0e 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java @@ -1,13 +1,13 @@ -package de.danoeh.antennapod.syndication.namespace; +package de.danoeh.antennapod.core.syndication.namespace; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.syndication.handler.HandlerState; -import de.danoeh.antennapod.syndication.util.SyndDateUtils; -import de.danoeh.antennapod.syndication.util.SyndTypeUtils; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.FeedImage; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.syndication.handler.HandlerState; +import de.danoeh.antennapod.core.syndication.util.SyndDateUtils; +import de.danoeh.antennapod.core.syndication.util.SyndTypeUtils; import org.xml.sax.Attributes; /** @@ -68,6 +68,7 @@ public class NSRSS20 extends Namespace { String parent = state.getTagstack().peek().getName(); if (parent.equals(CHANNEL)) { state.getFeed().setImage(new FeedImage()); + state.getFeed().getImage().setOwner(state.getFeed()); } } } @@ -85,6 +86,13 @@ public class NSRSS20 extends Namespace { state.getCurrentItem().setTitle( state.getCurrentItem().getDescription()); } + + if (state.getTempObjects().containsKey(NSITunes.DURATION)) { + if (state.getCurrentItem().hasMedia()) { + state.getCurrentItem().getMedia().setDuration((Integer) state.getTempObjects().get(NSITunes.DURATION)); + } + state.getTempObjects().remove(NSITunes.DURATION); + } } state.setCurrentItem(null); } else if (state.getTagstack().size() >= 2 diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java new file mode 100644 index 000000000..a2e5d0187 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java @@ -0,0 +1,52 @@ +package de.danoeh.antennapod.core.syndication.namespace; + +import android.util.Log; + +import org.xml.sax.Attributes; + +import java.util.ArrayList; + +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.SimpleChapter; +import de.danoeh.antennapod.core.syndication.handler.HandlerState; +import de.danoeh.antennapod.core.syndication.util.SyndDateUtils; + +public class NSSimpleChapters extends Namespace { + private static final String TAG = "NSSimpleChapters"; + + public static final String NSTAG = "psc|sc"; + public static final String NSURI = "http://podlove.org/simple-chapters"; + + public static final String CHAPTERS = "chapters"; + public static final String CHAPTER = "chapter"; + public static final String START = "start"; + public static final String TITLE = "title"; + public static final String HREF = "href"; + + @Override + public SyndElement handleElementStart(String localName, HandlerState state, + Attributes attributes) { + if (localName.equals(CHAPTERS)) { + state.getCurrentItem().setChapters(new ArrayList()); + } else if (localName.equals(CHAPTER)) { + try { + state.getCurrentItem() + .getChapters() + .add(new SimpleChapter(SyndDateUtils + .parseTimeString(attributes.getValue(START)), + attributes.getValue(TITLE), state.getCurrentItem(), + attributes.getValue(HREF))); + } catch (NumberFormatException e) { + if (BuildConfig.DEBUG) Log.w(TAG, "Unable to read chapter", e); + } + } + + return new SyndElement(localName, this); + } + + @Override + public void handleElementEnd(String localName, HandlerState state) { + } + +} diff --git a/src/de/danoeh/antennapod/syndication/namespace/Namespace.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/Namespace.java similarity index 84% rename from src/de/danoeh/antennapod/syndication/namespace/Namespace.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/Namespace.java index 910131feb..cf118d202 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/Namespace.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/Namespace.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.syndication.namespace; +package de.danoeh.antennapod.core.syndication.namespace; -import de.danoeh.antennapod.syndication.handler.HandlerState; +import de.danoeh.antennapod.core.syndication.handler.HandlerState; import org.xml.sax.Attributes; diff --git a/src/de/danoeh/antennapod/syndication/namespace/SyndElement.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/SyndElement.java similarity index 86% rename from src/de/danoeh/antennapod/syndication/namespace/SyndElement.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/SyndElement.java index 187312c9e..8adcd2086 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/SyndElement.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/SyndElement.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.syndication.namespace; +package de.danoeh.antennapod.core.syndication.namespace; /** Defines a XML Element that is pushed on the tagstack */ public class SyndElement { diff --git a/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java similarity index 83% rename from src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java index 86b80d2ed..43fe0edb7 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java @@ -1,7 +1,7 @@ -package de.danoeh.antennapod.syndication.namespace.atom; +package de.danoeh.antennapod.core.syndication.namespace.atom; -import de.danoeh.antennapod.syndication.namespace.Namespace; -import de.danoeh.antennapod.syndication.namespace.SyndElement; +import de.danoeh.antennapod.core.syndication.namespace.Namespace; +import de.danoeh.antennapod.core.syndication.namespace.SyndElement; import org.apache.commons.lang3.StringEscapeUtils; /** Represents Atom Element which contains text (content, title, summary). */ diff --git a/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java similarity index 86% rename from src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java index 2c8e232ff..1de001c55 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java @@ -1,16 +1,17 @@ -package de.danoeh.antennapod.syndication.namespace.atom; +package de.danoeh.antennapod.core.syndication.namespace.atom; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.syndication.handler.HandlerState; -import de.danoeh.antennapod.syndication.namespace.NSRSS20; -import de.danoeh.antennapod.syndication.namespace.Namespace; -import de.danoeh.antennapod.syndication.namespace.SyndElement; -import de.danoeh.antennapod.syndication.util.SyndDateUtils; -import de.danoeh.antennapod.syndication.util.SyndTypeUtils; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.FeedImage; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.syndication.handler.HandlerState; +import de.danoeh.antennapod.core.syndication.namespace.NSITunes; +import de.danoeh.antennapod.core.syndication.namespace.NSRSS20; +import de.danoeh.antennapod.core.syndication.namespace.Namespace; +import de.danoeh.antennapod.core.syndication.namespace.SyndElement; +import de.danoeh.antennapod.core.syndication.util.SyndDateUtils; +import de.danoeh.antennapod.core.syndication.util.SyndTypeUtils; import org.xml.sax.Attributes; public class NSAtom extends Namespace { @@ -128,6 +129,13 @@ public class NSAtom extends Namespace { @Override public void handleElementEnd(String localName, HandlerState state) { if (localName.equals(ENTRY)) { + if (state.getCurrentItem() != null && + state.getTempObjects().containsKey(NSITunes.DURATION)) { + if (state.getCurrentItem().hasMedia()) { + state.getCurrentItem().getMedia().setDuration((Integer) state.getTempObjects().get(NSITunes.DURATION)); + } + state.getTempObjects().remove(NSITunes.DURATION); + } state.setCurrentItem(null); } @@ -185,7 +193,7 @@ public class NSAtom extends Namespace { SyndDateUtils.parseRFC3339Date(content)); } } else if (top.equals(IMAGE)) { - state.getFeed().setImage(new FeedImage(content, null)); + state.getFeed().setImage(new FeedImage(state.getFeed(), content, null)); } } diff --git a/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndDateUtils.java similarity index 98% rename from src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndDateUtils.java index 56687ac2e..d493286ac 100644 --- a/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndDateUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.syndication.util; +package de.danoeh.antennapod.core.syndication.util; import android.util.Log; diff --git a/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndTypeUtils.java similarity index 95% rename from src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java rename to core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndTypeUtils.java index d0fa3a5fc..8d1d8ffde 100644 --- a/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndTypeUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.syndication.util; +package de.danoeh.antennapod.core.syndication.util; import android.webkit.MimeTypeMap; import org.apache.commons.io.FilenameUtils; diff --git a/src/de/danoeh/antennapod/util/ChapterUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java similarity index 94% rename from src/de/danoeh/antennapod/util/ChapterUtils.java rename to core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java index 2d9022eed..8dd9ffe4b 100644 --- a/src/de/danoeh/antennapod/util/ChapterUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import android.util.Log; @@ -15,14 +15,14 @@ import java.net.URL; import java.util.Collections; import java.util.List; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.util.comparator.ChapterStartTimeComparator; -import de.danoeh.antennapod.util.id3reader.ChapterReader; -import de.danoeh.antennapod.util.id3reader.ID3ReaderException; -import de.danoeh.antennapod.util.playback.Playable; -import de.danoeh.antennapod.util.vorbiscommentreader.VorbisCommentChapterReader; -import de.danoeh.antennapod.util.vorbiscommentreader.VorbisCommentReaderException; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.util.comparator.ChapterStartTimeComparator; +import de.danoeh.antennapod.core.util.id3reader.ChapterReader; +import de.danoeh.antennapod.core.util.id3reader.ID3ReaderException; +import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.core.util.vorbiscommentreader.VorbisCommentChapterReader; +import de.danoeh.antennapod.core.util.vorbiscommentreader.VorbisCommentReaderException; /** * Utility class for getting chapter data from media files. diff --git a/src/de/danoeh/antennapod/util/Converter.java b/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java similarity index 98% rename from src/de/danoeh/antennapod/util/Converter.java rename to core/src/main/java/de/danoeh/antennapod/core/util/Converter.java index f4c2b2f66..a0b514bd6 100644 --- a/src/de/danoeh/antennapod/util/Converter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import android.util.Log; diff --git a/src/de/danoeh/antennapod/util/DownloadError.java b/core/src/main/java/de/danoeh/antennapod/core/util/DownloadError.java similarity index 95% rename from src/de/danoeh/antennapod/util/DownloadError.java rename to core/src/main/java/de/danoeh/antennapod/core/util/DownloadError.java index 1a64991a6..602c221bf 100644 --- a/src/de/danoeh/antennapod/util/DownloadError.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/DownloadError.java @@ -1,7 +1,7 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import android.content.Context; -import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.R; /** Utility class for Download Errors. */ public enum DownloadError { diff --git a/src/de/danoeh/antennapod/util/DuckType.java b/core/src/main/java/de/danoeh/antennapod/core/util/DuckType.java similarity index 97% rename from src/de/danoeh/antennapod/util/DuckType.java rename to core/src/main/java/de/danoeh/antennapod/core/util/DuckType.java index 163110418..f432424f8 100644 --- a/src/de/danoeh/antennapod/util/DuckType.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/DuckType.java @@ -1,12 +1,12 @@ /* Adapted from: http://thinking-in-code.blogspot.com/2008/11/duck-typing-in-java-using-dynamic.html */ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; /** * Allows "duck typing" or dynamic invocation based on method signature rather diff --git a/src/de/danoeh/antennapod/util/EpisodeFilter.java b/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java similarity index 91% rename from src/de/danoeh/antennapod/util/EpisodeFilter.java rename to core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java index 115913bca..4c23b161b 100644 --- a/src/de/danoeh/antennapod/util/EpisodeFilter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedItem; import java.util.ArrayList; import java.util.List; diff --git a/src/de/danoeh/antennapod/util/FeedtitleComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedtitleComparator.java similarity index 76% rename from src/de/danoeh/antennapod/util/FeedtitleComparator.java rename to core/src/main/java/de/danoeh/antennapod/core/util/FeedtitleComparator.java index 112b6678d..bf14cd23e 100644 --- a/src/de/danoeh/antennapod/util/FeedtitleComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FeedtitleComparator.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; -import de.danoeh.antennapod.feed.Feed; +import de.danoeh.antennapod.core.feed.Feed; import java.util.Comparator; diff --git a/src/de/danoeh/antennapod/util/FileNameGenerator.java b/core/src/main/java/de/danoeh/antennapod/core/util/FileNameGenerator.java similarity index 95% rename from src/de/danoeh/antennapod/util/FileNameGenerator.java rename to core/src/main/java/de/danoeh/antennapod/core/util/FileNameGenerator.java index 702df62b8..00c023b64 100644 --- a/src/de/danoeh/antennapod/util/FileNameGenerator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FileNameGenerator.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import java.util.Arrays; diff --git a/src/de/danoeh/antennapod/util/InvalidFeedException.java b/core/src/main/java/de/danoeh/antennapod/core/util/InvalidFeedException.java similarity index 91% rename from src/de/danoeh/antennapod/util/InvalidFeedException.java rename to core/src/main/java/de/danoeh/antennapod/core/util/InvalidFeedException.java index 50adae216..c98c2d82a 100644 --- a/src/de/danoeh/antennapod/util/InvalidFeedException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/InvalidFeedException.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; /** Thrown if a feed has invalid attribute values. */ public class InvalidFeedException extends Exception { diff --git a/src/de/danoeh/antennapod/util/LangUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/LangUtils.java similarity index 99% rename from src/de/danoeh/antennapod/util/LangUtils.java rename to core/src/main/java/de/danoeh/antennapod/core/util/LangUtils.java index e6e1d8399..07432d28a 100644 --- a/src/de/danoeh/antennapod/util/LangUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/LangUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import java.nio.charset.Charset; import java.util.HashMap; diff --git a/src/de/danoeh/antennapod/util/NetworkUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java similarity index 93% rename from src/de/danoeh/antennapod/util/NetworkUtils.java rename to core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java index 0c8065e94..b321536a3 100644 --- a/src/de/danoeh/antennapod/util/NetworkUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import android.content.Context; import android.net.ConnectivityManager; @@ -6,8 +6,8 @@ import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.preferences.UserPreferences; import java.util.Arrays; import java.util.List; diff --git a/src/de/danoeh/antennapod/util/QueueAccess.java b/core/src/main/java/de/danoeh/antennapod/core/util/QueueAccess.java similarity index 96% rename from src/de/danoeh/antennapod/util/QueueAccess.java rename to core/src/main/java/de/danoeh/antennapod/core/util/QueueAccess.java index 7a1c7fef2..8e40ae184 100644 --- a/src/de/danoeh/antennapod/util/QueueAccess.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/QueueAccess.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedItem; import java.util.Iterator; import java.util.List; diff --git a/src/de/danoeh/antennapod/util/ShareUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java similarity index 86% rename from src/de/danoeh/antennapod/util/ShareUtils.java rename to core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java index 941fc62ae..85f32ed50 100644 --- a/src/de/danoeh/antennapod/util/ShareUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java @@ -1,9 +1,9 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import android.content.Context; import android.content.Intent; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.core.feed.FeedItem; /** Utility methods for sharing data */ public class ShareUtils { diff --git a/src/de/danoeh/antennapod/util/ShownotesProvider.java b/core/src/main/java/de/danoeh/antennapod/core/util/ShownotesProvider.java similarity index 91% rename from src/de/danoeh/antennapod/util/ShownotesProvider.java rename to core/src/main/java/de/danoeh/antennapod/core/util/ShownotesProvider.java index 8345ca34d..7e7c6c08b 100644 --- a/src/de/danoeh/antennapod/util/ShownotesProvider.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ShownotesProvider.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import java.util.concurrent.Callable; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java new file mode 100644 index 000000000..dea380937 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java @@ -0,0 +1,67 @@ +package de.danoeh.antennapod.core.util; + +import android.app.Activity; +import android.content.Context; +import android.os.Build; +import android.os.StatFs; +import android.util.Log; + +import java.io.File; + +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.preferences.UserPreferences; + +/** + * Utility functions for handling storage errors + */ +public class StorageUtils { + private static final String TAG = "StorageUtils"; + + public static boolean storageAvailable(Context context) { + File dir = UserPreferences.getDataFolder(context, null); + if (dir != null) { + return dir.exists() && dir.canRead() && dir.canWrite(); + } else { + if (BuildConfig.DEBUG) + Log.d(TAG, "Storage not available: data folder is null"); + return false; + } + } + + /** + * Checks if external storage is available. If external storage isn't + * available, the current activity is finsished an an error activity is + * launched. + * + * @param activity the activity which would be finished if no storage is + * available + * @return true if external storage is available + */ + public static boolean checkStorageAvailability(Activity activity) { + boolean storageAvailable = storageAvailable(activity); + if (!storageAvailable) { + activity.finish(); + activity.startActivity(ClientConfig.applicationCallbacks.getStorageErrorActivity(activity)); + } + return storageAvailable; + } + + /** + * Get the number of free bytes that are available on the external storage. + */ + public static long getFreeSpaceAvailable() { + StatFs stat = new StatFs(UserPreferences.getDataFolder( + ClientConfig.applicationCallbacks.getApplicationInstance(), null).getAbsolutePath()); + long availableBlocks; + long blockSize; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { + availableBlocks = stat.getAvailableBlocksLong(); + blockSize = stat.getBlockSizeLong(); + } else { + availableBlocks = stat.getAvailableBlocks(); + blockSize = stat.getBlockSize(); + } + return availableBlocks * blockSize; + } +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java new file mode 100644 index 000000000..f67367643 --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java @@ -0,0 +1,23 @@ +package de.danoeh.antennapod.core.util; + +import android.util.Log; + +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.preferences.UserPreferences; + +public class ThemeUtils { + private static final String TAG = "ThemeUtils"; + + public static int getSelectionBackgroundColor() { + int theme = UserPreferences.getTheme(); + if (theme == R.style.Theme_AntennaPod_Dark) { + return R.color.selection_background_color_dark; + } else if (theme == R.style.Theme_AntennaPod_Light) { + return R.color.selection_background_color_light; + } else { + Log.e(TAG, + "getSelectionBackgroundColor could not match the current theme to any color!"); + return R.color.selection_background_color_light; + } + } +} diff --git a/src/de/danoeh/antennapod/util/URIUtil.java b/core/src/main/java/de/danoeh/antennapod/core/util/URIUtil.java similarity index 91% rename from src/de/danoeh/antennapod/util/URIUtil.java rename to core/src/main/java/de/danoeh/antennapod/core/util/URIUtil.java index 5af40d591..092c06b4a 100644 --- a/src/de/danoeh/antennapod/util/URIUtil.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/URIUtil.java @@ -1,7 +1,7 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import java.net.MalformedURLException; import java.net.URI; diff --git a/src/de/danoeh/antennapod/util/URLChecker.java b/core/src/main/java/de/danoeh/antennapod/core/util/URLChecker.java similarity index 95% rename from src/de/danoeh/antennapod/util/URLChecker.java rename to core/src/main/java/de/danoeh/antennapod/core/util/URLChecker.java index 2352adddf..4bd18c8bc 100644 --- a/src/de/danoeh/antennapod/util/URLChecker.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/URLChecker.java @@ -1,10 +1,10 @@ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import android.util.Log; import org.apache.commons.lang3.StringUtils; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; /** * Provides methods for checking and editing a URL. diff --git a/src/de/danoeh/antennapod/util/UndoBarController.java b/core/src/main/java/de/danoeh/antennapod/core/util/UndoBarController.java similarity index 98% rename from src/de/danoeh/antennapod/util/UndoBarController.java rename to core/src/main/java/de/danoeh/antennapod/core/util/UndoBarController.java index 332cc22e0..5843c5f8f 100644 --- a/src/de/danoeh/antennapod/util/UndoBarController.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/UndoBarController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package de.danoeh.antennapod.util; +package de.danoeh.antennapod.core.util; import android.os.Bundle; import android.os.Handler; @@ -26,7 +26,7 @@ import com.nineoldandroids.animation.Animator; import com.nineoldandroids.animation.AnimatorListenerAdapter; import com.nineoldandroids.view.ViewHelper; import com.nineoldandroids.view.ViewPropertyAnimator; -import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.R; import static com.nineoldandroids.view.ViewPropertyAnimator.animate; diff --git a/src/de/danoeh/antennapod/util/comparator/ChapterStartTimeComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/ChapterStartTimeComparator.java similarity index 76% rename from src/de/danoeh/antennapod/util/comparator/ChapterStartTimeComparator.java rename to core/src/main/java/de/danoeh/antennapod/core/util/comparator/ChapterStartTimeComparator.java index bfc2fd057..5274ffc9e 100644 --- a/src/de/danoeh/antennapod/util/comparator/ChapterStartTimeComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/ChapterStartTimeComparator.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util.comparator; +package de.danoeh.antennapod.core.util.comparator; -import de.danoeh.antennapod.feed.Chapter; +import de.danoeh.antennapod.core.feed.Chapter; import java.util.Comparator; diff --git a/src/de/danoeh/antennapod/util/comparator/DownloadStatusComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/DownloadStatusComparator.java similarity index 73% rename from src/de/danoeh/antennapod/util/comparator/DownloadStatusComparator.java rename to core/src/main/java/de/danoeh/antennapod/core/util/comparator/DownloadStatusComparator.java index 14b8f1194..ebdbfe2a5 100644 --- a/src/de/danoeh/antennapod/util/comparator/DownloadStatusComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/DownloadStatusComparator.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util.comparator; +package de.danoeh.antennapod.core.util.comparator; -import de.danoeh.antennapod.service.download.DownloadStatus; +import de.danoeh.antennapod.core.service.download.DownloadStatus; import java.util.Comparator; diff --git a/src/de/danoeh/antennapod/util/comparator/FeedItemPubdateComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/FeedItemPubdateComparator.java similarity index 81% rename from src/de/danoeh/antennapod/util/comparator/FeedItemPubdateComparator.java rename to core/src/main/java/de/danoeh/antennapod/core/util/comparator/FeedItemPubdateComparator.java index f92c23d05..a1f3ec699 100644 --- a/src/de/danoeh/antennapod/util/comparator/FeedItemPubdateComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/FeedItemPubdateComparator.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util.comparator; +package de.danoeh.antennapod.core.util.comparator; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedItem; import java.util.Comparator; diff --git a/src/de/danoeh/antennapod/util/comparator/PlaybackCompletionDateComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/PlaybackCompletionDateComparator.java similarity index 82% rename from src/de/danoeh/antennapod/util/comparator/PlaybackCompletionDateComparator.java rename to core/src/main/java/de/danoeh/antennapod/core/util/comparator/PlaybackCompletionDateComparator.java index 0147e0cdc..84d244660 100644 --- a/src/de/danoeh/antennapod/util/comparator/PlaybackCompletionDateComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/PlaybackCompletionDateComparator.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util.comparator; +package de.danoeh.antennapod.core.util.comparator; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedItem; import java.util.Comparator; diff --git a/src/de/danoeh/antennapod/util/comparator/SearchResultValueComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/SearchResultValueComparator.java similarity index 68% rename from src/de/danoeh/antennapod/util/comparator/SearchResultValueComparator.java rename to core/src/main/java/de/danoeh/antennapod/core/util/comparator/SearchResultValueComparator.java index 02b084a01..b16e0949d 100644 --- a/src/de/danoeh/antennapod/util/comparator/SearchResultValueComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/SearchResultValueComparator.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util.comparator; +package de.danoeh.antennapod.core.util.comparator; -import de.danoeh.antennapod.feed.SearchResult; +import de.danoeh.antennapod.core.feed.SearchResult; import java.util.Comparator; diff --git a/src/de/danoeh/antennapod/util/exception/MediaFileNotFoundException.java b/core/src/main/java/de/danoeh/antennapod/core/util/exception/MediaFileNotFoundException.java similarity index 79% rename from src/de/danoeh/antennapod/util/exception/MediaFileNotFoundException.java rename to core/src/main/java/de/danoeh/antennapod/core/util/exception/MediaFileNotFoundException.java index 4586cea87..287fe1100 100644 --- a/src/de/danoeh/antennapod/util/exception/MediaFileNotFoundException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/exception/MediaFileNotFoundException.java @@ -1,6 +1,6 @@ -package de.danoeh.antennapod.util.exception; +package de.danoeh.antennapod.core.util.exception; -import de.danoeh.antennapod.feed.FeedMedia; +import de.danoeh.antennapod.core.feed.FeedMedia; public class MediaFileNotFoundException extends Exception { private static final long serialVersionUID = 1L; diff --git a/src/de/danoeh/antennapod/util/flattr/FlattrServiceCreator.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrServiceCreator.java similarity index 87% rename from src/de/danoeh/antennapod/util/flattr/FlattrServiceCreator.java rename to core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrServiceCreator.java index eda83b7aa..e4818214e 100644 --- a/src/de/danoeh/antennapod/util/flattr/FlattrServiceCreator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrServiceCreator.java @@ -1,7 +1,7 @@ -package de.danoeh.antennapod.util.flattr; +package de.danoeh.antennapod.core.util.flattr; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.core.BuildConfig; import org.shredzone.flattr4j.FlattrFactory; import org.shredzone.flattr4j.FlattrService; import org.shredzone.flattr4j.oauth.AccessToken; diff --git a/src/de/danoeh/antennapod/util/flattr/FlattrStatus.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrStatus.java similarity index 97% rename from src/de/danoeh/antennapod/util/flattr/FlattrStatus.java rename to core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrStatus.java index a1d6d3bc4..d82171d1a 100644 --- a/src/de/danoeh/antennapod/util/flattr/FlattrStatus.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrStatus.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.flattr; +package de.danoeh.antennapod.core.util.flattr; import java.util.Calendar; diff --git a/src/de/danoeh/antennapod/util/flattr/FlattrThing.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrThing.java similarity index 74% rename from src/de/danoeh/antennapod/util/flattr/FlattrThing.java rename to core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrThing.java index f17ef1d83..515028ab6 100644 --- a/src/de/danoeh/antennapod/util/flattr/FlattrThing.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrThing.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.flattr; +package de.danoeh.antennapod.core.util.flattr; public interface FlattrThing { public String getTitle(); diff --git a/src/de/danoeh/antennapod/util/flattr/FlattrUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java similarity index 89% rename from src/de/danoeh/antennapod/util/flattr/FlattrUtils.java rename to core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java index 96d3bbedd..90caad946 100644 --- a/src/de/danoeh/antennapod/util/flattr/FlattrUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.flattr; +package de.danoeh.antennapod.core.util.flattr; import android.app.AlertDialog; import android.content.Context; @@ -26,12 +26,11 @@ import java.util.EnumSet; import java.util.List; import java.util.TimeZone; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.FlattrAuthActivity; -import de.danoeh.antennapod.asynctask.FlattrTokenFetcher; -import de.danoeh.antennapod.storage.DBWriter; +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; +import de.danoeh.antennapod.core.storage.DBWriter; /** * Utility methods for doing something with flattr. @@ -53,8 +52,8 @@ public class FlattrUtils { private static volatile AccessToken cachedToken; private static AndroidAuthenticator createAuthenticator() { - return new AndroidAuthenticator(HOST_NAME, BuildConfig.FLATTR_APP_KEY, - BuildConfig.FLATTR_APP_SECRET); + return new AndroidAuthenticator(HOST_NAME, ClientConfig.flattrCallbacks.getFlattrAppKey(), + ClientConfig.flattrCallbacks.getFlattrAppSecret()); } public static void startAuthProcess(Context context) throws FlattrException { @@ -69,7 +68,7 @@ public class FlattrUtils { if (BuildConfig.DEBUG) Log.d(TAG, "Retrieving access token"); String token = PreferenceManager.getDefaultSharedPreferences( - PodcastApp.getInstance()) + ClientConfig.applicationCallbacks.getApplicationInstance()) .getString(PREF_ACCESS_TOKEN, null); if (token != null) { if (BuildConfig.DEBUG) @@ -89,8 +88,8 @@ public class FlattrUtils { * Returns true if FLATTR_APP_KEY and FLATTR_APP_SECRET in BuildConfig are not null and not empty */ public static boolean hasAPICredentials() { - return StringUtils.isNotEmpty(BuildConfig.FLATTR_APP_KEY) - && StringUtils.isNotEmpty(BuildConfig.FLATTR_APP_SECRET); + return StringUtils.isNotEmpty(ClientConfig.flattrCallbacks.getFlattrAppKey()) + && StringUtils.isNotEmpty(ClientConfig.flattrCallbacks.getFlattrAppSecret()); } public static boolean hasToken() { @@ -101,7 +100,7 @@ public class FlattrUtils { if (BuildConfig.DEBUG) Log.d(TAG, "Storing token"); SharedPreferences.Editor editor = PreferenceManager - .getDefaultSharedPreferences(PodcastApp.getInstance()).edit(); + .getDefaultSharedPreferences(ClientConfig.applicationCallbacks.getApplicationInstance()).edit(); if (token != null) { editor.putString(PREF_ACCESS_TOKEN, token.getToken()); } else { @@ -220,7 +219,7 @@ public class FlattrUtils { * Opens a dialog that ask the user to either connect the app with flattr or to be redirected to * the thing's website. * If no API credentials are available, the user will immediately be redirected to the thing's website. - * */ + */ public static void showNoTokenDialogOrRedirect(final Context context, final String url) { if (hasAPICredentials()) { AlertDialog.Builder builder = new AlertDialog.Builder(context); @@ -231,8 +230,8 @@ public class FlattrUtils { @Override public void onClick(DialogInterface dialog, int which) { - context.startActivity(new Intent(context, - FlattrAuthActivity.class)); + context.startActivity( + ClientConfig.flattrCallbacks.getFlattrAuthenticationActivityIntent(context)); } } @@ -267,8 +266,8 @@ public class FlattrUtils { @Override public void onClick(DialogInterface dialog, int which) { - context.startActivity(new Intent(context, - FlattrAuthActivity.class)); + context.startActivity( + ClientConfig.flattrCallbacks.getFlattrAuthenticationActivityIntent(context)); } } diff --git a/src/de/danoeh/antennapod/util/flattr/SimpleFlattrThing.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/SimpleFlattrThing.java similarity index 92% rename from src/de/danoeh/antennapod/util/flattr/SimpleFlattrThing.java rename to core/src/main/java/de/danoeh/antennapod/core/util/flattr/SimpleFlattrThing.java index 296610871..2c178496e 100644 --- a/src/de/danoeh/antennapod/util/flattr/SimpleFlattrThing.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/SimpleFlattrThing.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.flattr; +package de.danoeh.antennapod.core.util.flattr; /* SimpleFlattrThing is a trivial implementation of the FlattrThing interface */ public class SimpleFlattrThing implements FlattrThing { diff --git a/src/de/danoeh/antennapod/util/gui/FeedItemUndoToken.java b/core/src/main/java/de/danoeh/antennapod/core/util/gui/FeedItemUndoToken.java similarity index 93% rename from src/de/danoeh/antennapod/util/gui/FeedItemUndoToken.java rename to core/src/main/java/de/danoeh/antennapod/core/util/gui/FeedItemUndoToken.java index b920559db..17581d3e9 100644 --- a/src/de/danoeh/antennapod/util/gui/FeedItemUndoToken.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/gui/FeedItemUndoToken.java @@ -1,8 +1,8 @@ -package de.danoeh.antennapod.util.gui; +package de.danoeh.antennapod.core.util.gui; import android.os.Parcel; import android.os.Parcelable; -import de.danoeh.antennapod.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedItem; /** * Used by an UndoBarController for saving a removed FeedItem diff --git a/src/de/danoeh/antennapod/util/id3reader/ChapterReader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java similarity index 91% rename from src/de/danoeh/antennapod/util/id3reader/ChapterReader.java rename to core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java index 257635129..9f3c4c6d5 100644 --- a/src/de/danoeh/antennapod/util/id3reader/ChapterReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java @@ -1,11 +1,11 @@ -package de.danoeh.antennapod.util.id3reader; +package de.danoeh.antennapod.core.util.id3reader; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.ID3Chapter; -import de.danoeh.antennapod.util.id3reader.model.FrameHeader; -import de.danoeh.antennapod.util.id3reader.model.TagHeader; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.ID3Chapter; +import de.danoeh.antennapod.core.util.id3reader.model.FrameHeader; +import de.danoeh.antennapod.core.util.id3reader.model.TagHeader; import java.io.IOException; import java.io.InputStream; diff --git a/src/de/danoeh/antennapod/util/id3reader/ID3Reader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3Reader.java similarity index 97% rename from src/de/danoeh/antennapod/util/id3reader/ID3Reader.java rename to core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3Reader.java index 252d64107..a238c11e9 100644 --- a/src/de/danoeh/antennapod/util/id3reader/ID3Reader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3Reader.java @@ -1,7 +1,7 @@ -package de.danoeh.antennapod.util.id3reader; +package de.danoeh.antennapod.core.util.id3reader; -import de.danoeh.antennapod.util.id3reader.model.FrameHeader; -import de.danoeh.antennapod.util.id3reader.model.TagHeader; +import de.danoeh.antennapod.core.util.id3reader.model.FrameHeader; +import de.danoeh.antennapod.core.util.id3reader.model.TagHeader; import org.apache.commons.io.IOUtils; import java.io.IOException; diff --git a/src/de/danoeh/antennapod/util/id3reader/ID3ReaderException.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3ReaderException.java similarity index 85% rename from src/de/danoeh/antennapod/util/id3reader/ID3ReaderException.java rename to core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3ReaderException.java index c458540ee..0c746d7e5 100644 --- a/src/de/danoeh/antennapod/util/id3reader/ID3ReaderException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3ReaderException.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.id3reader; +package de.danoeh.antennapod.core.util.id3reader; public class ID3ReaderException extends Exception { diff --git a/src/de/danoeh/antennapod/util/id3reader/model/FrameHeader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/FrameHeader.java similarity index 86% rename from src/de/danoeh/antennapod/util/id3reader/model/FrameHeader.java rename to core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/FrameHeader.java index df73393a5..89eab1398 100644 --- a/src/de/danoeh/antennapod/util/id3reader/model/FrameHeader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/FrameHeader.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.id3reader.model; +package de.danoeh.antennapod.core.util.id3reader.model; public class FrameHeader extends Header { diff --git a/src/de/danoeh/antennapod/util/id3reader/model/Header.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/Header.java similarity index 86% rename from src/de/danoeh/antennapod/util/id3reader/model/Header.java rename to core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/Header.java index 22d5b6376..346e2893f 100644 --- a/src/de/danoeh/antennapod/util/id3reader/model/Header.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/Header.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.id3reader.model; +package de.danoeh.antennapod.core.util.id3reader.model; public abstract class Header { diff --git a/src/de/danoeh/antennapod/util/id3reader/model/TagHeader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/TagHeader.java similarity index 88% rename from src/de/danoeh/antennapod/util/id3reader/model/TagHeader.java rename to core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/TagHeader.java index ec99ef14e..0a6b8357f 100644 --- a/src/de/danoeh/antennapod/util/id3reader/model/TagHeader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/TagHeader.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.id3reader.model; +package de.danoeh.antennapod.core.util.id3reader.model; public class TagHeader extends Header { diff --git a/src/de/danoeh/antennapod/util/playback/AudioPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/AudioPlayer.java similarity index 95% rename from src/de/danoeh/antennapod/util/playback/AudioPlayer.java rename to core/src/main/java/de/danoeh/antennapod/core/util/playback/AudioPlayer.java index bd49b0d18..aafcea307 100644 --- a/src/de/danoeh/antennapod/util/playback/AudioPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/AudioPlayer.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.playback; +package de.danoeh.antennapod.core.util.playback; import android.content.Context; import android.util.Log; diff --git a/src/de/danoeh/antennapod/util/playback/ExternalMedia.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/ExternalMedia.java similarity index 95% rename from src/de/danoeh/antennapod/util/playback/ExternalMedia.java rename to core/src/main/java/de/danoeh/antennapod/core/util/playback/ExternalMedia.java index 3f6e6ae0a..49769f4f0 100644 --- a/src/de/danoeh/antennapod/util/playback/ExternalMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/ExternalMedia.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.playback; +package de.danoeh.antennapod.core.util.playback; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; @@ -6,12 +6,10 @@ import android.media.MediaMetadataRetriever; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.MediaType; -import de.danoeh.antennapod.util.ChapterUtils; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.core.util.ChapterUtils; -import java.io.File; -import java.io.InputStream; import java.util.List; import java.util.concurrent.Callable; diff --git a/src/de/danoeh/antennapod/util/playback/IPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/IPlayer.java similarity index 96% rename from src/de/danoeh/antennapod/util/playback/IPlayer.java rename to core/src/main/java/de/danoeh/antennapod/core/util/playback/IPlayer.java index 2d4551b13..147c7848d 100644 --- a/src/de/danoeh/antennapod/util/playback/IPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/IPlayer.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.playback; +package de.danoeh.antennapod.core.util.playback; import android.content.Context; import android.view.SurfaceHolder; diff --git a/src/de/danoeh/antennapod/util/playback/MediaPlayerError.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/MediaPlayerError.java similarity index 85% rename from src/de/danoeh/antennapod/util/playback/MediaPlayerError.java rename to core/src/main/java/de/danoeh/antennapod/core/util/playback/MediaPlayerError.java index 23ead581f..0650225f0 100644 --- a/src/de/danoeh/antennapod/util/playback/MediaPlayerError.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/MediaPlayerError.java @@ -1,8 +1,8 @@ -package de.danoeh.antennapod.util.playback; +package de.danoeh.antennapod.core.util.playback; import android.content.Context; import android.media.MediaPlayer; -import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.R; /** Utility class for MediaPlayer errors. */ public class MediaPlayerError { diff --git a/src/de/danoeh/antennapod/util/playback/Playable.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java similarity index 94% rename from src/de/danoeh/antennapod/util/playback/Playable.java rename to core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java index 004ae56bb..7ebd580f7 100644 --- a/src/de/danoeh/antennapod/util/playback/Playable.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.playback; +package de.danoeh.antennapod.core.util.playback; import android.content.Context; import android.content.SharedPreferences; @@ -7,12 +7,12 @@ import android.util.Log; import java.util.List; -import de.danoeh.antennapod.asynctask.PicassoImageResource; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.feed.MediaType; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.ShownotesProvider; +import de.danoeh.antennapod.core.asynctask.PicassoImageResource; +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.storage.DBReader; +import de.danoeh.antennapod.core.util.ShownotesProvider; /** * Interface for objects that can be played by the PlaybackService. diff --git a/src/de/danoeh/antennapod/util/playback/PlaybackController.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java similarity index 96% rename from src/de/danoeh/antennapod/util/playback/PlaybackController.java rename to core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java index 64dbf4868..6b843e040 100644 --- a/src/de/danoeh/antennapod/util/playback/PlaybackController.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.playback; +package de.danoeh.antennapod.core.util.playback; import android.app.Activity; import android.content.*; @@ -19,19 +19,19 @@ import android.widget.TextView; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.FeedMedia; -import de.danoeh.antennapod.feed.MediaType; -import de.danoeh.antennapod.preferences.PlaybackPreferences; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.playback.PlaybackService; -import de.danoeh.antennapod.service.playback.PlaybackServiceMediaPlayer; -import de.danoeh.antennapod.service.playback.PlayerStatus; -import de.danoeh.antennapod.storage.DBTasks; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.playback.Playable.PlayableUtils; +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; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.playback.Playable.PlayableUtils; import java.util.concurrent.*; @@ -394,6 +394,12 @@ public abstract class PlaybackController { public abstract void onPlaybackEnd(); + public void repeatHandleStatus() { + if (status != null && playbackService != null) { + handleStatus(); + } + } + /** * Is called whenever the PlaybackService changes it's status. This method * should be used to update the GUI or start/cancel background threads. diff --git a/src/de/danoeh/antennapod/util/playback/Timeline.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java similarity index 96% rename from src/de/danoeh/antennapod/util/playback/Timeline.java rename to core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java index ceed68183..443ff0ad1 100644 --- a/src/de/danoeh/antennapod/util/playback/Timeline.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.playback; +package de.danoeh.antennapod.core.util.playback; import android.content.Context; import android.content.res.TypedArray; @@ -14,9 +14,9 @@ import org.jsoup.select.Elements; import java.util.regex.Matcher; import java.util.regex.Pattern; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.util.Converter; -import de.danoeh.antennapod.util.ShownotesProvider; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.ShownotesProvider; /** * Connects chapter information and shownotes of a shownotesProvider, for example by making it possible to use the diff --git a/src/de/danoeh/antennapod/util/playback/VideoPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/VideoPlayer.java similarity index 97% rename from src/de/danoeh/antennapod/util/playback/VideoPlayer.java rename to core/src/main/java/de/danoeh/antennapod/core/util/playback/VideoPlayer.java index ea9c692ab..dc5270d8f 100644 --- a/src/de/danoeh/antennapod/util/playback/VideoPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/VideoPlayer.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.playback; +package de.danoeh.antennapod.core.util.playback; import android.media.MediaPlayer; import android.util.Log; diff --git a/src/de/danoeh/antennapod/util/syndication/FeedDiscoverer.java b/core/src/main/java/de/danoeh/antennapod/core/util/syndication/FeedDiscoverer.java similarity index 98% rename from src/de/danoeh/antennapod/util/syndication/FeedDiscoverer.java rename to core/src/main/java/de/danoeh/antennapod/core/util/syndication/FeedDiscoverer.java index ac38ec876..9588265b8 100644 --- a/src/de/danoeh/antennapod/util/syndication/FeedDiscoverer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/syndication/FeedDiscoverer.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.syndication; +package de.danoeh.antennapod.core.util.syndication; import android.net.Uri; import org.apache.commons.lang3.StringUtils; diff --git a/src/de/danoeh/antennapod/util/vorbiscommentreader/OggInputStream.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/OggInputStream.java similarity index 96% rename from src/de/danoeh/antennapod/util/vorbiscommentreader/OggInputStream.java rename to core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/OggInputStream.java index 767034ed2..4799d3881 100644 --- a/src/de/danoeh/antennapod/util/vorbiscommentreader/OggInputStream.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/OggInputStream.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.vorbiscommentreader; +package de.danoeh.antennapod.core.util.vorbiscommentreader; import org.apache.commons.io.IOUtils; diff --git a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentChapterReader.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReader.java similarity index 92% rename from src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentChapterReader.java rename to core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReader.java index b2f149ddd..c4961a3ab 100644 --- a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentChapterReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReader.java @@ -1,9 +1,9 @@ -package de.danoeh.antennapod.util.vorbiscommentreader; +package de.danoeh.antennapod.core.util.vorbiscommentreader; import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.VorbisCommentChapter; +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.core.feed.VorbisCommentChapter; import java.util.ArrayList; import java.util.List; diff --git a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentHeader.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentHeader.java similarity index 90% rename from src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentHeader.java rename to core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentHeader.java index 8c47393c9..5f9dd0faf 100644 --- a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentHeader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentHeader.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.vorbiscommentreader; +package de.danoeh.antennapod.core.util.vorbiscommentreader; public class VorbisCommentHeader { private String vendorString; private long userCommentLength; diff --git a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReader.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReader.java similarity index 98% rename from src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReader.java rename to core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReader.java index 718a4f30f..9639b9c42 100644 --- a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReader.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.vorbiscommentreader; +package de.danoeh.antennapod.core.util.vorbiscommentreader; import org.apache.commons.io.EndianUtils; import org.apache.commons.io.IOUtils; diff --git a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReaderException.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReaderException.java similarity index 89% rename from src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReaderException.java rename to core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReaderException.java index 574373241..89ab20db0 100644 --- a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReaderException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReaderException.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.util.vorbiscommentreader; +package de.danoeh.antennapod.core.util.vorbiscommentreader; public class VorbisCommentReaderException extends Exception { public VorbisCommentReaderException() { diff --git a/res/drawable-hdpi-v11/ic_stat_antenna.png b/core/src/main/res/drawable-hdpi-v11/ic_stat_antenna_default.png similarity index 100% rename from res/drawable-hdpi-v11/ic_stat_antenna.png rename to core/src/main/res/drawable-hdpi-v11/ic_stat_antenna_default.png diff --git a/res/drawable-hdpi-v11/ic_stat_authentication.png b/core/src/main/res/drawable-hdpi-v11/ic_stat_authentication.png similarity index 100% rename from res/drawable-hdpi-v11/ic_stat_authentication.png rename to core/src/main/res/drawable-hdpi-v11/ic_stat_authentication.png diff --git a/res/drawable-hdpi-v11/stat_notify_sync.png b/core/src/main/res/drawable-hdpi-v11/stat_notify_sync.png similarity index 100% rename from res/drawable-hdpi-v11/stat_notify_sync.png rename to core/src/main/res/drawable-hdpi-v11/stat_notify_sync.png diff --git a/res/drawable-hdpi-v11/stat_notify_sync_error.png b/core/src/main/res/drawable-hdpi-v11/stat_notify_sync_error.png similarity index 100% rename from res/drawable-hdpi-v11/stat_notify_sync_error.png rename to core/src/main/res/drawable-hdpi-v11/stat_notify_sync_error.png diff --git a/res/drawable-hdpi/action_about.png b/core/src/main/res/drawable-hdpi/action_about.png similarity index 100% rename from res/drawable-hdpi/action_about.png rename to core/src/main/res/drawable-hdpi/action_about.png diff --git a/res/drawable-hdpi/action_about_dark.png b/core/src/main/res/drawable-hdpi/action_about_dark.png similarity index 100% rename from res/drawable-hdpi/action_about_dark.png rename to core/src/main/res/drawable-hdpi/action_about_dark.png diff --git a/res/drawable-hdpi/action_search.png b/core/src/main/res/drawable-hdpi/action_search.png similarity index 100% rename from res/drawable-hdpi/action_search.png rename to core/src/main/res/drawable-hdpi/action_search.png diff --git a/res/drawable-hdpi/action_search_dark.png b/core/src/main/res/drawable-hdpi/action_search_dark.png similarity index 100% rename from res/drawable-hdpi/action_search_dark.png rename to core/src/main/res/drawable-hdpi/action_search_dark.png diff --git a/res/drawable-hdpi/action_settings.png b/core/src/main/res/drawable-hdpi/action_settings.png similarity index 100% rename from res/drawable-hdpi/action_settings.png rename to core/src/main/res/drawable-hdpi/action_settings.png diff --git a/res/drawable-hdpi/action_settings_dark.png b/core/src/main/res/drawable-hdpi/action_settings_dark.png similarity index 100% rename from res/drawable-hdpi/action_settings_dark.png rename to core/src/main/res/drawable-hdpi/action_settings_dark.png diff --git a/res/drawable-hdpi/action_stream.png b/core/src/main/res/drawable-hdpi/action_stream.png similarity index 100% rename from res/drawable-hdpi/action_stream.png rename to core/src/main/res/drawable-hdpi/action_stream.png diff --git a/res/drawable-hdpi/action_stream_dark.png b/core/src/main/res/drawable-hdpi/action_stream_dark.png similarity index 100% rename from res/drawable-hdpi/action_stream_dark.png rename to core/src/main/res/drawable-hdpi/action_stream_dark.png diff --git a/res/drawable-hdpi/av_download.png b/core/src/main/res/drawable-hdpi/av_download.png similarity index 100% rename from res/drawable-hdpi/av_download.png rename to core/src/main/res/drawable-hdpi/av_download.png diff --git a/res/drawable-hdpi/av_download_dark.png b/core/src/main/res/drawable-hdpi/av_download_dark.png similarity index 100% rename from res/drawable-hdpi/av_download_dark.png rename to core/src/main/res/drawable-hdpi/av_download_dark.png diff --git a/res/drawable-hdpi/av_fast_forward.png b/core/src/main/res/drawable-hdpi/av_fast_forward.png similarity index 100% rename from res/drawable-hdpi/av_fast_forward.png rename to core/src/main/res/drawable-hdpi/av_fast_forward.png diff --git a/res/drawable-hdpi/av_fast_forward_dark.png b/core/src/main/res/drawable-hdpi/av_fast_forward_dark.png similarity index 100% rename from res/drawable-hdpi/av_fast_forward_dark.png rename to core/src/main/res/drawable-hdpi/av_fast_forward_dark.png diff --git a/res/drawable-hdpi/av_pause.png b/core/src/main/res/drawable-hdpi/av_pause.png similarity index 100% rename from res/drawable-hdpi/av_pause.png rename to core/src/main/res/drawable-hdpi/av_pause.png diff --git a/res/drawable-hdpi/av_pause_dark.png b/core/src/main/res/drawable-hdpi/av_pause_dark.png similarity index 100% rename from res/drawable-hdpi/av_pause_dark.png rename to core/src/main/res/drawable-hdpi/av_pause_dark.png diff --git a/res/drawable-hdpi/av_play.png b/core/src/main/res/drawable-hdpi/av_play.png similarity index 100% rename from res/drawable-hdpi/av_play.png rename to core/src/main/res/drawable-hdpi/av_play.png diff --git a/res/drawable-hdpi/av_play_dark.png b/core/src/main/res/drawable-hdpi/av_play_dark.png similarity index 100% rename from res/drawable-hdpi/av_play_dark.png rename to core/src/main/res/drawable-hdpi/av_play_dark.png diff --git a/res/drawable-hdpi/av_rewind.png b/core/src/main/res/drawable-hdpi/av_rewind.png similarity index 100% rename from res/drawable-hdpi/av_rewind.png rename to core/src/main/res/drawable-hdpi/av_rewind.png diff --git a/res/drawable-hdpi/av_rewind_dark.png b/core/src/main/res/drawable-hdpi/av_rewind_dark.png similarity index 100% rename from res/drawable-hdpi/av_rewind_dark.png rename to core/src/main/res/drawable-hdpi/av_rewind_dark.png diff --git a/res/drawable-hdpi/content_discard.png b/core/src/main/res/drawable-hdpi/content_discard.png similarity index 100% rename from res/drawable-hdpi/content_discard.png rename to core/src/main/res/drawable-hdpi/content_discard.png diff --git a/res/drawable-hdpi/content_discard_dark.png b/core/src/main/res/drawable-hdpi/content_discard_dark.png similarity index 100% rename from res/drawable-hdpi/content_discard_dark.png rename to core/src/main/res/drawable-hdpi/content_discard_dark.png diff --git a/res/drawable-hdpi/content_new.png b/core/src/main/res/drawable-hdpi/content_new.png similarity index 100% rename from res/drawable-hdpi/content_new.png rename to core/src/main/res/drawable-hdpi/content_new.png diff --git a/res/drawable-hdpi/content_new_dark.png b/core/src/main/res/drawable-hdpi/content_new_dark.png similarity index 100% rename from res/drawable-hdpi/content_new_dark.png rename to core/src/main/res/drawable-hdpi/content_new_dark.png diff --git a/res/drawable-hdpi/default_cover.png b/core/src/main/res/drawable-hdpi/default_cover.png similarity index 100% rename from res/drawable-hdpi/default_cover.png rename to core/src/main/res/drawable-hdpi/default_cover.png diff --git a/res/drawable-hdpi/default_cover_dark.png b/core/src/main/res/drawable-hdpi/default_cover_dark.png similarity index 100% rename from res/drawable-hdpi/default_cover_dark.png rename to core/src/main/res/drawable-hdpi/default_cover_dark.png diff --git a/res/drawable-hdpi/device_access_time.png b/core/src/main/res/drawable-hdpi/device_access_time.png similarity index 100% rename from res/drawable-hdpi/device_access_time.png rename to core/src/main/res/drawable-hdpi/device_access_time.png diff --git a/res/drawable-hdpi/device_access_time_dark.png b/core/src/main/res/drawable-hdpi/device_access_time_dark.png similarity index 100% rename from res/drawable-hdpi/device_access_time_dark.png rename to core/src/main/res/drawable-hdpi/device_access_time_dark.png diff --git a/res/drawable-hdpi/ic_action_overflow.png b/core/src/main/res/drawable-hdpi/ic_action_overflow.png similarity index 100% rename from res/drawable-hdpi/ic_action_overflow.png rename to core/src/main/res/drawable-hdpi/ic_action_overflow.png diff --git a/res/drawable-hdpi/ic_action_overflow_dark.png b/core/src/main/res/drawable-hdpi/ic_action_overflow_dark.png similarity index 100% rename from res/drawable-hdpi/ic_action_overflow_dark.png rename to core/src/main/res/drawable-hdpi/ic_action_overflow_dark.png diff --git a/res/drawable-hdpi/ic_action_pause_over_video.png b/core/src/main/res/drawable-hdpi/ic_action_pause_over_video.png similarity index 100% rename from res/drawable-hdpi/ic_action_pause_over_video.png rename to core/src/main/res/drawable-hdpi/ic_action_pause_over_video.png diff --git a/res/drawable-hdpi/ic_action_play_over_video.png b/core/src/main/res/drawable-hdpi/ic_action_play_over_video.png similarity index 100% rename from res/drawable-hdpi/ic_action_play_over_video.png rename to core/src/main/res/drawable-hdpi/ic_action_play_over_video.png diff --git a/res/drawable-hdpi/ic_drag_handle.png b/core/src/main/res/drawable-hdpi/ic_drag_handle.png similarity index 100% rename from res/drawable-hdpi/ic_drag_handle.png rename to core/src/main/res/drawable-hdpi/ic_drag_handle.png diff --git a/res/drawable-hdpi/ic_drag_handle_dark.png b/core/src/main/res/drawable-hdpi/ic_drag_handle_dark.png similarity index 100% rename from res/drawable-hdpi/ic_drag_handle_dark.png rename to core/src/main/res/drawable-hdpi/ic_drag_handle_dark.png diff --git a/res/drawable-hdpi/ic_drawer.png b/core/src/main/res/drawable-hdpi/ic_drawer.png similarity index 100% rename from res/drawable-hdpi/ic_drawer.png rename to core/src/main/res/drawable-hdpi/ic_drawer.png diff --git a/res/drawable-hdpi/ic_drawer_dark.png b/core/src/main/res/drawable-hdpi/ic_drawer_dark.png similarity index 100% rename from res/drawable-hdpi/ic_drawer_dark.png rename to core/src/main/res/drawable-hdpi/ic_drawer_dark.png diff --git a/res/drawable-hdpi/ic_launcher.png b/core/src/main/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from res/drawable-hdpi/ic_launcher.png rename to core/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/res/drawable-hdpi/ic_new.png b/core/src/main/res/drawable-hdpi/ic_new.png similarity index 100% rename from res/drawable-hdpi/ic_new.png rename to core/src/main/res/drawable-hdpi/ic_new.png diff --git a/res/drawable-hdpi/ic_new_dark.png b/core/src/main/res/drawable-hdpi/ic_new_dark.png similarity index 100% rename from res/drawable-hdpi/ic_new_dark.png rename to core/src/main/res/drawable-hdpi/ic_new_dark.png diff --git a/res/drawable-hdpi/ic_stat_antenna.png b/core/src/main/res/drawable-hdpi/ic_stat_antenna_default.png similarity index 100% rename from res/drawable-hdpi/ic_stat_antenna.png rename to core/src/main/res/drawable-hdpi/ic_stat_antenna_default.png diff --git a/res/drawable-hdpi/ic_stat_authentication.png b/core/src/main/res/drawable-hdpi/ic_stat_authentication.png similarity index 100% rename from res/drawable-hdpi/ic_stat_authentication.png rename to core/src/main/res/drawable-hdpi/ic_stat_authentication.png diff --git a/res/drawable-hdpi/location_web_site.png b/core/src/main/res/drawable-hdpi/location_web_site.png similarity index 100% rename from res/drawable-hdpi/location_web_site.png rename to core/src/main/res/drawable-hdpi/location_web_site.png diff --git a/res/drawable-hdpi/location_web_site_dark.png b/core/src/main/res/drawable-hdpi/location_web_site_dark.png similarity index 100% rename from res/drawable-hdpi/location_web_site_dark.png rename to core/src/main/res/drawable-hdpi/location_web_site_dark.png diff --git a/res/drawable-hdpi/navigation_accept.png b/core/src/main/res/drawable-hdpi/navigation_accept.png similarity index 100% rename from res/drawable-hdpi/navigation_accept.png rename to core/src/main/res/drawable-hdpi/navigation_accept.png diff --git a/res/drawable-hdpi/navigation_accept_dark.png b/core/src/main/res/drawable-hdpi/navigation_accept_dark.png similarity index 100% rename from res/drawable-hdpi/navigation_accept_dark.png rename to core/src/main/res/drawable-hdpi/navigation_accept_dark.png diff --git a/res/drawable-hdpi/navigation_cancel.png b/core/src/main/res/drawable-hdpi/navigation_cancel.png similarity index 100% rename from res/drawable-hdpi/navigation_cancel.png rename to core/src/main/res/drawable-hdpi/navigation_cancel.png diff --git a/res/drawable-hdpi/navigation_cancel_dark.png b/core/src/main/res/drawable-hdpi/navigation_cancel_dark.png similarity index 100% rename from res/drawable-hdpi/navigation_cancel_dark.png rename to core/src/main/res/drawable-hdpi/navigation_cancel_dark.png diff --git a/res/drawable-hdpi/navigation_chapters.png b/core/src/main/res/drawable-hdpi/navigation_chapters.png similarity index 100% rename from res/drawable-hdpi/navigation_chapters.png rename to core/src/main/res/drawable-hdpi/navigation_chapters.png diff --git a/res/drawable-hdpi/navigation_chapters_dark.png b/core/src/main/res/drawable-hdpi/navigation_chapters_dark.png similarity index 100% rename from res/drawable-hdpi/navigation_chapters_dark.png rename to core/src/main/res/drawable-hdpi/navigation_chapters_dark.png diff --git a/res/drawable-hdpi/navigation_collapse.png b/core/src/main/res/drawable-hdpi/navigation_collapse.png similarity index 100% rename from res/drawable-hdpi/navigation_collapse.png rename to core/src/main/res/drawable-hdpi/navigation_collapse.png diff --git a/res/drawable-hdpi/navigation_collapse_dark.png b/core/src/main/res/drawable-hdpi/navigation_collapse_dark.png similarity index 100% rename from res/drawable-hdpi/navigation_collapse_dark.png rename to core/src/main/res/drawable-hdpi/navigation_collapse_dark.png diff --git a/res/drawable-hdpi/navigation_expand.png b/core/src/main/res/drawable-hdpi/navigation_expand.png similarity index 100% rename from res/drawable-hdpi/navigation_expand.png rename to core/src/main/res/drawable-hdpi/navigation_expand.png diff --git a/res/drawable-hdpi/navigation_expand_dark.png b/core/src/main/res/drawable-hdpi/navigation_expand_dark.png similarity index 100% rename from res/drawable-hdpi/navigation_expand_dark.png rename to core/src/main/res/drawable-hdpi/navigation_expand_dark.png diff --git a/res/drawable-hdpi/navigation_refresh.png b/core/src/main/res/drawable-hdpi/navigation_refresh.png similarity index 100% rename from res/drawable-hdpi/navigation_refresh.png rename to core/src/main/res/drawable-hdpi/navigation_refresh.png diff --git a/res/drawable-hdpi/navigation_refresh_dark.png b/core/src/main/res/drawable-hdpi/navigation_refresh_dark.png similarity index 100% rename from res/drawable-hdpi/navigation_refresh_dark.png rename to core/src/main/res/drawable-hdpi/navigation_refresh_dark.png diff --git a/res/drawable-hdpi/navigation_shownotes.png b/core/src/main/res/drawable-hdpi/navigation_shownotes.png similarity index 100% rename from res/drawable-hdpi/navigation_shownotes.png rename to core/src/main/res/drawable-hdpi/navigation_shownotes.png diff --git a/res/drawable-hdpi/navigation_shownotes_dark.png b/core/src/main/res/drawable-hdpi/navigation_shownotes_dark.png similarity index 100% rename from res/drawable-hdpi/navigation_shownotes_dark.png rename to core/src/main/res/drawable-hdpi/navigation_shownotes_dark.png diff --git a/res/drawable-hdpi/navigation_up.png b/core/src/main/res/drawable-hdpi/navigation_up.png similarity index 100% rename from res/drawable-hdpi/navigation_up.png rename to core/src/main/res/drawable-hdpi/navigation_up.png diff --git a/res/drawable-hdpi/navigation_up_dark.png b/core/src/main/res/drawable-hdpi/navigation_up_dark.png similarity index 100% rename from res/drawable-hdpi/navigation_up_dark.png rename to core/src/main/res/drawable-hdpi/navigation_up_dark.png diff --git a/res/drawable-hdpi/social_share.png b/core/src/main/res/drawable-hdpi/social_share.png similarity index 100% rename from res/drawable-hdpi/social_share.png rename to core/src/main/res/drawable-hdpi/social_share.png diff --git a/res/drawable-hdpi/social_share_dark.png b/core/src/main/res/drawable-hdpi/social_share_dark.png similarity index 100% rename from res/drawable-hdpi/social_share_dark.png rename to core/src/main/res/drawable-hdpi/social_share_dark.png diff --git a/res/drawable-hdpi/spinner_button.9.png b/core/src/main/res/drawable-hdpi/spinner_button.9.png similarity index 100% rename from res/drawable-hdpi/spinner_button.9.png rename to core/src/main/res/drawable-hdpi/spinner_button.9.png diff --git a/res/drawable-hdpi/spinner_button_dark.9.png b/core/src/main/res/drawable-hdpi/spinner_button_dark.9.png similarity index 100% rename from res/drawable-hdpi/spinner_button_dark.9.png rename to core/src/main/res/drawable-hdpi/spinner_button_dark.9.png diff --git a/res/drawable-hdpi/stat_notify_sync.png b/core/src/main/res/drawable-hdpi/stat_notify_sync.png similarity index 100% rename from res/drawable-hdpi/stat_notify_sync.png rename to core/src/main/res/drawable-hdpi/stat_notify_sync.png diff --git a/res/drawable-hdpi/stat_notify_sync_error.png b/core/src/main/res/drawable-hdpi/stat_notify_sync_error.png similarity index 100% rename from res/drawable-hdpi/stat_notify_sync_error.png rename to core/src/main/res/drawable-hdpi/stat_notify_sync_error.png diff --git a/res/drawable-hdpi/stat_playlist.png b/core/src/main/res/drawable-hdpi/stat_playlist.png similarity index 100% rename from res/drawable-hdpi/stat_playlist.png rename to core/src/main/res/drawable-hdpi/stat_playlist.png diff --git a/res/drawable-hdpi/stat_playlist_dark.png b/core/src/main/res/drawable-hdpi/stat_playlist_dark.png similarity index 100% rename from res/drawable-hdpi/stat_playlist_dark.png rename to core/src/main/res/drawable-hdpi/stat_playlist_dark.png diff --git a/res/drawable-hdpi/type_audio.png b/core/src/main/res/drawable-hdpi/type_audio.png similarity index 100% rename from res/drawable-hdpi/type_audio.png rename to core/src/main/res/drawable-hdpi/type_audio.png diff --git a/res/drawable-hdpi/type_audio_dark.png b/core/src/main/res/drawable-hdpi/type_audio_dark.png similarity index 100% rename from res/drawable-hdpi/type_audio_dark.png rename to core/src/main/res/drawable-hdpi/type_audio_dark.png diff --git a/res/drawable-hdpi/type_video.png b/core/src/main/res/drawable-hdpi/type_video.png similarity index 100% rename from res/drawable-hdpi/type_video.png rename to core/src/main/res/drawable-hdpi/type_video.png diff --git a/res/drawable-hdpi/type_video_dark.png b/core/src/main/res/drawable-hdpi/type_video_dark.png similarity index 100% rename from res/drawable-hdpi/type_video_dark.png rename to core/src/main/res/drawable-hdpi/type_video_dark.png diff --git a/res/drawable-ldpi-v11/ic_stat_antenna.png b/core/src/main/res/drawable-ldpi-v11/ic_stat_antenna_default.png similarity index 100% rename from res/drawable-ldpi-v11/ic_stat_antenna.png rename to core/src/main/res/drawable-ldpi-v11/ic_stat_antenna_default.png diff --git a/res/drawable-ldpi/action_stream.png b/core/src/main/res/drawable-ldpi/action_stream.png similarity index 100% rename from res/drawable-ldpi/action_stream.png rename to core/src/main/res/drawable-ldpi/action_stream.png diff --git a/res/drawable-ldpi/action_stream_dark.png b/core/src/main/res/drawable-ldpi/action_stream_dark.png similarity index 100% rename from res/drawable-ldpi/action_stream_dark.png rename to core/src/main/res/drawable-ldpi/action_stream_dark.png diff --git a/res/drawable-ldpi/ic_launcher.png b/core/src/main/res/drawable-ldpi/ic_launcher.png similarity index 100% rename from res/drawable-ldpi/ic_launcher.png rename to core/src/main/res/drawable-ldpi/ic_launcher.png diff --git a/res/drawable-ldpi/ic_stat_antenna.png b/core/src/main/res/drawable-ldpi/ic_stat_antenna_default.png similarity index 100% rename from res/drawable-ldpi/ic_stat_antenna.png rename to core/src/main/res/drawable-ldpi/ic_stat_antenna_default.png diff --git a/res/drawable-ldpi/stat_playlist.png b/core/src/main/res/drawable-ldpi/stat_playlist.png similarity index 100% rename from res/drawable-ldpi/stat_playlist.png rename to core/src/main/res/drawable-ldpi/stat_playlist.png diff --git a/res/drawable-ldpi/stat_playlist_dark.png b/core/src/main/res/drawable-ldpi/stat_playlist_dark.png similarity index 100% rename from res/drawable-ldpi/stat_playlist_dark.png rename to core/src/main/res/drawable-ldpi/stat_playlist_dark.png diff --git a/res/drawable-mdpi-v11/ic_stat_antenna.png b/core/src/main/res/drawable-mdpi-v11/ic_stat_antenna_default.png similarity index 100% rename from res/drawable-mdpi-v11/ic_stat_antenna.png rename to core/src/main/res/drawable-mdpi-v11/ic_stat_antenna_default.png diff --git a/res/drawable-mdpi-v11/ic_stat_authentication.png b/core/src/main/res/drawable-mdpi-v11/ic_stat_authentication.png similarity index 100% rename from res/drawable-mdpi-v11/ic_stat_authentication.png rename to core/src/main/res/drawable-mdpi-v11/ic_stat_authentication.png diff --git a/res/drawable-mdpi-v11/stat_notify_sync.png b/core/src/main/res/drawable-mdpi-v11/stat_notify_sync.png similarity index 100% rename from res/drawable-mdpi-v11/stat_notify_sync.png rename to core/src/main/res/drawable-mdpi-v11/stat_notify_sync.png diff --git a/res/drawable-mdpi-v11/stat_notify_sync_error.png b/core/src/main/res/drawable-mdpi-v11/stat_notify_sync_error.png similarity index 100% rename from res/drawable-mdpi-v11/stat_notify_sync_error.png rename to core/src/main/res/drawable-mdpi-v11/stat_notify_sync_error.png diff --git a/res/drawable-mdpi/action_about.png b/core/src/main/res/drawable-mdpi/action_about.png similarity index 100% rename from res/drawable-mdpi/action_about.png rename to core/src/main/res/drawable-mdpi/action_about.png diff --git a/res/drawable-mdpi/action_about_dark.png b/core/src/main/res/drawable-mdpi/action_about_dark.png similarity index 100% rename from res/drawable-mdpi/action_about_dark.png rename to core/src/main/res/drawable-mdpi/action_about_dark.png diff --git a/res/drawable-mdpi/action_search.png b/core/src/main/res/drawable-mdpi/action_search.png similarity index 100% rename from res/drawable-mdpi/action_search.png rename to core/src/main/res/drawable-mdpi/action_search.png diff --git a/res/drawable-mdpi/action_search_dark.png b/core/src/main/res/drawable-mdpi/action_search_dark.png similarity index 100% rename from res/drawable-mdpi/action_search_dark.png rename to core/src/main/res/drawable-mdpi/action_search_dark.png diff --git a/res/drawable-mdpi/action_settings.png b/core/src/main/res/drawable-mdpi/action_settings.png similarity index 100% rename from res/drawable-mdpi/action_settings.png rename to core/src/main/res/drawable-mdpi/action_settings.png diff --git a/res/drawable-mdpi/action_settings_dark.png b/core/src/main/res/drawable-mdpi/action_settings_dark.png similarity index 100% rename from res/drawable-mdpi/action_settings_dark.png rename to core/src/main/res/drawable-mdpi/action_settings_dark.png diff --git a/res/drawable-mdpi/action_stream.png b/core/src/main/res/drawable-mdpi/action_stream.png similarity index 100% rename from res/drawable-mdpi/action_stream.png rename to core/src/main/res/drawable-mdpi/action_stream.png diff --git a/res/drawable-mdpi/action_stream_dark.png b/core/src/main/res/drawable-mdpi/action_stream_dark.png similarity index 100% rename from res/drawable-mdpi/action_stream_dark.png rename to core/src/main/res/drawable-mdpi/action_stream_dark.png diff --git a/res/drawable-mdpi/av_download.png b/core/src/main/res/drawable-mdpi/av_download.png similarity index 100% rename from res/drawable-mdpi/av_download.png rename to core/src/main/res/drawable-mdpi/av_download.png diff --git a/res/drawable-mdpi/av_download_dark.png b/core/src/main/res/drawable-mdpi/av_download_dark.png similarity index 100% rename from res/drawable-mdpi/av_download_dark.png rename to core/src/main/res/drawable-mdpi/av_download_dark.png diff --git a/res/drawable-mdpi/av_fast_forward.png b/core/src/main/res/drawable-mdpi/av_fast_forward.png similarity index 100% rename from res/drawable-mdpi/av_fast_forward.png rename to core/src/main/res/drawable-mdpi/av_fast_forward.png diff --git a/res/drawable-mdpi/av_fast_forward_dark.png b/core/src/main/res/drawable-mdpi/av_fast_forward_dark.png similarity index 100% rename from res/drawable-mdpi/av_fast_forward_dark.png rename to core/src/main/res/drawable-mdpi/av_fast_forward_dark.png diff --git a/res/drawable-mdpi/av_pause.png b/core/src/main/res/drawable-mdpi/av_pause.png similarity index 100% rename from res/drawable-mdpi/av_pause.png rename to core/src/main/res/drawable-mdpi/av_pause.png diff --git a/res/drawable-mdpi/av_pause_dark.png b/core/src/main/res/drawable-mdpi/av_pause_dark.png similarity index 100% rename from res/drawable-mdpi/av_pause_dark.png rename to core/src/main/res/drawable-mdpi/av_pause_dark.png diff --git a/res/drawable-mdpi/av_play.png b/core/src/main/res/drawable-mdpi/av_play.png similarity index 100% rename from res/drawable-mdpi/av_play.png rename to core/src/main/res/drawable-mdpi/av_play.png diff --git a/res/drawable-mdpi/av_play_dark.png b/core/src/main/res/drawable-mdpi/av_play_dark.png similarity index 100% rename from res/drawable-mdpi/av_play_dark.png rename to core/src/main/res/drawable-mdpi/av_play_dark.png diff --git a/res/drawable-mdpi/av_rewind.png b/core/src/main/res/drawable-mdpi/av_rewind.png similarity index 100% rename from res/drawable-mdpi/av_rewind.png rename to core/src/main/res/drawable-mdpi/av_rewind.png diff --git a/res/drawable-mdpi/av_rewind_dark.png b/core/src/main/res/drawable-mdpi/av_rewind_dark.png similarity index 100% rename from res/drawable-mdpi/av_rewind_dark.png rename to core/src/main/res/drawable-mdpi/av_rewind_dark.png diff --git a/res/drawable-mdpi/content_discard.png b/core/src/main/res/drawable-mdpi/content_discard.png similarity index 100% rename from res/drawable-mdpi/content_discard.png rename to core/src/main/res/drawable-mdpi/content_discard.png diff --git a/res/drawable-mdpi/content_discard_dark.png b/core/src/main/res/drawable-mdpi/content_discard_dark.png similarity index 100% rename from res/drawable-mdpi/content_discard_dark.png rename to core/src/main/res/drawable-mdpi/content_discard_dark.png diff --git a/res/drawable-mdpi/content_new.png b/core/src/main/res/drawable-mdpi/content_new.png similarity index 100% rename from res/drawable-mdpi/content_new.png rename to core/src/main/res/drawable-mdpi/content_new.png diff --git a/res/drawable-mdpi/content_new_dark.png b/core/src/main/res/drawable-mdpi/content_new_dark.png similarity index 100% rename from res/drawable-mdpi/content_new_dark.png rename to core/src/main/res/drawable-mdpi/content_new_dark.png diff --git a/res/drawable-mdpi/default_cover.png b/core/src/main/res/drawable-mdpi/default_cover.png similarity index 100% rename from res/drawable-mdpi/default_cover.png rename to core/src/main/res/drawable-mdpi/default_cover.png diff --git a/res/drawable-mdpi/default_cover_dark.png b/core/src/main/res/drawable-mdpi/default_cover_dark.png similarity index 100% rename from res/drawable-mdpi/default_cover_dark.png rename to core/src/main/res/drawable-mdpi/default_cover_dark.png diff --git a/res/drawable-mdpi/device_access_time.png b/core/src/main/res/drawable-mdpi/device_access_time.png similarity index 100% rename from res/drawable-mdpi/device_access_time.png rename to core/src/main/res/drawable-mdpi/device_access_time.png diff --git a/res/drawable-mdpi/device_access_time_dark.png b/core/src/main/res/drawable-mdpi/device_access_time_dark.png similarity index 100% rename from res/drawable-mdpi/device_access_time_dark.png rename to core/src/main/res/drawable-mdpi/device_access_time_dark.png diff --git a/res/drawable-mdpi/ic_action_overflow.png b/core/src/main/res/drawable-mdpi/ic_action_overflow.png similarity index 100% rename from res/drawable-mdpi/ic_action_overflow.png rename to core/src/main/res/drawable-mdpi/ic_action_overflow.png diff --git a/res/drawable-mdpi/ic_action_overflow_dark.png b/core/src/main/res/drawable-mdpi/ic_action_overflow_dark.png similarity index 100% rename from res/drawable-mdpi/ic_action_overflow_dark.png rename to core/src/main/res/drawable-mdpi/ic_action_overflow_dark.png diff --git a/res/drawable-mdpi/ic_action_pause_over_video.png b/core/src/main/res/drawable-mdpi/ic_action_pause_over_video.png similarity index 100% rename from res/drawable-mdpi/ic_action_pause_over_video.png rename to core/src/main/res/drawable-mdpi/ic_action_pause_over_video.png diff --git a/res/drawable-mdpi/ic_action_play_over_video.png b/core/src/main/res/drawable-mdpi/ic_action_play_over_video.png similarity index 100% rename from res/drawable-mdpi/ic_action_play_over_video.png rename to core/src/main/res/drawable-mdpi/ic_action_play_over_video.png diff --git a/res/drawable-mdpi/ic_drag_handle.png b/core/src/main/res/drawable-mdpi/ic_drag_handle.png similarity index 100% rename from res/drawable-mdpi/ic_drag_handle.png rename to core/src/main/res/drawable-mdpi/ic_drag_handle.png diff --git a/res/drawable-mdpi/ic_drag_handle_dark.png b/core/src/main/res/drawable-mdpi/ic_drag_handle_dark.png similarity index 100% rename from res/drawable-mdpi/ic_drag_handle_dark.png rename to core/src/main/res/drawable-mdpi/ic_drag_handle_dark.png diff --git a/res/drawable-mdpi/ic_drawer.png b/core/src/main/res/drawable-mdpi/ic_drawer.png similarity index 100% rename from res/drawable-mdpi/ic_drawer.png rename to core/src/main/res/drawable-mdpi/ic_drawer.png diff --git a/res/drawable-mdpi/ic_drawer_dark.png b/core/src/main/res/drawable-mdpi/ic_drawer_dark.png similarity index 100% rename from res/drawable-mdpi/ic_drawer_dark.png rename to core/src/main/res/drawable-mdpi/ic_drawer_dark.png diff --git a/res/drawable-mdpi/ic_launcher.png b/core/src/main/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from res/drawable-mdpi/ic_launcher.png rename to core/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/res/drawable-mdpi/ic_new.png b/core/src/main/res/drawable-mdpi/ic_new.png similarity index 100% rename from res/drawable-mdpi/ic_new.png rename to core/src/main/res/drawable-mdpi/ic_new.png diff --git a/res/drawable-mdpi/ic_new_dark.png b/core/src/main/res/drawable-mdpi/ic_new_dark.png similarity index 100% rename from res/drawable-mdpi/ic_new_dark.png rename to core/src/main/res/drawable-mdpi/ic_new_dark.png diff --git a/res/drawable-mdpi/ic_stat_antenna.png b/core/src/main/res/drawable-mdpi/ic_stat_antenna_default.png similarity index 100% rename from res/drawable-mdpi/ic_stat_antenna.png rename to core/src/main/res/drawable-mdpi/ic_stat_antenna_default.png diff --git a/res/drawable-mdpi/ic_stat_authentication.png b/core/src/main/res/drawable-mdpi/ic_stat_authentication.png similarity index 100% rename from res/drawable-mdpi/ic_stat_authentication.png rename to core/src/main/res/drawable-mdpi/ic_stat_authentication.png diff --git a/res/drawable-mdpi/location_web_site.png b/core/src/main/res/drawable-mdpi/location_web_site.png similarity index 100% rename from res/drawable-mdpi/location_web_site.png rename to core/src/main/res/drawable-mdpi/location_web_site.png diff --git a/res/drawable-mdpi/location_web_site_dark.png b/core/src/main/res/drawable-mdpi/location_web_site_dark.png similarity index 100% rename from res/drawable-mdpi/location_web_site_dark.png rename to core/src/main/res/drawable-mdpi/location_web_site_dark.png diff --git a/res/drawable-mdpi/navigation_accept.png b/core/src/main/res/drawable-mdpi/navigation_accept.png similarity index 100% rename from res/drawable-mdpi/navigation_accept.png rename to core/src/main/res/drawable-mdpi/navigation_accept.png diff --git a/res/drawable-mdpi/navigation_accept_dark.png b/core/src/main/res/drawable-mdpi/navigation_accept_dark.png similarity index 100% rename from res/drawable-mdpi/navigation_accept_dark.png rename to core/src/main/res/drawable-mdpi/navigation_accept_dark.png diff --git a/res/drawable-mdpi/navigation_cancel.png b/core/src/main/res/drawable-mdpi/navigation_cancel.png similarity index 100% rename from res/drawable-mdpi/navigation_cancel.png rename to core/src/main/res/drawable-mdpi/navigation_cancel.png diff --git a/res/drawable-mdpi/navigation_cancel_dark.png b/core/src/main/res/drawable-mdpi/navigation_cancel_dark.png similarity index 100% rename from res/drawable-mdpi/navigation_cancel_dark.png rename to core/src/main/res/drawable-mdpi/navigation_cancel_dark.png diff --git a/res/drawable-mdpi/navigation_chapters.png b/core/src/main/res/drawable-mdpi/navigation_chapters.png similarity index 100% rename from res/drawable-mdpi/navigation_chapters.png rename to core/src/main/res/drawable-mdpi/navigation_chapters.png diff --git a/res/drawable-mdpi/navigation_chapters_dark.png b/core/src/main/res/drawable-mdpi/navigation_chapters_dark.png similarity index 100% rename from res/drawable-mdpi/navigation_chapters_dark.png rename to core/src/main/res/drawable-mdpi/navigation_chapters_dark.png diff --git a/res/drawable-mdpi/navigation_collapse.png b/core/src/main/res/drawable-mdpi/navigation_collapse.png similarity index 100% rename from res/drawable-mdpi/navigation_collapse.png rename to core/src/main/res/drawable-mdpi/navigation_collapse.png diff --git a/res/drawable-mdpi/navigation_collapse_dark.png b/core/src/main/res/drawable-mdpi/navigation_collapse_dark.png similarity index 100% rename from res/drawable-mdpi/navigation_collapse_dark.png rename to core/src/main/res/drawable-mdpi/navigation_collapse_dark.png diff --git a/res/drawable-mdpi/navigation_expand.png b/core/src/main/res/drawable-mdpi/navigation_expand.png similarity index 100% rename from res/drawable-mdpi/navigation_expand.png rename to core/src/main/res/drawable-mdpi/navigation_expand.png diff --git a/res/drawable-mdpi/navigation_expand_dark.png b/core/src/main/res/drawable-mdpi/navigation_expand_dark.png similarity index 100% rename from res/drawable-mdpi/navigation_expand_dark.png rename to core/src/main/res/drawable-mdpi/navigation_expand_dark.png diff --git a/res/drawable-mdpi/navigation_refresh.png b/core/src/main/res/drawable-mdpi/navigation_refresh.png similarity index 100% rename from res/drawable-mdpi/navigation_refresh.png rename to core/src/main/res/drawable-mdpi/navigation_refresh.png diff --git a/res/drawable-mdpi/navigation_refresh_dark.png b/core/src/main/res/drawable-mdpi/navigation_refresh_dark.png similarity index 100% rename from res/drawable-mdpi/navigation_refresh_dark.png rename to core/src/main/res/drawable-mdpi/navigation_refresh_dark.png diff --git a/res/drawable-mdpi/navigation_shownotes.png b/core/src/main/res/drawable-mdpi/navigation_shownotes.png similarity index 100% rename from res/drawable-mdpi/navigation_shownotes.png rename to core/src/main/res/drawable-mdpi/navigation_shownotes.png diff --git a/res/drawable-mdpi/navigation_shownotes_dark.png b/core/src/main/res/drawable-mdpi/navigation_shownotes_dark.png similarity index 100% rename from res/drawable-mdpi/navigation_shownotes_dark.png rename to core/src/main/res/drawable-mdpi/navigation_shownotes_dark.png diff --git a/res/drawable-mdpi/navigation_up.png b/core/src/main/res/drawable-mdpi/navigation_up.png similarity index 100% rename from res/drawable-mdpi/navigation_up.png rename to core/src/main/res/drawable-mdpi/navigation_up.png diff --git a/res/drawable-mdpi/navigation_up_dark.png b/core/src/main/res/drawable-mdpi/navigation_up_dark.png similarity index 100% rename from res/drawable-mdpi/navigation_up_dark.png rename to core/src/main/res/drawable-mdpi/navigation_up_dark.png diff --git a/res/drawable-mdpi/social_share.png b/core/src/main/res/drawable-mdpi/social_share.png similarity index 100% rename from res/drawable-mdpi/social_share.png rename to core/src/main/res/drawable-mdpi/social_share.png diff --git a/res/drawable-mdpi/social_share_dark.png b/core/src/main/res/drawable-mdpi/social_share_dark.png similarity index 100% rename from res/drawable-mdpi/social_share_dark.png rename to core/src/main/res/drawable-mdpi/social_share_dark.png diff --git a/res/drawable-mdpi/spinner_button.9.png b/core/src/main/res/drawable-mdpi/spinner_button.9.png similarity index 100% rename from res/drawable-mdpi/spinner_button.9.png rename to core/src/main/res/drawable-mdpi/spinner_button.9.png diff --git a/res/drawable-mdpi/spinner_button_dark.9.png b/core/src/main/res/drawable-mdpi/spinner_button_dark.9.png similarity index 100% rename from res/drawable-mdpi/spinner_button_dark.9.png rename to core/src/main/res/drawable-mdpi/spinner_button_dark.9.png diff --git a/res/drawable-mdpi/stat_notify_sync.png b/core/src/main/res/drawable-mdpi/stat_notify_sync.png similarity index 100% rename from res/drawable-mdpi/stat_notify_sync.png rename to core/src/main/res/drawable-mdpi/stat_notify_sync.png diff --git a/res/drawable-mdpi/stat_notify_sync_error.png b/core/src/main/res/drawable-mdpi/stat_notify_sync_error.png similarity index 100% rename from res/drawable-mdpi/stat_notify_sync_error.png rename to core/src/main/res/drawable-mdpi/stat_notify_sync_error.png diff --git a/res/drawable-mdpi/stat_playlist.png b/core/src/main/res/drawable-mdpi/stat_playlist.png similarity index 100% rename from res/drawable-mdpi/stat_playlist.png rename to core/src/main/res/drawable-mdpi/stat_playlist.png diff --git a/res/drawable-mdpi/stat_playlist_dark.png b/core/src/main/res/drawable-mdpi/stat_playlist_dark.png similarity index 100% rename from res/drawable-mdpi/stat_playlist_dark.png rename to core/src/main/res/drawable-mdpi/stat_playlist_dark.png diff --git a/res/drawable-mdpi/type_audio.png b/core/src/main/res/drawable-mdpi/type_audio.png similarity index 100% rename from res/drawable-mdpi/type_audio.png rename to core/src/main/res/drawable-mdpi/type_audio.png diff --git a/res/drawable-mdpi/type_audio_dark.png b/core/src/main/res/drawable-mdpi/type_audio_dark.png similarity index 100% rename from res/drawable-mdpi/type_audio_dark.png rename to core/src/main/res/drawable-mdpi/type_audio_dark.png diff --git a/res/drawable-mdpi/type_video.png b/core/src/main/res/drawable-mdpi/type_video.png similarity index 100% rename from res/drawable-mdpi/type_video.png rename to core/src/main/res/drawable-mdpi/type_video.png diff --git a/res/drawable-mdpi/type_video_dark.png b/core/src/main/res/drawable-mdpi/type_video_dark.png similarity index 100% rename from res/drawable-mdpi/type_video_dark.png rename to core/src/main/res/drawable-mdpi/type_video_dark.png diff --git a/res/drawable-xhdpi-v11/ic_stat_antenna.png b/core/src/main/res/drawable-xhdpi-v11/ic_stat_antenna_default.png similarity index 100% rename from res/drawable-xhdpi-v11/ic_stat_antenna.png rename to core/src/main/res/drawable-xhdpi-v11/ic_stat_antenna_default.png diff --git a/res/drawable-xhdpi-v11/ic_stat_authentication.png b/core/src/main/res/drawable-xhdpi-v11/ic_stat_authentication.png similarity index 100% rename from res/drawable-xhdpi-v11/ic_stat_authentication.png rename to core/src/main/res/drawable-xhdpi-v11/ic_stat_authentication.png diff --git a/res/drawable-xhdpi-v11/stat_notify_sync.png b/core/src/main/res/drawable-xhdpi-v11/stat_notify_sync.png similarity index 100% rename from res/drawable-xhdpi-v11/stat_notify_sync.png rename to core/src/main/res/drawable-xhdpi-v11/stat_notify_sync.png diff --git a/res/drawable-xhdpi-v11/stat_notify_sync_error.png b/core/src/main/res/drawable-xhdpi-v11/stat_notify_sync_error.png similarity index 100% rename from res/drawable-xhdpi-v11/stat_notify_sync_error.png rename to core/src/main/res/drawable-xhdpi-v11/stat_notify_sync_error.png diff --git a/res/drawable-xhdpi/action_about.png b/core/src/main/res/drawable-xhdpi/action_about.png similarity index 100% rename from res/drawable-xhdpi/action_about.png rename to core/src/main/res/drawable-xhdpi/action_about.png diff --git a/res/drawable-xhdpi/action_about_dark.png b/core/src/main/res/drawable-xhdpi/action_about_dark.png similarity index 100% rename from res/drawable-xhdpi/action_about_dark.png rename to core/src/main/res/drawable-xhdpi/action_about_dark.png diff --git a/res/drawable-xhdpi/action_search.png b/core/src/main/res/drawable-xhdpi/action_search.png similarity index 100% rename from res/drawable-xhdpi/action_search.png rename to core/src/main/res/drawable-xhdpi/action_search.png diff --git a/res/drawable-xhdpi/action_search_dark.png b/core/src/main/res/drawable-xhdpi/action_search_dark.png similarity index 100% rename from res/drawable-xhdpi/action_search_dark.png rename to core/src/main/res/drawable-xhdpi/action_search_dark.png diff --git a/res/drawable-xhdpi/action_settings.png b/core/src/main/res/drawable-xhdpi/action_settings.png similarity index 100% rename from res/drawable-xhdpi/action_settings.png rename to core/src/main/res/drawable-xhdpi/action_settings.png diff --git a/res/drawable-xhdpi/action_settings_dark.png b/core/src/main/res/drawable-xhdpi/action_settings_dark.png similarity index 100% rename from res/drawable-xhdpi/action_settings_dark.png rename to core/src/main/res/drawable-xhdpi/action_settings_dark.png diff --git a/res/drawable-xhdpi/action_stream.png b/core/src/main/res/drawable-xhdpi/action_stream.png similarity index 100% rename from res/drawable-xhdpi/action_stream.png rename to core/src/main/res/drawable-xhdpi/action_stream.png diff --git a/res/drawable-xhdpi/action_stream_dark.png b/core/src/main/res/drawable-xhdpi/action_stream_dark.png similarity index 100% rename from res/drawable-xhdpi/action_stream_dark.png rename to core/src/main/res/drawable-xhdpi/action_stream_dark.png diff --git a/res/drawable-xhdpi/av_download.png b/core/src/main/res/drawable-xhdpi/av_download.png similarity index 100% rename from res/drawable-xhdpi/av_download.png rename to core/src/main/res/drawable-xhdpi/av_download.png diff --git a/res/drawable-xhdpi/av_download_dark.png b/core/src/main/res/drawable-xhdpi/av_download_dark.png similarity index 100% rename from res/drawable-xhdpi/av_download_dark.png rename to core/src/main/res/drawable-xhdpi/av_download_dark.png diff --git a/res/drawable-xhdpi/av_fast_forward.png b/core/src/main/res/drawable-xhdpi/av_fast_forward.png similarity index 100% rename from res/drawable-xhdpi/av_fast_forward.png rename to core/src/main/res/drawable-xhdpi/av_fast_forward.png diff --git a/res/drawable-xhdpi/av_fast_forward_dark.png b/core/src/main/res/drawable-xhdpi/av_fast_forward_dark.png similarity index 100% rename from res/drawable-xhdpi/av_fast_forward_dark.png rename to core/src/main/res/drawable-xhdpi/av_fast_forward_dark.png diff --git a/res/drawable-xhdpi/av_pause.png b/core/src/main/res/drawable-xhdpi/av_pause.png similarity index 100% rename from res/drawable-xhdpi/av_pause.png rename to core/src/main/res/drawable-xhdpi/av_pause.png diff --git a/res/drawable-xhdpi/av_pause_dark.png b/core/src/main/res/drawable-xhdpi/av_pause_dark.png similarity index 100% rename from res/drawable-xhdpi/av_pause_dark.png rename to core/src/main/res/drawable-xhdpi/av_pause_dark.png diff --git a/res/drawable-xhdpi/av_play.png b/core/src/main/res/drawable-xhdpi/av_play.png similarity index 100% rename from res/drawable-xhdpi/av_play.png rename to core/src/main/res/drawable-xhdpi/av_play.png diff --git a/res/drawable-xhdpi/av_play_dark.png b/core/src/main/res/drawable-xhdpi/av_play_dark.png similarity index 100% rename from res/drawable-xhdpi/av_play_dark.png rename to core/src/main/res/drawable-xhdpi/av_play_dark.png diff --git a/res/drawable-xhdpi/av_rewind.png b/core/src/main/res/drawable-xhdpi/av_rewind.png similarity index 100% rename from res/drawable-xhdpi/av_rewind.png rename to core/src/main/res/drawable-xhdpi/av_rewind.png diff --git a/res/drawable-xhdpi/av_rewind_dark.png b/core/src/main/res/drawable-xhdpi/av_rewind_dark.png similarity index 100% rename from res/drawable-xhdpi/av_rewind_dark.png rename to core/src/main/res/drawable-xhdpi/av_rewind_dark.png diff --git a/res/drawable-xhdpi/content_discard.png b/core/src/main/res/drawable-xhdpi/content_discard.png similarity index 100% rename from res/drawable-xhdpi/content_discard.png rename to core/src/main/res/drawable-xhdpi/content_discard.png diff --git a/res/drawable-xhdpi/content_discard_dark.png b/core/src/main/res/drawable-xhdpi/content_discard_dark.png similarity index 100% rename from res/drawable-xhdpi/content_discard_dark.png rename to core/src/main/res/drawable-xhdpi/content_discard_dark.png diff --git a/res/drawable-xhdpi/content_new.png b/core/src/main/res/drawable-xhdpi/content_new.png similarity index 100% rename from res/drawable-xhdpi/content_new.png rename to core/src/main/res/drawable-xhdpi/content_new.png diff --git a/res/drawable-xhdpi/content_new_dark.png b/core/src/main/res/drawable-xhdpi/content_new_dark.png similarity index 100% rename from res/drawable-xhdpi/content_new_dark.png rename to core/src/main/res/drawable-xhdpi/content_new_dark.png diff --git a/res/drawable-xhdpi/content_remove.png b/core/src/main/res/drawable-xhdpi/content_remove.png similarity index 100% rename from res/drawable-xhdpi/content_remove.png rename to core/src/main/res/drawable-xhdpi/content_remove.png diff --git a/res/drawable-xhdpi/content_remove_dark.png b/core/src/main/res/drawable-xhdpi/content_remove_dark.png similarity index 100% rename from res/drawable-xhdpi/content_remove_dark.png rename to core/src/main/res/drawable-xhdpi/content_remove_dark.png diff --git a/res/drawable-xhdpi/default_cover.png b/core/src/main/res/drawable-xhdpi/default_cover.png similarity index 100% rename from res/drawable-xhdpi/default_cover.png rename to core/src/main/res/drawable-xhdpi/default_cover.png diff --git a/res/drawable-xhdpi/default_cover_dark.png b/core/src/main/res/drawable-xhdpi/default_cover_dark.png similarity index 100% rename from res/drawable-xhdpi/default_cover_dark.png rename to core/src/main/res/drawable-xhdpi/default_cover_dark.png diff --git a/res/drawable-xhdpi/device_access_time.png b/core/src/main/res/drawable-xhdpi/device_access_time.png similarity index 100% rename from res/drawable-xhdpi/device_access_time.png rename to core/src/main/res/drawable-xhdpi/device_access_time.png diff --git a/res/drawable-xhdpi/device_access_time_dark.png b/core/src/main/res/drawable-xhdpi/device_access_time_dark.png similarity index 100% rename from res/drawable-xhdpi/device_access_time_dark.png rename to core/src/main/res/drawable-xhdpi/device_access_time_dark.png diff --git a/res/drawable-xhdpi/ic_action_overflow.png b/core/src/main/res/drawable-xhdpi/ic_action_overflow.png similarity index 100% rename from res/drawable-xhdpi/ic_action_overflow.png rename to core/src/main/res/drawable-xhdpi/ic_action_overflow.png diff --git a/res/drawable-xhdpi/ic_action_overflow_dark.png b/core/src/main/res/drawable-xhdpi/ic_action_overflow_dark.png similarity index 100% rename from res/drawable-xhdpi/ic_action_overflow_dark.png rename to core/src/main/res/drawable-xhdpi/ic_action_overflow_dark.png diff --git a/res/drawable-xhdpi/ic_action_pause_over_video.png b/core/src/main/res/drawable-xhdpi/ic_action_pause_over_video.png similarity index 100% rename from res/drawable-xhdpi/ic_action_pause_over_video.png rename to core/src/main/res/drawable-xhdpi/ic_action_pause_over_video.png diff --git a/res/drawable-xhdpi/ic_action_play_over_video.png b/core/src/main/res/drawable-xhdpi/ic_action_play_over_video.png similarity index 100% rename from res/drawable-xhdpi/ic_action_play_over_video.png rename to core/src/main/res/drawable-xhdpi/ic_action_play_over_video.png diff --git a/res/drawable-xhdpi/ic_drag_handle.png b/core/src/main/res/drawable-xhdpi/ic_drag_handle.png similarity index 100% rename from res/drawable-xhdpi/ic_drag_handle.png rename to core/src/main/res/drawable-xhdpi/ic_drag_handle.png diff --git a/res/drawable-xhdpi/ic_drag_handle_dark.png b/core/src/main/res/drawable-xhdpi/ic_drag_handle_dark.png similarity index 100% rename from res/drawable-xhdpi/ic_drag_handle_dark.png rename to core/src/main/res/drawable-xhdpi/ic_drag_handle_dark.png diff --git a/res/drawable-xhdpi/ic_drawer.png b/core/src/main/res/drawable-xhdpi/ic_drawer.png similarity index 100% rename from res/drawable-xhdpi/ic_drawer.png rename to core/src/main/res/drawable-xhdpi/ic_drawer.png diff --git a/res/drawable-xhdpi/ic_drawer_dark.png b/core/src/main/res/drawable-xhdpi/ic_drawer_dark.png similarity index 100% rename from res/drawable-xhdpi/ic_drawer_dark.png rename to core/src/main/res/drawable-xhdpi/ic_drawer_dark.png diff --git a/res/drawable-xhdpi/ic_launcher.png b/core/src/main/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from res/drawable-xhdpi/ic_launcher.png rename to core/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/res/drawable-xhdpi/ic_new.png b/core/src/main/res/drawable-xhdpi/ic_new.png similarity index 100% rename from res/drawable-xhdpi/ic_new.png rename to core/src/main/res/drawable-xhdpi/ic_new.png diff --git a/res/drawable-xhdpi/ic_new_dark.png b/core/src/main/res/drawable-xhdpi/ic_new_dark.png similarity index 100% rename from res/drawable-xhdpi/ic_new_dark.png rename to core/src/main/res/drawable-xhdpi/ic_new_dark.png diff --git a/res/drawable-xhdpi/ic_stat_antenna.png b/core/src/main/res/drawable-xhdpi/ic_stat_antenna_default.png similarity index 100% rename from res/drawable-xhdpi/ic_stat_antenna.png rename to core/src/main/res/drawable-xhdpi/ic_stat_antenna_default.png diff --git a/res/drawable-xhdpi/ic_stat_authentication.png b/core/src/main/res/drawable-xhdpi/ic_stat_authentication.png similarity index 100% rename from res/drawable-xhdpi/ic_stat_authentication.png rename to core/src/main/res/drawable-xhdpi/ic_stat_authentication.png diff --git a/res/drawable-xhdpi/ic_undobar_undo.png b/core/src/main/res/drawable-xhdpi/ic_undobar_undo.png similarity index 100% rename from res/drawable-xhdpi/ic_undobar_undo.png rename to core/src/main/res/drawable-xhdpi/ic_undobar_undo.png diff --git a/res/drawable-xhdpi/location_web_site.png b/core/src/main/res/drawable-xhdpi/location_web_site.png similarity index 100% rename from res/drawable-xhdpi/location_web_site.png rename to core/src/main/res/drawable-xhdpi/location_web_site.png diff --git a/res/drawable-xhdpi/location_web_site_dark.png b/core/src/main/res/drawable-xhdpi/location_web_site_dark.png similarity index 100% rename from res/drawable-xhdpi/location_web_site_dark.png rename to core/src/main/res/drawable-xhdpi/location_web_site_dark.png diff --git a/res/drawable-xhdpi/navigation_accept.png b/core/src/main/res/drawable-xhdpi/navigation_accept.png similarity index 100% rename from res/drawable-xhdpi/navigation_accept.png rename to core/src/main/res/drawable-xhdpi/navigation_accept.png diff --git a/res/drawable-xhdpi/navigation_accept_dark.png b/core/src/main/res/drawable-xhdpi/navigation_accept_dark.png similarity index 100% rename from res/drawable-xhdpi/navigation_accept_dark.png rename to core/src/main/res/drawable-xhdpi/navigation_accept_dark.png diff --git a/res/drawable-xhdpi/navigation_cancel.png b/core/src/main/res/drawable-xhdpi/navigation_cancel.png similarity index 100% rename from res/drawable-xhdpi/navigation_cancel.png rename to core/src/main/res/drawable-xhdpi/navigation_cancel.png diff --git a/res/drawable-xhdpi/navigation_cancel_dark.png b/core/src/main/res/drawable-xhdpi/navigation_cancel_dark.png similarity index 100% rename from res/drawable-xhdpi/navigation_cancel_dark.png rename to core/src/main/res/drawable-xhdpi/navigation_cancel_dark.png diff --git a/res/drawable-xhdpi/navigation_chapters.png b/core/src/main/res/drawable-xhdpi/navigation_chapters.png similarity index 100% rename from res/drawable-xhdpi/navigation_chapters.png rename to core/src/main/res/drawable-xhdpi/navigation_chapters.png diff --git a/res/drawable-xhdpi/navigation_chapters_dark.png b/core/src/main/res/drawable-xhdpi/navigation_chapters_dark.png similarity index 100% rename from res/drawable-xhdpi/navigation_chapters_dark.png rename to core/src/main/res/drawable-xhdpi/navigation_chapters_dark.png diff --git a/res/drawable-xhdpi/navigation_collapse.png b/core/src/main/res/drawable-xhdpi/navigation_collapse.png similarity index 100% rename from res/drawable-xhdpi/navigation_collapse.png rename to core/src/main/res/drawable-xhdpi/navigation_collapse.png diff --git a/res/drawable-xhdpi/navigation_collapse_dark.png b/core/src/main/res/drawable-xhdpi/navigation_collapse_dark.png similarity index 100% rename from res/drawable-xhdpi/navigation_collapse_dark.png rename to core/src/main/res/drawable-xhdpi/navigation_collapse_dark.png diff --git a/res/drawable-xhdpi/navigation_expand.png b/core/src/main/res/drawable-xhdpi/navigation_expand.png similarity index 100% rename from res/drawable-xhdpi/navigation_expand.png rename to core/src/main/res/drawable-xhdpi/navigation_expand.png diff --git a/res/drawable-xhdpi/navigation_expand_dark.png b/core/src/main/res/drawable-xhdpi/navigation_expand_dark.png similarity index 100% rename from res/drawable-xhdpi/navigation_expand_dark.png rename to core/src/main/res/drawable-xhdpi/navigation_expand_dark.png diff --git a/res/drawable-xhdpi/navigation_refresh.png b/core/src/main/res/drawable-xhdpi/navigation_refresh.png similarity index 100% rename from res/drawable-xhdpi/navigation_refresh.png rename to core/src/main/res/drawable-xhdpi/navigation_refresh.png diff --git a/res/drawable-xhdpi/navigation_refresh_dark.png b/core/src/main/res/drawable-xhdpi/navigation_refresh_dark.png similarity index 100% rename from res/drawable-xhdpi/navigation_refresh_dark.png rename to core/src/main/res/drawable-xhdpi/navigation_refresh_dark.png diff --git a/res/drawable-xhdpi/navigation_shownotes.png b/core/src/main/res/drawable-xhdpi/navigation_shownotes.png similarity index 100% rename from res/drawable-xhdpi/navigation_shownotes.png rename to core/src/main/res/drawable-xhdpi/navigation_shownotes.png diff --git a/res/drawable-xhdpi/navigation_shownotes_dark.png b/core/src/main/res/drawable-xhdpi/navigation_shownotes_dark.png similarity index 100% rename from res/drawable-xhdpi/navigation_shownotes_dark.png rename to core/src/main/res/drawable-xhdpi/navigation_shownotes_dark.png diff --git a/res/drawable-xhdpi/navigation_up.png b/core/src/main/res/drawable-xhdpi/navigation_up.png similarity index 100% rename from res/drawable-xhdpi/navigation_up.png rename to core/src/main/res/drawable-xhdpi/navigation_up.png diff --git a/res/drawable-xhdpi/navigation_up_dark.png b/core/src/main/res/drawable-xhdpi/navigation_up_dark.png similarity index 100% rename from res/drawable-xhdpi/navigation_up_dark.png rename to core/src/main/res/drawable-xhdpi/navigation_up_dark.png diff --git a/res/drawable-xhdpi/social_share.png b/core/src/main/res/drawable-xhdpi/social_share.png similarity index 100% rename from res/drawable-xhdpi/social_share.png rename to core/src/main/res/drawable-xhdpi/social_share.png diff --git a/res/drawable-xhdpi/social_share_dark.png b/core/src/main/res/drawable-xhdpi/social_share_dark.png similarity index 100% rename from res/drawable-xhdpi/social_share_dark.png rename to core/src/main/res/drawable-xhdpi/social_share_dark.png diff --git a/res/drawable-xhdpi/spinner_button.9.png b/core/src/main/res/drawable-xhdpi/spinner_button.9.png similarity index 100% rename from res/drawable-xhdpi/spinner_button.9.png rename to core/src/main/res/drawable-xhdpi/spinner_button.9.png diff --git a/res/drawable-xhdpi/spinner_button_dark.9.png b/core/src/main/res/drawable-xhdpi/spinner_button_dark.9.png similarity index 100% rename from res/drawable-xhdpi/spinner_button_dark.9.png rename to core/src/main/res/drawable-xhdpi/spinner_button_dark.9.png diff --git a/res/drawable-xhdpi/stat_playlist.png b/core/src/main/res/drawable-xhdpi/stat_playlist.png similarity index 100% rename from res/drawable-xhdpi/stat_playlist.png rename to core/src/main/res/drawable-xhdpi/stat_playlist.png diff --git a/res/drawable-xhdpi/stat_playlist_dark.png b/core/src/main/res/drawable-xhdpi/stat_playlist_dark.png similarity index 100% rename from res/drawable-xhdpi/stat_playlist_dark.png rename to core/src/main/res/drawable-xhdpi/stat_playlist_dark.png diff --git a/res/drawable-xhdpi/type_audio.png b/core/src/main/res/drawable-xhdpi/type_audio.png similarity index 100% rename from res/drawable-xhdpi/type_audio.png rename to core/src/main/res/drawable-xhdpi/type_audio.png diff --git a/res/drawable-xhdpi/type_audio_dark.png b/core/src/main/res/drawable-xhdpi/type_audio_dark.png similarity index 100% rename from res/drawable-xhdpi/type_audio_dark.png rename to core/src/main/res/drawable-xhdpi/type_audio_dark.png diff --git a/res/drawable-xhdpi/type_video.png b/core/src/main/res/drawable-xhdpi/type_video.png similarity index 100% rename from res/drawable-xhdpi/type_video.png rename to core/src/main/res/drawable-xhdpi/type_video.png diff --git a/res/drawable-xhdpi/type_video_dark.png b/core/src/main/res/drawable-xhdpi/type_video_dark.png similarity index 100% rename from res/drawable-xhdpi/type_video_dark.png rename to core/src/main/res/drawable-xhdpi/type_video_dark.png diff --git a/res/drawable-xhdpi/undobar.9.png b/core/src/main/res/drawable-xhdpi/undobar.9.png similarity index 100% rename from res/drawable-xhdpi/undobar.9.png rename to core/src/main/res/drawable-xhdpi/undobar.9.png diff --git a/res/drawable-xhdpi/undobar_button_focused.9.png b/core/src/main/res/drawable-xhdpi/undobar_button_focused.9.png similarity index 100% rename from res/drawable-xhdpi/undobar_button_focused.9.png rename to core/src/main/res/drawable-xhdpi/undobar_button_focused.9.png diff --git a/res/drawable-xhdpi/undobar_button_pressed.9.png b/core/src/main/res/drawable-xhdpi/undobar_button_pressed.9.png similarity index 100% rename from res/drawable-xhdpi/undobar_button_pressed.9.png rename to core/src/main/res/drawable-xhdpi/undobar_button_pressed.9.png diff --git a/res/drawable-xhdpi/undobar_divider.9.png b/core/src/main/res/drawable-xhdpi/undobar_divider.9.png similarity index 100% rename from res/drawable-xhdpi/undobar_divider.9.png rename to core/src/main/res/drawable-xhdpi/undobar_divider.9.png diff --git a/res/drawable-xxhdpi/ic_action_overflow.png b/core/src/main/res/drawable-xxhdpi/ic_action_overflow.png similarity index 100% rename from res/drawable-xxhdpi/ic_action_overflow.png rename to core/src/main/res/drawable-xxhdpi/ic_action_overflow.png diff --git a/res/drawable-xxhdpi/ic_action_overflow_dark.png b/core/src/main/res/drawable-xxhdpi/ic_action_overflow_dark.png similarity index 100% rename from res/drawable-xxhdpi/ic_action_overflow_dark.png rename to core/src/main/res/drawable-xxhdpi/ic_action_overflow_dark.png diff --git a/res/drawable-xxhdpi/ic_action_pause_over_video.png b/core/src/main/res/drawable-xxhdpi/ic_action_pause_over_video.png similarity index 100% rename from res/drawable-xxhdpi/ic_action_pause_over_video.png rename to core/src/main/res/drawable-xxhdpi/ic_action_pause_over_video.png diff --git a/res/drawable-xxhdpi/ic_action_play_over_video.png b/core/src/main/res/drawable-xxhdpi/ic_action_play_over_video.png similarity index 100% rename from res/drawable-xxhdpi/ic_action_play_over_video.png rename to core/src/main/res/drawable-xxhdpi/ic_action_play_over_video.png diff --git a/res/drawable-xxhdpi/ic_drag_handle.png b/core/src/main/res/drawable-xxhdpi/ic_drag_handle.png similarity index 100% rename from res/drawable-xxhdpi/ic_drag_handle.png rename to core/src/main/res/drawable-xxhdpi/ic_drag_handle.png diff --git a/res/drawable-xxhdpi/ic_drag_handle_dark.png b/core/src/main/res/drawable-xxhdpi/ic_drag_handle_dark.png similarity index 100% rename from res/drawable-xxhdpi/ic_drag_handle_dark.png rename to core/src/main/res/drawable-xxhdpi/ic_drag_handle_dark.png diff --git a/res/drawable-xxhdpi/ic_drawer.png b/core/src/main/res/drawable-xxhdpi/ic_drawer.png similarity index 100% rename from res/drawable-xxhdpi/ic_drawer.png rename to core/src/main/res/drawable-xxhdpi/ic_drawer.png diff --git a/res/drawable-xxhdpi/ic_drawer_dark.png b/core/src/main/res/drawable-xxhdpi/ic_drawer_dark.png similarity index 100% rename from res/drawable-xxhdpi/ic_drawer_dark.png rename to core/src/main/res/drawable-xxhdpi/ic_drawer_dark.png diff --git a/res/drawable-xxhdpi/ic_launcher.png b/core/src/main/res/drawable-xxhdpi/ic_launcher.png similarity index 100% rename from res/drawable-xxhdpi/ic_launcher.png rename to core/src/main/res/drawable-xxhdpi/ic_launcher.png diff --git a/res/drawable-xxhdpi/ic_new.png b/core/src/main/res/drawable-xxhdpi/ic_new.png similarity index 100% rename from res/drawable-xxhdpi/ic_new.png rename to core/src/main/res/drawable-xxhdpi/ic_new.png diff --git a/res/drawable-xxhdpi/ic_new_dark.png b/core/src/main/res/drawable-xxhdpi/ic_new_dark.png similarity index 100% rename from res/drawable-xxhdpi/ic_new_dark.png rename to core/src/main/res/drawable-xxhdpi/ic_new_dark.png diff --git a/res/drawable-xxhdpi/ic_stat_authentication.png b/core/src/main/res/drawable-xxhdpi/ic_stat_authentication.png similarity index 100% rename from res/drawable-xxhdpi/ic_stat_authentication.png rename to core/src/main/res/drawable-xxhdpi/ic_stat_authentication.png diff --git a/res/drawable/badge.xml b/core/src/main/res/drawable/badge.xml similarity index 100% rename from res/drawable/badge.xml rename to core/src/main/res/drawable/badge.xml diff --git a/res/drawable/borderless_button.xml b/core/src/main/res/drawable/borderless_button.xml similarity index 100% rename from res/drawable/borderless_button.xml rename to core/src/main/res/drawable/borderless_button.xml diff --git a/res/drawable/borderless_button_dark.xml b/core/src/main/res/drawable/borderless_button_dark.xml similarity index 100% rename from res/drawable/borderless_button_dark.xml rename to core/src/main/res/drawable/borderless_button_dark.xml diff --git a/res/drawable/horizontal_divider.9.png b/core/src/main/res/drawable/horizontal_divider.9.png similarity index 100% rename from res/drawable/horizontal_divider.9.png rename to core/src/main/res/drawable/horizontal_divider.9.png diff --git a/res/drawable/overlay_button_circle_background.xml b/core/src/main/res/drawable/overlay_button_circle_background.xml similarity index 100% rename from res/drawable/overlay_button_circle_background.xml rename to core/src/main/res/drawable/overlay_button_circle_background.xml diff --git a/res/drawable/overlay_drawable.xml b/core/src/main/res/drawable/overlay_drawable.xml similarity index 100% rename from res/drawable/overlay_drawable.xml rename to core/src/main/res/drawable/overlay_drawable.xml diff --git a/res/drawable/overlay_drawable_dark.xml b/core/src/main/res/drawable/overlay_drawable_dark.xml similarity index 100% rename from res/drawable/overlay_drawable_dark.xml rename to core/src/main/res/drawable/overlay_drawable_dark.xml diff --git a/res/drawable/type_audio.png b/core/src/main/res/drawable/type_audio.png similarity index 100% rename from res/drawable/type_audio.png rename to core/src/main/res/drawable/type_audio.png diff --git a/res/drawable/type_video.png b/core/src/main/res/drawable/type_video.png similarity index 100% rename from res/drawable/type_video.png rename to core/src/main/res/drawable/type_video.png diff --git a/res/drawable/undobar_button.xml b/core/src/main/res/drawable/undobar_button.xml similarity index 100% rename from res/drawable/undobar_button.xml rename to core/src/main/res/drawable/undobar_button.xml diff --git a/res/drawable/vertical_divider.9.png b/core/src/main/res/drawable/vertical_divider.9.png similarity index 100% rename from res/drawable/vertical_divider.9.png rename to core/src/main/res/drawable/vertical_divider.9.png diff --git a/res/drawable/white_circle.xml b/core/src/main/res/drawable/white_circle.xml similarity index 100% rename from res/drawable/white_circle.xml rename to core/src/main/res/drawable/white_circle.xml diff --git a/res/values-az/strings.xml b/core/src/main/res/values-az/strings.xml similarity index 100% rename from res/values-az/strings.xml rename to core/src/main/res/values-az/strings.xml diff --git a/res/values-ca/strings.xml b/core/src/main/res/values-ca/strings.xml similarity index 100% rename from res/values-ca/strings.xml rename to core/src/main/res/values-ca/strings.xml diff --git a/res/values-cs-rCZ/strings.xml b/core/src/main/res/values-cs-rCZ/strings.xml similarity index 100% rename from res/values-cs-rCZ/strings.xml rename to core/src/main/res/values-cs-rCZ/strings.xml diff --git a/res/values-da/strings.xml b/core/src/main/res/values-da/strings.xml similarity index 100% rename from res/values-da/strings.xml rename to core/src/main/res/values-da/strings.xml diff --git a/res/values-de/strings.xml b/core/src/main/res/values-de/strings.xml similarity index 100% rename from res/values-de/strings.xml rename to core/src/main/res/values-de/strings.xml diff --git a/res/values-es-rES/strings.xml b/core/src/main/res/values-es-rES/strings.xml similarity index 100% rename from res/values-es-rES/strings.xml rename to core/src/main/res/values-es-rES/strings.xml diff --git a/res/values-es/strings.xml b/core/src/main/res/values-es/strings.xml similarity index 100% rename from res/values-es/strings.xml rename to core/src/main/res/values-es/strings.xml diff --git a/res/values-fr/strings.xml b/core/src/main/res/values-fr/strings.xml similarity index 100% rename from res/values-fr/strings.xml rename to core/src/main/res/values-fr/strings.xml diff --git a/res/values-hi-rIN/strings.xml b/core/src/main/res/values-hi-rIN/strings.xml similarity index 100% rename from res/values-hi-rIN/strings.xml rename to core/src/main/res/values-hi-rIN/strings.xml diff --git a/res/values-it-rIT/strings.xml b/core/src/main/res/values-it-rIT/strings.xml similarity index 100% rename from res/values-it-rIT/strings.xml rename to core/src/main/res/values-it-rIT/strings.xml diff --git a/res/values-iw-rIL/strings.xml b/core/src/main/res/values-iw-rIL/strings.xml similarity index 100% rename from res/values-iw-rIL/strings.xml rename to core/src/main/res/values-iw-rIL/strings.xml diff --git a/res/values-ko/strings.xml b/core/src/main/res/values-ko/strings.xml similarity index 100% rename from res/values-ko/strings.xml rename to core/src/main/res/values-ko/strings.xml diff --git a/res/values-land/styles.xml b/core/src/main/res/values-land/styles.xml similarity index 100% rename from res/values-land/styles.xml rename to core/src/main/res/values-land/styles.xml diff --git a/res/values-large/dimens.xml b/core/src/main/res/values-large/dimens.xml similarity index 100% rename from res/values-large/dimens.xml rename to core/src/main/res/values-large/dimens.xml diff --git a/res/values-nl/strings.xml b/core/src/main/res/values-nl/strings.xml similarity index 100% rename from res/values-nl/strings.xml rename to core/src/main/res/values-nl/strings.xml diff --git a/res/values-pl-rPL/strings.xml b/core/src/main/res/values-pl-rPL/strings.xml similarity index 100% rename from res/values-pl-rPL/strings.xml rename to core/src/main/res/values-pl-rPL/strings.xml diff --git a/res/values-pt-rBR/strings.xml b/core/src/main/res/values-pt-rBR/strings.xml similarity index 100% rename from res/values-pt-rBR/strings.xml rename to core/src/main/res/values-pt-rBR/strings.xml diff --git a/res/values-pt/strings.xml b/core/src/main/res/values-pt/strings.xml similarity index 100% rename from res/values-pt/strings.xml rename to core/src/main/res/values-pt/strings.xml diff --git a/res/values-ro-rRO/strings.xml b/core/src/main/res/values-ro-rRO/strings.xml similarity index 100% rename from res/values-ro-rRO/strings.xml rename to core/src/main/res/values-ro-rRO/strings.xml diff --git a/res/values-ru/strings.xml b/core/src/main/res/values-ru/strings.xml similarity index 100% rename from res/values-ru/strings.xml rename to core/src/main/res/values-ru/strings.xml diff --git a/res/values-sv-rSE/strings.xml b/core/src/main/res/values-sv-rSE/strings.xml similarity index 100% rename from res/values-sv-rSE/strings.xml rename to core/src/main/res/values-sv-rSE/strings.xml diff --git a/res/values-uk-rUA/strings.xml b/core/src/main/res/values-uk-rUA/strings.xml similarity index 100% rename from res/values-uk-rUA/strings.xml rename to core/src/main/res/values-uk-rUA/strings.xml diff --git a/res/values-v11/colors.xml b/core/src/main/res/values-v11/colors.xml similarity index 100% rename from res/values-v11/colors.xml rename to core/src/main/res/values-v11/colors.xml diff --git a/res/values-v14/dimens.xml b/core/src/main/res/values-v14/dimens.xml similarity index 100% rename from res/values-v14/dimens.xml rename to core/src/main/res/values-v14/dimens.xml diff --git a/res/values-v14/styles.xml b/core/src/main/res/values-v14/styles.xml similarity index 100% rename from res/values-v14/styles.xml rename to core/src/main/res/values-v14/styles.xml diff --git a/res/values-v16/styles.xml b/core/src/main/res/values-v16/styles.xml similarity index 100% rename from res/values-v16/styles.xml rename to core/src/main/res/values-v16/styles.xml diff --git a/res/values-v19/colors.xml b/core/src/main/res/values-v19/colors.xml similarity index 100% rename from res/values-v19/colors.xml rename to core/src/main/res/values-v19/colors.xml diff --git a/res/values-zh-rCN/strings.xml b/core/src/main/res/values-zh-rCN/strings.xml similarity index 100% rename from res/values-zh-rCN/strings.xml rename to core/src/main/res/values-zh-rCN/strings.xml diff --git a/res/values/arrays.xml b/core/src/main/res/values/arrays.xml similarity index 100% rename from res/values/arrays.xml rename to core/src/main/res/values/arrays.xml diff --git a/res/values/attrs.xml b/core/src/main/res/values/attrs.xml similarity index 100% rename from res/values/attrs.xml rename to core/src/main/res/values/attrs.xml diff --git a/res/values/colors.xml b/core/src/main/res/values/colors.xml similarity index 100% rename from res/values/colors.xml rename to core/src/main/res/values/colors.xml diff --git a/res/values/dimens.xml b/core/src/main/res/values/dimens.xml similarity index 100% rename from res/values/dimens.xml rename to core/src/main/res/values/dimens.xml diff --git a/res/values/ids.xml b/core/src/main/res/values/ids.xml similarity index 100% rename from res/values/ids.xml rename to core/src/main/res/values/ids.xml diff --git a/res/values/integers.xml b/core/src/main/res/values/integers.xml similarity index 100% rename from res/values/integers.xml rename to core/src/main/res/values/integers.xml diff --git a/res/values/strings.xml b/core/src/main/res/values/strings.xml similarity index 100% rename from res/values/strings.xml rename to core/src/main/res/values/strings.xml diff --git a/res/values/styles.xml b/core/src/main/res/values/styles.xml similarity index 100% rename from res/values/styles.xml rename to core/src/main/res/values/styles.xml diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6c3897a9c..b6dc96bf1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Sep 28 21:26:43 CEST 2014 +#Sun Oct 12 21:44:21 CEST 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip diff --git a/pom.xml b/pom.xml deleted file mode 100644 index c90a33f1c..000000000 --- a/pom.xml +++ /dev/null @@ -1,269 +0,0 @@ - - - 4.0.0 - de.danoeh - antennapod - apk - 0.9.9.4 - AntennaPod - - - - - android.support - compatibility-v4 - 19 - - - android.support - compatibility-v7-appcompat - 19 - apklib - - - android.support - compatibility-v7-appcompat - 19 - jar - - - com.google.android - android-test - 2.2.1 - - - org.apache.commons - commons-lang3 - 3.1 - - - org.shredzone.flattr4j - flattr4j-core - 2.7 - compile - - - org.apache.httpcomponents - httpcore - - - org.apache.httpcomponents - httpclient - - - org.json - json - - - - - android - android - provided - 4.4_r1 - - - com.google.android.annotations - annotations - 22.3 - provided - - - commons-io - commons-io - 2.4 - - - com.mobeta.android.dslv - drag-sort-listview - 0.6.1-SNAPSHOT - apklib - - - com.nineoldandroids - library - 2.4.0 - - - com.aocate - presto_client - 0.8.5 - jar - system - ${project.basedir}/libs/presto_client-0.8.5.jar - - - - - src - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - 3.8.0 - - - ${env.ANDROID_HOME} - 19 - - - true - - - true - - - alignApk - package - - zipalign - - - - - - - - - - development - - - - environment - !production - - - - In Development - - - - production - - In Production - - - - release - - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-jarsigner-plugin - - - signing - - sign - verify - - package - true - - true - - - ${project.build.directory}/${project.artifactId}-${project.version}.apk - - ${sign.keystore} - ${sign.alias} - ${sign.storepass} - ${sign.keypass} - true - - -sigalgMD5withRSA - -digestalgSHA1 - - - - - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - true - - - false - - - false - true - ${project.build.directory}/${project.artifactId}-${project.version}.apk - ${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk - - - - false - false - - - false - proguard-mvn.cfg - - - - - alignApk - package - - zipalign - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - - ${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk - apk - signed-aligned - - - ${project.build.directory}/proguard/mapping.txt - map - release - - - - - - attach-signed-aligned - package - - attach-artifact - - - - - - - - - - diff --git a/proguard-mvn.cfg b/proguard-mvn.cfg deleted file mode 100644 index 70019bfcb..000000000 --- a/proguard-mvn.cfg +++ /dev/null @@ -1,66 +0,0 @@ --printmapping out.map --renamesourcefileattribute SourceFile --keepattributes SourceFile,LineNumberTable - --dontpreverify --repackageclasses '' --allowaccessmodification --optimizations !code/simplification/arithmetic --keepattributes *Annotation* - --injars libs/presto_client-0.8.5.jar - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider - --keep public class * extends android.view.View { - public (android.content.Context); - public (android.content.Context, android.util.AttributeSet); - public (android.content.Context, android.util.AttributeSet, int); - public void set*(...); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.content.Context { - public void *(android.view.View); - public void *(android.view.MenuItem); -} - --keepclassmembers class * implements android.os.Parcelable { - static android.os.Parcelable$Creator CREATOR; -} - --keepclassmembers class **.R$* { - public static ; -} - --keep class android.support.v4.** { *; } --keep interface android.support.v4.** { *; } --keep class android.support.v7.** { *; } --keep interface android.support.v7.** { *; } --dontwarn android.support.v4.** --dontwarn android.support.v7.** - --keepattributes *Annotation* - --keep class org.shredzone.flattr4j.** { *; } --dontwarn org.shredzone.flattr4j.** - --keep class org.apache.commons.** { *; } - --dontskipnonpubliclibraryclassmembers diff --git a/proguard-project.txt b/proguard-project.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/settings.gradle b/settings.gradle index 6de43d84c..de34bc1c1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,2 @@ -include ':submodules:dslv:library' +include ':app', ':core' +include ':app:dslv:library' diff --git a/src/com/aocate/media/MediaPlayer.java b/src/com/aocate/media/MediaPlayer.java deleted file mode 100644 index 04ecd58a9..000000000 --- a/src/com/aocate/media/MediaPlayer.java +++ /dev/null @@ -1,1296 +0,0 @@ -// Copyright 2011, Aocate, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.aocate.media; - -import java.io.IOException; -import java.util.List; -import java.util.concurrent.locks.ReentrantLock; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.media.AudioManager; -import android.net.Uri; -import android.os.Handler; -import android.os.IBinder; -import android.os.Message; -import android.os.Handler.Callback; -import android.util.Log; - -import de.danoeh.antennapod.BuildConfig; - -public class MediaPlayer { - public interface OnBufferingUpdateListener { - public abstract void onBufferingUpdate(MediaPlayer arg0, int percent); - } - - public interface OnCompletionListener { - public abstract void onCompletion(MediaPlayer arg0); - } - - public interface OnErrorListener { - public abstract boolean onError(MediaPlayer arg0, int what, int extra); - } - - public interface OnInfoListener { - public abstract boolean onInfo(MediaPlayer arg0, int what, int extra); - } - - public interface OnPitchAdjustmentAvailableChangedListener { - /** - * - * @param arg0 - * The owning media player - * @param pitchAdjustmentAvailable - * True if pitch adjustment is available, false if not - */ - public abstract void onPitchAdjustmentAvailableChanged( - MediaPlayer arg0, boolean pitchAdjustmentAvailable); - } - - public interface OnPreparedListener { - public abstract void onPrepared(MediaPlayer arg0); - } - - public interface OnSeekCompleteListener { - public abstract void onSeekComplete(MediaPlayer arg0); - } - - public interface OnSpeedAdjustmentAvailableChangedListener { - /** - * - * @param arg0 - * The owning media player - * @param speedAdjustmentAvailable - * True if speed adjustment is available, false if not - */ - public abstract void onSpeedAdjustmentAvailableChanged( - MediaPlayer arg0, boolean speedAdjustmentAvailable); - } - - public enum State { - IDLE, INITIALIZED, PREPARED, STARTED, PAUSED, STOPPED, PREPARING, PLAYBACK_COMPLETED, END, ERROR - } - - private static Uri SPEED_ADJUSTMENT_MARKET_URI = Uri - .parse("market://details?id=com.aocate.presto"); - - private static Intent prestoMarketIntent = null; - - public static final int MEDIA_ERROR_SERVER_DIED = android.media.MediaPlayer.MEDIA_ERROR_SERVER_DIED; - public static final int MEDIA_ERROR_UNKNOWN = android.media.MediaPlayer.MEDIA_ERROR_UNKNOWN; - public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = android.media.MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK; - - /** - * Indicates whether the specified action can be used as an intent. This - * method queries the package manager for installed packages that can - * respond to an intent with the specified action. If no suitable package is - * found, this method returns false. - * - * @param context - * The application's environment. - * @param action - * The Intent action to check for availability. - * - * @return True if an Intent with the specified action can be sent and - * responded to, false otherwise. - */ - public static boolean isIntentAvailable(Context context, String action) { - final PackageManager packageManager = context.getPackageManager(); - final Intent intent = new Intent(action); - List list = packageManager.queryIntentServices(intent, - PackageManager.MATCH_DEFAULT_ONLY); - return list.size() > 0; - } - - /** - * Indicates whether the Presto library is installed - * - * @param context - * The context to use to query the package manager. - * @return True if the Presto library is installed, false if not. - */ - public static boolean isPrestoLibraryInstalled(Context context) { - return isIntentAvailable(context, ServiceBackedMediaPlayer.INTENT_NAME); - } - - /** - * Return an Intent that opens the Android Market page for the speed - * alteration library - * - * @return The Intent for the Presto library on the Android Market - */ - public static Intent getPrestoMarketIntent() { - if (prestoMarketIntent == null) { - prestoMarketIntent = new Intent(Intent.ACTION_VIEW, - SPEED_ADJUSTMENT_MARKET_URI); - } - return prestoMarketIntent; - } - - /** - * Open the Android Market page for the Presto library - * - * @param context - * The context from which to open the Android Market page - */ - public static void openPrestoMarketIntent(Context context) { - context.startActivity(getPrestoMarketIntent()); - } - - private static final String MP_TAG = "AocateReplacementMediaPlayer"; - - private static final double PITCH_STEP_CONSTANT = 1.0594630943593; - - private AndroidMediaPlayer amp = null; - // This is whether speed adjustment should be enabled (by the Service) - // To avoid the Service entirely, set useService to false - protected boolean enableSpeedAdjustment = true; - private int lastKnownPosition = 0; - // In some cases, we're going to have to replace the - // android.media.MediaPlayer on the fly, and we don't want to touch the - // wrong media player, so lock it way too much. - ReentrantLock lock = new ReentrantLock(); - private int mAudioStreamType = AudioManager.STREAM_MUSIC; - private Context mContext; - private boolean mIsLooping = false; - private float mLeftVolume = 1f; - private float mPitchStepsAdjustment = 0f; - private float mRightVolume = 1f; - private float mSpeedMultiplier = 1f; - private int mWakeMode = 0; - MediaPlayerImpl mpi = null; - protected boolean pitchAdjustmentAvailable = false; - private ServiceBackedMediaPlayer sbmp = null; - protected boolean speedAdjustmentAvailable = false; - - private Handler mServiceDisconnectedHandler = null; - - // Some parts of state cannot be found by calling MediaPlayerImpl functions, - // so store our own state. This also helps copy state when changing - // implementations - State state = State.INITIALIZED; - String stringDataSource = null; - Uri uriDataSource = null; - private boolean useService = false; - - // Naming Convention for Listeners - // Most listeners can both be set by clients and called by MediaPlayImpls - // There are a few that have to do things in this class as well as calling - // the function. In all cases, onX is what is called by MediaPlayerImpl - // If there is work to be done in this class, then the listener that is - // set by setX is X (with the first letter lowercase). - OnBufferingUpdateListener onBufferingUpdateListener = null; - OnCompletionListener onCompletionListener = null; - OnErrorListener onErrorListener = null; - OnInfoListener onInfoListener = null; - - // Special case. Pitch adjustment ceases to be available when we switch - // to the android.media.MediaPlayer (though it is not guaranteed to be - // available when using the ServiceBackedMediaPlayer) - OnPitchAdjustmentAvailableChangedListener onPitchAdjustmentAvailableChangedListener = new OnPitchAdjustmentAvailableChangedListener() { - public void onPitchAdjustmentAvailableChanged(MediaPlayer arg0, - boolean pitchAdjustmentAvailable) { - lock.lock(); - try { - Log - .d( - MP_TAG, - "onPitchAdjustmentAvailableChangedListener.onPitchAdjustmentAvailableChanged being called"); - if (MediaPlayer.this.pitchAdjustmentAvailable != pitchAdjustmentAvailable) { - Log.d(MP_TAG, "Pitch adjustment state has changed from " - + MediaPlayer.this.pitchAdjustmentAvailable - + " to " + pitchAdjustmentAvailable); - MediaPlayer.this.pitchAdjustmentAvailable = pitchAdjustmentAvailable; - if (MediaPlayer.this.pitchAdjustmentAvailableChangedListener != null) { - MediaPlayer.this.pitchAdjustmentAvailableChangedListener - .onPitchAdjustmentAvailableChanged(arg0, - pitchAdjustmentAvailable); - } - } - } finally { - lock.unlock(); - } - } - }; - OnPitchAdjustmentAvailableChangedListener pitchAdjustmentAvailableChangedListener = null; - - MediaPlayer.OnPreparedListener onPreparedListener = new MediaPlayer.OnPreparedListener() { - public void onPrepared(MediaPlayer arg0) { - Log.d(MP_TAG, "onPreparedListener 242 setting state to PREPARED"); - MediaPlayer.this.state = State.PREPARED; - if (MediaPlayer.this.preparedListener != null) { - Log.d(MP_TAG, "Calling preparedListener"); - MediaPlayer.this.preparedListener.onPrepared(arg0); - } - Log.d(MP_TAG, "Wrap up onPreparedListener"); - } - }; - - OnPreparedListener preparedListener = null; - OnSeekCompleteListener onSeekCompleteListener = null; - - // Special case. Speed adjustment ceases to be available when we switch - // to the android.media.MediaPlayer (though it is not guaranteed to be - // available when using the ServiceBackedMediaPlayer) - OnSpeedAdjustmentAvailableChangedListener onSpeedAdjustmentAvailableChangedListener = new OnSpeedAdjustmentAvailableChangedListener() { - public void onSpeedAdjustmentAvailableChanged(MediaPlayer arg0, - boolean speedAdjustmentAvailable) { - lock.lock(); - try { - Log - .d( - MP_TAG, - "onSpeedAdjustmentAvailableChangedListener.onSpeedAdjustmentAvailableChanged being called"); - if (MediaPlayer.this.speedAdjustmentAvailable != speedAdjustmentAvailable) { - Log.d(MP_TAG, "Speed adjustment state has changed from " - + MediaPlayer.this.speedAdjustmentAvailable - + " to " + speedAdjustmentAvailable); - MediaPlayer.this.speedAdjustmentAvailable = speedAdjustmentAvailable; - if (MediaPlayer.this.speedAdjustmentAvailableChangedListener != null) { - MediaPlayer.this.speedAdjustmentAvailableChangedListener - .onSpeedAdjustmentAvailableChanged(arg0, - speedAdjustmentAvailable); - } - } - } finally { - lock.unlock(); - } - } - }; - OnSpeedAdjustmentAvailableChangedListener speedAdjustmentAvailableChangedListener = null; - - private int speedAdjustmentAlgorithm = SpeedAdjustmentAlgorithm.SONIC; - - public MediaPlayer(final Context context) { - this(context, true); - } - - public MediaPlayer(final Context context, boolean useService) { - this.mContext = context; - this.useService = useService; - - // So here's the major problem - // Sometimes the service won't exist or won't be connected, - // so start with an android.media.MediaPlayer, and when - // the service is connected, use that from then on - this.mpi = this.amp = new AndroidMediaPlayer(this, context); - - // setupMpi will go get the Service, if it can, then bring that - // implementation into sync - Log.d(MP_TAG, "setupMpi"); - setupMpi(context); - } - - private boolean invalidServiceConnectionConfiguration() { - if (!(this.mpi instanceof ServiceBackedMediaPlayer)) { - if (this.useService && isPrestoLibraryInstalled()) { - // In this case, the Presto library has been installed - // or something while playing sound - // We could be using the service, but we're not - Log.d(MP_TAG, "We could be using the service, but we're not 316"); - return true; - } - // If useService is false, then we shouldn't be using the SBMP - // If the Presto library isn't installed, ditto - Log.d(MP_TAG, "this.mpi is not a ServiceBackedMediaPlayer, but we couldn't use it anyway 321"); - return false; - } else { - if (BuildConfig.DEBUG && !(this.mpi instanceof ServiceBackedMediaPlayer)) throw new AssertionError(); - if (this.useService && isPrestoLibraryInstalled()) { - // We should be using the service, and we are. Great! - Log.d(MP_TAG, "We could be using a ServiceBackedMediaPlayer and we are 327"); - return false; - } - // We're trying to use the service when we shouldn't, - // that's an invalid configuration - Log.d(MP_TAG, "We're trying to use a ServiceBackedMediaPlayer but we shouldn't be 332"); - return true; - } - } - - private void setupMpi(final Context context) { - lock.lock(); - try { - Log.d(MP_TAG, "setupMpi 336"); - // Check if the client wants to use the service at all, - // then if we're already using the right kind of media player - if (this.useService && isPrestoLibraryInstalled()) { - if ((this.mpi != null) - && (this.mpi instanceof ServiceBackedMediaPlayer)) { - Log.d(MP_TAG, "Already using ServiceBackedMediaPlayer"); - return; - } - if (this.sbmp == null) { - Log.d(MP_TAG, "Instantiating new ServiceBackedMediaPlayer 346"); - this.sbmp = new ServiceBackedMediaPlayer(this, context, - new ServiceConnection() { - public void onServiceConnected( - ComponentName className, - final IBinder service) { - Thread t = new Thread(new Runnable() { - public void run() { - // This lock probably isn't granular - // enough - MediaPlayer.this.lock.lock(); - Log.d(MP_TAG, - "onServiceConnected 257"); - try { - MediaPlayer.this - .switchMediaPlayerImpl( - MediaPlayer.this.amp, - MediaPlayer.this.sbmp); - Log.d(MP_TAG, "End onServiceConnected 362"); - } finally { - MediaPlayer.this.lock.unlock(); - } - } - }); - t.start(); - } - - public void onServiceDisconnected( - ComponentName className) { - MediaPlayer.this.lock.lock(); - try { - // Can't get any more useful information - // out of sbmp - if (MediaPlayer.this.sbmp != null) { - MediaPlayer.this.sbmp.release(); - } - // Unlike most other cases, sbmp gets set - // to null since there's nothing useful - // backing it now - MediaPlayer.this.sbmp = null; - - if (mServiceDisconnectedHandler == null) { - mServiceDisconnectedHandler = new Handler(new Callback() { - public boolean handleMessage(Message msg) { - // switchMediaPlayerImpl won't try to - // clone anything from null - lock.lock(); - try { - if (MediaPlayer.this.amp == null) { - // This should never be in this state - MediaPlayer.this.amp = new AndroidMediaPlayer( - MediaPlayer.this, - MediaPlayer.this.mContext); - } - // Use sbmp instead of null in case by some miracle it's - // been restored in the meantime - MediaPlayer.this.switchMediaPlayerImpl( - MediaPlayer.this.sbmp, - MediaPlayer.this.amp); - return true; - } - finally { - lock.unlock(); - } - } - }); - } - - // This code needs to execute on the - // original thread to instantiate - // the new object in the right place - mServiceDisconnectedHandler - .sendMessage( - mServiceDisconnectedHandler - .obtainMessage()); - // Note that we do NOT want to set - // useService. useService is about - // what the user wants, not what they - // get - } finally { - MediaPlayer.this.lock.unlock(); - } - } - } - ); - } - switchMediaPlayerImpl(this.amp, this.sbmp); - } else { - if ((this.mpi != null) - && (this.mpi instanceof AndroidMediaPlayer)) { - Log.d(MP_TAG, "Already using AndroidMediaPlayer"); - return; - } - if (this.amp == null) { - Log.d(MP_TAG, "Instantiating new AndroidMediaPlayer (this should be impossible)"); - this.amp = new AndroidMediaPlayer(this, context); - } - switchMediaPlayerImpl(this.sbmp, this.amp); - } - } finally { - lock.unlock(); - } - } - - private void switchMediaPlayerImpl(MediaPlayerImpl from, MediaPlayerImpl to) { - lock.lock(); - try { - Log.d(MP_TAG, "switchMediaPlayerImpl"); - if ((from == to) - // Same object, nothing to synchronize - || (to == null) - // Nothing to copy to (maybe this should throw an error?) - || ((to instanceof ServiceBackedMediaPlayer) && !((ServiceBackedMediaPlayer) to).isConnected()) - // ServiceBackedMediaPlayer hasn't yet connected, onServiceConnected will take care of the transition - || (MediaPlayer.this.state == State.END)) { - // State.END is after a release(), no further functions should - // be called on this class and from is likely to have problems - // retrieving state that won't be used anyway - return; - } - // Extract all that we can from the existing implementation - // and copy it to the new implementation - - Log.d(MP_TAG, "switchMediaPlayerImpl(), current state is " - + this.state.toString()); - - to.reset(); - - // Do this first so we don't have to prepare the same - // data file twice - to.setEnableSpeedAdjustment(MediaPlayer.this.enableSpeedAdjustment); - - // This is a reasonable place to set all of these, - // none of them require prepare() or the like first - to.setAudioStreamType(this.mAudioStreamType); - to.setSpeedAdjustmentAlgorithm(this.speedAdjustmentAlgorithm); - to.setLooping(this.mIsLooping); - to.setPitchStepsAdjustment(this.mPitchStepsAdjustment); - Log.d(MP_TAG, "Setting playback speed to " + this.mSpeedMultiplier); - to.setPlaybackSpeed(this.mSpeedMultiplier); - to.setVolume(MediaPlayer.this.mLeftVolume, - MediaPlayer.this.mRightVolume); - to.setWakeMode(this.mContext, this.mWakeMode); - - Log.d(MP_TAG, "asserting at least one data source is null"); - assert ((MediaPlayer.this.stringDataSource == null) || (MediaPlayer.this.uriDataSource == null)); - - if (uriDataSource != null) { - Log.d(MP_TAG, "switchMediaPlayerImpl(): uriDataSource != null"); - try { - to.setDataSource(this.mContext, uriDataSource); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (stringDataSource != null) { - Log.d(MP_TAG, - "switchMediaPlayerImpl(): stringDataSource != null"); - try { - to.setDataSource(stringDataSource); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if ((this.state == State.PREPARED) - || (this.state == State.PREPARING) - || (this.state == State.PAUSED) - || (this.state == State.STOPPED) - || (this.state == State.STARTED) - || (this.state == State.PLAYBACK_COMPLETED)) { - Log.d(MP_TAG, "switchMediaPlayerImpl(): prepare and seek"); - // Use prepare here instead of prepareAsync so that - // we wait for it to be ready before we try to use it - try { - to.muteNextOnPrepare(); - to.prepare(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - int seekPos = 0; - if (from != null) { - seekPos = from.getCurrentPosition(); - } else if (this.lastKnownPosition < to.getDuration()) { - // This can happen if the Service unexpectedly - // disconnected. Because it would result in too much - // information being passed around, we don't constantly - // poll for the lastKnownPosition, but we'll save it - // when getCurrentPosition is called - seekPos = this.lastKnownPosition; - } - to.muteNextSeek(); - to.seekTo(seekPos); - } - if ((from != null) - && from.isPlaying()) { - from.pause(); - } - if ((this.state == State.STARTED) - || (this.state == State.PAUSED) - || (this.state == State.STOPPED)) { - Log.d(MP_TAG, "switchMediaPlayerImpl(): start"); - if (to != null) { - to.start(); - } - } - - if (this.state == State.PAUSED) { - Log.d(MP_TAG, "switchMediaPlayerImpl(): paused"); - if (to != null) { - to.pause(); - } - } else if (this.state == State.STOPPED) { - Log.d(MP_TAG, "switchMediaPlayerImpl(): stopped"); - if (to != null) { - to.stop(); - } - } - - this.mpi = to; - - // Cheating here by relying on the side effect in - // on(Pitch|Speed)AdjustmentAvailableChanged - if ((to.canSetPitch() != this.pitchAdjustmentAvailable) - && (this.onPitchAdjustmentAvailableChangedListener != null)) { - this.onPitchAdjustmentAvailableChangedListener - .onPitchAdjustmentAvailableChanged(this, to - .canSetPitch()); - } - if ((to.canSetSpeed() != this.speedAdjustmentAvailable) - && (this.onSpeedAdjustmentAvailableChangedListener != null)) { - this.onSpeedAdjustmentAvailableChangedListener - .onSpeedAdjustmentAvailableChanged(this, to - .canSetSpeed()); - } - Log.d(MP_TAG, "switchMediaPlayerImpl() 625 " + this.state.toString()); - } finally { - lock.unlock(); - } - } - - /** - * Returns true if pitch can be changed at this moment - * - * @return True if pitch can be changed - */ - public boolean canSetPitch() { - lock.lock(); - try { - return this.mpi.canSetPitch(); - } finally { - lock.unlock(); - } - } - - /** - * Returns true if speed can be changed at this moment - * - * @return True if speed can be changed - */ - public boolean canSetSpeed() { - lock.lock(); - try { - return this.mpi.canSetSpeed(); - } finally { - lock.unlock(); - } - } - - protected void finalize() throws Throwable { - lock.lock(); - try { - Log.d(MP_TAG, "finalize() 626"); - this.release(); - } finally { - lock.unlock(); - } - } - - /** - * Returns the number of steps (in a musical scale) by which playback is - * currently shifted. When greater than zero, pitch is shifted up. When less - * than zero, pitch is shifted down. - * - * @return The number of steps pitch is currently shifted by - */ - public float getCurrentPitchStepsAdjustment() { - lock.lock(); - try { - return this.mpi.getCurrentPitchStepsAdjustment(); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.getCurrentPosition() - * Accurate only to frame size of encoded data (26 ms for MP3s) - * - * @return Current position (in milliseconds) - */ - public int getCurrentPosition() { - lock.lock(); - try { - return (this.lastKnownPosition = this.mpi.getCurrentPosition()); - } finally { - lock.unlock(); - } - } - - /** - * Returns the current speed multiplier. Defaults to 1.0 (normal speed) - * - * @return The current speed multiplier - */ - public float getCurrentSpeedMultiplier() { - lock.lock(); - try { - return this.mpi.getCurrentSpeedMultiplier(); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.getDuration() - * - * @return Length of the track (in milliseconds) - */ - public int getDuration() { - lock.lock(); - try { - return this.mpi.getDuration(); - } finally { - lock.unlock(); - } - } - - /** - * Get the maximum value that can be passed to setPlaybackSpeed - * - * @return The maximum speed multiplier - */ - public float getMaxSpeedMultiplier() { - lock.lock(); - try { - return this.mpi.getMaxSpeedMultiplier(); - } finally { - lock.unlock(); - } - } - - /** - * Get the minimum value that can be passed to setPlaybackSpeed - * - * @return The minimum speed multiplier - */ - public float getMinSpeedMultiplier() { - lock.lock(); - try { - return this.mpi.getMinSpeedMultiplier(); - } finally { - lock.unlock(); - } - } - - /** - * Gets the version code of the backing service - * @return -1 if ServiceBackedMediaPlayer is not used, 0 if the service is not - * connected, otherwise the version code retrieved from the service - */ - public int getServiceVersionCode() { - lock.lock(); - try { - if (this.mpi instanceof ServiceBackedMediaPlayer) { - return ((ServiceBackedMediaPlayer) this.mpi).getServiceVersionCode(); - } - else { - return -1; - } - } - finally { - lock.unlock(); - } - } - - /** - * Gets the version name of the backing service - * @return null if ServiceBackedMediaPlayer is not used, empty string if - * the service is not connected, otherwise the version name retrieved from - * the service - */ - public String getServiceVersionName() { - lock.lock(); - try { - if (this.mpi instanceof ServiceBackedMediaPlayer) { - return ((ServiceBackedMediaPlayer) this.mpi).getServiceVersionName(); - } - else { - return null; - } - } - finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.isLooping() - * - * @return True if the track is looping - */ - public boolean isLooping() { - lock.lock(); - try { - return this.mpi.isLooping(); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.isPlaying() - * - * @return True if the track is playing - */ - public boolean isPlaying() { - lock.lock(); - try { - return this.mpi.isPlaying(); - } finally { - lock.unlock(); - } - } - - /** - * Returns true if this MediaPlayer has access to the Presto - * library - * - * @return True if the Presto library is installed - */ - public boolean isPrestoLibraryInstalled() { - if ((this.mpi == null) || (this.mpi.mContext == null)) { - return false; - } - return isPrestoLibraryInstalled(this.mpi.mContext); - } - - /** - * Open the Android Market page in the same context as this MediaPlayer - */ - public void openPrestoMarketIntent() { - if ((this.mpi != null) && (this.mpi.mContext != null)) { - openPrestoMarketIntent(this.mpi.mContext); - } - } - - /** - * Functions identically to android.media.MediaPlayer.pause() Pauses the - * track - */ - public void pause() { - lock.lock(); - try { - if (invalidServiceConnectionConfiguration()) { - setupMpi(this.mpi.mContext); - } - this.state = State.PAUSED; - this.mpi.pause(); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.prepare() Prepares the - * track. This or prepareAsync must be called before start() - */ - public void prepare() throws IllegalStateException, IOException { - lock.lock(); - try { - Log.d(MP_TAG, "prepare() 746 using " + ((this.mpi == null) ? "null (this shouldn't happen)" : this.mpi.getClass().toString()) + " state " + this.state.toString()); - Log.d(MP_TAG, "onPreparedListener is: " + ((this.onPreparedListener == null) ? "null" : "non-null")); - Log.d(MP_TAG, "preparedListener is: " + ((this.preparedListener == null) ? "null" : "non-null")); - if (invalidServiceConnectionConfiguration()) { - setupMpi(this.mpi.mContext); - } - this.mpi.prepare(); - this.state = State.PREPARED; - Log.d(MP_TAG, "prepare() finished 778"); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.prepareAsync() - * Prepares the track. This or prepare must be called before start() - */ - public void prepareAsync() { - lock.lock(); - try { - Log.d(MP_TAG, "prepareAsync() 779"); - if (invalidServiceConnectionConfiguration()) { - setupMpi(this.mpi.mContext); - } - this.state = State.PREPARING; - this.mpi.prepareAsync(); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.release() Releases the - * underlying resources used by the media player. - */ - public void release() { - lock.lock(); - try { - Log.d(MP_TAG, "Releasing MediaPlayer 791"); - - this.state = State.END; - if (this.amp != null) { - this.amp.release(); - } - if (this.sbmp != null) { - this.sbmp.release(); - } - - this.onBufferingUpdateListener = null; - this.onCompletionListener = null; - this.onErrorListener = null; - this.onInfoListener = null; - this.preparedListener = null; - this.onPitchAdjustmentAvailableChangedListener = null; - this.pitchAdjustmentAvailableChangedListener = null; - Log.d(MP_TAG, "Setting onSeekCompleteListener to null 871"); - this.onSeekCompleteListener = null; - this.onSpeedAdjustmentAvailableChangedListener = null; - this.speedAdjustmentAvailableChangedListener = null; - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.reset() Resets the - * track to idle state - */ - public void reset() { - lock.lock(); - try { - this.state = State.IDLE; - this.stringDataSource = null; - this.uriDataSource = null; - this.mpi.reset(); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.seekTo(int msec) Seeks - * to msec in the track - */ - public void seekTo(int msec) throws IllegalStateException { - lock.lock(); - try { - this.mpi.seekTo(msec); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.setAudioStreamType(int - * streamtype) Sets the audio stream type. - */ - public void setAudioStreamType(int streamtype) { - lock.lock(); - try { - this.mAudioStreamType = streamtype; - this.mpi.setAudioStreamType(streamtype); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.setDataSource(Context - * context, Uri uri) Sets uri as data source in the context given - */ - public void setDataSource(Context context, Uri uri) - throws IllegalArgumentException, IllegalStateException, IOException { - lock.lock(); - try { - Log.d(MP_TAG, "In setDataSource(context, " + uri.toString() + "), using " + this.mpi.getClass().toString()); - if (invalidServiceConnectionConfiguration()) { - setupMpi(this.mpi.mContext); - } - this.state = State.INITIALIZED; - this.stringDataSource = null; - this.uriDataSource = uri; - this.mpi.setDataSource(context, uri); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.setDataSource(String - * path) Sets the data source of the track to a file given. - */ - public void setDataSource(String path) throws IllegalArgumentException, - IllegalStateException, IOException { - lock.lock(); - try { - Log.d(MP_TAG, "In setDataSource(context, " + path + ")"); - if (invalidServiceConnectionConfiguration()) { - setupMpi(this.mpi.mContext); - } - this.state = State.INITIALIZED; - this.stringDataSource = path; - this.uriDataSource = null; - this.mpi.setDataSource(path); - } finally { - lock.unlock(); - } - } - - /** - * Sets whether to use speed adjustment or not. Speed adjustment on is more - * computation-intensive than with it off. - * - * @param enableSpeedAdjustment - * Whether speed adjustment should be supported. - */ - public void setEnableSpeedAdjustment(boolean enableSpeedAdjustment) { - lock.lock(); - try { - this.enableSpeedAdjustment = enableSpeedAdjustment; - this.mpi.setEnableSpeedAdjustment(enableSpeedAdjustment); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.setLooping(boolean - * loop) Sets the track to loop infinitely if loop is true, play once if - * loop is false - */ - public void setLooping(boolean loop) { - lock.lock(); - try { - this.mIsLooping = loop; - this.mpi.setLooping(loop); - } finally { - lock.unlock(); - } - } - - /** - * Sets the number of steps (in a musical scale) by which playback is - * currently shifted. When greater than zero, pitch is shifted up. When less - * than zero, pitch is shifted down. - * - * @param pitchSteps - * The number of steps by which to shift playback - */ - public void setPitchStepsAdjustment(float pitchSteps) { - lock.lock(); - try { - this.mPitchStepsAdjustment = pitchSteps; - this.mpi.setPitchStepsAdjustment(pitchSteps); - } finally { - lock.unlock(); - } - } - - /** - * Set the algorithm to use for changing the speed and pitch of audio - * See SpeedAdjustmentAlgorithm constants for more details - * @param algorithm The algorithm to use. - */ - public void setSpeedAdjustmentAlgorithm(int algorithm) { - lock.lock(); - try { - this.speedAdjustmentAlgorithm = algorithm; - if (this.mpi != null) { - this.mpi.setSpeedAdjustmentAlgorithm(algorithm); - } - } - finally { - lock.unlock(); - } - } - - private static float getPitchStepsAdjustment(float pitch) { - return (float) (Math.log(pitch) / (2 * Math.log(PITCH_STEP_CONSTANT))); - } - - /** - * Sets the percentage by which pitch is currently shifted. When greater - * than zero, pitch is shifted up. When less than zero, pitch is shifted - * down - * - * @param f - * The percentage to shift pitch - */ - public void setPlaybackPitch(float pitch) { - lock.lock(); - try { - this.mPitchStepsAdjustment = getPitchStepsAdjustment(pitch); - this.mpi.setPlaybackPitch(pitch); - } finally { - lock.unlock(); - } - } - - /** - * Set playback speed. 1.0 is normal speed, 2.0 is double speed, and so on. - * Speed should never be set to 0 or below. - * - * @param f - * The speed multiplier to use for further playback - */ - public void setPlaybackSpeed(float f) { - lock.lock(); - try { - this.mSpeedMultiplier = f; - this.mpi.setPlaybackSpeed(f); - } finally { - lock.unlock(); - } - } - - /** - * Sets whether to use speed adjustment or not. Speed adjustment on is more - * computation-intensive than with it off. - * - * @param enableSpeedAdjustment - * Whether speed adjustment should be supported. - */ - public void setUseService(boolean useService) { - lock.lock(); - try { - this.useService = useService; - setupMpi(this.mpi.mContext); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.setVolume(float - * leftVolume, float rightVolume) Sets the stereo volume - */ - public void setVolume(float leftVolume, float rightVolume) { - lock.lock(); - try { - this.mLeftVolume = leftVolume; - this.mRightVolume = rightVolume; - this.mpi.setVolume(leftVolume, rightVolume); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.setWakeMode(Context - * context, int mode) Acquires a wake lock in the context given. You must - * request the appropriate permissions in your AndroidManifest.xml file. - */ - public void setWakeMode(Context context, int mode) { - lock.lock(); - try { - this.mWakeMode = mode; - this.mpi.setWakeMode(context, mode); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to - * android.media.MediaPlayer.setOnCompletionListener(OnCompletionListener - * listener) Sets a listener to be used when a track completes playing. - */ - public void setOnBufferingUpdateListener(OnBufferingUpdateListener listener) { - lock.lock(); - try { - this.onBufferingUpdateListener = listener; - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to - * android.media.MediaPlayer.setOnCompletionListener(OnCompletionListener - * listener) Sets a listener to be used when a track completes playing. - */ - public void setOnCompletionListener(OnCompletionListener listener) { - lock.lock(); - try { - this.onCompletionListener = listener; - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to - * android.media.MediaPlayer.setOnErrorListener(OnErrorListener listener) - * Sets a listener to be used when a track encounters an error. - */ - public void setOnErrorListener(OnErrorListener listener) { - lock.lock(); - try { - this.onErrorListener = listener; - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to - * android.media.MediaPlayer.setOnInfoListener(OnInfoListener listener) Sets - * a listener to be used when a track has info. - */ - public void setOnInfoListener(OnInfoListener listener) { - lock.lock(); - try { - this.onInfoListener = listener; - } finally { - lock.unlock(); - } - } - - /** - * Sets a listener that will fire when pitch adjustment becomes available or - * stops being available - */ - public void setOnPitchAdjustmentAvailableChangedListener( - OnPitchAdjustmentAvailableChangedListener listener) { - lock.lock(); - try { - this.pitchAdjustmentAvailableChangedListener = listener; - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to - * android.media.MediaPlayer.setOnPreparedListener(OnPreparedListener - * listener) Sets a listener to be used when a track finishes preparing. - */ - public void setOnPreparedListener(OnPreparedListener listener) { - lock.lock(); - Log.d(MP_TAG, " ++++++++++++++++++++++++++++++++++++++++++++ setOnPreparedListener"); - try { - this.preparedListener = listener; - // For this one, we do not explicitly set the MediaPlayer or the - // Service listener. This is because in addition to calling the - // listener provided by the client, it's necessary to change - // state to PREPARED. See prepareAsync for implementation details - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to - * android.media.MediaPlayer.setOnSeekCompleteListener - * (OnSeekCompleteListener listener) Sets a listener to be used when a track - * finishes seeking. - */ - public void setOnSeekCompleteListener(OnSeekCompleteListener listener) { - lock.lock(); - try { - this.onSeekCompleteListener = listener; - } finally { - lock.unlock(); - } - } - - /** - * Sets a listener that will fire when speed adjustment becomes available or - * stops being available - */ - public void setOnSpeedAdjustmentAvailableChangedListener( - OnSpeedAdjustmentAvailableChangedListener listener) { - lock.lock(); - try { - this.speedAdjustmentAvailableChangedListener = listener; - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.start() Starts a track - * playing - */ - public void start() { - lock.lock(); - try { - Log.d(MP_TAG, "start() 1149"); - if (invalidServiceConnectionConfiguration()) { - setupMpi(this.mpi.mContext); - } - this.state = State.STARTED; - Log.d(MP_TAG, "start() 1154"); - this.mpi.start(); - } finally { - lock.unlock(); - } - } - - /** - * Functions identically to android.media.MediaPlayer.stop() Stops a track - * playing and resets its position to the start. - */ - public void stop() { - lock.lock(); - try { - if (invalidServiceConnectionConfiguration()) { - setupMpi(this.mpi.mContext); - } - this.state = State.STOPPED; - this.mpi.stop(); - } finally { - lock.unlock(); - } - } -} \ No newline at end of file diff --git a/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java b/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java deleted file mode 100644 index 0dcf832f7..000000000 --- a/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java +++ /dev/null @@ -1,95 +0,0 @@ -package de.danoeh.antennapod.asynctask; - - -import android.annotation.SuppressLint; -import android.app.ProgressDialog; -import android.content.Context; -import android.net.Uri; -import android.os.AsyncTask; -import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.FlattrAuthActivity; -import de.danoeh.antennapod.util.flattr.FlattrUtils; -import org.shredzone.flattr4j.exception.FlattrException; -import org.shredzone.flattr4j.oauth.AccessToken; -import org.shredzone.flattr4j.oauth.AndroidAuthenticator; - -/** Fetches the access token in the background in order to avoid networkOnMainThread exception. */ - -public class FlattrTokenFetcher extends AsyncTask { - private static final String TAG = "FlattrTokenFetcher"; - Context context; - AndroidAuthenticator auth; - AccessToken token; - Uri uri; - ProgressDialog dialog; - FlattrException exception; - - public FlattrTokenFetcher(Context context, AndroidAuthenticator auth, Uri uri) { - super(); - this.context = context; - this.auth = auth; - this.uri = uri; - } - - @Override - protected void onPostExecute(AccessToken result) { - if (result != null) { - FlattrUtils.storeToken(result); - } - dialog.dismiss(); - if (exception == null) { - FlattrAuthActivity instance = FlattrAuthActivity.getInstance(); - if (instance != null) { - instance.handleAuthenticationSuccess(); - } else { - Log.e(TAG, "FlattrAuthActivity instance was null"); - } - } else { - FlattrUtils.showErrorDialog(context, exception.getMessage()); - } - } - - - - @Override - protected void onPreExecute() { - super.onPreExecute(); - dialog = new ProgressDialog(context); - dialog.setMessage(context.getString(R.string.processing_label)); - dialog.setIndeterminate(true); - dialog.setCancelable(false); - dialog.show(); - } - - - - @Override - protected AccessToken doInBackground(Void... params) { - try { - token = auth.fetchAccessToken(uri); - } catch (FlattrException e) { - e.printStackTrace(); - exception = e; - return null; - } - if (token != null) { - if (BuildConfig.DEBUG) Log.d(TAG, "Successfully got token"); - return token; - } else { - Log.w(TAG, "Flattr token was null"); - return null; - } - } - - @SuppressLint("NewApi") - public void executeAsync() { - if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { - executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } else { - execute(); - } - } - -} diff --git a/src/de/danoeh/antennapod/asynctask/OpmlExportWorker.java b/src/de/danoeh/antennapod/asynctask/OpmlExportWorker.java deleted file mode 100644 index 4abb1a67d..000000000 --- a/src/de/danoeh/antennapod/asynctask/OpmlExportWorker.java +++ /dev/null @@ -1,114 +0,0 @@ -package de.danoeh.antennapod.asynctask; - -import android.annotation.SuppressLint; -import android.app.AlertDialog; -import android.app.ProgressDialog; -import android.content.Context; -import android.content.DialogInterface; -import android.os.AsyncTask; -import android.util.Log; -import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.opml.OpmlWriter; -import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.LangUtils; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; - -/** Writes an OPML file into the export directory in the background. */ -public class OpmlExportWorker extends AsyncTask { - private static final String TAG = "OpmlExportWorker"; - private static final String DEFAULT_OUTPUT_NAME = "antennapod-feeds.opml"; - private Context context; - private File output; - - private ProgressDialog progDialog; - private Exception exception; - - public OpmlExportWorker(Context context, File output) { - this.context = context; - this.output = output; - } - - public OpmlExportWorker(Context context) { - this.context = context; - } - - @Override - protected Void doInBackground(Void... params) { - OpmlWriter opmlWriter = new OpmlWriter(); - if (output == null) { - output = new File( - UserPreferences.getDataFolder(context, PodcastApp.EXPORT_DIR), - DEFAULT_OUTPUT_NAME); - if (output.exists()) { - Log.w(TAG, "Overwriting previously exported file."); - output.delete(); - } - } - OutputStreamWriter writer = null; - try { - writer = new OutputStreamWriter(new FileOutputStream(output), LangUtils.UTF_8); - opmlWriter.writeDocument(DBReader.getFeedList(context), writer); - } catch (IOException e) { - e.printStackTrace(); - exception = e; - } finally { - if (writer != null) { - try { - writer.close(); - } catch (IOException ioe) { - exception = ioe; - } - } - } - return null; - } - - @Override - protected void onPostExecute(Void result) { - progDialog.dismiss(); - AlertDialog.Builder alert = new AlertDialog.Builder(context) - .setNeutralButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, - int which) { - dialog.dismiss(); - } - }); - if (exception != null) { - alert.setTitle(R.string.export_error_label); - alert.setMessage(exception.getMessage()); - } else { - alert.setTitle(R.string.opml_export_success_title); - alert.setMessage(context - .getString(R.string.opml_export_success_sum) - + output.toString()); - } - alert.create().show(); - } - - @Override - protected void onPreExecute() { - progDialog = new ProgressDialog(context); - progDialog.setMessage(context.getString(R.string.exporting_label)); - progDialog.setIndeterminate(true); - progDialog.show(); - } - - @SuppressLint("NewApi") - public void executeAsync() { - if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { - executeOnExecutor(THREAD_POOL_EXECUTOR); - } else { - execute(); - } - } - -} diff --git a/src/de/danoeh/antennapod/service/download/Downloader.java b/src/de/danoeh/antennapod/service/download/Downloader.java deleted file mode 100644 index 80cc5b3f8..000000000 --- a/src/de/danoeh/antennapod/service/download/Downloader.java +++ /dev/null @@ -1,69 +0,0 @@ -package de.danoeh.antennapod.service.download; - -import android.content.Context; -import android.net.wifi.WifiManager; -import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.R; - -import java.util.concurrent.Callable; - -/** Downloads files */ -public abstract class Downloader implements Callable { - private static final String TAG = "Downloader"; - - protected volatile boolean finished; - - protected volatile boolean cancelled; - - protected DownloadRequest request; - protected DownloadStatus result; - - public Downloader(DownloadRequest request) { - super(); - this.request = request; - this.request.setStatusMsg(R.string.download_pending); - this.cancelled = false; - this.result = new DownloadStatus(request, null, false, false, null); - } - - protected abstract void download(); - - public final Downloader call() { - WifiManager wifiManager = (WifiManager) PodcastApp.getInstance().getSystemService(Context.WIFI_SERVICE); - WifiManager.WifiLock wifiLock = null; - if (wifiManager != null) { - wifiLock = wifiManager.createWifiLock(TAG); - wifiLock.acquire(); - } - - download(); - - if (wifiLock != null) { - wifiLock.release(); - } - - if (result == null) { - throw new IllegalStateException( - "Downloader hasn't created DownloadStatus object"); - } - finished = true; - return this; - } - - public DownloadRequest getDownloadRequest() { - return request; - } - - public DownloadStatus getResult() { - return result; - } - - public boolean isFinished() { - return finished; - } - - public void cancel() { - cancelled = true; - } - -} \ No newline at end of file diff --git a/src/de/danoeh/antennapod/service/playback/PlayerStatus.java b/src/de/danoeh/antennapod/service/playback/PlayerStatus.java deleted file mode 100644 index 3d2b4ad39..000000000 --- a/src/de/danoeh/antennapod/service/playback/PlayerStatus.java +++ /dev/null @@ -1,14 +0,0 @@ -package de.danoeh.antennapod.service.playback; - -public enum PlayerStatus { - INDETERMINATE, // player is currently changing its state, listeners should wait until the player has left this state. - ERROR, - PREPARING, - PAUSED, - PLAYING, - STOPPED, - PREPARED, - SEEKING, - INITIALIZING, // playback service is loading the Playable's metadata - INITIALIZED // playback service was started, data source of media player was set. -} diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java b/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java deleted file mode 100644 index b45793b6b..000000000 --- a/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java +++ /dev/null @@ -1,51 +0,0 @@ -package de.danoeh.antennapod.syndication.namespace; - -import android.util.Log; - -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.feed.Chapter; -import de.danoeh.antennapod.feed.SimpleChapter; -import de.danoeh.antennapod.syndication.handler.HandlerState; -import de.danoeh.antennapod.syndication.util.SyndDateUtils; -import org.xml.sax.Attributes; - -import java.util.ArrayList; - -public class NSSimpleChapters extends Namespace { - private static final String TAG = "NSSimpleChapters"; - - public static final String NSTAG = "psc|sc"; - public static final String NSURI = "http://podlove.org/simple-chapters"; - - public static final String CHAPTERS = "chapters"; - public static final String CHAPTER = "chapter"; - public static final String START = "start"; - public static final String TITLE = "title"; - public static final String HREF = "href"; - - @Override - public SyndElement handleElementStart(String localName, HandlerState state, - Attributes attributes) { - if (localName.equals(CHAPTERS)) { - state.getCurrentItem().setChapters(new ArrayList()); - } else if (localName.equals(CHAPTER)) { - try { - state.getCurrentItem() - .getChapters() - .add(new SimpleChapter(SyndDateUtils - .parseTimeString(attributes.getValue(START)), - attributes.getValue(TITLE), state.getCurrentItem(), - attributes.getValue(HREF))); - } catch (NumberFormatException e) { - if (BuildConfig.DEBUG) Log.w(TAG, "Unable to read chapter", e); - } - } - - return new SyndElement(localName, this); - } - - @Override - public void handleElementEnd(String localName, HandlerState state) { - } - -} diff --git a/src/de/danoeh/antennapod/util/StorageUtils.java b/src/de/danoeh/antennapod/util/StorageUtils.java deleted file mode 100644 index ff0bde280..000000000 --- a/src/de/danoeh/antennapod/util/StorageUtils.java +++ /dev/null @@ -1,66 +0,0 @@ -package de.danoeh.antennapod.util; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Build; -import android.os.StatFs; -import android.util.Log; -import de.danoeh.antennapod.BuildConfig; -import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.activity.StorageErrorActivity; -import de.danoeh.antennapod.preferences.UserPreferences; - -import java.io.File; - -/** Utility functions for handling storage errors */ -public class StorageUtils { - private static final String TAG = "StorageUtils"; - - public static boolean storageAvailable(Context context) { - File dir = UserPreferences.getDataFolder(context, null); - if (dir != null) { - return dir.exists() && dir.canRead() && dir.canWrite(); - } else { - if (BuildConfig.DEBUG) - Log.d(TAG, "Storage not available: data folder is null"); - return false; - } - } - - /** - * Checks if external storage is available. If external storage isn't - * available, the current activity is finsished an an error activity is - * launched. - * - * @param activity - * the activity which would be finished if no storage is - * available - * @return true if external storage is available - */ - public static boolean checkStorageAvailability(Activity activity) { - boolean storageAvailable = storageAvailable(activity); - if (!storageAvailable) { - activity.finish(); - activity.startActivity(new Intent(activity, - StorageErrorActivity.class)); - } - return storageAvailable; - } - - /** Get the number of free bytes that are available on the external storage. */ - public static long getFreeSpaceAvailable() { - StatFs stat = new StatFs(UserPreferences.getDataFolder( - PodcastApp.getInstance(), null).getAbsolutePath()); - long availableBlocks; - long blockSize; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - availableBlocks = stat.getAvailableBlocksLong(); - blockSize = stat.getBlockSizeLong(); - } else { - availableBlocks = stat.getAvailableBlocks(); - blockSize = stat.getBlockSize(); - } - return availableBlocks * blockSize; - } -} diff --git a/src/de/danoeh/antennapod/util/ThemeUtils.java b/src/de/danoeh/antennapod/util/ThemeUtils.java deleted file mode 100644 index 8e593f3fb..000000000 --- a/src/de/danoeh/antennapod/util/ThemeUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package de.danoeh.antennapod.util; - -import android.util.Log; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.preferences.UserPreferences; - -public class ThemeUtils { - private static final String TAG = "ThemeUtils"; - - public static int getSelectionBackgroundColor() { - switch (UserPreferences.getTheme()) { - case R.style.Theme_AntennaPod_Dark: - return R.color.selection_background_color_dark; - case R.style.Theme_AntennaPod_Light: - return R.color.selection_background_color_light; - default: - Log.e(TAG, - "getSelectionBackgroundColor could not match the current theme to any color!"); - return R.color.selection_background_color_light; - } - } -} diff --git a/submodules/dslv b/submodules/dslv deleted file mode 160000 index cde289ca2..000000000 --- a/submodules/dslv +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cde289ca23772bbcd5c72c187011c6cbd22a76c9 diff --git a/tests/.classpath b/tests/.classpath deleted file mode 100644 index 62d428f2b..000000000 --- a/tests/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tests/.project b/tests/.project deleted file mode 100644 index 22c678688..000000000 --- a/tests/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - AntennaPodTest - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml deleted file mode 100644 index d2d661e83..000000000 --- a/tests/AndroidManifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/lint.xml b/tests/lint.xml deleted file mode 100644 index ee0eead5b..000000000 --- a/tests/lint.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/tests/project.properties b/tests/project.properties deleted file mode 100644 index 0840b4a05..000000000 --- a/tests/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-15 diff --git a/tests/res/drawable-hdpi/ic_launcher.png b/tests/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index 96a442e5b..000000000 Binary files a/tests/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/tests/res/drawable-ldpi/ic_launcher.png b/tests/res/drawable-ldpi/ic_launcher.png deleted file mode 100644 index 99238729d..000000000 Binary files a/tests/res/drawable-ldpi/ic_launcher.png and /dev/null differ diff --git a/tests/res/drawable-mdpi/ic_launcher.png b/tests/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 359047dfa..000000000 Binary files a/tests/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/tests/res/drawable-xhdpi/ic_launcher.png b/tests/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 71c6d760f..000000000 Binary files a/tests/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/tests/res/values/strings.xml b/tests/res/values/strings.xml deleted file mode 100644 index 8f0a2c82b..000000000 --- a/tests/res/values/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - AntennapodTestTest - - \ No newline at end of file