use of com.scwang.smart.refresh.layout.constant.RefreshState in project wanandroid by KnightAndroid.
the class HomeRecommendFragment method initView.
@Override
protected void initView(Bundle savedInstanceState) {
mDatabind.setClick(new ProxyClick());
EventBus.getDefault().register(this);
mSkeletonScreen = Skeleton.bind(mDatabind.flTest).load(R.layout.activity_home_skeleton).duration(1200).angle(0).show();
bindHeadView();
mTopArticleAdapter = new TopArticleAdapter(new ArrayList<>());
SetInitCustomView.initSwipeRecycleview(home_top_article_rv, new LinearLayoutManager(getActivity()), mTopArticleAdapter, false);
mOfficialAccountAdapter = new OfficialAccountAdapter(new ArrayList<>());
mHomeArticleAdapter = new HomeArticleAdapter(new ArrayList<>());
SetInitCustomView.initSwipeRecycleview(mDatabind.homeRecommendArticleBody, new LinearLayoutManager(getActivity()), mHomeArticleAdapter, true);
topArticleFootView = LayoutInflater.from(getActivity()).inflate(R.layout.home_toparticle_foot, null);
topArticleFootView.findViewById(R.id.home_ll_seemorearticles).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
HomeArticleLogic.getInstance().setArrowAnimate(mTopArticleAdapter, topArticleFootView.findViewById(R.id.home_iv_toparticlearrow), isShowOnlythree);
isShowOnlythree = !isShowOnlythree;
}
});
mDatabind.homeIconFab.setBackgroundTintList(ColorUtils.createColorStateList(CacheUtils.getThemeColor(), CacheUtils.getThemeColor()));
initTopAdapterClick();
initOfficialAccountClick();
initArticleListener();
initTwoLevel();
mDatabind.homeRefreshLayout.setOnMultiListener(new SimpleMultiListener() {
@Override
public void onHeaderMoving(RefreshHeader header, boolean isDragging, float percent, int offset, int headerHeight, int maxDragHeight) {
}
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
lazyLoadData();
}
@Override
public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) {
if (oldState == RefreshState.TwoLevel) {
mDatabind.homeTwoLevelContent.animate().alpha(0).setDuration(0);
} else if (oldState == RefreshState.TwoLevelReleased) {
openTwoLevel = true;
mDatabind.homeIconFab.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.base_icon_bottom));
} else if (oldState == RefreshState.TwoLevelFinish) {
openTwoLevel = false;
mDatabind.homeIconFab.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.base_icon_up));
}
}
});
mDatabind.homeTwoLevelHeader.setOnTwoLevelListener(new OnTwoLevelListener() {
@Override
public boolean onTwoLevel(@NonNull RefreshLayout refreshLayout) {
mDatabind.homeTwoLevelContent.animate().alpha(1).setDuration(1000);
return true;
}
});
mDatabind.homeTwoLevelHeader.setEnablePullToCloseTwoLevel(false);
mDatabind.homeRefreshLayout.setEnableLoadMore(true);
mDatabind.homeRefreshLayout.setOnLoadMoreListener(this);
}
use of com.scwang.smart.refresh.layout.constant.RefreshState in project Oh by y1xian.
the class AbsListFragment method finishRefresh.
public void finishRefresh(boolean hasData) {
PagedList<T> currentList = adapter.getCurrentList();
hasData = hasData || currentList != null && currentList.size() > 0;
RefreshState state = mRefreshLayout.getState();
if (state.isFooter && state.isOpening) {
mRefreshLayout.finishLoadMore();
} else if (state.isHeader && state.isOpening) {
mRefreshLayout.finishRefresh();
}
// if (hasData) {
// mEmptyView.setVisibility(View.GONE);
// } else {
// mEmptyView.setVisibility(View.VISIBLE);
// }
}
Aggregations