diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2023-07-04 22:31:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-04 22:31:47 +0200 |
commit | 6999a944bb3c1ce1547832ad15e401ff7cbbbe10 (patch) | |
tree | fe199e17b41dbcc22d5f4161d49124bdcd9d6243 /app | |
parent | 23d4cf5632279bcc9293396d8943bf84275a9d60 (diff) | |
download | AntennaPod-6999a944bb3c1ce1547832ad15e401ff7cbbbe10.zip |
Fix 'allow once' for feed update on mobile networks (#6528)
Diffstat (limited to 'app')
5 files changed, 8 insertions, 9 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java index 0fb6a7e7a..08d7cbefd 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java @@ -11,8 +11,8 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.actionbutton.DownloadActionButton; import de.danoeh.antennapod.core.storage.DBReader; -import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.util.DownloadErrorLabel; +import de.danoeh.antennapod.core.util.download.FeedUpdateManager; import de.danoeh.antennapod.model.download.DownloadError; import de.danoeh.antennapod.model.download.DownloadResult; import de.danoeh.antennapod.model.feed.Feed; @@ -109,7 +109,7 @@ public class DownloadLogAdapter extends BaseAdapter { Log.e(TAG, "Could not find feed for feed id: " + status.getFeedfileId()); return; } - DBTasks.forceRefreshFeed(context, feed, true); + FeedUpdateManager.runOnce(context, feed); }); } else if (status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) { holder.secondaryActionButton.setOnClickListener(v -> { diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/EditUrlSettingsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/EditUrlSettingsDialog.java index e6ad78a89..1929b997e 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/EditUrlSettingsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/EditUrlSettingsDialog.java @@ -6,8 +6,8 @@ import android.view.LayoutInflater; import androidx.appcompat.app.AlertDialog; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.core.util.download.FeedUpdateManager; import de.danoeh.antennapod.databinding.EditTextDialogBinding; import de.danoeh.antennapod.model.feed.Feed; @@ -48,7 +48,7 @@ public abstract class EditUrlSettingsDialog { try { DBWriter.updateFeedDownloadURL(original, updated).get(); feed.setDownload_url(updated); - DBTasks.forceRefreshFeed(activityRef.get(), feed, false); + FeedUpdateManager.runOnce(activityRef.get(), feed); } catch (ExecutionException | InterruptedException e) { throw new RuntimeException(e); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java index 864e23d7d..6a72348bc 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java @@ -27,6 +27,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.OnlineFeedViewActivity; import de.danoeh.antennapod.activity.OpmlImportActivity; +import de.danoeh.antennapod.core.util.download.FeedUpdateManager; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.model.feed.SortOrder; @@ -210,7 +211,7 @@ public class AddFeedFragment extends Fragment { dirFeed.setItems(Collections.emptyList()); dirFeed.setSortOrder(SortOrder.EPISODE_TITLE_A_Z); Feed fromDatabase = DBTasks.updateFeed(getContext(), dirFeed, false); - DBTasks.forceRefreshFeed(getContext(), fromDatabase, true); + FeedUpdateManager.runOnce(requireContext(), fromDatabase); return fromDatabase; } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java index 6f3aaa6a5..6b6fedd1f 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java @@ -32,7 +32,6 @@ import de.danoeh.antennapod.adapter.EpisodeItemListAdapter; import de.danoeh.antennapod.core.feed.FeedEvent; import de.danoeh.antennapod.core.menuhandler.MenuItemUtils; import de.danoeh.antennapod.core.storage.DBReader; -import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.util.FeedItemPermutors; import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.download.FeedUpdateManager; @@ -185,7 +184,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem viewBinding.swipeRefresh.setDistanceToTriggerSync(getResources().getInteger(R.integer.swipe_refresh_distance)); viewBinding.swipeRefresh.setOnRefreshListener(() -> { - DBTasks.forceRefreshFeed(requireContext(), feed, true); + FeedUpdateManager.runOnceOrAsk(requireContext(), feed); new Handler(Looper.getMainLooper()).postDelayed(() -> viewBinding.swipeRefresh.setRefreshing(false), getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms)); }); diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java index 9b9525133..7a9eb1bb5 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -6,7 +6,6 @@ import android.view.Menu; import android.view.MenuItem; import androidx.annotation.NonNull; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.ShareUtils; @@ -64,7 +63,7 @@ public class FeedMenuHandler { public static boolean onOptionsItemClicked(final Context context, final MenuItem item, final Feed selectedFeed) { final int itemId = item.getItemId(); if (itemId == R.id.refresh_item) { - DBTasks.forceRefreshFeed(context, selectedFeed, true); + FeedUpdateManager.runOnceOrAsk(context, selectedFeed); } else if (itemId == R.id.refresh_complete_item) { new Thread(() -> { selectedFeed.setNextPageLink(selectedFeed.getDownload_url()); |