scroll to the first new entry when loading more headlines

This commit is contained in:
Andrew Dolgov 2011-11-26 10:40:35 +03:00
parent e02e76bf6f
commit 5b0c674f2b

View File

@ -191,11 +191,19 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
if (m_offset == 0) if (m_offset == 0)
m_articles.clear(); m_articles.clear();
int last_position = m_articles.size();
for (Article f : articles) for (Article f : articles)
m_articles.add(f); m_articles.add(f);
m_adapter.notifyDataSetChanged(); m_adapter.notifyDataSetChanged();
ListView list = (ListView)getView().findViewById(R.id.headlines);
if (list != null) {
list.setSelection(last_position+1);
}
showLoading(false); showLoading(false);
} }
}); });