summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/fragment
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-04-18 20:32:22 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2014-04-18 20:32:22 +0200
commit257913196b0aa7f971bad387359f49e391fe9ed3 (patch)
tree2cff3dba84443aabffea4ee16948bf9d42353b63 /src/de/danoeh/antennapod/fragment
parent9a86c6651a2335f3385777c99a3943ac52d555f0 (diff)
downloadAntennaPod-257913196b0aa7f971bad387359f49e391fe9ed3.zip
Added FeedItem dialog
Diffstat (limited to 'src/de/danoeh/antennapod/fragment')
-rw-r--r--src/de/danoeh/antennapod/fragment/ItemlistFragment.java18
-rw-r--r--src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java26
-rw-r--r--src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java23
-rw-r--r--src/de/danoeh/antennapod/fragment/QueueFragment.java24
4 files changed, 91 insertions, 0 deletions
diff --git a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
index dce64aa5e..de3d48d55 100644
--- a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
+++ b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
@@ -23,6 +23,7 @@ import de.danoeh.antennapod.adapter.DefaultActionButtonCallback;
import de.danoeh.antennapod.adapter.InternalFeedItemlistAdapter;
import de.danoeh.antennapod.asynctask.DownloadObserver;
import de.danoeh.antennapod.asynctask.ImageLoader;
+import de.danoeh.antennapod.dialog.FeedItemDialog;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem;
@@ -65,6 +66,8 @@ public class ItemlistFragment extends ListFragment {
private DownloadObserver downloadObserver;
private List<Downloader> downloaderList;
+ private FeedItemDialog feedItemDialog;
+
/**
* Creates new ItemlistFragment which shows the Feeditems of a specific
@@ -122,6 +125,7 @@ public class ItemlistFragment extends ListFragment {
if (downloadObserver != null) {
downloadObserver.onPause();
}
+ feedItemDialog = null;
}
@Override
@@ -149,12 +153,16 @@ public class ItemlistFragment extends ListFragment {
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
FeedItem selection = adapter.getItem(position - l.getHeaderViewsCount());
+ /*
Intent showItem = new Intent(getActivity(), ItemviewActivity.class);
showItem.putExtra(FeedlistFragment.EXTRA_SELECTED_FEED, selection
.getFeed().getId());
showItem.putExtra(EXTRA_SELECTED_FEEDITEM, selection.getId());
startActivity(showItem);
+ */
+ feedItemDialog = new FeedItemDialog(activity.get(), selection, queue);
+ feedItemDialog.show();
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@@ -200,6 +208,13 @@ public class ItemlistFragment extends ListFragment {
setListShown(true);
adapter.notifyDataSetChanged();
+ if (feedItemDialog != null && feedItemDialog.isShowing()) {
+ feedItemDialog.setItemFromCollection(feed.getItems());
+ feedItemDialog.setQueue(queue);
+ feedItemDialog.updateMenuAppearance();
+ }
+
+
}
private DownloadObserver.Callback downloadObserverCallback = new DownloadObserver.Callback() {
@@ -208,6 +223,9 @@ public class ItemlistFragment extends ListFragment {
if (adapter != null) {
adapter.notifyDataSetChanged();
}
+ if (feedItemDialog != null && feedItemDialog.isShowing()) {
+ feedItemDialog.updateMenuAppearance();
+ }
}
@Override
diff --git a/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java b/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java
index 3377dc565..c2dccd820 100644
--- a/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java
+++ b/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java
@@ -9,6 +9,7 @@ import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.mobeta.android.dslv.DragSortListView;
@@ -17,6 +18,7 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.DefaultActionButtonCallback;
import de.danoeh.antennapod.adapter.NewEpisodesListAdapter;
import de.danoeh.antennapod.asynctask.DownloadObserver;
+import de.danoeh.antennapod.dialog.FeedItemDialog;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
@@ -56,6 +58,8 @@ public class NewEpisodesFragment extends Fragment {
private DownloadObserver downloadObserver = null;
+ private FeedItemDialog feedItemDialog;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -101,6 +105,7 @@ public class NewEpisodesFragment extends Fragment {
if (downloadObserver != null) {
downloadObserver.onPause();
}
+ feedItemDialog = null;
}
@Override
@@ -111,6 +116,18 @@ public class NewEpisodesFragment extends Fragment {
txtvEmpty = (TextView) root.findViewById(android.R.id.empty);
progLoading = (ProgressBar) root.findViewById(R.id.progLoading);
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ FeedItem item = (FeedItem) listAdapter.getItem(position - listView.getHeaderViewsCount());
+ if (item != null) {
+ feedItemDialog = new FeedItemDialog(activity.get(), item, queueAccess);
+ feedItemDialog.show();
+ }
+
+ }
+ });
+
if (!itemsLoaded) {
progLoading.setVisibility(View.VISIBLE);
txtvEmpty.setVisibility(View.GONE);
@@ -133,6 +150,12 @@ public class NewEpisodesFragment extends Fragment {
downloadObserver = new DownloadObserver(activity.get(), new Handler(), downloadObserverCallback);
downloadObserver.onResume();
}
+ if (feedItemDialog != null && feedItemDialog.isShowing()) {
+ feedItemDialog.setQueue(queueAccess);
+ feedItemDialog.setItemFromCollection(unreadItems);
+ feedItemDialog.setItemFromCollection(recentItems);
+ feedItemDialog.updateMenuAppearance();
+ }
listAdapter.notifyDataSetChanged();
}
@@ -142,6 +165,9 @@ public class NewEpisodesFragment extends Fragment {
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
+ if (feedItemDialog != null && feedItemDialog.isShowing()) {
+ feedItemDialog.updateMenuAppearance();
+ }
}
@Override
diff --git a/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java b/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java
index a8627f12e..c28208d37 100644
--- a/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java
+++ b/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java
@@ -7,10 +7,12 @@ import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.ListFragment;
import android.view.View;
+import android.widget.ListView;
import de.danoeh.antennapod.adapter.ActionButtonCallback;
import de.danoeh.antennapod.adapter.DefaultActionButtonCallback;
import de.danoeh.antennapod.adapter.InternalFeedItemlistAdapter;
import de.danoeh.antennapod.asynctask.DownloadObserver;
+import de.danoeh.antennapod.dialog.FeedItemDialog;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
@@ -36,6 +38,8 @@ public class PlaybackHistoryFragment extends ListFragment {
private DownloadObserver downloadObserver;
private List<Downloader> downloaderList;
+ private FeedItemDialog feedItemDialog;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -67,6 +71,7 @@ public class PlaybackHistoryFragment extends ListFragment {
if (downloadObserver != null) {
downloadObserver.onPause();
}
+ feedItemDialog = null;
}
@Override
@@ -91,6 +96,16 @@ public class PlaybackHistoryFragment extends ListFragment {
}
}
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+ super.onListItemClick(l, v, position, id);
+ FeedItem item = adapter.getItem(position - l.getHeaderViewsCount());
+ if (item != null) {
+ feedItemDialog = new FeedItemDialog(activity.get(), item, queue);
+ feedItemDialog.show();
+ }
+ }
+
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
@@ -110,6 +125,11 @@ public class PlaybackHistoryFragment extends ListFragment {
}
setListShown(true);
adapter.notifyDataSetChanged();
+ if (feedItemDialog != null && feedItemDialog.isShowing()) {
+ feedItemDialog.setItemFromCollection(playbackHistory);
+ feedItemDialog.setQueue(queue);
+ feedItemDialog.updateMenuAppearance();
+ }
}
private DownloadObserver.Callback downloadObserverCallback = new DownloadObserver.Callback() {
@@ -118,6 +138,9 @@ public class PlaybackHistoryFragment extends ListFragment {
if (adapter != null) {
adapter.notifyDataSetChanged();
}
+ if (feedItemDialog != null && feedItemDialog.isShowing()) {
+ feedItemDialog.updateMenuAppearance();
+ }
}
@Override
diff --git a/src/de/danoeh/antennapod/fragment/QueueFragment.java b/src/de/danoeh/antennapod/fragment/QueueFragment.java
index e88c7e178..093151d98 100644
--- a/src/de/danoeh/antennapod/fragment/QueueFragment.java
+++ b/src/de/danoeh/antennapod/fragment/QueueFragment.java
@@ -11,6 +11,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.mobeta.android.dslv.DragSortListView;
@@ -19,12 +20,14 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.DefaultActionButtonCallback;
import de.danoeh.antennapod.adapter.QueueListAdapter;
import de.danoeh.antennapod.asynctask.DownloadObserver;
+import de.danoeh.antennapod.dialog.FeedItemDialog;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.service.download.Downloader;
import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.storage.DBWriter;
+import de.danoeh.antennapod.util.QueueAccess;
import de.danoeh.antennapod.util.UndoBarController;
import de.danoeh.antennapod.util.gui.FeedItemUndoToken;
@@ -56,6 +59,8 @@ public class QueueFragment extends Fragment {
private DownloadObserver downloadObserver = null;
+ private FeedItemDialog feedItemDialog;
+
/**
* Download observer updates won't result in an upate of the list adapter if this is true.
*/
@@ -108,6 +113,7 @@ public class QueueFragment extends Fragment {
if (downloadObserver != null) {
downloadObserver.onPause();
}
+ feedItemDialog = null;
}
@Override
@@ -119,6 +125,16 @@ public class QueueFragment extends Fragment {
progLoading = (ProgressBar) root.findViewById(R.id.progLoading);
listView.setEmptyView(txtvEmpty);
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ FeedItem item = (FeedItem) listAdapter.getItem(position - listView.getHeaderViewsCount());
+ if (item != null) {
+ feedItemDialog = new FeedItemDialog(activity.get(), item, QueueAccess.ItemListAccess(queue));
+ feedItemDialog.show();
+ }
+ }
+ });
listView.setRemoveListener(new DragSortListView.RemoveListener() {
@Override
@@ -192,6 +208,11 @@ public class QueueFragment extends Fragment {
downloadObserver.onResume();
}
listAdapter.notifyDataSetChanged();
+ if (feedItemDialog != null && feedItemDialog.isShowing()) {
+ feedItemDialog.setQueue(QueueAccess.ItemListAccess(queue));
+ feedItemDialog.setItemFromCollection(queue);
+ feedItemDialog.updateMenuAppearance();
+ }
}
private DownloadObserver.Callback downloadObserverCallback = new DownloadObserver.Callback() {
@@ -200,6 +221,9 @@ public class QueueFragment extends Fragment {
if (listAdapter != null && !blockDownloadObserverUpdate) {
listAdapter.notifyDataSetChanged();
}
+ if (feedItemDialog != null && feedItemDialog.isShowing()) {
+ feedItemDialog.updateMenuAppearance();
+ }
}
@Override