diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-12-19 19:47:09 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-12-19 19:47:38 +0100 |
commit | 3ad4dbc15f52ed7c068ac022309283678b9b32d6 (patch) | |
tree | a0c7a0e901188d8b278a9a793cb7633b728f7978 /app/src/main/java/de | |
parent | b18e0ccf5b14fc581a62d73fa82d9b7cac65366b (diff) | |
download | AntennaPod-3ad4dbc15f52ed7c068ac022309283678b9b32d6.zip |
Fixed 2.3 issues
- Title in FeedItemFragment was not properly displayed
- ItemlistFragment crashed when ItemFragment was closed
Diffstat (limited to 'app/src/main/java/de')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java | 19 |
1 files changed, 18 insertions, 1 deletions
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 512fee66a..1d8e32d7a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.ListFragment; @@ -18,6 +19,7 @@ import android.view.MenuItem; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; @@ -153,6 +155,7 @@ public class ItemlistFragment extends ListFragment { private void resetViewState() { adapter = null; viewsCreated = false; + listFooter = null; if (downloadObserver != null) { downloadObserver.onPause(); } @@ -252,6 +255,15 @@ public class ItemlistFragment extends ListFragment { } @Override + public void setListAdapter(ListAdapter adapter) { + // This workaround prevents the ListFragment from setting a list adapter when its state is restored. + // This is only necessary on API 10 because addFooterView throws an internal exception in this case. + if (Build.VERSION.SDK_INT > 10 || insideOnFragmentLoaded) { + super.setListAdapter(adapter); + } + } + + @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(""); @@ -297,9 +309,12 @@ public class ItemlistFragment extends ListFragment { } + private boolean insideOnFragmentLoaded = false; + private void onFragmentLoaded() { + insideOnFragmentLoaded = true; if (adapter == null) { - getListView().setAdapter(null); + setListAdapter(null); setupHeaderView(); setupFooterView(); adapter = new FeedItemlistAdapter(getActivity(), itemAccess, new DefaultActionButtonCallback(getActivity()), false); @@ -316,6 +331,8 @@ public class ItemlistFragment extends ListFragment { getListView().removeFooterView(listFooter.getRoot()); } + insideOnFragmentLoaded = false; + } private DownloadObserver.Callback downloadObserverCallback = new DownloadObserver.Callback() { |