com.cjj.MaterialRefreshLayout Java Examples

The following examples show how to use com.cjj.MaterialRefreshLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LordDetailActivity.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
private void initRefresh(MaterialRefreshLayout materialRefreshLayout) {
    page = 1; //重置  在刷新的时候
    OkGo.post(HttpUrlPaths.LORD_DETAIL_URL)
            .params("catgId", catgId)
            .params("page", page)
            .params("userid", 0)
            .getCall(StringConvert.create(), RxAdapter.<String>create())
            .doOnSubscribe(() -> {
            })
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(s -> {
                Type type = new TypeToken<LordDetailBean>() {
                }.getType();
                LordDetailBean bean = new Gson().fromJson(s, type);
                if (bean.getErrorStr().equals("success")
                        && bean.getErrorCode() == 0
                        && bean.getResultCount() > 0) {
                    mLordDetailDatas.clear();
                    detailAdapter.notifyDataSetChanged();
                    mLordRefresh.finishRefresh();
                }
            }, throwable -> {
            });


}
 
Example #2
Source File: CategoryFragment.java    From MousePaint with MIT License 6 votes vote down vote up
private void handRefreshMore(MaterialRefreshLayout materialRefreshLayout) {
    switch (mViewPager_book.getCurrentItem())
    {
        case 0:
            EventBus.getDefault().post(new RefreshEvent(materialRefreshLayout,"refresh_hot"));
            break;
        case 1:
            EventBus.getDefault().post(new RefreshEvent(materialRefreshLayout,"refresh_same"));
            break;
        case 2:
            EventBus.getDefault().post(new RefreshEvent(materialRefreshLayout,"refresh_mouse"));
            break;
        case 3:

            break;
    }
}
 
Example #3
Source File: NewsListFragment.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
@Override
public void onRefreshLoadMore(final MaterialRefreshLayout materialRefreshLayout) {
    LogUtils.i("load more: start=" + start);
    String arcIds = parseIds();
    if (!TextUtils.isEmpty(arcIds)) {
        requestNews(arcIds, false, true);
    } else {
        ToastUtils.showToast("已经到底啦");
        complete();
    }
}
 
Example #4
Source File: OrationActivity.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
private void initRefresh(MaterialRefreshLayout materialRefreshLayout) {
    page = 1;
    OkGo.post(HttpUrlPaths.SCAN_MORE)
            .params("userid", "54442")
            .params("page", page + "")
            .getCall(StringConvert.create(), RxAdapter.<String>create())
            .doOnSubscribe(() -> {

            })
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(s -> {
                Type type = new TypeToken<HomeNewsBean>() {
                }.getType();
                HomeNewsBean bean = new Gson().fromJson(s, type);
                if (bean.getErrorCode() == 0
                        && bean.getErrorStr().equals("success")
                        && bean.getResults().size() > 0) {
                    mOrationDatas.clear();
                    mOrationDatas = bean.getResults();
                    mOrationAdapter.addData(mOrationDatas);
                    materialRefreshLayout.finishRefresh();

                }
            }, throwable -> {

            });
}
 
Example #5
Source File: AdvisoryFragment.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
private void initListener() {
    mDataList.setLayoutManager(new LinearLayoutManager(getContext()){
        @Override
        public boolean canScrollVertically() {
            return false;
        }
    });
    mDataList.setItemAnimator(new SlideInOutTopItemAnimator(mDataList));
    mDataList.addItemDecoration(new DividerItemDecoration(getContext(),
            DividerItemDecoration.VERTICAL_LIST));
    mAdvisoryAdapter = new AdvisoryAdapter(getContext(), mDatas);
    mAdvisoryAdapter.setOnItemClickListener((view, position) -> {
        int index = mDatas.size()-position-1;  //不太明白,为什么显示的是倒叙
        AdvisoryFragmentBean.ResultsBean resultsBean = mDatas.get(index);
        String userid = resultsBean.getUserid();
        Intent intent = new Intent(getActivity(), UserDetailActivity.class);
        intent.putExtra(Contants.USER_ID, userid);
        intent.putExtra(Contants.C_USER_ID, userid);
        startActivity(intent);
    });
    mDataList.setAdapter(mAdvisoryAdapter);
    mRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {
        @Override
        public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
            refreshData();
        }
    });
}
 
Example #6
Source File: MainActivity.java    From MaterialRefreshLayoutDemo with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化布局控件
 */
private void initView() {

    mRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.refresh);
    mRecyclerView = (RecyclerView) findViewById(R.id.recycleview);
    initRefresh();
}
 
Example #7
Source File: RecommendActivity.java    From MousePaint with MIT License 5 votes vote down vote up
private void Data() {
    viewSelectorLayout.show_LoadingView();
    getRecommendBookData();

    refreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {
        @Override
        public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
            getRecommendBookData();
        }
    });
}
 
Example #8
Source File: HomeFragment.java    From MousePaint with MIT License 5 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    viewSelectorLayout.show_LoadingView();
    getBookData();

    refreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {
        @Override
        public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
            getBookData();
        }
    });
}
 
Example #9
Source File: WeekActivity.java    From MousePaint with MIT License 5 votes vote down vote up
private void Data() {
    viewSelectorLayout.show_LoadingView();
    getWeekBookData();

    refreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {
        @Override
        public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
            getWeekBookData();
        }
    });
}
 
Example #10
Source File: HotFragment.java    From ImitateTaobaoApp with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view= inflater.inflate(R.layout.fragment_hot,container,false);

    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview_hot);

    mRefreshLayout = (MaterialRefreshLayout) view.findViewById(R.id.refresh_view);


    com.lidroid.xutils.ViewUtils.inject(view);

    initRefreshLayout();
    getData();
    return view ;
}
 
Example #11
Source File: MessageActivity.java    From styT with Apache License 2.0 4 votes vote down vote up
private void initView() {
    listView = (ListView) findViewById(R.id.lxw_id_message_listview);
    materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.lxw_id_message_refresh);
}
 
Example #12
Source File: NewsListFragment.java    From SprintNBA with Apache License 2.0 4 votes vote down vote up
@Override
public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
    requestIndex(true);
}
 
Example #13
Source File: TeamSortFragment.java    From SprintNBA with Apache License 2.0 4 votes vote down vote up
@Override
public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
    presenter.requestTeamsRank(true);
}
 
Example #14
Source File: ScheduleFragment.java    From SprintNBA with Apache License 2.0 4 votes vote down vote up
@Override
public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
    requestMatchs(date, true);
}
 
Example #15
Source File: RefreshEvent.java    From MousePaint with MIT License 4 votes vote down vote up
public RefreshEvent(MaterialRefreshLayout materialRefreshLayout,String category)
{
    this.category = category;
    this.mMaterialRefreshLayout = materialRefreshLayout;
}