diff options
author | Andrew Dolgov <[email protected]> | 2015-06-04 19:49:04 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-06-04 19:49:04 +0300 |
commit | 6b6f3db8c3ffc864e2d56dc1741d7ddb53dab171 (patch) | |
tree | f34aab8f44034faddf7fbfbc2e4c6d653a4e0def /org.fox.ttrss/src/main/java | |
parent | 17327f145723f031c003a4d53b4206c8e05f8627 (diff) |
add workaround for listview animations not working after clear()
Diffstat (limited to 'org.fox.ttrss/src/main/java')
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java | 13 |
1 files changed, 8 insertions, 5 deletions
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 b395eca3..808a5ef1 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 @@ -47,6 +47,7 @@ import android.widget.TextView; import com.amulyakhare.textdrawable.TextDrawable; import com.amulyakhare.textdrawable.util.ColorGenerator; import com.google.gson.JsonElement; +import com.nhaarman.listviewanimations.appearance.AnimationAdapter; import com.nhaarman.listviewanimations.appearance.simple.SwingBottomInAnimationAdapter; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; @@ -90,6 +91,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, private SharedPreferences m_prefs; private ArticleListAdapter m_adapter; + private AnimationAdapter m_animationAdapter; private ArticleList m_articles = new ArticleList(); //GlobalState.getInstance().m_loadedArticles; //private ArticleList m_selectedArticles = new ArticleList(); private ArticleList m_readArticles = new ArticleList(); @@ -377,10 +379,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, } m_adapter = new ArticleListAdapter(getActivity(), R.layout.headlines_row, (ArrayList<Article>)m_articles); - SwingBottomInAnimationAdapter animationAdapter = new SwingBottomInAnimationAdapter(m_adapter); + m_animationAdapter = new SwingBottomInAnimationAdapter(m_adapter); - animationAdapter.setAbsListView(m_list); - m_list.setAdapter(animationAdapter); + m_animationAdapter.setAbsListView(m_list); + m_list.setAdapter(m_animationAdapter); m_list.setOnItemClickListener(this); m_list.setOnScrollListener(this); @@ -481,7 +483,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, m_autoCatchupDisabled = true; m_list.setSelection(0); m_autoCatchupDisabled = false; - //m_articles.clear(); + m_animationAdapter.reset(); + m_articles.clear(); m_adapter.notifyDataSetChanged(); } } @@ -493,7 +496,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, HeadlinesRequest req = new HeadlinesRequest(getActivity().getApplicationContext(), m_activity, m_feed, m_articles) { @Override protected void onProgressUpdate(Integer... progress) { - m_activity.setProgress(Math.round((((float)progress[0] / (float)progress[1]) * 10000))); + m_activity.setProgress(Math.round((((float) progress[0] / (float) progress[1]) * 10000))); } @Override |