summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java7
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java289
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java12
-rwxr-xr-xdescription/en.txt62
4 files changed, 196 insertions, 174 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
index e7e39d794..1b2c14756 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
@@ -551,8 +551,11 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
menuInfo = lastMenuInfo;
}
- if(menuInfo.targetView.getParent() instanceof ListView == false
- || ((ListView)menuInfo.targetView.getParent()).getId() != R.id.nav_list) {
+ if(menuInfo == null
+ || menuInfo.targetView == null
+ || menuInfo.targetView.getParent() == null
+ || menuInfo.targetView.getParent() instanceof ListView == false
+ || ((ListView)menuInfo.targetView.getParent()).getId() != R.id.nav_list) {
return false;
}
final int position = menuInfo.position;
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
index 6d28478e9..705de636c 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
@@ -11,8 +11,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
-import android.support.v4.app.LoaderManager;
-import android.support.v4.content.Loader;
import android.support.v4.util.Pair;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.Toolbar;
@@ -42,12 +40,11 @@ import java.util.List;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.DefaultActionButtonCallback;
-import de.danoeh.antennapod.core.asynctask.DBTaskLoader;
import de.danoeh.antennapod.core.asynctask.DownloadObserver;
+import de.danoeh.antennapod.core.event.QueueEvent;
import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.FeedMedia;
-import de.danoeh.antennapod.core.event.QueueEvent;
import de.danoeh.antennapod.core.glide.ApGlideSettings;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.Downloader;
@@ -63,11 +60,15 @@ import de.danoeh.antennapod.core.util.ShareUtils;
import de.danoeh.antennapod.core.util.playback.Timeline;
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
import de.greenrobot.event.EventBus;
+import rx.Observable;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
/**
* Displays information about a FeedItem and actions.
*/
-public class ItemFragment extends Fragment implements LoaderManager.LoaderCallbacks<Pair<FeedItem, LongList>> {
+public class ItemFragment extends Fragment {
private static final String TAG = "ItemFragment";
@@ -113,6 +114,8 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
private ImageButton butMore;
private PopupMenu popupMenu;
+ private Subscription subscription;
+
/**
* URL that was selected via long-press.
*/
@@ -127,55 +130,6 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
itemID = getArguments().getLong(ARG_FEEDITEM, -1);
}
- @Override
- public void onActivityCreated(@Nullable Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
- getLoaderManager().initLoader(0, null, this);
- Toolbar toolbar = ((MainActivity) getActivity()).getToolbar();
- toolbar.addView(header);
- }
-
- @Override
- public void onStart() {
- super.onStart();
- EventDistributor.getInstance().register(contentUpdate);
- EventBus.getDefault().register(this);
- if (downloadObserver != null) {
- downloadObserver.setActivity(getActivity());
- downloadObserver.onResume();
- }
- if (itemsLoaded) {
- onFragmentLoaded();
- }
-
- }
-
- @Override
- public void onStop() {
- super.onStop();
- EventDistributor.getInstance().unregister(contentUpdate);
- EventBus.getDefault().unregister(this);
- }
-
- private void resetViewState() {
- if (downloadObserver != null) {
- downloadObserver.onPause();
- }
- Toolbar toolbar = ((MainActivity) getActivity()).getToolbar();
- toolbar.removeView(header);
- }
-
- @Override
- public void onDestroyView() {
- super.onDestroyView();
- resetViewState();
- if (webvDescription != null && root != null) {
- root.removeView(webvDescription);
- webvDescription.destroy();
- }
- }
-
-
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -195,19 +149,18 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
webvDescription = (WebView) layout.findViewById(R.id.webvDescription);
if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
if (Build.VERSION.SDK_INT >= 11
- && Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
+ && Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
webvDescription.setBackgroundColor(getResources().getColor(
- R.color.black));
+ R.color.black));
}
webvDescription.getSettings().setUseWideViewPort(false);
webvDescription.getSettings().setLayoutAlgorithm(
- WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
+ WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webvDescription.getSettings().setLoadWithOverviewMode(true);
webvDescription.setOnLongClickListener(webViewLongClickListener);
webvDescription.setWebViewClient(new WebViewClient() {
-
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
@@ -243,74 +196,111 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
((MainActivity) getActivity()).dismissChildFragment();
}
}
-
-
}
);
- butAction2.setOnClickListener(new View.OnClickListener()
-
- {
- @Override
- public void onClick(View v) {
- if (item == null) {
- return;
- }
+ butAction2.setOnClickListener(v -> {
+ if (item == null) {
+ return;
+ }
- if (item.hasMedia()) {
- FeedMedia media = item.getMedia();
- if (!media.isDownloaded()) {
- DBTasks.playMedia(getActivity(), media, true, true, true);
- ((MainActivity) getActivity()).dismissChildFragment();
- } else {
- DBWriter.deleteFeedMediaOfItem(getActivity(), media.getId());
- }
- } else if (item.getLink() != null) {
- Uri uri = Uri.parse(item.getLink());
- getActivity().startActivity(new Intent(Intent.ACTION_VIEW, uri));
- }
- }
- }
+ if (item.hasMedia()) {
+ FeedMedia media = item.getMedia();
+ if (!media.isDownloaded()) {
+ DBTasks.playMedia(getActivity(), media, true, true, true);
+ ((MainActivity) getActivity()).dismissChildFragment();
+ } else {
+ DBWriter.deleteFeedMediaOfItem(getActivity(), media.getId());
+ }
+ } else if (item.getLink() != null) {
+ Uri uri = Uri.parse(item.getLink());
+ getActivity().startActivity(new Intent(Intent.ACTION_VIEW, uri));
+ }
+ }
);
- butMore.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (item == null) {
- return;
- }
- popupMenu.getMenu().clear();
- popupMenu.inflate(R.menu.feeditem_options);
- if (item.hasMedia()) {
- FeedItemMenuHandler.onPrepareMenu(getActivity(), popupMenuInterface, item, true, queue);
- } else {
- // these are already available via button1 and button2
- FeedItemMenuHandler.onPrepareMenu(getActivity(), popupMenuInterface, item, true, queue,
- R.id.mark_read_item, R.id.visit_website_item);
- }
- popupMenu.show();
- }
- }
+ butMore.setOnClickListener(v -> {
+ if (item == null) {
+ return;
+ }
+ popupMenu.getMenu().clear();
+ popupMenu.inflate(R.menu.feeditem_options);
+ if (item.hasMedia()) {
+ FeedItemMenuHandler.onPrepareMenu(getActivity(), popupMenuInterface, item, true, queue);
+ } else {
+ // these are already available via button1 and button2
+ FeedItemMenuHandler.onPrepareMenu(getActivity(), popupMenuInterface, item, true, queue,
+ R.id.mark_read_item, R.id.visit_website_item);
+ }
+ popupMenu.show();
+ }
);
- popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem menuItem) {
-
- try {
- return FeedItemMenuHandler.onMenuItemClicked(getActivity(), menuItem.getItemId(), item);
- } catch (DownloadRequestException e) {
- e.printStackTrace();
- Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();
- return true;
- }
- }
- }
+ popupMenu.setOnMenuItemClickListener(menuItem -> {
+
+ try {
+ return FeedItemMenuHandler.onMenuItemClicked(getActivity(), menuItem.getItemId(), item);
+ } catch (DownloadRequestException e) {
+ e.printStackTrace();
+ Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();
+ return true;
+ }
+ }
);
return layout;
}
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ Toolbar toolbar = ((MainActivity) getActivity()).getToolbar();
+ toolbar.addView(header);
+ load();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ EventDistributor.getInstance().register(contentUpdate);
+ EventBus.getDefault().register(this);
+ if (downloadObserver != null) {
+ downloadObserver.setActivity(getActivity());
+ downloadObserver.onResume();
+ }
+ if(itemsLoaded) {
+ updateAppearance();
+ }
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ EventDistributor.getInstance().unregister(contentUpdate);
+ EventBus.getDefault().unregister(this);
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ resetViewState();
+ if(subscription != null) {
+ subscription.unsubscribe();
+ }
+ if (webvDescription != null && root != null) {
+ root.removeView(webvDescription);
+ webvDescription.destroy();
+ }
+ }
+
+ private void resetViewState() {
+ if (downloadObserver != null) {
+ downloadObserver.onPause();
+ }
+ Toolbar toolbar = ((MainActivity) getActivity()).getToolbar();
+ toolbar.removeView(header);
+ }
+
private final FeedItemMenuHandler.MenuInterface popupMenuInterface = new FeedItemMenuHandler.MenuInterface() {
@Override
public void setItemVisibility(int id, boolean visible) {
@@ -409,11 +399,6 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
}
}
- public void onEvent(QueueEvent event) {
- Log.d(TAG, "onEvent(" + event + ")");
- getLoaderManager().restartLoader(0, null, ItemFragment.this);
- }
-
private View.OnLongClickListener webViewLongClickListener = new View.OnLongClickListener() {
@Override
@@ -491,46 +476,18 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
}
}
- @Override
- public Loader<Pair<FeedItem,LongList>> onCreateLoader(int id, Bundle args) {
- return new DBTaskLoader<Pair<FeedItem,LongList>>(getActivity()) {
- @Override
- public Pair<FeedItem,LongList> loadInBackground() {
- FeedItem data1 = DBReader.getFeedItem(itemID);
- if (data1 != null) {
- Timeline t = new Timeline(getActivity(), data1);
- webviewData = t.processShownotes(false);
- }
- LongList data2 = DBReader.getQueueIDList();
- return Pair.create(data1, data2);
- }
- };
- }
-
- @Override
- public void onLoadFinished(Loader<Pair<FeedItem,LongList>> loader, Pair<FeedItem,LongList> data) {
-
- if (data != null) {
- item = data.first;
- queue = data.second;
- if (!itemsLoaded) {
- itemsLoaded = true;
- onFragmentLoaded();
- } else {
- updateAppearance();
- }
+ public void onEventMainThread(QueueEvent event) {
+ if(event.contains(itemID)) {
+ updateAppearance();
}
}
- @Override
- public void onLoaderReset(Loader<Pair<FeedItem,LongList>> loader) {
- }
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EVENTS) != 0) {
- getLoaderManager().restartLoader(0, null, ItemFragment.this);
+ updateAppearance();
}
}
};
@@ -545,4 +502,36 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
}
}
};
+
+ private void load() {
+ if(subscription != null) {
+ subscription.unsubscribe();
+ }
+ subscription = Observable.defer(() -> Observable.just(loadInBackground()))
+ .subscribeOn(Schedulers.newThread())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(result -> {
+ item = result.first;
+ queue = result.second;
+ if (!itemsLoaded) {
+ itemsLoaded = true;
+ onFragmentLoaded();
+ } else {
+ updateAppearance();
+ }
+ }, error -> {
+ Log.e(TAG, Log.getStackTraceString(error));
+ });
+ }
+
+ private Pair<FeedItem,LongList> loadInBackground() {
+ FeedItem data1 = DBReader.getFeedItem(itemID);
+ if (data1 != null) {
+ Timeline t = new Timeline(getActivity(), data1);
+ webviewData = t.processShownotes(false);
+ }
+ LongList data2 = DBReader.getQueueIDList();
+ return Pair.create(data1, data2);
+ }
+
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java
index 4d59d75eb..4992252d1 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java
@@ -41,6 +41,18 @@ public class QueueEvent {
this.position = position;
}
+ public boolean contains(long id) {
+ if(item != null) {
+ return item.getId() == id;
+ }
+ for(FeedItem item : items) {
+ if(item.getId() == id) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
diff --git a/description/en.txt b/description/en.txt
index 3f3ffea02..9aa4769e4 100755
--- a/description/en.txt
+++ b/description/en.txt
@@ -1,22 +1,40 @@
-An open-source podcast manager for Android.
-
-AntennaPod is an open-source podcast manager for Android 2.3.3 and above. It offers all the basic features you expect from a podcatcher, like streaming and downloading episodes, refreshing all feeds automatically or adding them to a queue to listen to them later. Moreover, AntennaPod lets you flattr podcasts and episodes from within the app.
-
-So far the following features are implemented:
-
-* Downloading and Streaming of episodes
-* Variable speed playback (requires Presto Sound Library or Prestissimo)
-* Support for Atom and RSS feeds
-* Support for password-protected feeds and episodes
-* Support for searching iTunes listings
-* OPML import and export
-* Flattr integration including automatic flattring
-* Player homescreen widget
-* Search
-* Automatic feed updates
-* Automatic download of new episodes
-* Sleep timer
-* Access to the gpodder.net podcast directory
-* Subscription syncing with the gpodder.net service
-* Supports MP3 chapters, VorbisComment chapters and Podlove Simple Chapters
-* Supports paged feeds (http://podlove.org/paged-feeds/)
+AntennaPod is a podcast manager that gives you instant access to millions of free and paid podcasts, from independent podcasters to large publishing houses such as the BBC, NPR and CNN. Add, import and export their feeds hassle-free using the iTunes podcast database, OPML files or simple RSS URLs. Save effort, battery power and mobile data usage with powerful automation controls for downloading episodes (specify times, intervals and WiFi networks) and deleting episodes (based your favourites and delay settings).<br>
+But most importantly: Download, stream or queue episodes and enjoy them the way you like with adjustable playback speeds, chapter support and a sleep timer. You can even show your love to the content creators with our Flattr integration.
+
+Made by podcast-enthousiast, AntennaPod is free in all senses of the word: open source, no costs, no ads.
+
+<b>All features:</b><br>
+IMPORT, MANAGE AND PLAY<br>
+&#8226; Add and import feeds via the iTunes and gPodder.net directories, OPML files and RSS or Atom links<br>
+&#8226; Manage playback from anywhere: homescreen widget, system notification and earplug and bluetooth controls<br>
+&#8226; Enjoy listening your way with adjustable playback speed, chapter support (MP3, VorbisComment and Podlove), remembered playback position and an advanced sleep timer (shake to reset, lower volume and slow down playback)<br>
+&#8226; Access password-protected feeds and episodes<br>
+&#8226; Take advantage of paged feeds (www.podlove.org/paged-feeds)
+
+KEEP TRACK, SHARE & APPRECIATE<br>
+&#8226; Keep track of the best of the best by marking episodes as favourites<br>
+&#8226; Find that one episode through the playback history or by searching (titles and shownotes)<br>
+&#8226; Share episodes and feeds through advanced social media and email options, the gPodder.net services and via OPML export<br>
+&#8226; Support content creators with Flattr integration including automatic flattring
+
+CONTROL THE SYSTEM<br>
+&#8226; Take control over automated downloading: choose feeds, exclude mobile networks, select specific WiFi networks, require the phone to be charging and set times or intervals<br>
+&#8226; Manage storage by setting the amount of cached episodes, smart deletion (based on your favourites and play status) and selecting your preferred location<br>
+&#8226; Use AntennaPod in your language (EN, DE, CS, NL, NB, JA, PT, ES, SV, CA, UK, FR, KO, TR, ZH)<br>
+&#8226; Adapt to your environment using the light and dark theme<br>
+&#8226; Back-up your subscriptions with the gPodder.net integration and OPML export
+
+<b>Join the AntennaPod community!</b><br>
+AntennaPod is under active development by volunteers. You can contribute too, with code or with comment!
+
+GitHub is the place to go for feature requests, bug reports and code contributions:<br>
+www.github.com/AntennaPod/AntennaPod
+
+Our Google Group is the place to share your ideas, favourite podcasting moments and gratitude to all the volunteers:<br>
+https://groups.google.com/forum/#!forum/antennapod
+
+Transifex is the place to help with translations:<br>
+www.transifex.com/antennapod/antennapod
+
+Check out our Beta Testing programme to get the latest features first:<br>
+www.github.com/AntennaPod/AntennaPod/wiki/Help-test-AntennaPod