Java Code Examples for com.cjj.MaterialRefreshLayout

The following examples show how to use com.cjj.MaterialRefreshLayout. These examples are extracted from open source projects. 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 Project: MyHearts   Source File: LordDetailActivity.java    License: 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 Project: MousePaint   Source File: CategoryFragment.java    License: 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 Project: SprintNBA   Source File: NewsListFragment.java    License: 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 Project: MyHearts   Source File: OrationActivity.java    License: 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 Project: MyHearts   Source File: AdvisoryFragment.java    License: 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 Project: MaterialRefreshLayoutDemo   Source File: MainActivity.java    License: 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 Project: MousePaint   Source File: RecommendActivity.java    License: 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 Project: MousePaint   Source File: HomeFragment.java    License: 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 Project: MousePaint   Source File: WeekActivity.java    License: 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 Project: ImitateTaobaoApp   Source File: HotFragment.java    License: 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 Project: styT   Source File: MessageActivity.java    License: 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 Project: SprintNBA   Source File: NewsListFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
    requestIndex(true);
}
 
Example 13
Source Project: SprintNBA   Source File: TeamSortFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
    presenter.requestTeamsRank(true);
}
 
Example 14
Source Project: SprintNBA   Source File: ScheduleFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
    requestMatchs(date, true);
}
 
Example 15
Source Project: MousePaint   Source File: RefreshEvent.java    License: MIT License 4 votes vote down vote up
public RefreshEvent(MaterialRefreshLayout materialRefreshLayout,String category)
{
    this.category = category;
    this.mMaterialRefreshLayout = materialRefreshLayout;
}