diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-10-19 19:21:51 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-10-19 19:37:31 +0200 |
commit | 2cd504b9d093203e5861f3cbe917a07bbc92c70e (patch) | |
tree | a39e0e13d026f79675f053752c2bf3d4f0400b7c /app/src | |
parent | eff021c14962e7b89742b6097a4133ae841ecaf1 (diff) | |
download | AntennaPod-2cd504b9d093203e5861f3cbe917a07bbc92c70e.zip |
Updated config in app module, fixed typo
Diffstat (limited to 'app/src')
5 files changed, 80 insertions, 0 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7de13e7c1..572b7137d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -288,6 +288,12 @@ android:value="de.danoeh.antennapod.activity.PreferenceActivity"/> </activity> + <receiver android:name=".receiver.ConnectivityActionReceiver"> + <intent-filter> + <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> + </intent-filter> + </receiver> + <receiver android:name=".receiver.SPAReceiver"> <intent-filter> <action android:name="de.danoeh.antennapdsp.intent.SP_APPS_QUERY_FEEDS_RESPONSE"/> diff --git a/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java index fdbb2139d..4d9be5d78 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java @@ -8,6 +8,7 @@ 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 { @@ -20,4 +21,9 @@ public class ApplicationCallbacksImpl implements ApplicationCallbacks { public Intent getStorageErrorActivity(Context context) { return new Intent(context, StorageErrorActivity.class); } + + @Override + public void setUpdateInterval(long updateInterval) { + UserPreferences.restartUpdateAlarm(updateInterval, updateInterval); + } } diff --git a/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java index 0f180e9c5..3a9e62435 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java @@ -9,6 +9,7 @@ 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; @@ -46,4 +47,14 @@ public class DownloadServiceCallbacksImpl implements DownloadServiceCallbacks { intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args); return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } + + @Override + public void onFeedParsed(Context context, Feed feed) { + // do nothing + } + + @Override + public boolean shouldCreateReport() { + return true; + } } diff --git a/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java index d1e3a8379..997befe99 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.config; import android.content.Context; import android.content.Intent; +import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.AudioplayerActivity; import de.danoeh.antennapod.activity.VideoplayerActivity; import de.danoeh.antennapod.core.PlaybackServiceCallbacks; @@ -18,4 +19,14 @@ public class PlaybackServiceCallbacksImpl implements PlaybackServiceCallbacks { return new Intent(context, AudioplayerActivity.class); } } + + @Override + public boolean useQueue() { + return true; + } + + @Override + public int getNotificationIconResource(Context context) { + return R.drawable.ic_stat_antenna_default; + } } diff --git a/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java b/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java new file mode 100644 index 000000000..f55a7603f --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java @@ -0,0 +1,46 @@ +package de.danoeh.antennapod.receiver; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.util.Log; + +import org.apache.commons.lang3.StringUtils; + +import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.NetworkUtils; + +public class ConnectivityActionReceiver extends BroadcastReceiver { + private static final String TAG = "ConnectivityActionReceiver"; + + @Override + public void onReceive(final Context context, Intent intent) { + if (StringUtils.equals(intent.getAction(), ConnectivityManager.CONNECTIVITY_ACTION)) { + if (BuildConfig.DEBUG) + Log.d(TAG, "Received intent"); + + if (NetworkUtils.autodownloadNetworkAvailable(context)) { + if (BuildConfig.DEBUG) + Log.d(TAG, + "auto-dl network available, starting auto-download"); + DBTasks.autodownloadUndownloadedItems(context); + } else { // if new network is Wi-Fi, finish ongoing downloads, + // otherwise cancel all downloads + ConnectivityManager cm = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo ni = cm.getActiveNetworkInfo(); + if (ni == null || ni.getType() != ConnectivityManager.TYPE_WIFI) { + if (BuildConfig.DEBUG) + Log.i(TAG, + "Device is no longer connected to Wi-Fi. Cancelling ongoing downloads"); + DownloadRequester.getInstance().cancelAllDownloads(context); + } + + } + } + } +} |