properly restore fragment states on resume/rotate
This commit is contained in:
parent
7604bb30e5
commit
c00b9e724e
@ -80,6 +80,7 @@ public class ArticlePager extends Fragment {
|
|||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
m_article = savedInstanceState.getParcelable("article");
|
m_article = savedInstanceState.getParcelable("article");
|
||||||
|
m_articles = ((HeadlinesActivity)m_activity).m_articles;
|
||||||
m_feed = savedInstanceState.getParcelable("feed");
|
m_feed = savedInstanceState.getParcelable("feed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == HEADLINES_REQUEST) {
|
if (requestCode == HEADLINES_REQUEST && data != null) {
|
||||||
//GlobalState.getInstance().m_activeArticle = null;
|
//GlobalState.getInstance().m_activeArticle = null;
|
||||||
|
|
||||||
//ArrayList<Article> tmp = data.getParcelableArrayListExtra("articles");
|
//ArrayList<Article> tmp = data.getParcelableArrayListExtra("articles");
|
||||||
|
@ -20,7 +20,7 @@ import org.fox.ttrss.types.Feed;
|
|||||||
|
|
||||||
public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventListener {
|
public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventListener {
|
||||||
private final String TAG = this.getClass().getSimpleName();
|
private final String TAG = this.getClass().getSimpleName();
|
||||||
private ArticleList m_articles = new ArticleList();
|
protected ArticleList m_articles = new ArticleList();
|
||||||
|
|
||||||
protected SharedPreferences m_prefs;
|
protected SharedPreferences m_prefs;
|
||||||
private Article m_activeArticle;
|
private Article m_activeArticle;
|
||||||
@ -49,8 +49,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
//
|
m_articles = savedInstanceState.getParcelable("articles");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
|
|
||||||
@ -145,6 +144,8 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle out) {
|
public void onSaveInstanceState(Bundle out) {
|
||||||
super.onSaveInstanceState(out);
|
super.onSaveInstanceState(out);
|
||||||
|
|
||||||
|
out.putParcelable("articles", m_articles);
|
||||||
|
|
||||||
GlobalState.getInstance().save(out);
|
GlobalState.getInstance().save(out);
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,13 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
m_feed = savedInstanceState.getParcelable("feed");
|
m_feed = savedInstanceState.getParcelable("feed");
|
||||||
m_articles = savedInstanceState.getParcelable("articles");
|
|
||||||
|
if (! (m_activity instanceof HeadlinesActivity)) {
|
||||||
|
m_articles = savedInstanceState.getParcelable("articles");
|
||||||
|
} else {
|
||||||
|
m_articles = ((HeadlinesActivity)m_activity).m_articles;
|
||||||
|
}
|
||||||
|
|
||||||
m_activeArticle = savedInstanceState.getParcelable("activeArticle");
|
m_activeArticle = savedInstanceState.getParcelable("activeArticle");
|
||||||
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
|
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
|
||||||
m_searchQuery = (String) savedInstanceState.getCharSequence("searchQuery");
|
m_searchQuery = (String) savedInstanceState.getCharSequence("searchQuery");
|
||||||
|
Loading…
Reference in New Issue
Block a user