undoing changes to 'activity' which weren't needed
This commit is contained in:
parent
dfbd878afe
commit
05c64eb063
|
@ -87,7 +87,7 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
private boolean viewsCreated = false;
|
private boolean viewsCreated = false;
|
||||||
private final boolean showOnlyNewEpisodes;
|
private final boolean showOnlyNewEpisodes;
|
||||||
|
|
||||||
protected AtomicReference<MainActivity> mainActivity = new AtomicReference<MainActivity>();
|
private AtomicReference<MainActivity> activity = new AtomicReference<MainActivity>();
|
||||||
|
|
||||||
private DownloadObserver downloadObserver = null;
|
private DownloadObserver downloadObserver = null;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
EventDistributor.getInstance().register(contentUpdate);
|
EventDistributor.getInstance().register(contentUpdate);
|
||||||
this.mainActivity.set((MainActivity) getActivity());
|
this.activity.set((MainActivity) getActivity());
|
||||||
if (downloadObserver != null) {
|
if (downloadObserver != null) {
|
||||||
downloadObserver.setActivity(getActivity());
|
downloadObserver.setActivity(getActivity());
|
||||||
downloadObserver.onResume();
|
downloadObserver.onResume();
|
||||||
|
@ -153,7 +153,7 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
this.mainActivity.set((MainActivity) getActivity());
|
this.activity.set((MainActivity) getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,7 +188,7 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
|
|
||||||
protected void resetViewState() {
|
protected void resetViewState() {
|
||||||
listAdapter = null;
|
listAdapter = null;
|
||||||
mainActivity.set(null);
|
activity.set(null);
|
||||||
viewsCreated = false;
|
viewsCreated = false;
|
||||||
if (downloadObserver != null) {
|
if (downloadObserver != null) {
|
||||||
downloadObserver.onPause();
|
downloadObserver.onPause();
|
||||||
|
@ -313,7 +313,7 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
|
|
||||||
viewsCreated = true;
|
viewsCreated = true;
|
||||||
|
|
||||||
if (itemsLoaded && mainActivity.get() != null) {
|
if (itemsLoaded && activity.get() != null) {
|
||||||
onFragmentLoaded();
|
onFragmentLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,11 +390,11 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
|
|
||||||
private void onFragmentLoaded() {
|
private void onFragmentLoaded() {
|
||||||
if (listAdapter == null) {
|
if (listAdapter == null) {
|
||||||
listAdapter = new AllEpisodesListAdapter(mainActivity.get(), itemAccess,
|
listAdapter = new AllEpisodesListAdapter(activity.get(), itemAccess,
|
||||||
new DefaultActionButtonCallback(mainActivity.get()), showOnlyNewEpisodes);
|
new DefaultActionButtonCallback(activity.get()), showOnlyNewEpisodes);
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
listView.setEmptyView(txtvEmpty);
|
listView.setEmptyView(txtvEmpty);
|
||||||
downloadObserver = new DownloadObserver(mainActivity.get(), new Handler(), downloadObserverCallback);
|
downloadObserver = new DownloadObserver(activity.get(), new Handler(), downloadObserverCallback);
|
||||||
downloadObserver.onResume();
|
downloadObserver.onResume();
|
||||||
}
|
}
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
|
@ -489,7 +489,7 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
episodes = data.first;
|
episodes = data.first;
|
||||||
queuedItemsIds = data.second;
|
queuedItemsIds = data.second;
|
||||||
itemsLoaded = true;
|
itemsLoaded = true;
|
||||||
if (viewsCreated && mainActivity.get() != null) {
|
if (viewsCreated && activity.get() != null) {
|
||||||
onFragmentLoaded();
|
onFragmentLoaded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue