androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener Java Examples
The following examples show how to use
androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener.
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: ZeroFiveNewsFragment.java From AcgClub with MIT License | 5 votes |
@Override protected void initData() { mAdapter = new ZeroFiveNewsItemAdapter(getMAppComponent().imageLoader()); mAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, android.view.View view, int position) { ZeroFiveNews zeroFiveNews = (ZeroFiveNews) adapter.getData().get(position); Intent intent = new Intent(getContext(), ZeroFiveNewsDetailActivity.class); intent.putExtra(IntentConstant.ZERO_FIVE_NEWS_ITEM, zeroFiveNews); startActivity(intent); } }); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); rcvNewsItem.addItemDecoration(new CommonItemDecoration(2, CommonItemDecoration.UNIT_DP)); rcvNewsItem.setLayoutManager(layoutManager); mAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { mPresenter.getMoreAcgNewsList(); } }); rcvNewsItem.setAdapter(mAdapter); swipeRefresh.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { mPresenter.getAcgNewsList(); } }); setSwipeRefreshLayout(swipeRefresh); mPresenter.getAcgNewsList(); }
Example #2
Source File: ISHNewsFragment.java From AcgClub with MIT License | 5 votes |
@Override protected void initData() { mAdapter = new ISHNewsItemAdapter(getMAppComponent().imageLoader()); mAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, android.view.View view, int position) { SHPostItem shPostItem = (SHPostItem) adapter.getData().get(position); Intent intent = new Intent(getContext(), ISHNewsDetailActivity.class); intent.putExtra(IntentConstant.ISH_NEWS_ITEM, shPostItem); startActivity(intent); } }); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); rcvNewsItem.addItemDecoration(new CommonItemDecoration(2, CommonItemDecoration.UNIT_DP)); rcvNewsItem.setLayoutManager(layoutManager); mAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { mPresenter.getMoreAcgNewsList(); } }); rcvNewsItem.setAdapter(mAdapter); swipeRefresh.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { mPresenter.getAcgNewsList(); } }); setSwipeRefreshLayout(swipeRefresh); mPresenter.getAcgNewsList(); }
Example #3
Source File: ScheduleMainFragment.java From AcgClub with MIT License | 5 votes |
@SuppressLint("ClickableViewAccessibility") @Override protected void initData() { swipeRefresh.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { bannerSchedule.pause(); mPresenter.getDilidiliInfo(); } }); setSwipeRefreshLayout(swipeRefresh); rxPermissions = new RxPermissions(getActivity()); mPresenter.getDilidiliInfo(); }
Example #4
Source File: ScheduleOtherActivity.java From AcgClub with MIT License | 4 votes |
@Override protected void initData() { setToolBar(toolbar, ""); String scheduleOtherUrl = getIntent().getStringExtra(IntentConstant.SCHEDULE_DETAIL_URL); if (TextUtils.isEmpty(scheduleOtherUrl)) { showError(R.string.msg_error_url_null); return; } mAdapter = new ScheduleOtherAdapter(mAppComponent.imageLoader()); mAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, android.view.View view, int position) { ScheduleOtherPage.ScheduleOtherItem scheduleOtherItem = (ScheduleOtherPage.ScheduleOtherItem) adapter .getData().get(position); Intent intent = new Intent(getBaseContext(), ScheduleVideoActivity.class); intent.putExtra(IntentConstant.SCHEDULE_EPISODE_URL, scheduleOtherItem.getVideolLink()); startActivity(intent); } }); mAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { mPresenter.getMoreScheduleOther(); } }); GridLayoutManager layoutManager = new GridLayoutManager(getBaseContext(), 2); rcvScheduleOther.addItemDecoration(new CommonItemDecoration(2, CommonItemDecoration.UNIT_DP)); rcvScheduleOther.setLayoutManager(layoutManager); rcvScheduleOther.setAdapter(mAdapter); swipeRefresh.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { mPresenter.getScheduleOther(); } }); mPresenter.setCurScheduleOtherUrl(scheduleOtherUrl); mPresenter.getScheduleOther(); }
Example #5
Source File: RecyclerSpec.java From litho with Apache License 2.0 | 4 votes |
@OnBind protected static void onBind( ComponentContext context, SectionsRecyclerView sectionsRecycler, @Prop Binder<RecyclerView> binder, @Prop(optional = true) final RecyclerEventsController recyclerEventsController, @Prop(optional = true, varArg = "onScrollListener") List<OnScrollListener> onScrollListeners, @Prop(optional = true) SnapHelper snapHelper, @Prop(optional = true) boolean pullToRefresh, @Prop(optional = true) LithoRecylerView.TouchInterceptor touchInterceptor, @Nullable @Prop(optional = true) final EventHandler refreshHandler) { // contentDescription should be set on the recyclerView itself, and not the sectionsRecycler. sectionsRecycler.setContentDescription(null); sectionsRecycler.setEnabled(pullToRefresh && refreshHandler != null); sectionsRecycler.setOnRefreshListener( new OnRefreshListener() { @Override public void onRefresh() { Recycler.dispatchPTRRefreshEvent(refreshHandler); } }); final LithoRecylerView recyclerView = (LithoRecylerView) sectionsRecycler.getRecyclerView(); if (recyclerView == null) { throw new IllegalStateException( "RecyclerView not found, it should not be removed from SwipeRefreshLayout " + "before unmounting"); } if (onScrollListeners != null) { for (OnScrollListener onScrollListener : onScrollListeners) { recyclerView.addOnScrollListener(onScrollListener); } } if (touchInterceptor != null) { recyclerView.setTouchInterceptor(touchInterceptor); } // We cannot detach the snap helper in unbind, so it may be possible for it to get // attached twice which causes SnapHelper to raise an exception. if (snapHelper != null && recyclerView.getOnFlingListener() == null) { snapHelper.attachToRecyclerView(recyclerView); } binder.bind(recyclerView); if (recyclerEventsController != null) { recyclerEventsController.setSectionsRecyclerView(sectionsRecycler); } if (sectionsRecycler.hasBeenDetachedFromWindow()) { recyclerView.requestLayout(); sectionsRecycler.setHasBeenDetachedFromWindow(false); } }