summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/fragment
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-04-22 13:55:20 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2014-04-22 13:55:20 +0200
commit1fe2a8da456a3fbf3752c7a8ae218891b632d552 (patch)
tree6734ccb076b47bd8105d9fe8fea4c48bdfdfd198 /src/de/danoeh/antennapod/fragment
parente68482e1b8646884cc7e7a749bd5a2954472b8cf (diff)
downloadAntennaPod-1fe2a8da456a3fbf3752c7a8ae218891b632d552.zip
Resolved dialog issues + fragment crashes
Diffstat (limited to 'src/de/danoeh/antennapod/fragment')
-rw-r--r--src/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java5
-rw-r--r--src/de/danoeh/antennapod/fragment/ItemlistFragment.java8
-rw-r--r--src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java7
-rw-r--r--src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java19
-rw-r--r--src/de/danoeh/antennapod/fragment/QueueFragment.java15
-rw-r--r--src/de/danoeh/antennapod/fragment/SearchFragment.java7
6 files changed, 39 insertions, 22 deletions
diff --git a/src/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java b/src/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java
index fe661a38a..51c92e234 100644
--- a/src/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java
+++ b/src/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java
@@ -53,6 +53,11 @@ public class CompletedDownloadsFragment extends ListFragment {
public void onDetach() {
super.onDetach();
stopItemLoader();
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
listAdapter = null;
viewCreated = false;
}
diff --git a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
index 8a958c758..c3533bff5 100644
--- a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
+++ b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
@@ -118,7 +118,6 @@ public class ItemlistFragment extends ListFragment {
super.onStop();
EventDistributor.getInstance().unregister(contentUpdate);
stopItemLoader();
- resetViewState();
}
@Override
@@ -131,6 +130,11 @@ public class ItemlistFragment extends ListFragment {
public void onDetach() {
super.onDetach();
stopItemLoader();
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
resetViewState();
}
@@ -233,7 +237,7 @@ public class ItemlistFragment extends ListFragment {
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
FeedItem selection = adapter.getItem(position - l.getHeaderViewsCount());
- feedItemDialog = new FeedItemDialog(getActivity(), selection, queue);
+ feedItemDialog = FeedItemDialog.newInstace(getActivity(), selection, queue);
feedItemDialog.show();
}
diff --git a/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java b/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java
index 05ac37554..ae4083c86 100644
--- a/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java
+++ b/src/de/danoeh/antennapod/fragment/NewEpisodesFragment.java
@@ -100,7 +100,6 @@ public class NewEpisodesFragment extends Fragment {
super.onStop();
EventDistributor.getInstance().unregister(contentUpdate);
stopItemLoader();
- resetViewState();
}
@Override
@@ -110,8 +109,8 @@ public class NewEpisodesFragment extends Fragment {
}
@Override
- public void onDetach() {
- super.onDetach();
+ public void onDestroyView() {
+ super.onDestroyView();
resetViewState();
}
@@ -192,7 +191,7 @@ public class NewEpisodesFragment extends Fragment {
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 = FeedItemDialog.newInstace(activity.get(), item, queueAccess);
feedItemDialog.show();
}
diff --git a/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java b/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java
index c4e02c5f0..2abc7a9fb 100644
--- a/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java
+++ b/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java
@@ -73,13 +73,7 @@ public class PlaybackHistoryFragment extends ListFragment {
public void onDetach() {
super.onDetach();
stopItemLoader();
- adapter = null;
- viewsCreated = false;
activity.set(null);
- if (downloadObserver != null) {
- downloadObserver.onPause();
- }
- feedItemDialog = null;
}
@Override
@@ -96,6 +90,17 @@ public class PlaybackHistoryFragment extends ListFragment {
}
@Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ adapter = null;
+ viewsCreated = false;
+ if (downloadObserver != null) {
+ downloadObserver.onPause();
+ }
+ feedItemDialog = null;
+ }
+
+ @Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
viewsCreated = true;
@@ -109,7 +114,7 @@ public class PlaybackHistoryFragment extends ListFragment {
super.onListItemClick(l, v, position, id);
FeedItem item = adapter.getItem(position - l.getHeaderViewsCount());
if (item != null) {
- feedItemDialog = new FeedItemDialog(activity.get(), item, queue);
+ feedItemDialog = FeedItemDialog.newInstace(activity.get(), item, queue);
feedItemDialog.show();
}
}
diff --git a/src/de/danoeh/antennapod/fragment/QueueFragment.java b/src/de/danoeh/antennapod/fragment/QueueFragment.java
index 838da7e6a..13f21e3c8 100644
--- a/src/de/danoeh/antennapod/fragment/QueueFragment.java
+++ b/src/de/danoeh/antennapod/fragment/QueueFragment.java
@@ -96,7 +96,6 @@ public class QueueFragment extends Fragment {
super.onStop();
EventDistributor.getInstance().unregister(contentUpdate);
stopItemLoader();
- resetViewState();
}
@Override
@@ -105,12 +104,6 @@ public class QueueFragment extends Fragment {
this.activity.set((MainActivity) activity);
}
- @Override
- public void onDetach() {
- super.onDetach();
- resetViewState();
- }
-
private void resetViewState() {
listAdapter = null;
undoBarController = null;
@@ -124,6 +117,12 @@ public class QueueFragment extends Fragment {
}
@Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ resetViewState();
+ }
+
+ @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
final SearchView sv = new SearchView(getActivity());
@@ -160,7 +159,7 @@ public class QueueFragment extends Fragment {
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 = FeedItemDialog.newInstace(activity.get(), item, QueueAccess.ItemListAccess(queue));
feedItemDialog.show();
}
}
diff --git a/src/de/danoeh/antennapod/fragment/SearchFragment.java b/src/de/danoeh/antennapod/fragment/SearchFragment.java
index 268e36c37..566695465 100644
--- a/src/de/danoeh/antennapod/fragment/SearchFragment.java
+++ b/src/de/danoeh/antennapod/fragment/SearchFragment.java
@@ -89,6 +89,11 @@ public class SearchFragment extends ListFragment {
public void onDetach() {
super.onDetach();
stopSearchTask();
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
searchAdapter = null;
viewCreated = false;
}
@@ -112,7 +117,7 @@ public class SearchFragment extends ListFragment {
((MainActivity)getActivity()).loadFeedFragment(comp.getId());
} else {
if (comp.getClass() == FeedItem.class) {
- feedItemDialog = new FeedItemDialog(getActivity(), (FeedItem) comp, queue);
+ feedItemDialog = FeedItemDialog.newInstace(getActivity(), (FeedItem) comp, queue);
feedItemDialog.show();
}
}