diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-04-05 19:20:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-05 19:20:27 +0200 |
commit | 92ab575b150ab49ca85e0ac994558142e49c9e68 (patch) | |
tree | 422dcd76895a4ba06ed02723ff61351435c0fe49 /net/download | |
parent | 2143ab135182434911d4554a8ef08115eaa0d2d0 (diff) | |
download | AntennaPod-92ab575b150ab49ca85e0ac994558142e49c9e68.zip |
Delete core module (#7060)
Diffstat (limited to 'net/download')
6 files changed, 19 insertions, 13 deletions
diff --git a/net/download/service/build.gradle b/net/download/service/build.gradle index 789fb3aef..f74550c05 100644 --- a/net/download/service/build.gradle +++ b/net/download/service/build.gradle @@ -10,7 +10,6 @@ android { } dependencies { - implementation project(":core") implementation project(':event') implementation project(':model') implementation project(':net:common') @@ -23,6 +22,7 @@ dependencies { implementation project(':ui:notifications') implementation project(':storage:preferences') implementation project(':ui:app-start-intent') + implementation project(':ui:chapters') annotationProcessor "androidx.annotation:annotation:$annotationVersion" implementation "androidx.core:core:$coreVersion" diff --git a/net/download/service/src/main/AndroidManifest.xml b/net/download/service/src/main/AndroidManifest.xml index 89b6823e5..0a1400010 100644 --- a/net/download/service/src/main/AndroidManifest.xml +++ b/net/download/service/src/main/AndroidManifest.xml @@ -7,7 +7,6 @@ <application android:allowBackup="true" - android:icon="@mipmap/ic_launcher" android:supportsRtl="true"> <receiver android:name=".feed.FeedUpdateReceiver" diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java index dd930c62f..6ed16aa80 100644 --- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java @@ -8,6 +8,7 @@ import androidx.annotation.NonNull; import de.danoeh.antennapod.model.MediaMetadataRetrieverCompat; import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink; +import de.danoeh.antennapod.ui.chapters.ChapterUtils; import org.greenrobot.eventbus.EventBus; import java.io.File; @@ -19,7 +20,6 @@ import de.danoeh.antennapod.model.download.DownloadRequest; import de.danoeh.antennapod.model.download.DownloadResult; import de.danoeh.antennapod.storage.database.DBReader; import de.danoeh.antennapod.storage.database.DBWriter; -import de.danoeh.antennapod.core.util.ChapterUtils; import de.danoeh.antennapod.model.download.DownloadError; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java index ae9b25564..2ce5f7006 100644 --- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java @@ -14,10 +14,10 @@ import androidx.work.OutOfQuotaPolicy; import androidx.work.PeriodicWorkRequest; import androidx.work.WorkManager; import com.google.android.material.dialog.MaterialAlertDialogBuilder; -import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.net.common.NetworkUtils; import de.danoeh.antennapod.event.MessageEvent; import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.net.download.service.R; import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager; import de.danoeh.antennapod.storage.preferences.UserPreferences; import org.greenrobot.eventbus.EventBus; diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java index f3c3e657c..2e983d88e 100644 --- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java @@ -1,5 +1,6 @@ package de.danoeh.antennapod.net.download.service.feed.remote; +import android.os.StatFs; import androidx.annotation.NonNull; import android.text.TextUtils; import android.util.Log; @@ -9,6 +10,7 @@ import de.danoeh.antennapod.model.download.DownloadResult; import de.danoeh.antennapod.model.download.DownloadRequest; import de.danoeh.antennapod.net.common.AntennapodHttpClient; import de.danoeh.antennapod.net.download.service.R; +import de.danoeh.antennapod.storage.preferences.UserPreferences; import okhttp3.CacheControl; import okhttp3.internal.http.StatusLine; import org.apache.commons.io.IOUtils; @@ -30,7 +32,6 @@ import java.util.Locale; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.parser.feed.util.DateUtils; import de.danoeh.antennapod.model.download.DownloadError; -import de.danoeh.antennapod.core.util.StorageUtils; import de.danoeh.antennapod.net.common.UriUtil; import okhttp3.OkHttpClient; import okhttp3.Protocol; @@ -148,7 +149,7 @@ public class HttpDownloader extends Downloader { request.setSize(DownloadResult.SIZE_UNKNOWN); } - long freeSpace = StorageUtils.getFreeSpaceAvailable(); + long freeSpace = getFreeSpaceAvailable(); Log.d(TAG, "Free space is " + freeSpace); if (request.getSize() != DownloadResult.SIZE_UNKNOWN && request.getSize() > freeSpace) { onFail(DownloadError.ERROR_NOT_ENOUGH_SPACE, null); @@ -297,6 +298,18 @@ public class HttpDownloader extends Downloader { } } + private static long getFreeSpaceAvailable() { + File dataFolder = UserPreferences.getDataFolder(null); + if (dataFolder != null) { + StatFs stat = new StatFs(dataFolder.getAbsolutePath()); + long availableBlocks = stat.getAvailableBlocksLong(); + long blockSize = stat.getBlockSizeLong(); + return availableBlocks * blockSize; + } else { + return 0; + } + } + private void onSuccess() { Log.d(TAG, "Download was successful"); result.setSuccessful(); diff --git a/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java index 38d3e5dd0..ccb822a91 100644 --- a/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java @@ -36,7 +36,6 @@ import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.storage.preferences.PlaybackPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences; -import de.danoeh.antennapod.core.util.FeedItemUtil; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -610,17 +609,12 @@ public class DbWriterTest { Cursor cursor = adapter.getQueueIDCursor(); assertTrue(cursor.moveToFirst()); assertEquals(numItems, cursor.getCount()); - List<Long> expectedIds; - expectedIds = FeedItemUtil.getIdList(feed.getItems()); - List<Long> actualIds = new ArrayList<>(); for (int i = 0; i < numItems; i++) { assertTrue(cursor.moveToPosition(i)); - actualIds.add(cursor.getLong(0)); + assertEquals(feed.getItems().get(i).getId(), cursor.getLong(0)); } cursor.close(); adapter.close(); - assertEquals("Bulk add to queue: result order should be the same as the order given", - expectedIds, actualIds); } @Test |