本文整理汇总了Java中it.gmariotti.recyclerview.itemanimator.ScaleInOutItemAnimator类的典型用法代码示例。如果您正苦于以下问题:Java ScaleInOutItemAnimator类的具体用法?Java ScaleInOutItemAnimator怎么用?Java ScaleInOutItemAnimator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScaleInOutItemAnimator类属于it.gmariotti.recyclerview.itemanimator包,在下文中一共展示了ScaleInOutItemAnimator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityCreated
import it.gmariotti.recyclerview.itemanimator.ScaleInOutItemAnimator; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mComments = new ArrayList<CommentItem>();
mAdapter = new CommentsAdapter(getActivity(), mComments);
if(mRecyclerView != null) {
mRecyclerView.setAdapter(mAdapter);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setItemAnimator(new ScaleInOutItemAnimator(mRecyclerView));
}
mSwipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mComments.clear();
mAdapter.notifyDataSetChanged();
fetchComments(commentIDs, true);
}
});
}
示例2: onActivityCreated
import it.gmariotti.recyclerview.itemanimator.ScaleInOutItemAnimator; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mStories = new ArrayList<StoryItem>();
mAdapter = new StoryAdapter(getActivity(), mStories);
if(mRecyclerView != null) {
mRecyclerView.setAdapter(mAdapter);
final LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setItemAnimator(new ScaleInOutItemAnimator(mRecyclerView));
mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
totalItemCount = mStoriesWorker.totalStories.size();
int totalLoadedItems = Math.max(mLayoutManager.getItemCount(), mStories.size());
int lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
if (loading) {
if (totalLoadedItems > previousTotal) {
loading = false;
previousTotal = totalLoadedItems;
}
}
// load more items if we have reached the end of the scroll
// log(lastVisibleItem + "; " + totalLoadedItems + "; " + totalItemCount+ "; " + loading);
if(!loading && (lastVisibleItem >= (totalLoadedItems - 1) && totalLoadedItems < totalItemCount)) {
if(mStoriesWorker.isLoading()) {
// log("already loading data.. ");
return;
}
// log("scroll end reached");
mSwipeLayout.setRefreshing(true);
loading = true;
mStoriesWorker.loadMore(lastVisibleItem + 1, lastVisibleItem + 1 + visibleThreshold);
}
}
});
}
fetchStories(false );
mSwipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mStories.clear();
mAdapter.notifyDataSetChanged();
fetchStories(true);
}
});
}