diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-11-10 21:01:41 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-11-10 21:01:41 +0100 |
commit | ad04a80ae7b2091c94b0d007c2a78d97e7af871d (patch) | |
tree | 0d43b619ddcc6ea6d1222595d7a56db5a8c6e823 /app/src/main/java/de | |
parent | 6035e8fee91d895dd3a0fcedbedab2bc9de5b6a1 (diff) | |
download | AntennaPod-ad04a80ae7b2091c94b0d007c2a78d97e7af871d.zip |
Squashed commit of the following:
commit 7d0e6d5c2dc75f8f1e54f4a1279c6b0cffa7b8cc
Author: daniel oeh <daniel.oeh@gmail.com>
Date: Mon Nov 10 21:00:58 2014 +0100
Made tests compile
commit 05c57df87dd469d8f64835700eefe2e3c87e04e4
Author: daniel oeh <daniel.oeh@gmail.com>
Date: Mon Nov 10 20:56:58 2014 +0100
Removed unused code
commit 0a1fbc9e6d9648646140e30dec0ec8389fb8d37f
Author: daniel oeh <daniel.oeh@gmail.com>
Date: Thu Nov 6 15:48:24 2014 +0100
Added UI controls to download more feed pages
closes #245
commit 6486fb40f1d03887e264df95946f91f0a9cdac9b
Author: daniel oeh <daniel.oeh@gmail.com>
Date: Thu Nov 6 14:49:43 2014 +0100
Added support for downloading feed pages
commit e1faa06908bfd50f2aa0c28ee5118772c4281557
Author: daniel oeh <daniel.oeh@gmail.com>
Date: Wed Nov 5 21:27:03 2014 +0100
Added "paged" and "loadAllPages" attributes
Diffstat (limited to 'app/src/main/java/de')
4 files changed, 56 insertions, 4 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index d84e6cc03..9f028000e 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -183,14 +183,14 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { url = URLChecker.prepareURL(url); feed = new Feed(url, new Date()); 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(), FileNameGenerator.generateFileName(feed.getDownload_url())) .toString(); feed.setFile_url(fileUrl); 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( request); new Thread() { diff --git a/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java index ec133aed1..ebb3780b7 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java @@ -13,7 +13,7 @@ public class StorageCallbacksImpl implements StorageCallbacks { @Override public int getDatabaseVersion() { - return 12; + return 13; } @Override @@ -103,5 +103,11 @@ public class StorageCallbacksImpl implements StorageCallbacks { + " ADD COLUMN " + PodDBAdapter.KEY_IMAGE + " INTEGER"); } + if (oldVersion <= 12) { + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + + " ADD COLUMN " + PodDBAdapter.KEY_IS_PAGED + " INTEGER DEFAULT 0"); + db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + + " ADD COLUMN " + PodDBAdapter.KEY_NEXT_PAGE_LINK + " TEXT"); + } } } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java index 15f6e85e4..abf894c2a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -4,7 +4,6 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; -import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; @@ -44,9 +43,11 @@ import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.download.Downloader; import de.danoeh.antennapod.core.storage.DBReader; +import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.core.util.gui.MoreContentListFooterUtil; import de.danoeh.antennapod.dialog.FeedItemDialog; import de.danoeh.antennapod.menuhandler.FeedMenuHandler; import de.danoeh.antennapod.menuhandler.MenuItemUtils; @@ -82,6 +83,8 @@ public class ItemlistFragment extends ListFragment { private FeedItemDialog feedItemDialog; private FeedItemDialog.FeedItemDialogSavedInstance feedItemDialogSavedInstance; + private MoreContentListFooterUtil listFooter; + private boolean isUpdatingFeed; /** @@ -293,12 +296,17 @@ public class ItemlistFragment extends ListFragment { if (isUpdatingFeed != updateRefreshMenuItemChecker.isRefreshing()) { getActivity().supportInvalidateOptionsMenu(); } + if (listFooter != null) { + listFooter.setLoadingState(DownloadRequester.getInstance().isDownloadingFeeds()); + } + } private void onFragmentLoaded() { if (adapter == null) { getListView().setAdapter(null); setupHeaderView(); + setupFooterView(); adapter = new FeedItemlistAdapter(getActivity(), itemAccess, new DefaultActionButtonCallback(getActivity()), false); setListAdapter(adapter); downloadObserver = new DownloadObserver(getActivity(), new Handler(), downloadObserverCallback); @@ -313,6 +321,11 @@ public class ItemlistFragment extends ListFragment { feedItemDialog = FeedItemDialog.newInstance(getActivity(), feedItemDialogSavedInstance); } getActivity().supportInvalidateOptionsMenu(); + + if (feed != null && feed.getNextPageLink() == null && listFooter != null) { + getListView().removeFooterView(listFooter.getRoot()); + } + } private DownloadObserver.Callback downloadObserverCallback = new DownloadObserver.Callback() { @@ -372,6 +385,34 @@ public class ItemlistFragment extends ListFragment { }); } + private void setupFooterView() { + if (getListView() == null || feed == null) { + Log.e(TAG, "Unable to setup listview: listView = null or feed = null"); + return; + } + if (feed.isPaged() && feed.getNextPageLink() != null) { + ListView lv = getListView(); + LayoutInflater inflater = (LayoutInflater) + getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View header = inflater.inflate(R.layout.more_content_list_footer, lv, false); + lv.addFooterView(header); + listFooter = new MoreContentListFooterUtil(header); + listFooter.setClickListener(new MoreContentListFooterUtil.Listener() { + @Override + public void onClick() { + if (feed != null) { + try { + DBTasks.loadNextPageOfFeed(getActivity(), feed, false); + } catch (DownloadRequestException e) { + e.printStackTrace(); + DownloadRequestErrorDialogCreator.newRequestErrorDialog(getActivity(), e.getMessage()); + } + } + } + }); + } + } + private FeedItemlistAdapter.ItemAccess itemAccess = new FeedItemlistAdapter.ItemAccess() { @Override 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 e382a5888..b62fd22b2 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -41,6 +41,8 @@ public class FeedMenuHandler { else menu.findItem(R.id.support_item).setVisible(false); + menu.findItem(R.id.refresh_complete_item).setVisible(selectedFeed.isPaged()); + return true; } @@ -55,6 +57,9 @@ public class FeedMenuHandler { case R.id.refresh_item: DBTasks.refreshFeed(context, selectedFeed); break; + case R.id.refresh_complete_item: + DBTasks.refreshCompleteFeed(context, selectedFeed); + break; case R.id.mark_all_read_item: DBWriter.markFeedRead(context, selectedFeed.getId()); break; |