From 02810f6eee11927991f2c2cb2423b83af8c62caf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 31 May 2017 18:23:17 +0300 Subject: [PATCH] experimental: set article pager and headlines fragment to retain instance debug: open all articles on startup --- .../src/main/java/org/fox/ttrss/ArticlePager.java | 9 ++++++++- .../src/main/java/org/fox/ttrss/HeadlinesFragment.java | 9 ++++++++- .../src/main/java/org/fox/ttrss/MasterActivity.java | 7 ++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java index 6e51722c..ac621191 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java @@ -88,7 +88,14 @@ public class ArticlePager extends Fragment { public void setSearchQuery(String searchQuery) { m_searchQuery = searchQuery; } - + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setRetainInstance(true); + } + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.article_pager, container, false); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java index 880bf384..1967f5cb 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -435,7 +435,14 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, super.onCreateContextMenu(menu, v, menuInfo); } - + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setRetainInstance(true); + } + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java index 51781582..1c557df9 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java @@ -151,7 +151,12 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList if (m_prefs.getBoolean("open_fresh_on_startup", true)) { HeadlinesFragment hf = new HeadlinesFragment(); - hf.initialize(new Feed(-3, getString(R.string.fresh_articles), false)); + + if (BuildConfig.DEBUG) { + hf.initialize(new Feed(-4, "All articles", false)); + } else { + hf.initialize(new Feed(-3, getString(R.string.fresh_articles), false)); + } ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES); } else if (m_drawerLayout != null) {