hide headlines fragment fab on tablets in landscape

use shared articlelist if possible in both pager & fragment
This commit is contained in:
Andrew Dolgov 2016-04-14 09:56:50 +03:00
parent 657366879c
commit c3a9241741
2 changed files with 20 additions and 8 deletions

View File

@ -81,7 +81,13 @@ public class ArticlePager extends Fragment {
if (savedInstanceState != null) {
m_article = savedInstanceState.getParcelable("article");
m_articles = ((DetailActivity)m_activity).m_articles;
if (! (m_activity instanceof DetailActivity)) {
m_articles = savedInstanceState.getParcelable("articles");
} else {
m_articles = ((DetailActivity)m_activity).m_articles;
}
m_feed = savedInstanceState.getParcelable("feed");
m_firstId = savedInstanceState.getInt("firstId");
}

View File

@ -434,13 +434,19 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
m_list = (ListView)view.findViewById(R.id.headlines_list);
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.headlines_fab);
m_list.setOnTouchListener(new ShowHideOnScroll(fab));
fab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
refresh(false);
}
});
if (! (getActivity() instanceof DetailActivity)) {
m_list.setOnTouchListener(new ShowHideOnScroll(fab));
fab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
refresh(false);
}
});
} else {
fab.setVisibility(View.GONE);
}
m_listLoadingView = inflater.inflate(R.layout.headlines_row_loadmore, m_list, false);
m_list.addFooterView(m_listLoadingView, null, false);