Merge branch 'develop'

This commit is contained in:
daniel oeh 2014-11-19 16:50:50 +01:00
commit 563ceaf393
933 changed files with 7479 additions and 6018 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "submodules/dslv"] [submodule "submodules/dslv"]
path = submodules/dslv path = submodules/dslv
url = git://github.com/danieloeh/drag-sort-listview.git url = git://github.com/danieloeh/drag-sort-listview.git
[submodule "app/dslv"]
path = app/dslv
url = https://github.com/danieloeh/drag-sort-listview.git

View File

@ -2,31 +2,33 @@
host = https://www.transifex.com host = https://www.transifex.com
[antennapod.english] [antennapod.english]
source_file = res/values/strings.xml source_file = core/src/main/res/values/strings.xml
source_lang = en source_lang = en
trans.az = res/values-az/strings.xml trans.az = core/src/main/res/values-az/strings.xml
trans.ca = res/values-ca/strings.xml trans.ca = core/src/main/res/values-ca/strings.xml
trans.cs_CZ = res/values-cs-rCZ/strings.xml trans.cs_CZ = core/src/main/res/values-cs-rCZ/strings.xml
trans.da = res/values-da/strings.xml trans.da = core/src/main/res/values-da/strings.xml
trans.de = res/values-de/strings.xml trans.de = core/src/main/res/values-de/strings.xml
trans.es = res/values-es/strings.xml trans.es = core/src/main/res/values-es/strings.xml
trans.es_ES = res/values-es-rES/strings.xml trans.es_ES = core/src/main/res/values-es-rES/strings.xml
trans.fr = res/values-fr/strings.xml trans.fr = core/src/main/res/values-fr/strings.xml
trans.he_IL = res/values-iw-rIL/strings.xml trans.he_IL = core/src/main/res/values-iw-rIL/strings.xml
trans.hi_IN = res/values-hi-rIN/strings.xml trans.hi_IN = core/src/main/res/values-hi-rIN/strings.xml
trans.it_IT = res/values-it-rIT/strings.xml trans.it_IT = core/src/main/res/values-it-rIT/strings.xml
trans.ko = res/values-ko/strings.xml trans.ja = core/src/main/res/values-ja/strings.xml
trans.nl = res/values-nl/strings.xml trans.ko = core/src/main/res/values-ko/strings.xml
trans.pl_PL = res/values-pl-rPL/strings.xml trans.nl = core/src/main/res/values-nl/strings.xml
trans.pt = res/values-pt/strings.xml trans.pl_PL = core/src/main/res/values-pl-rPL/strings.xml
trans.pt_BR = res/values-pt-rBR/strings.xml trans.pt = core/src/main/res/values-pt/strings.xml
trans.ro_RO = res/values-ro-rRO/strings.xml trans.pt_BR = core/src/main/res/values-pt-rBR/strings.xml
trans.ru = res/values-ru/strings.xml trans.ro_RO = core/src/main/res/values-ro-rRO/strings.xml
trans.ru-RU = res/values-ru/strings.xml trans.ru = core/src/main/res/values-ru/strings.xml
trans.ru_RU = res/values-ru/strings.xml trans.ru-RU = core/src/main/res/values-ru/strings.xml
trans.uk_UA = res/values-uk-rUA/strings.xml trans.ru_RU = core/src/main/res/values-ru/strings.xml
trans.zh_CN = res/values-zh-rCN/strings.xml trans.uk_UA = core/src/main/res/values-uk-rUA/strings.xml
trans.sv_SE = res/values-sv-rSE/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
trans.tr = core/src/main/res/values-tr/strings.xml
[antennapod.description] [antennapod.description]
file_filter = description/<lang>.txt file_filter = description/<lang>.txt

View File

@ -1,6 +1,14 @@
Change Log Change Log
========== ==========
Version 0.9.9.5
---------------
* Added support for paged feeds
* Improved user interface
* Added Japanese and Turkish translations
* Fixed more image loading problems
* Other bugfixes and improvements
Version 0.9.9.4 Version 0.9.9.4
--------------- ---------------
* Added option to keep notification and lockscreen controls when playback is paused * Added option to keep notification and lockscreen controls when playback is paused

View File

@ -37,3 +37,5 @@ Information on how to build AntennaPod can be found in the [Wiki](https://github
Bitcoin address: `1DzvtuvdW8VhDsq9GUytMyALmsHeaHEKbg` Bitcoin address: `1DzvtuvdW8VhDsq9GUytMyALmsHeaHEKbg`
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=370084)](https://www.bountysource.com/trackers/370084-antennapod?utm_source=370084&utm_medium=shield&utm_campaign=TRACKER_BADGE) [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=370084)](https://www.bountysource.com/trackers/370084-antennapod?utm_source=370084&utm_medium=shield&utm_campaign=TRACKER_BADGE)
[![Support via Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.png)](https://gratipay.com/danieloeh/)

92
app/build.gradle Normal file
View File

@ -0,0 +1,92 @@
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.2'
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 'org.jsoup:jsoup:1.7.3'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.squareup.okhttp:okhttp:2.1.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.1.0'
compile 'com.squareup.okio:okio:1.0.1'
compile project(':core')
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 21
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 {
minifyEnabled 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
}
}

1
app/dslv Submodule

@ -0,0 +1 @@
Subproject commit 80011c50e444e1c7d5e13b57bdb127b524a1ff92

1
app/settings.gradle Normal file
View File

@ -0,0 +1 @@
include ':app:dslv:library'

View File

@ -1,4 +1,4 @@
package instrumentationTest.de.test.antennapod; package de.test.antennapod;
import android.test.InstrumentationTestRunner; import android.test.InstrumentationTestRunner;
import android.test.suitebuilder.TestSuiteBuilder; import android.test.suitebuilder.TestSuiteBuilder;
@ -10,7 +10,7 @@ public class AntennaPodTestRunner extends InstrumentationTestRunner {
public TestSuite getAllTests() { public TestSuite getAllTests() {
return new TestSuiteBuilder(AntennaPodTestRunner.class) return new TestSuiteBuilder(AntennaPodTestRunner.class)
.includeAllPackagesUnderHere() .includeAllPackagesUnderHere()
.excludePackages("instrumentationTest.de.test.antennapod.gpodnet") .excludePackages("de.test.antennapod.gpodnet")
.build(); .build();
} }
} }

View File

@ -1,11 +1,11 @@
package instrumentationTest.de.test.antennapod.gpodnet; package de.test.antennapod.gpodnet;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.util.Log;
import de.danoeh.antennapod.gpoddernet.GpodnetService; import de.danoeh.antennapod.core.gpoddernet.GpodnetService;
import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException;
import de.danoeh.antennapod.gpoddernet.model.GpodnetDevice; import de.danoeh.antennapod.core.gpoddernet.model.GpodnetDevice;
import de.danoeh.antennapod.gpoddernet.model.GpodnetTag; import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -1,13 +1,13 @@
package instrumentationTest.de.test.antennapod.syndication.handler; package de.test.antennapod.handler;
import android.content.Context; import android.content.Context;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import de.danoeh.antennapod.feed.*; import de.danoeh.antennapod.core.feed.*;
import de.danoeh.antennapod.syndication.handler.FeedHandler; import de.danoeh.antennapod.core.syndication.handler.FeedHandler;
import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException; import de.danoeh.antennapod.core.syndication.handler.UnsupportedFeedtypeException;
import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.AtomGenerator; import de.test.antennapod.util.syndication.feedgenerator.AtomGenerator;
import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.FeedGenerator; import de.test.antennapod.util.syndication.feedgenerator.FeedGenerator;
import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.RSS2Generator; import de.test.antennapod.util.syndication.feedgenerator.RSS2Generator;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;

View File

@ -1,14 +1,14 @@
package instrumentationTest.de.test.antennapod.service.download; package de.test.antennapod.service.download;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import android.util.Log; import android.util.Log;
import de.danoeh.antennapod.feed.FeedFile; import de.danoeh.antennapod.core.feed.FeedFile;
import de.danoeh.antennapod.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadRequest;
import de.danoeh.antennapod.service.download.DownloadStatus; import de.danoeh.antennapod.core.service.download.DownloadStatus;
import de.danoeh.antennapod.service.download.Downloader; import de.danoeh.antennapod.core.service.download.Downloader;
import de.danoeh.antennapod.service.download.HttpDownloader; import de.danoeh.antennapod.core.service.download.HttpDownloader;
import de.danoeh.antennapod.util.DownloadError; import de.danoeh.antennapod.core.util.DownloadError;
import instrumentationTest.de.test.antennapod.util.service.download.HTTPBin; import de.test.antennapod.util.service.download.HTTPBin;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -65,7 +65,7 @@ public class HttpDownloaderTest extends InstrumentationTestCase {
private Downloader download(String url, String title, boolean expectedResult, boolean deleteExisting, String username, String password, boolean deleteOnFail) { private Downloader download(String url, String title, boolean expectedResult, boolean deleteExisting, String username, String password, boolean deleteOnFail) {
FeedFile feedFile = setupFeedFile(url, title, deleteExisting); FeedFile feedFile = setupFeedFile(url, title, deleteExisting);
DownloadRequest request = new DownloadRequest(feedFile.getFile_url(), url, title, 0, feedFile.getTypeAsInt(), username, password, deleteOnFail); DownloadRequest request = new DownloadRequest(feedFile.getFile_url(), url, title, 0, feedFile.getTypeAsInt(), username, password, deleteOnFail, null);
Downloader downloader = new HttpDownloader(request); Downloader downloader = new HttpDownloader(request);
downloader.call(); downloader.call();
DownloadStatus status = downloader.getResult(); DownloadStatus status = downloader.getResult();

View File

@ -1,16 +1,16 @@
package instrumentationTest.de.test.antennapod.service.playback; package de.test.antennapod.service.playback;
import android.content.Context; import android.content.Context;
import android.media.RemoteControlClient; import android.media.RemoteControlClient;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.service.playback.PlaybackServiceMediaPlayer; import de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer;
import de.danoeh.antennapod.service.playback.PlayerStatus; import de.danoeh.antennapod.core.service.playback.PlayerStatus;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.util.playback.Playable; import de.danoeh.antennapod.core.util.playback.Playable;
import instrumentationTest.de.test.antennapod.util.service.download.HTTPBin; import de.test.antennapod.util.service.download.HTTPBin;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -69,7 +69,7 @@ public class PlaybackServiceMediaPlayerTest extends InstrumentationTestCase {
assertTrue(cacheDir.canWrite()); assertTrue(cacheDir.canWrite());
assertTrue(cacheDir.canRead()); assertTrue(cacheDir.canRead());
if (!dest.exists()) { 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)); OutputStream o = new FileOutputStream(new File(cacheDir, PLAYABLE_DEST_URL));
IOUtils.copy(i, o); IOUtils.copy(i, o);
o.flush(); o.flush();

View File

@ -1,13 +1,13 @@
package instrumentationTest.de.test.antennapod.service.playback; package de.test.antennapod.service.playback;
import android.content.Context; import android.content.Context;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import de.danoeh.antennapod.feed.EventDistributor; import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.service.playback.PlaybackServiceTaskManager; import de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.util.playback.Playable; import de.danoeh.antennapod.core.util.playback.Playable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;

View File

@ -1,22 +1,21 @@
package instrumentationTest.de.test.antennapod.storage; package de.test.antennapod.storage;
import android.content.Context; import android.content.Context;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.storage.FeedItemStatistics; import de.danoeh.antennapod.core.storage.FeedItemStatistics;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.util.flattr.FlattrStatus; import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
import static instrumentationTest.de.test.antennapod.storage.DBTestUtils.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Random; 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 * Test class for DBReader
@ -44,7 +43,7 @@ public class DBReaderTest extends InstrumentationTestCase {
private void expiredFeedListTestHelper(long lastUpdate, long expirationTime, boolean shouldReturn) { private void expiredFeedListTestHelper(long lastUpdate, long expirationTime, boolean shouldReturn) {
final Context context = getInstrumentation().getTargetContext(); final Context context = getInstrumentation().getTargetContext();
Feed feed = new Feed(0, new Date(lastUpdate), "feed", "link", "descr", null, Feed feed = new Feed(0, new Date(lastUpdate), "feed", "link", "descr", null,
null, null, null, "feed", null, null, "url", false, new FlattrStatus()); null, null, null, "feed", null, null, "url", false, new FlattrStatus(), false, null);
feed.setItems(new ArrayList<FeedItem>()); feed.setItems(new ArrayList<FeedItem>());
PodDBAdapter adapter = new PodDBAdapter(context); PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open(); adapter.open();
@ -326,8 +325,9 @@ public class DBReaderTest extends InstrumentationTestCase {
public void testGetPlaybackHistory() { public void testGetPlaybackHistory() {
final Context context = getInstrumentation().getTargetContext(); final Context context = getInstrumentation().getTargetContext();
final int numItems = 10; final int numItems = (DBReader.PLAYBACK_HISTORY_SIZE+1) * 2;
final int playedItems = 5; final int playedItems = DBReader.PLAYBACK_HISTORY_SIZE + 1;
final int numReturnedItems = Math.min(playedItems, DBReader.PLAYBACK_HISTORY_SIZE);
final int numFeeds = 1; final int numFeeds = 1;
Feed feed = DBTestUtils.saveFeedlist(context, numFeeds, numItems, true).get(0); Feed feed = DBTestUtils.saveFeedlist(context, numFeeds, numItems, true).get(0);
@ -345,8 +345,8 @@ public class DBReaderTest extends InstrumentationTestCase {
List<FeedItem> saved = DBReader.getPlaybackHistory(context); List<FeedItem> saved = DBReader.getPlaybackHistory(context);
assertNotNull(saved); assertNotNull(saved);
assertEquals("Wrong size: ", playedItems, saved.size()); assertEquals("Wrong size: ", numReturnedItems, saved.size());
for (int i = 0; i < playedItems; i++) { for (int i = 0; i < numReturnedItems; i++) {
FeedItem item = saved.get(i); FeedItem item = saved.get(i);
assertNotNull(item.getMedia().getPlaybackCompletionDate()); assertNotNull(item.getMedia().getPlaybackCompletionDate());
assertEquals("Wrong sort order: ", item.getId(), ids[i]); assertEquals("Wrong sort order: ", item.getId(), ids[i]);

View File

@ -1,17 +1,17 @@
package instrumentationTest.de.test.antennapod.storage; package de.test.antennapod.storage;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.util.flattr.FlattrStatus; import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -20,7 +20,7 @@ import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import static instrumentationTest.de.test.antennapod.storage.DBTestUtils.*; import static de.test.antennapod.storage.DBTestUtils.*;
/** /**
* Test class for DBTasks * Test class for DBTasks
@ -296,7 +296,7 @@ public class DBTasksTest extends InstrumentationTestCase {
final Context context = getInstrumentation().getTargetContext(); final Context context = getInstrumentation().getTargetContext();
UserPreferences.setUpdateInterval(context, expirationTime); UserPreferences.setUpdateInterval(context, expirationTime);
Feed feed = new Feed(0, new Date(lastUpdate), "feed", "link", "descr", null, Feed feed = new Feed(0, new Date(lastUpdate), "feed", "link", "descr", null,
null, null, null, "feed", null, null, "url", false, new FlattrStatus()); null, null, null, "feed", null, null, "url", false, new FlattrStatus(), false, null);
feed.setItems(new ArrayList<FeedItem>()); feed.setItems(new ArrayList<FeedItem>());
PodDBAdapter adapter = new PodDBAdapter(context); PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open(); adapter.open();

View File

@ -1,12 +1,12 @@
package instrumentationTest.de.test.antennapod.storage; package de.test.antennapod.storage;
import android.content.Context; import android.content.Context;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.util.comparator.FeedItemPubdateComparator; import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator;
import de.danoeh.antennapod.util.flattr.FlattrStatus; import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
import junit.framework.Assert; import junit.framework.Assert;
import java.util.ArrayList; import java.util.ArrayList;
@ -32,7 +32,7 @@ public class DBTestUtils {
adapter.open(); adapter.open();
for (int i = 0; i < numFeeds; i++) { for (int i = 0; i < numFeeds; i++) {
Feed f = new Feed(0, new Date(), "feed " + i, "link" + i, "descr", null, null, Feed f = new Feed(0, new Date(), "feed " + i, "link" + i, "descr", null, null,
null, null, "id" + i, null, null, "url" + i, false, new FlattrStatus()); null, null, "id" + i, null, null, "url" + i, false, new FlattrStatus(), false, null);
f.setItems(new ArrayList<FeedItem>()); f.setItems(new ArrayList<FeedItem>());
for (int j = 0; j < numItems; j++) { for (int j = 0; j < numItems; j++) {
FeedItem item = new FeedItem(0, "item " + j, "id" + j, "link" + j, new Date(), FeedItem item = new FeedItem(0, "item " + j, "id" + j, "link" + j, new Date(),

View File

@ -1,16 +1,16 @@
package instrumentationTest.de.test.antennapod.storage; package de.test.antennapod.storage;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import android.util.Log; import android.util.Log;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedImage; import de.danoeh.antennapod.core.feed.FeedImage;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View File

@ -1,18 +1,17 @@
package instrumentationTest.de.test.antennapod.ui; package de.test.antennapod.ui;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources;
import android.test.ActivityInstrumentationTestCase2; import android.test.ActivityInstrumentationTestCase2;
import android.view.View; import android.view.View;
import com.robotium.solo.Solo; import com.robotium.solo.Solo;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity; import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivityGingerbread;
import de.danoeh.antennapod.feed.EventDistributor; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.preferences.PreferenceController;
/** /**
* User interface tests for MainActivity * User interface tests for MainActivity
@ -112,6 +111,6 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
public void testGoToPreferences() { public void testGoToPreferences() {
solo.setNavigationDrawer(Solo.CLOSED); solo.setNavigationDrawer(Solo.CLOSED);
solo.clickOnMenuItem(solo.getString(R.string.settings_label)); solo.clickOnMenuItem(solo.getString(R.string.settings_label));
solo.waitForActivity(PreferenceActivity.class); solo.waitForActivity(PreferenceController.getPreferenceActivity());
} }
} }

View File

@ -1,4 +1,4 @@
package instrumentationTest.de.test.antennapod.ui; package de.test.antennapod.ui;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -9,12 +9,12 @@ import com.robotium.solo.Solo;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.AudioplayerActivity; import de.danoeh.antennapod.activity.AudioplayerActivity;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package instrumentationTest.de.test.antennapod.ui; package de.test.antennapod.ui;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
@ -6,11 +6,10 @@ import android.graphics.Bitmap;
import android.os.Build; import android.os.Build;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.*; import de.danoeh.antennapod.core.feed.*;
import de.danoeh.antennapod.storage.DBWriter; import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.storage.PodDBAdapter; import de.test.antennapod.util.service.download.HTTPBin;
import instrumentationTest.de.test.antennapod.util.service.download.HTTPBin; import de.test.antennapod.util.syndication.feedgenerator.RSS2Generator;
import instrumentationTest.de.test.antennapod.util.syndication.feedgenerator.RSS2Generator;
import junit.framework.Assert; import junit.framework.Assert;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;

View File

@ -1,8 +1,8 @@
package instrumentationTest.de.test.antennapod.ui; package de.test.antennapod.ui;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
import java.io.File; import java.io.File;

View File

@ -1,4 +1,4 @@
package instrumentationTest.de.test.antennapod.ui; package de.test.antennapod.ui;
import android.test.ActivityInstrumentationTestCase2; import android.test.ActivityInstrumentationTestCase2;

View File

@ -1,8 +1,8 @@
package instrumentationTest.de.test.antennapod.util; package de.test.antennapod.util;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.core.util.Converter;
/** /**
* Test class for converter * Test class for converter

View File

@ -1,9 +1,9 @@
package instrumentationTest.de.test.antennapod.util; package de.test.antennapod.util;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import de.danoeh.antennapod.util.FileNameGenerator; import de.danoeh.antennapod.core.util.FileNameGenerator;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
public class FilenameGeneratorTest extends AndroidTestCase { public class FilenameGeneratorTest extends AndroidTestCase {

View File

@ -1,7 +1,7 @@
package instrumentationTest.de.test.antennapod.util; package de.test.antennapod.util;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import de.danoeh.antennapod.util.URIUtil; import de.danoeh.antennapod.core.util.URIUtil;
/** /**
* Test class for URIUtil * Test class for URIUtil

View File

@ -1,7 +1,7 @@
package instrumentationTest.de.test.antennapod.util; package de.test.antennapod.util;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import de.danoeh.antennapod.util.URLChecker; import de.danoeh.antennapod.core.util.URLChecker;
/** /**
* Test class for URLChecker * Test class for URLChecker

View File

@ -1,4 +1,4 @@
package instrumentationTest.de.test.antennapod.util.playback; package de.test.antennapod.util.playback;
import android.content.Context; import android.content.Context;
import android.test.InstrumentationTestCase; import android.test.InstrumentationTestCase;
@ -11,11 +11,11 @@ import org.jsoup.select.Elements;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.core.feed.Chapter;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.util.playback.Playable; import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.util.playback.Timeline; import de.danoeh.antennapod.core.util.playback.Timeline;
/** /**
* Test class for timeline * Test class for timeline

View File

@ -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.Base64;
import android.util.Log; import android.util.Log;

View File

@ -1,4 +1,4 @@
package instrumentationTest.de.test.antennapod.util.service.download; package de.test.antennapod.util.service.download;
import java.io.*; import java.io.*;
import java.net.InetAddress; import java.net.InetAddress;

View File

@ -1,7 +1,7 @@
package instrumentationTest.de.test.antennapod.util.syndication; package de.test.antennapod.util.syndication;
import android.test.InstrumentationTestCase; 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.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;

View File

@ -1,10 +1,10 @@
package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator; package de.test.antennapod.util.syndication.feedgenerator;
import android.util.Xml; import android.util.Xml;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.syndication.util.SyndDateUtils; import de.danoeh.antennapod.core.syndication.util.SyndDateUtils;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
import java.io.IOException; import java.io.IOException;

View File

@ -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.IOException;
import java.io.OutputStream; import java.io.OutputStream;

View File

@ -1,4 +1,4 @@
package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator; package de.test.antennapod.util.syndication.feedgenerator;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;

View File

@ -1,9 +1,9 @@
package instrumentationTest.de.test.antennapod.util.syndication.feedgenerator; package de.test.antennapod.util.syndication.feedgenerator;
import android.util.Xml; import android.util.Xml;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.syndication.util.SyndDateUtils; import de.danoeh.antennapod.core.syndication.util.SyndDateUtils;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
import java.io.IOException; import java.io.IOException;

View File

@ -1,13 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.danoeh.antennapod" package="de.danoeh.antennapod"
android:versionCode="41" android:versionCode="42"
android:versionName="0.9.9.4"> android:versionName="0.9.9.5">
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<supports-screens <supports-screens
@ -31,7 +30,7 @@
android:name="de.danoeh.antennapod.PodcastApp" android:name="de.danoeh.antennapod.PodcastApp"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:backupAgent=".backup.OpmlBackupAgent" android:backupAgent=".core.backup.OpmlBackupAgent"
android:restoreAnyVersion="true" android:restoreAnyVersion="true"
android:logo="@drawable/ic_launcher" android:logo="@drawable/ic_launcher"
android:theme="@style/Theme.AntennaPod.Light"> android:theme="@style/Theme.AntennaPod.Light">
@ -70,19 +69,14 @@
android:name=".activity.DownloadAuthenticationActivity" android:name=".activity.DownloadAuthenticationActivity"
android:launchMode="singleInstance"/> android:launchMode="singleInstance"/>
<service <activity
android:name=".service.download.DownloadService" android:name=".activity.PreferenceActivityGingerbread"
android:enabled="true"/> android:configChanges="keyboardHidden|orientation"
<service android:label="@string/settings_label">
android:name=".service.playback.PlaybackService" <meta-data
android:enabled="true" android:name="android.support.PARENT_ACTIVITY"
android:exported="true"> android:value="de.danoeh.antennapod.activity.MainActivity"/>
</service> </activity>
<service
android:name=".service.GpodnetSyncService"
android:enabled="true">
</service>
<activity <activity
android:name=".activity.PreferenceActivity" android:name=".activity.PreferenceActivity"
@ -93,22 +87,11 @@
android:value="de.danoeh.antennapod.activity.MainActivity"/> android:value="de.danoeh.antennapod.activity.MainActivity"/>
</activity> </activity>
<receiver
android:name=".receiver.MediaButtonReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON"/>
</intent-filter>
<intent-filter>
<action android:name="de.danoeh.antennapod.NOTIFY_BUTTON_RECEIVER"/>
</intent-filter>
</receiver>
<activity android:name=".activity.FeedInfoActivity"> <activity android:name=".activity.FeedInfoActivity">
</activity> </activity>
<service <service
android:name=".service.playback.PlayerWidgetService" android:name=".service.PlayerWidgetService"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false">
</service> </service>
@ -129,11 +112,6 @@
<action android:name="de.danoeh.antennapod.STOP_WIDGET_UPDATE"/> <action android:name="de.danoeh.antennapod.STOP_WIDGET_UPDATE"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".receiver.FeedUpdateReceiver">
<intent-filter>
<action android:name="de.danoeh.antennapod.feedupdatereceiver.refreshFeeds"/>
</intent-filter>
</receiver>
<activity android:name=".activity.StorageErrorActivity"> <activity android:name=".activity.StorageErrorActivity">
</activity> </activity>
@ -320,13 +298,18 @@
android:value="de.danoeh.antennapod.activity.PreferenceActivity"/> android:value="de.danoeh.antennapod.activity.PreferenceActivity"/>
</activity> </activity>
<receiver android:name=".receiver.ConnectivityActionReceiver"> <receiver android:name=".receiver.ConnectivityActionReceiver">
<intent-filter> <intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".receiver.AlarmUpdateReceiver">
<receiver android:name=".receiver.SPAReceiver">
<intent-filter>
<action android:name="de.danoeh.antennapdsp.intent.SP_APPS_QUERY_FEEDS_RESPONSE"/>
</intent-filter>
</receiver>
<receiver android:name="de.danoeh.antennapod.core.receiver.AlarmUpdateReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter> </intent-filter>
@ -338,11 +321,6 @@
android:scheme="package"/> android:scheme="package"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".receiver.SPAReceiver">
<intent-filter>
<action android:name="de.danoeh.antennapdsp.intent.SP_APPS_QUERY_FEEDS_RESPONSE"/>
</intent-filter>
</receiver>
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,425 @@
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses.
Notwithstanding, Creative Commons may elect to apply one of its public
licenses to material it publishes and in those instances will be
considered the "Licensor." Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the public
licenses.
Creative Commons may be contacted at creativecommons.org.

View File

@ -41,7 +41,7 @@
<div id="header" align="center"> <div id="header" align="center">
<img src="logo.png" alt="Logo" width="100px" height="100px"/> <img src="logo.png" alt="Logo" width="100px" height="100px"/>
<p>AntennaPod, Version 0.9.9.4</p> <p>AntennaPod, Version 0.9.9.5</p>
<p>Copyright © 2014 Daniel Oeh</p> <p>Copyright © 2014 Daniel Oeh</p>
@ -80,4 +80,7 @@ licensed under the Apache 2.0 license <a href="LICENSE_OKHTTP.txt">(View)</a>
<h2>Okio <a href="https://github.com/square/okio">(Link)</a></h2> <h2>Okio <a href="https://github.com/square/okio">(Link)</a></h2>
licensed under the Apache 2.0 license <a href="LICENSE_OKIO.txt">(View)</a> licensed under the Apache 2.0 license <a href="LICENSE_OKIO.txt">(View)</a>
<h2>Material Design Icons <a href="https://github.com/google/material-design-icons">(Link)</a></h2>
by Google, licensed under an Attribution-ShareAlike 4.0 International license <a href="LICENSE_MATERIAL_DESIGN_ICONS.txt">(View)</a>
</html> </html>

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

View File

@ -2,17 +2,26 @@ package de.danoeh.antennapod;
import android.app.Application; import android.app.Application;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.util.Log;
import de.danoeh.antennapod.feed.EventDistributor; import de.danoeh.antennapod.core.asynctask.PicassoProvider;
import de.danoeh.antennapod.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.spa.SPAUtil; import de.danoeh.antennapod.spa.SPAUtil;
/** Main application class. */ /** Main application class. */
public class PodcastApp extends Application { 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"; private static final String TAG = "PodcastApp";
public static final String EXPORT_DIR = "export/";
private static float LOGICAL_DENSITY; private static float LOGICAL_DENSITY;
@ -28,6 +37,7 @@ public class PodcastApp extends Application {
singleton = this; singleton = this;
LOGICAL_DENSITY = getResources().getDisplayMetrics().density; LOGICAL_DENSITY = getResources().getDisplayMetrics().density;
PicassoProvider.setupPicassoInstance(this);
UserPreferences.createInstance(this); UserPreferences.createInstance(this);
PlaybackPreferences.createInstance(this); PlaybackPreferences.createInstance(this);
EventDistributor.getInstance(); EventDistributor.getInstance();

View File

@ -6,11 +6,11 @@ import android.content.res.Configuration;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.ListFragment; import android.support.v4.app.ListFragment;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -25,29 +25,30 @@ import android.widget.ImageView.ScaleType;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.ChapterListAdapter; import de.danoeh.antennapod.adapter.ChapterListAdapter;
import de.danoeh.antennapod.adapter.NavListAdapter; import de.danoeh.antennapod.adapter.NavListAdapter;
import de.danoeh.antennapod.asynctask.PicassoProvider; 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.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.util.playback.ExternalMedia;
import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.dialog.VariableSpeedDialog; 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.fragment.CoverFragment; import de.danoeh.antennapod.fragment.CoverFragment;
import de.danoeh.antennapod.fragment.ItemDescriptionFragment; import de.danoeh.antennapod.fragment.ItemDescriptionFragment;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.menuhandler.MenuItemUtils;
import de.danoeh.antennapod.service.playback.PlaybackService; import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
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;
/** /**
* Activity for playing audio files. * Activity for playing audio files.
@ -269,14 +270,17 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
@Override @Override
protected void postStatusMsg(int resId) { protected void postStatusMsg(int resId) {
setSupportProgressBarIndeterminateVisibility(resId == R.string.player_preparing_msg if (resId == R.string.player_preparing_msg
|| resId == R.string.player_seeking_msg || resId == R.string.player_seeking_msg
|| resId == R.string.player_buffering_msg); || resId == R.string.player_buffering_msg) {
// TODO Show progress bar here
}
} }
@Override @Override
protected void clearStatusMsg() { protected void clearStatusMsg() {
setSupportProgressBarIndeterminateVisibility(false); // TODO Hide progress bar here
} }
/** /**
@ -380,7 +384,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
@Override @Override
public void run() { public void run() {
PicassoProvider.getMediaMetadataPicassoInstance(AudioplayerActivity.this) Picasso.with(AudioplayerActivity.this)
.load(media.getImageUri()) .load(media.getImageUri())
.fit() .fit()
.into(butNavLeft); .into(butNavLeft);
@ -397,7 +401,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
@Override @Override
public void run() { public void run() {
PicassoProvider.getMediaMetadataPicassoInstance(AudioplayerActivity.this) Picasso.with(AudioplayerActivity.this)
.load(media.getImageUri()) .load(media.getImageUri())
.fit() .fit()
.into(butNavLeft); .into(butNavLeft);
@ -424,14 +428,13 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
butNavRight = (ImageButton) findViewById(R.id.butNavRight); butNavRight = (ImageButton) findViewById(R.id.butNavRight);
butPlaybackSpeed = (Button) findViewById(R.id.butPlaybackSpeed); butPlaybackSpeed = (Button) findViewById(R.id.butPlaybackSpeed);
TypedArray typedArray = obtainStyledAttributes(new int[]{R.attr.nav_drawer_toggle}); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) {
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, typedArray.getResourceId(0, 0), R.string.drawer_open, R.string.drawer_close) { CharSequence currentTitle = getSupportActionBar().getTitle();
String currentTitle = getSupportActionBar().getTitle().toString();
@Override @Override
public void onDrawerOpened(View drawerView) { public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView); super.onDrawerOpened(drawerView);
currentTitle = getSupportActionBar().getTitle().toString(); currentTitle = getSupportActionBar().getTitle();
getSupportActionBar().setTitle(R.string.app_name); getSupportActionBar().setTitle(R.string.app_name);
supportInvalidateOptionsMenu(); supportInvalidateOptionsMenu();
} }
@ -443,7 +446,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
supportInvalidateOptionsMenu(); supportInvalidateOptionsMenu();
} }
}; };
typedArray.recycle();
drawerToggle.setDrawerIndicatorEnabled(false); drawerToggle.setDrawerIndicatorEnabled(false);
drawerLayout.setDrawerListener(drawerToggle); drawerLayout.setDrawerListener(drawerToggle);

View File

@ -17,6 +17,8 @@ import android.widget.ListView;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.examples.HtmlToPlainText; import org.jsoup.examples.HtmlToPlainText;
@ -30,14 +32,13 @@ import java.util.Map;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter; import de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter;
import de.danoeh.antennapod.asynctask.PicassoProvider; import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.feed.EventDistributor; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.core.storage.DownloadRequestException;
import de.danoeh.antennapod.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequester;
import de.danoeh.antennapod.storage.DownloadRequester;
/** /**
* Default implementation of OnlineFeedViewActivity. Shows the downloaded feed's items with their descriptions, * Default implementation of OnlineFeedViewActivity. Shows the downloaded feed's items with their descriptions,
@ -123,7 +124,7 @@ public class DefaultOnlineFeedViewActivity extends OnlineFeedViewActivity {
subscribeButton = (Button) header.findViewById(R.id.butSubscribe); subscribeButton = (Button) header.findViewById(R.id.butSubscribe);
if (feed.getImage() != null && StringUtils.isNoneBlank(feed.getImage().getDownload_url())) { if (feed.getImage() != null && StringUtils.isNoneBlank(feed.getImage().getDownload_url())) {
PicassoProvider.getDefaultPicassoInstance(this) Picasso.with(this)
.load(feed.getImage().getDownload_url()) .load(feed.getImage().getDownload_url())
.fit() .fit()
.into(cover); .into(cover);

View File

@ -19,7 +19,7 @@ import android.widget.*;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -14,9 +14,9 @@ import org.apache.commons.lang3.Validate;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadRequest;
import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.core.storage.DownloadRequester;
/** /**
* Shows a username and a password text field. * Shows a username and a password text field.

View File

@ -9,19 +9,25 @@ import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.*; import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.PicassoProvider; import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.FeedPreferences;
import de.danoeh.antennapod.feed.FeedPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.storage.DBWriter; import de.danoeh.antennapod.core.storage.DownloadRequestException;
import de.danoeh.antennapod.storage.DownloadRequestException; import de.danoeh.antennapod.core.util.LangUtils;
import de.danoeh.antennapod.util.LangUtils; import de.danoeh.antennapod.menuhandler.FeedMenuHandler;
import de.danoeh.antennapod.util.menuhandler.FeedMenuHandler;
/** /**
* Displays information about a feed. * Displays information about a feed.
@ -78,7 +84,7 @@ public class FeedInfoActivity extends ActionBarActivity {
@Override @Override
public void run() { public void run() {
PicassoProvider.getDefaultPicassoInstance(FeedInfoActivity.this) Picasso.with(FeedInfoActivity.this)
.load(feed.getImageUri()) .load(feed.getImageUri())
.fit() .fit()
.into(imgvCover); .into(imgvCover);
@ -167,7 +173,7 @@ public class FeedInfoActivity extends ActionBarActivity {
super.onPrepareOptionsMenu(menu); super.onPrepareOptionsMenu(menu);
menu.findItem(R.id.support_item).setVisible( menu.findItem(R.id.support_item).setVisible(
feed != null && feed.getPaymentLink() != null); feed != null && feed.getPaymentLink() != null);
menu.findItem(R.id.share_link_item).setVisible(feed != null &&feed.getLink() != null); menu.findItem(R.id.share_link_item).setVisible(feed != null && feed.getLink() != null);
menu.findItem(R.id.visit_website_item).setVisible(feed != null && feed.getLink() != null); menu.findItem(R.id.visit_website_item).setVisible(feed != null && feed.getLink() != null);
return true; return true;
} }

View File

@ -14,8 +14,10 @@ import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.util.flattr.FlattrUtils; import de.danoeh.antennapod.core.util.flattr.FlattrUtils;
import de.danoeh.antennapod.preferences.PreferenceController;
import org.shredzone.flattr4j.exception.FlattrException; import org.shredzone.flattr4j.exception.FlattrException;
/** Guides the user through the authentication process */ /** Guides the user through the authentication process */
@ -108,7 +110,7 @@ public class FlattrAuthActivity extends ActionBarActivity {
switch (item.getItemId()) { switch (item.getItemId()) {
case android.R.id.home: case android.R.id.home:
if (authSuccessful) { if (authSuccessful) {
Intent intent = new Intent(this, PreferenceActivity.class); Intent intent = new Intent(this, PreferenceController.getPreferenceActivity());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent); startActivity(intent);
} else { } else {

View File

@ -3,42 +3,51 @@ package de.danoeh.antennapod.activity;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.media.AudioManager; import android.media.AudioManager;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.Log; import android.util.Log;
import android.view.*; import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ListView; import android.widget.ListView;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import java.util.List;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.NavListAdapter; import de.danoeh.antennapod.adapter.NavListAdapter;
import de.danoeh.antennapod.feed.EventDistributor; import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.fragment.*; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.core.util.StorageUtils;
import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.fragment.AddFeedFragment;
import de.danoeh.antennapod.util.menuhandler.NavDrawerActivity; import de.danoeh.antennapod.fragment.DownloadsFragment;
import de.danoeh.antennapod.fragment.ExternalPlayerFragment;
import java.util.List; import de.danoeh.antennapod.fragment.ItemlistFragment;
import de.danoeh.antennapod.fragment.NewEpisodesFragment;
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
import de.danoeh.antennapod.fragment.QueueFragment;
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
import de.danoeh.antennapod.preferences.PreferenceController;
/** /**
* The activity that is shown when the user launches the app. * The activity that is shown when the user launches the app.
*/ */
public class MainActivity extends ActionBarActivity implements NavDrawerActivity{ public class MainActivity extends ActionBarActivity implements NavDrawerActivity {
private static final String TAG = "MainActivity"; private static final String TAG = "MainActivity";
private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED
| EventDistributor.DOWNLOAD_QUEUED | EventDistributor.DOWNLOAD_QUEUED
@ -75,7 +84,6 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme()); setTheme(UserPreferences.getTheme());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
StorageUtils.checkStorageAvailability(this); StorageUtils.checkStorageAvailability(this);
setContentView(R.layout.main); setContentView(R.layout.main);
setVolumeControlStream(AudioManager.STREAM_MUSIC); setVolumeControlStream(AudioManager.STREAM_MUSIC);
@ -85,8 +93,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navList = (ListView) findViewById(R.id.nav_list); navList = (ListView) findViewById(R.id.nav_list);
TypedArray typedArray = obtainStyledAttributes(new int[]{R.attr.nav_drawer_toggle}); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) {
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, typedArray.getResourceId(0, 0), R.string.drawer_open, R.string.drawer_close) {
@Override @Override
public void onDrawerOpened(View drawerView) { public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView); super.onDrawerOpened(drawerView);
@ -103,7 +110,6 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
} }
}; };
typedArray.recycle();
drawerLayout.setDrawerListener(drawerToggle); drawerLayout.setDrawerListener(drawerToggle);
FragmentManager fm = getSupportFragmentManager(); FragmentManager fm = getSupportFragmentManager();
@ -309,7 +315,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
} }
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.show_preferences: case R.id.show_preferences:
startActivity(new Intent(this, PreferenceActivity.class)); startActivity(new Intent(this, PreferenceController.getPreferenceActivity()));
return true; return true;
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);

View File

@ -3,13 +3,10 @@ package de.danoeh.antennapod.activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.media.AudioManager; import android.media.AudioManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
@ -20,23 +17,21 @@ import android.widget.ImageButton;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView; import android.widget.TextView;
import com.doomonafireball.betterpickers.hmspicker.HmsPickerBuilder;
import com.doomonafireball.betterpickers.hmspicker.HmsPickerDialogFragment;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
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;
import de.danoeh.antennapod.dialog.TimeDialog; 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;
/** /**
* Provides general features which are both needed for playing audio and video * Provides general features which are both needed for playing audio and video
@ -172,9 +167,6 @@ public abstract class MediaplayerActivity extends ActionBarActivity
chooseTheme(); chooseTheme();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// subclasses might use this feature
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)
Log.d(TAG, "Creating Activity"); Log.d(TAG, "Creating Activity");
StorageUtils.checkStorageAvailability(this); StorageUtils.checkStorageAvailability(this);
@ -323,34 +315,17 @@ public abstract class MediaplayerActivity extends ActionBarActivity
break; break;
case R.id.set_sleeptimer_item: case R.id.set_sleeptimer_item:
if (controller.serviceAvailable()) { if (controller.serviceAvailable()) {
int pickerStyle = (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Light) ? TimeDialog td = new TimeDialog(this,
R.style.AntennaPodBetterPickerThemeLight : R.style.AntennaPodBetterPickerThemeDark; R.string.set_sleeptimer_label,
if (Build.VERSION.SDK_INT > 10) { // TODO remove this as soon as dialog is shown correctly on 2.3 R.string.set_sleeptimer_label) {
HmsPickerBuilder hpb = new HmsPickerBuilder()
.setStyleResId(pickerStyle)
.setFragmentManager(getSupportFragmentManager());
hpb.addHmsPickerDialogHandler(new HmsPickerDialogFragment.HmsPickerDialogHandler() { @Override
@Override public void onTimeEntered(long millis) {
public void onDialogHmsSet(int ref, int hours, int minutes, int seconds) { controller.setSleepTimer(millis);
if (controller != null && controller.serviceAvailable()) { }
controller.setSleepTimer((hours * 3600 + minutes * 60 + seconds) * 1000); };
} td.show();
}
});
hpb.show();
} else {
TimeDialog td = new TimeDialog(this,
R.string.set_sleeptimer_label,
R.string.set_sleeptimer_label) {
@Override
public void onTimeEntered(long millis) {
controller.setSleepTimer(millis);
}
};
td.show();
}
break; break;
} }

View File

@ -16,21 +16,21 @@ import android.widget.RelativeLayout;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.dialog.AuthenticationDialog; import de.danoeh.antennapod.dialog.AuthenticationDialog;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedPreferences; import de.danoeh.antennapod.core.feed.FeedPreferences;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadRequest;
import de.danoeh.antennapod.service.download.DownloadStatus; import de.danoeh.antennapod.core.service.download.DownloadStatus;
import de.danoeh.antennapod.service.download.Downloader; import de.danoeh.antennapod.core.service.download.Downloader;
import de.danoeh.antennapod.service.download.HttpDownloader; import de.danoeh.antennapod.core.service.download.HttpDownloader;
import de.danoeh.antennapod.syndication.handler.FeedHandler; import de.danoeh.antennapod.core.syndication.handler.FeedHandler;
import de.danoeh.antennapod.syndication.handler.FeedHandlerResult; import de.danoeh.antennapod.core.syndication.handler.FeedHandlerResult;
import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException; import de.danoeh.antennapod.core.syndication.handler.UnsupportedFeedtypeException;
import de.danoeh.antennapod.util.DownloadError; import de.danoeh.antennapod.core.util.DownloadError;
import de.danoeh.antennapod.util.FileNameGenerator; import de.danoeh.antennapod.core.util.FileNameGenerator;
import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.core.util.StorageUtils;
import de.danoeh.antennapod.util.URLChecker; import de.danoeh.antennapod.core.util.URLChecker;
import de.danoeh.antennapod.util.syndication.FeedDiscoverer; import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -183,14 +183,14 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
url = URLChecker.prepareURL(url); url = URLChecker.prepareURL(url);
feed = new Feed(url, new Date()); feed = new Feed(url, new Date());
if (username != null && password != null) { if (username != null && password != null) {
feed.setPreferences(new FeedPreferences(0, true, username, password)); feed.setPreferences(new FeedPreferences(0, false, username, password));
} }
String fileUrl = new File(getExternalCacheDir(), String fileUrl = new File(getExternalCacheDir(),
FileNameGenerator.generateFileName(feed.getDownload_url())) FileNameGenerator.generateFileName(feed.getDownload_url()))
.toString(); .toString();
feed.setFile_url(fileUrl); feed.setFile_url(fileUrl);
final DownloadRequest request = new DownloadRequest(feed.getFile_url(), final DownloadRequest request = new DownloadRequest(feed.getFile_url(),
feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED, username, password, true); feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED, username, password, true, null);
downloader = new HttpDownloader( downloader = new HttpDownloader(
request); request);
new Thread() { new Thread() {

View File

@ -13,8 +13,8 @@ import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.ListView; import android.widget.ListView;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.opml.OpmlElement; import de.danoeh.antennapod.core.opml.OpmlElement;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -6,7 +6,7 @@ import android.util.Log;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.asynctask.OpmlFeedQueuer; import de.danoeh.antennapod.asynctask.OpmlFeedQueuer;
import de.danoeh.antennapod.asynctask.OpmlImportWorker; 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.io.Reader;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -2,8 +2,8 @@ package de.danoeh.antennapod.activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.os.Bundle; import android.os.Bundle;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.util.LangUtils; import de.danoeh.antennapod.core.util.LangUtils;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;

View File

@ -13,9 +13,9 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.util.LangUtils; import de.danoeh.antennapod.core.util.LangUtils;
import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.core.util.StorageUtils;
import java.io.*; import java.io.*;
@ -23,7 +23,6 @@ import java.io.*;
* Lets the user start the OPML-import process from a path * Lets the user start the OPML-import process from a path
*/ */
public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
public static final String IMPORT_DIR = "import/";
private static final String TAG = "OpmlImportFromPathActivity"; private static final String TAG = "OpmlImportFromPathActivity";
private TextView txtvPath; private TextView txtvPath;
private Button butStart; private Button butStart;
@ -61,7 +60,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
* directory. * directory.
*/ */
private void setImportPath() { private void setImportPath() {
File importDir = UserPreferences.getDataFolder(this, IMPORT_DIR); File importDir = UserPreferences.getDataFolder(this, UserPreferences.IMPORT_DIR);
boolean success = true; boolean success = true;
if (!importDir.exists()) { if (!importDir.exists()) {
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)

View File

@ -1,6 +1,6 @@
package de.danoeh.antennapod.activity; package de.danoeh.antennapod.activity;
import de.danoeh.antennapod.opml.OpmlElement; import de.danoeh.antennapod.core.opml.OpmlElement;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -0,0 +1,120 @@
package de.danoeh.antennapod.activity;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.preferences.PreferenceController;
/**
* PreferenceActivity for API 11+. In order to change the behavior of the preference UI, see
* PreferenceController.
*/
public class PreferenceActivity extends ActionBarActivity {
private PreferenceController preferenceController;
private MainFragment prefFragment;
private static PreferenceActivity instance;
private final PreferenceController.PreferenceUI preferenceUI = new PreferenceController.PreferenceUI() {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public Preference findPreference(CharSequence key) {
return prefFragment.findPreference(key);
}
@Override
public Activity getActivity() {
return PreferenceActivity.this;
}
};
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme());
super.onCreate(savedInstanceState);
instance = this;
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
// set up layout
FrameLayout root = new FrameLayout(this);
root.setId(R.id.content);
root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
setContentView(root);
prefFragment = new MainFragment();
getFragmentManager().beginTransaction().replace(R.id.content, prefFragment).commit();
preferenceController = new PreferenceController(preferenceUI);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
preferenceController.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onBackPressed() {
// The default back button behavior has to be overwritten because changing the theme clears the back stack
Intent destIntent = new Intent(this, MainActivity.class);
destIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(destIntent);
finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Intent destIntent = new Intent(this, MainActivity.class);
destIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(destIntent);
finish();
return true;
default:
return false;
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class MainFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
instance.preferenceController.onCreate();
}
@Override
public void onResume() {
super.onResume();
instance.preferenceController.onResume();
}
}
}

View File

@ -0,0 +1,96 @@
package de.danoeh.antennapod.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources.Theme;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.preferences.PreferenceController;
/**
* PreferenceActivity for API 10. In order to change the behavior of the preference UI, see
* PreferenceController.
*/
public class PreferenceActivityGingerbread extends android.preference.PreferenceActivity {
private static final String TAG = "PreferenceActivity";
private PreferenceController preferenceController;
private final PreferenceController.PreferenceUI preferenceUI = new PreferenceController.PreferenceUI() {
@SuppressWarnings("deprecation")
@Override
public Preference findPreference(CharSequence key) {
return PreferenceActivityGingerbread.this.findPreference(key);
}
@Override
public Activity getActivity() {
return PreferenceActivityGingerbread.this;
}
};
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme());
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
preferenceController = new PreferenceController(preferenceUI);
preferenceController.onCreate();
}
@Override
protected void onResume() {
super.onResume();
preferenceController.onResume();
}
@Override
protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
theme.applyStyle(UserPreferences.getTheme(), true);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
preferenceController.onActivityResult(requestCode, resultCode, data);
}
@SuppressWarnings("deprecation")
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
Preference preference) {
super.onPreferenceTreeClick(preferenceScreen, preference);
if (preference != null)
if (preference instanceof PreferenceScreen)
if (((PreferenceScreen) preference).getDialog() != null)
((PreferenceScreen) preference)
.getDialog()
.getWindow()
.getDecorView()
.setBackgroundDrawable(
this.getWindow().getDecorView()
.getBackground().getConstantState()
.newDrawable()
);
return false;
}
@Override
public void onBackPressed() {
// The default back button behavior has to be overwritten because changing the theme clears the back stack
Intent destIntent = new Intent(this, MainActivity.class);
destIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(destIntent);
finish();
}
}

View File

@ -12,8 +12,8 @@ import org.apache.commons.lang3.StringUtils;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.core.util.StorageUtils;
/** Is show if there is now external storage available. */ /** Is show if there is now external storage available. */
public class StorageErrorActivity extends ActionBarActivity { public class StorageErrorActivity extends ActionBarActivity {

View File

@ -6,12 +6,12 @@ import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.WindowCompat;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.View; import android.view.View;
import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
@ -21,11 +21,11 @@ import android.widget.SeekBar;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.MediaType; import de.danoeh.antennapod.core.feed.MediaType;
import de.danoeh.antennapod.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.service.playback.PlayerStatus; import de.danoeh.antennapod.core.service.playback.PlayerStatus;
import de.danoeh.antennapod.util.playback.ExternalMedia; import de.danoeh.antennapod.core.util.playback.ExternalMedia;
import de.danoeh.antennapod.util.playback.Playable; import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.view.AspectRatioVideoView; import de.danoeh.antennapod.view.AspectRatioVideoView;
/** /**
@ -47,16 +47,14 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override @Override
protected void chooseTheme() { protected void chooseTheme() {
setTheme(R.style.Theme_AntennaPod_Dark); setTheme(R.style.Theme_AntennaPod_VideoPlayer);
} }
@SuppressLint("AppCompatMethod") @SuppressLint("AppCompatMethod")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= 11) {
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY); // has to be called before setting layout content
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0x80000000)); getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0x80000000));
} }
@ -336,6 +334,9 @@ public class VideoplayerActivity extends MediaplayerActivity {
} }
if (Build.VERSION.SDK_INT >= 14) { if (Build.VERSION.SDK_INT >= 14) {
videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
} }
videoOverlay.setVisibility(View.GONE); videoOverlay.setVisibility(View.GONE);
butPlay.setVisibility(View.GONE); butPlay.setVisibility(View.GONE);

View File

@ -15,12 +15,12 @@ import android.widget.*;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.gpoddernet.GpodnetService; import de.danoeh.antennapod.core.gpoddernet.GpodnetService;
import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException;
import de.danoeh.antennapod.gpoddernet.model.GpodnetDevice; import de.danoeh.antennapod.core.gpoddernet.model.GpodnetDevice;
import de.danoeh.antennapod.preferences.GpodnetPreferences; import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.service.GpodnetSyncService; import de.danoeh.antennapod.core.service.GpodnetSyncService;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,6 +1,6 @@
package de.danoeh.antennapod.adapter; package de.danoeh.antennapod.adapter;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
public interface ActionButtonCallback { public interface ActionButtonCallback {
/** Is called when the action button of a list item has been pressed. */ /** Is called when the action button of a list item has been pressed. */

View File

@ -8,9 +8,9 @@ import android.widget.ImageButton;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.core.storage.DownloadRequester;
/** /**
* Utility methods for the action button that is displayed on the right hand side * Utility methods for the action button that is displayed on the right hand side
@ -27,7 +27,7 @@ public class ActionButtonUtils {
this.context = context; this.context = context;
drawables = context.obtainStyledAttributes(new int[]{ drawables = context.obtainStyledAttributes(new int[]{
R.attr.av_play, R.attr.navigation_cancel, R.attr.av_download, R.attr.navigation_chapters, R.attr.navigation_accept}); R.attr.av_play, R.attr.navigation_cancel, R.attr.av_download, R.attr.av_pause, R.attr.navigation_accept});
labels = new int[]{R.string.play_label, R.string.cancel_download_label, R.string.download_label, R.string.mark_read_label}; labels = new int[]{R.string.play_label, R.string.cancel_download_label, R.string.download_label, R.string.mark_read_label};
} }

View File

@ -4,10 +4,10 @@ import android.content.res.Resources;
import android.view.View; import android.view.View;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.core.util.Converter;
/** /**
* Utility methods for adapters * Utility methods for adapters
@ -44,13 +44,9 @@ public class AdapterUtils {
- media.getPosition())); - media.getPosition()));
} }
} else if (!media.isDownloaded()) { } else if (!media.isDownloaded()) {
txtvPos.setText(res.getString( txtvPos.setText(Converter.byteToString(media.getSize()));
R.string.size_prefix)
+ Converter.byteToString(media.getSize()));
} else { } else {
txtvPos.setText(res.getString( txtvPos.setText(Converter.getDurationStringLong(media
R.string.length_prefix)
+ Converter.getDurationStringLong(media
.getDuration())); .getDuration()));
} }
} }

View File

@ -16,10 +16,10 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.core.feed.Chapter;
import de.danoeh.antennapod.util.ChapterUtils; import de.danoeh.antennapod.core.util.ChapterUtils;
import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.util.playback.Playable; import de.danoeh.antennapod.core.util.playback.Playable;
import java.util.List; import java.util.List;

View File

@ -6,13 +6,13 @@ import android.widget.Toast;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequestException;
import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.core.storage.DownloadRequester;
/** /**
* Default implementation of an ActionButtonCallback * Default implementation of an ActionButtonCallback

View File

@ -8,10 +8,10 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.FeedImage; import de.danoeh.antennapod.core.feed.FeedImage;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.service.download.DownloadStatus; import de.danoeh.antennapod.core.service.download.DownloadStatus;
/** Displays a list of DownloadStatus entries. */ /** Displays a list of DownloadStatus entries. */
public class DownloadLogAdapter extends BaseAdapter { public class DownloadLogAdapter extends BaseAdapter {

View File

@ -10,10 +10,11 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.PicassoProvider; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.util.Converter;
/** /**
* Shows a list of downloaded episodes * Shows a list of downloaded episodes
@ -72,7 +73,7 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter {
} }
holder.title.setText(item.getTitle()); holder.title.setText(item.getTitle());
holder.pubDate.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_SHOW_DATE)); holder.pubDate.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_ABBREV_ALL));
holder.txtvSize.setText(Converter.byteToString(item.getMedia().getSize())); holder.txtvSize.setText(Converter.byteToString(item.getMedia().getSize()));
FeedItem.State state = item.getState(); FeedItem.State state = item.getState();
@ -87,7 +88,7 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter {
holder.butSecondary.setOnClickListener(secondaryActionListener); holder.butSecondary.setOnClickListener(secondaryActionListener);
PicassoProvider.getMediaMetadataPicassoInstance(context) Picasso.with(context)
.load(item.getImageUri()) .load(item.getImageUri())
.fit() .fit()
.into(holder.imageView); .into(holder.imageView);

View File

@ -8,12 +8,13 @@ import android.widget.BaseAdapter;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadRequest;
import de.danoeh.antennapod.service.download.DownloadStatus; import de.danoeh.antennapod.core.service.download.DownloadStatus;
import de.danoeh.antennapod.service.download.Downloader; import de.danoeh.antennapod.core.service.download.Downloader;
import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.util.ThemeUtils; import de.danoeh.antennapod.core.util.ThemeUtils;
public class DownloadlistAdapter extends BaseAdapter { public class DownloadlistAdapter extends BaseAdapter {
@ -49,7 +50,7 @@ public class DownloadlistAdapter extends BaseAdapter {
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
Holder holder; Holder holder;
Downloader downloader = getItem(position); Downloader downloader = getItem(position);
DownloadRequest request = downloader.getDownloadRequest(); DownloadRequest request = downloader.getDownloadRequest();
// Inflate layout // Inflate layout
if (convertView == null) { if (convertView == null) {
@ -58,8 +59,6 @@ public class DownloadlistAdapter extends BaseAdapter {
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.downloadlist_item, parent, false); convertView = inflater.inflate(R.layout.downloadlist_item, parent, false);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.message = (TextView) convertView
.findViewById(R.id.txtvMessage);
holder.downloaded = (TextView) convertView holder.downloaded = (TextView) convertView
.findViewById(R.id.txtvDownloaded); .findViewById(R.id.txtvDownloaded);
holder.percent = (TextView) convertView holder.percent = (TextView) convertView
@ -82,9 +81,9 @@ public class DownloadlistAdapter extends BaseAdapter {
} }
holder.title.setText(request.getTitle()); holder.title.setText(request.getTitle());
if (request.getStatusMsg() != 0) {
holder.message.setText(request.getStatusMsg()); holder.progbar.setIndeterminate(request.getSoFar() <= 0);
}
String strDownloaded = Converter.byteToString(request.getSoFar()); String strDownloaded = Converter.byteToString(request.getSoFar());
if (request.getSize() != DownloadStatus.SIZE_UNKNOWN) { if (request.getSize() != DownloadStatus.SIZE_UNKNOWN) {
strDownloaded += " / " + Converter.byteToString(request.getSize()); strDownloaded += " / " + Converter.byteToString(request.getSize());
@ -115,7 +114,6 @@ public class DownloadlistAdapter extends BaseAdapter {
static class Holder { static class Holder {
TextView title; TextView title;
TextView message;
TextView downloaded; TextView downloaded;
TextView percent; TextView percent;
ProgressBar progbar; ProgressBar progbar;

View File

@ -9,12 +9,11 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.*; import android.widget.*;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.feed.MediaType; import de.danoeh.antennapod.core.feed.MediaType;
import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.core.storage.DownloadRequester;
import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.core.util.ThemeUtils;
import de.danoeh.antennapod.util.ThemeUtils;
/** /**
* List adapter for items of feeds that the user has already subscribed to. * List adapter for items of feeds that the user has already subscribed to.
@ -108,22 +107,22 @@ public class FeedItemlistAdapter extends BaseAdapter {
FeedItem.State state = item.getState(); FeedItem.State state = item.getState();
switch (state) { switch (state) {
case PLAYING: case PLAYING:
holder.statusUnread.setVisibility(View.GONE); holder.statusUnread.setVisibility(View.INVISIBLE);
holder.episodeProgress.setVisibility(View.VISIBLE); holder.episodeProgress.setVisibility(View.VISIBLE);
break; break;
case IN_PROGRESS: case IN_PROGRESS:
holder.statusUnread.setVisibility(View.GONE); holder.statusUnread.setVisibility(View.INVISIBLE);
holder.episodeProgress.setVisibility(View.VISIBLE); holder.episodeProgress.setVisibility(View.VISIBLE);
break; break;
case NEW: case NEW:
holder.statusUnread.setVisibility(View.VISIBLE); holder.statusUnread.setVisibility(View.VISIBLE);
break; break;
default: default:
holder.statusUnread.setVisibility(View.GONE); holder.statusUnread.setVisibility(View.INVISIBLE);
break; break;
} }
holder.published.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_SHOW_DATE)); holder.published.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_ABBREV_ALL));
FeedMedia media = item.getMedia(); FeedMedia media = item.getMedia();
@ -146,6 +145,10 @@ public class FeedItemlistAdapter extends BaseAdapter {
item.getMedia())) { item.getMedia())) {
holder.episodeProgress.setVisibility(View.VISIBLE); holder.episodeProgress.setVisibility(View.VISIBLE);
holder.episodeProgress.setProgress(((ItemAccess) itemAccess).getItemDownloadProgressPercent(item)); holder.episodeProgress.setProgress(((ItemAccess) itemAccess).getItemDownloadProgressPercent(item));
holder.published.setVisibility(View.GONE);
} else {
holder.episodeProgress.setVisibility(View.GONE);
holder.published.setVisibility(View.VISIBLE);
} }
TypedArray typeDrawables = context.obtainStyledAttributes( TypedArray typeDrawables = context.obtainStyledAttributes(

View File

@ -7,7 +7,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import java.util.List; import java.util.List;

View File

@ -10,9 +10,11 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.PicassoProvider; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.Feed;
/** /**
* BaseAdapter for the navigation drawer * BaseAdapter for the navigation drawer
@ -37,7 +39,7 @@ public class NavListAdapter extends BaseAdapter {
this.context = context; this.context = context;
TypedArray ta = context.obtainStyledAttributes(new int[]{R.attr.ic_new, R.attr.stat_playlist, TypedArray ta = context.obtainStyledAttributes(new int[]{R.attr.ic_new, R.attr.stat_playlist,
R.attr.av_download, R.attr.device_access_time, R.attr.content_new}); R.attr.av_download, R.attr.ic_history, R.attr.content_new});
drawables = new Drawable[]{ta.getDrawable(0), ta.getDrawable(1), ta.getDrawable(2), drawables = new Drawable[]{ta.getDrawable(0), ta.getDrawable(1), ta.getDrawable(2),
ta.getDrawable(3), ta.getDrawable(4)}; ta.getDrawable(3), ta.getDrawable(4)};
ta.recycle(); ta.recycle();
@ -54,7 +56,7 @@ public class NavListAdapter extends BaseAdapter {
if (viewType == VIEW_TYPE_NAV) { if (viewType == VIEW_TYPE_NAV) {
return context.getString(NAV_TITLES[position]); return context.getString(NAV_TITLES[position]);
} else if (viewType == VIEW_TYPE_SECTION_DIVIDER) { } else if (viewType == VIEW_TYPE_SECTION_DIVIDER) {
return context.getString(R.string.podcasts_label); return "";
} else { } else {
return itemAccess.getItem(position); return itemAccess.getItem(position);
} }
@ -88,11 +90,11 @@ public class NavListAdapter extends BaseAdapter {
if (viewType == VIEW_TYPE_NAV) { if (viewType == VIEW_TYPE_NAV) {
v = getNavView((String) getItem(position), position, convertView, parent); v = getNavView((String) getItem(position), position, convertView, parent);
} else if (viewType == VIEW_TYPE_SECTION_DIVIDER) { } else if (viewType == VIEW_TYPE_SECTION_DIVIDER) {
v = getSectionDividerView((String) getItem(position), position, convertView, parent); v = getSectionDividerView(convertView, parent);
} else { } else {
v = getFeedView(position - SUBSCRIPTION_OFFSET, convertView, parent); v = getFeedView(position - SUBSCRIPTION_OFFSET, convertView, parent);
} }
if (v != null) { if (v != null && viewType != VIEW_TYPE_SECTION_DIVIDER) {
TextView txtvTitle = (TextView) v.findViewById(R.id.txtvTitle); TextView txtvTitle = (TextView) v.findViewById(R.id.txtvTitle);
if (position == itemAccess.getSelectedItemIndex()) { if (position == itemAccess.getSelectedItemIndex()) {
txtvTitle.setTypeface(null, Typeface.BOLD); txtvTitle.setTypeface(null, Typeface.BOLD);
@ -147,22 +149,11 @@ public class NavListAdapter extends BaseAdapter {
return convertView; return convertView;
} }
private View getSectionDividerView(String title, int position, View convertView, ViewGroup parent) { private View getSectionDividerView(View convertView, ViewGroup parent) {
SectionHolder holder; LayoutInflater inflater = (LayoutInflater) context
if (convertView == null) { .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
holder = new SectionHolder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.nav_section_item, parent, false); convertView = inflater.inflate(R.layout.nav_section_item, parent, false);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
convertView.setTag(holder);
} else {
holder = (SectionHolder) convertView.getTag();
}
holder.title.setText(title);
convertView.setEnabled(false); convertView.setEnabled(false);
convertView.setOnClickListener(null); convertView.setOnClickListener(null);
@ -190,7 +181,7 @@ public class NavListAdapter extends BaseAdapter {
holder.title.setText(feed.getTitle()); holder.title.setText(feed.getTitle());
PicassoProvider.getDefaultPicassoInstance(context) Picasso.with(context)
.load(feed.getImageUri()) .load(feed.getImageUri())
.fit() .fit()
.into(holder.image); .into(holder.image);
@ -204,10 +195,6 @@ public class NavListAdapter extends BaseAdapter {
ImageView image; ImageView image;
} }
static class SectionHolder {
TextView title;
}
static class FeedHolder { static class FeedHolder {
TextView title; TextView title;
ImageView image; ImageView image;

View File

@ -11,12 +11,13 @@ import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.PicassoProvider; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.storage.DownloadRequester;
import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.util.Converter;
/** /**
* List adapter for the list of new episodes * List adapter for the list of new episodes
@ -86,9 +87,9 @@ public class NewEpisodesListAdapter extends BaseAdapter {
} }
holder.title.setText(item.getTitle()); holder.title.setText(item.getTitle());
holder.pubDate.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_SHOW_DATE)); holder.pubDate.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_ABBREV_ALL));
if (item.isRead()) { if (item.isRead()) {
holder.statusUnread.setVisibility(View.GONE); holder.statusUnread.setVisibility(View.INVISIBLE);
} else { } else {
holder.statusUnread.setVisibility(View.VISIBLE); holder.statusUnread.setVisibility(View.VISIBLE);
} }
@ -99,6 +100,8 @@ public class NewEpisodesListAdapter extends BaseAdapter {
if (media.getDuration() > 0) { if (media.getDuration() > 0) {
holder.txtvDuration.setText(Converter.getDurationStringLong(media.getDuration())); holder.txtvDuration.setText(Converter.getDurationStringLong(media.getDuration()));
} else if (media.getSize() > 0) {
holder.txtvDuration.setText(Converter.byteToString(media.getSize()));
} else { } else {
holder.txtvDuration.setText(""); holder.txtvDuration.setText("");
} }
@ -106,8 +109,10 @@ public class NewEpisodesListAdapter extends BaseAdapter {
if (isDownloadingMedia) { if (isDownloadingMedia) {
holder.downloadProgress.setVisibility(View.VISIBLE); holder.downloadProgress.setVisibility(View.VISIBLE);
holder.txtvDuration.setVisibility(View.GONE); holder.txtvDuration.setVisibility(View.GONE);
holder.pubDate.setVisibility(View.GONE);
} else { } else {
holder.txtvDuration.setVisibility(View.VISIBLE); holder.txtvDuration.setVisibility(View.VISIBLE);
holder.pubDate.setVisibility(View.VISIBLE);
holder.downloadProgress.setVisibility(View.GONE); holder.downloadProgress.setVisibility(View.GONE);
} }
@ -129,7 +134,7 @@ public class NewEpisodesListAdapter extends BaseAdapter {
holder.butSecondary.setTag(item); holder.butSecondary.setTag(item);
holder.butSecondary.setOnClickListener(secondaryActionListener); holder.butSecondary.setOnClickListener(secondaryActionListener);
PicassoProvider.getMediaMetadataPicassoInstance(context) Picasso.with(context)
.load(item.getImageUri()) .load(item.getImageUri())
.fit() .fit()
.into(holder.imageView); .into(holder.imageView);

View File

@ -4,12 +4,18 @@ import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.*; import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.PicassoProvider; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.core.storage.DownloadRequester;
import de.danoeh.antennapod.storage.DownloadRequester;
/** /**
* List adapter for the queue. * List adapter for the queue.
@ -92,7 +98,7 @@ public class QueueListAdapter extends BaseAdapter {
holder.butSecondary.setTag(item); holder.butSecondary.setTag(item);
holder.butSecondary.setOnClickListener(secondaryActionListener); holder.butSecondary.setOnClickListener(secondaryActionListener);
PicassoProvider.getMediaMetadataPicassoInstance(context) Picasso.with(context)
.load(item.getImageUri()) .load(item.getImageUri())
.fit() .fit()
.into(holder.imageView); .into(holder.imageView);

View File

@ -8,12 +8,13 @@ import android.widget.BaseAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.PicassoProvider; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.FeedComponent;
import de.danoeh.antennapod.feed.FeedComponent; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.core.feed.SearchResult;
import de.danoeh.antennapod.feed.SearchResult;
/** /**
* List adapter for search activity. * List adapter for search activity.
@ -72,7 +73,7 @@ public class SearchlistAdapter extends BaseAdapter {
holder.title.setText(feed.getTitle()); holder.title.setText(feed.getTitle());
holder.subtitle.setVisibility(View.GONE); holder.subtitle.setVisibility(View.GONE);
PicassoProvider.getDefaultPicassoInstance(context) Picasso.with(context)
.load(feed.getImageUri()) .load(feed.getImageUri())
.fit() .fit()
.into(holder.cover); .into(holder.cover);
@ -85,7 +86,7 @@ public class SearchlistAdapter extends BaseAdapter {
holder.subtitle.setText(result.getSubtitle()); holder.subtitle.setText(result.getSubtitle());
} }
PicassoProvider.getDefaultPicassoInstance(context) Picasso.with(context)
.load(item.getFeed().getImageUri()) .load(item.getFeed().getImageUri())
.fit() .fit()
.into(holder.cover); .into(holder.cover);

View File

@ -8,13 +8,14 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.squareup.picasso.Picasso;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.List; import java.util.List;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.PicassoProvider; import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast;
import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast;
/** /**
* Adapter for displaying a list of GPodnetPodcast-Objects. * Adapter for displaying a list of GPodnetPodcast-Objects.
@ -39,7 +40,6 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
convertView = inflater.inflate(R.layout.gpodnet_podcast_listitem, parent, false); convertView = inflater.inflate(R.layout.gpodnet_podcast_listitem, parent, false);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.description = (TextView) convertView.findViewById(R.id.txtvDescription);
holder.image = (ImageView) convertView.findViewById(R.id.imgvCover); holder.image = (ImageView) convertView.findViewById(R.id.imgvCover);
convertView.setTag(holder); convertView.setTag(holder);
@ -48,10 +48,9 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
} }
holder.title.setText(podcast.getTitle()); holder.title.setText(podcast.getTitle());
holder.description.setText(podcast.getDescription());
if (StringUtils.isNoneBlank(podcast.getLogoUrl())) { if (StringUtils.isNotBlank(podcast.getLogoUrl())) {
PicassoProvider.getDefaultPicassoInstance(convertView.getContext()) Picasso.with(convertView.getContext())
.load(podcast.getLogoUrl()) .load(podcast.getLogoUrl())
.fit() .fit()
.into(holder.image); .into(holder.image);
@ -62,7 +61,6 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
static class Holder { static class Holder {
TextView title; TextView title;
TextView description;
ImageView image; ImageView image;
} }
} }

View File

@ -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<Void, Void, Void> {
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();
}
}
}

View File

@ -4,12 +4,12 @@ import android.annotation.SuppressLint;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; 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.activity.OpmlImportHolder;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.opml.OpmlElement; import de.danoeh.antennapod.core.opml.OpmlElement;
import de.danoeh.antennapod.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequestException;
import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.core.storage.DownloadRequester;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;

View File

@ -8,10 +8,10 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.Log; import android.util.Log;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.core.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.opml.OpmlElement; import de.danoeh.antennapod.core.opml.OpmlElement;
import de.danoeh.antennapod.opml.OpmlReader; import de.danoeh.antennapod.core.opml.OpmlReader;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException; import java.io.IOException;
@ -74,7 +74,7 @@ public class OpmlImportWorker extends
if (exception != null) { if (exception != null) {
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)
Log.d(TAG, Log.d(TAG,
"An error occured while trying to parse the opml document"); "An error occurred while trying to parse the opml document");
AlertDialog.Builder alert = new AlertDialog.Builder(context); AlertDialog.Builder alert = new AlertDialog.Builder(context);
alert.setTitle(R.string.error_label); alert.setTitle(R.string.error_label);
alert.setMessage(context.getString(R.string.opml_reader_error) alert.setMessage(context.getString(R.string.opml_reader_error)

View File

@ -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);
}
}

View File

@ -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.5";
ClientConfig.applicationCallbacks = new ApplicationCallbacksImpl();
ClientConfig.downloadServiceCallbacks = new DownloadServiceCallbacksImpl();
ClientConfig.gpodnetCallbacks = new GpodnetCallbacksImpl();
ClientConfig.playbackServiceCallbacks = new PlaybackServiceCallbacksImpl();
ClientConfig.storageCallbacks = new StorageCallbacksImpl();
ClientConfig.flattrCallbacks = new FlattrCallbacksImpl();
}
}

View File

@ -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;
}
}

View File

@ -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");
}
}
}

View File

@ -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);
}
}

Some files were not shown because too many files have changed in this diff Show More