experimental: set article pager and headlines fragment to retain instance

debug: open all articles on startup
This commit is contained in:
Andrew Dolgov 2017-05-31 18:23:17 +03:00
parent 05dec34be2
commit 02810f6eee
3 changed files with 22 additions and 3 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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) {