use of com.scwang.smart.refresh.layout.listener.OnLoadMoreListener in project wanandroid by KnightAndroid.
the class SquareFragment method initView.
@Override
protected void initView(Bundle savedInstanceState) {
mDatabind.setClick(new ProcyClick());
loadLoading(mDatabind.squareSharearticleFreshlayout);
mHotKeyAdapter = new HotKeyAdapter(new ArrayList<SearchHotKeyEntity>());
mSquareArticleAdapter = new SquareArticleAdapter(new ArrayList<SquareArticleEntity>());
initListener();
FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(getActivity());
// 方向 主轴为水平方向,起点在左端
flexboxLayoutManager.setFlexDirection(FlexDirection.ROW);
// 左对齐
flexboxLayoutManager.setJustifyContent(JustifyContent.FLEX_START);
// flexboxLayoutManager.setAlignItems(AlignItems.CENTER);
SetInitCustomView.initSwipeRecycleview(mDatabind.squareSearchhotRv, flexboxLayoutManager, mHotKeyAdapter, false);
SetInitCustomView.initSwipeRecycleview(mDatabind.squareArticleRv, new LinearLayoutManager(getActivity()), mSquareArticleAdapter, true);
mDatabind.squareSharearticleFreshlayout.setOnRefreshListener(this);
mDatabind.squareSharearticleFreshlayout.setOnLoadMoreListener(this);
EventBus.getDefault().register(this);
View QuestionMenu = LayoutInflater.from(getActivity()).inflate(R.layout.square_question_activity, null);
mSquareQuestionAdapter = new SquareQuestionAdapter(new ArrayList<>());
initAdapterListener();
baserecycleview = QuestionMenu.findViewById(R.id.base_body_rv);
smartRefreshLayout = (SmartRefreshLayout) QuestionMenu.findViewById(R.id.include_square_question);
tv_question_title = ((TextView) QuestionMenu.findViewById(R.id.square_question_tv_title));
tv_question_title.setText(getString(R.string.square_question));
smartRefreshLayout.setOnRefreshListener(refreshLayout -> {
questionPage = 1;
mPresenter.requestSquareQuestion(questionPage);
});
smartRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
mPresenter.requestSquareQuestion(questionPage);
}
});
SetInitCustomView.initSwipeRecycleview(baserecycleview, new LinearLayoutManager(getActivity()), mSquareQuestionAdapter, true);
mDatabind.squareRoot.addView(QuestionMenu);
LoadSir loadSir = LoadSir.getDefault();
mViewLoadService = loadSir.register(QuestionMenu.findViewById(R.id.include_square_question), new Callback.OnReloadListener() {
@Override
public void onReload(View v) {
mViewLoadService.showCallback(LoadCallBack.class);
}
});
mViewLoadService.showCallback(LoadCallBack.class);
mRightLottieAnimation = new RightLottieAnimation.GuillotineBuilder(QuestionMenu, QuestionMenu.findViewById(R.id.square_question_lefticon), mDatabind.squareIvQuestion, mSquareQuestionAdapter).setStartDelay(RIPPLE_DURATION).setActionBarViewForAnimation(mDatabind.squareToolbar).setClosedOnStart(true).setGuillotineListener(new RightLottieListener() {
@Override
public void onRightLottieOpened() {
mDatabind.squareFabUp.setVisibility(View.GONE);
mViewLoadService.showCallback(LoadCallBack.class);
mPresenter.requestSquareQuestion(questionPage);
}
@Override
public void onRightLottieClosed() {
questionPage = 1;
mDatabind.squareFabUp.setVisibility(View.VISIBLE);
}
}).build();
}
use of com.scwang.smart.refresh.layout.listener.OnLoadMoreListener in project iot-device-java by tencentyun.
the class TmeMainActivity method initView.
private void initView() {
mGetSongBtn = findViewById(R.id.request_song);
mSearchIv = findViewById(R.id.search);
mPreIv = findViewById(R.id.iv_pre);
mNextIv = findViewById(R.id.iv_next);
mPlayIv = findViewById(R.id.iv_play);
mPlayModeIv = findViewById(R.id.iv_play_mode);
mInputEt = findViewById(R.id.input);
mCurrentSongTv = findViewById(R.id.tv_current_song);
mPlayList = findViewById(R.id.play_list);
mSmartRefreshLayout = findViewById(R.id.smart_refreshLayout);
mTimeTv = findViewById(R.id.tv_time);
mSeekBar = findViewById(R.id.sb_seek_bar);
mVolumeSeekBar = findViewById(R.id.sb_volume);
mSwitch = findViewById(R.id.tb_switch);
mSpinner = findViewById(R.id.sp_quality);
mSmartRefreshLayout.setEnableLoadMore(true);
mSmartRefreshLayout.setRefreshFooter(new ClassicsFooter(this));
mGetSongBtn.setOnClickListener(this);
mSearchIv.setOnClickListener(this);
mPreIv.setOnClickListener(this);
mNextIv.setOnClickListener(this);
mPlayIv.setOnClickListener(this);
mPlayModeIv.setOnClickListener(this);
mPlayList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mPlayList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
mAdapter = new SongListAdapter(this, mSongList);
mAdapter.setOnItemClickListener(new SongListAdapter.ItemClickListener() {
@Override
public void onItemClick(View view, int position) {
Song song = mSongList.get(position);
mCurrentSongTv.setText(song.songName + "-" + song.singerName);
playSong(position);
}
});
mPlayList.setAdapter(mAdapter);
mSmartRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(RefreshLayout refreshLayout) {
refreshLayout.finishLoadMore();
page++;
if (operationType == TYPE_SEARCH) {
doSearch(keyword);
} else if (operationType == TYPE_SONG_LIST) {
getSongListById(songListId, songListType);
}
}
});
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
TXLog.d(TAG, "seek =" + seekValue);
seekValue = progress;
UltimateSongPlayer.getInstance().seekTo(seekValue * 1000);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
mIsSeekBarTouching = true;
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
if (seekValue >= 60) {
SongInfo songInfo = UltimateSongPlayer.getInstance().getSongInfo();
if (songInfo != null && songInfo.isTryListen()) {
TmeMainActivity.this.runOnUiThread(() -> ToastUtil.showS("当前歌曲只支持试听60秒~"));
}
}
UltimateSongPlayer.getInstance().seekTo(seekValue * 1000);
mIsSeekBarTouching = false;
reportProperty(Common.PROPERTY_PLAY_POSITION, seekValue);
}
});
mVolumeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
TXLog.d(TAG, "seek =" + volumeSeekValue);
volumeSeekValue = progress;
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, AudioManager.FLAG_PLAY_SOUND);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
int volume = (int) ((volumeSeekValue / (maxVolume * 1.00)) * Common.TOTOAL_VOLUME_DURATION);
reportProperty(Common.PROPERTY_VOLUME, volume);
}
});
mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
if (mDataTemplateSample != null)
return;
mDataTemplateSample = new TmeDataTemplateSample(TmeMainActivity.this, mBrokerURL, mProductID, mDevName, mDevPSK, new SelfMqttActionCallBack(mProductID, mDevName), JSON_FILE_NAME, new SelfDownStreamCallBack(), mAuthCallback);
mDataTemplateSample.connect();
} else {
if (mDataTemplateSample == null)
return;
mDataTemplateSample.disconnect();
mDataTemplateSample = null;
}
}
});
mSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, qualityStrArray));
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (isGetStatusReply) {
UltimateSongPlayer.getInstance().changeQuality(qualities[position]);
isGetStatusReply = false;
} else {
if (UltimateSongPlayer.getInstance().getCurrentPlayQuality() == qualities[position]) {
return;
}
// 当前歌曲详情
SongInfo songInfo = UltimateSongPlayer.getInstance().getSongInfo();
if (songInfo == null) {
ToastUtil.showS("无法切换音质");
parent.setSelection(0);
return;
}
if (songInfo.isTryListen()) {
ToastUtil.showS("试听中,无法切换音质");
parent.setSelection(0);
return;
}
if (songInfo.getSupportQualities().contains(qualities[position])) {
UltimateSongPlayer.getInstance().changeQuality(qualities[position]);
reportProperty(Common.PROPERTY_RECOMMEND_QUALITY, position);
} else {
parent.setSelection(0);
ToastUtil.showS(String.format("当前歌曲不支持%s音质", qualityStrArray[position]));
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
use of com.scwang.smart.refresh.layout.listener.OnLoadMoreListener in project ManPinAPP by AnyMarvel.
the class BookRRecommendFImpl method notifyRecyclerView.
@Override
public void notifyRecyclerView(List<SourceListContent> recommendList, List<SourceListContent> hotRankingList, List<SourceListContent> contentList, boolean useCache) {
if (useCache || recommendRecyclerAdapter == null) {
recommendRecyclerAdapter = new BookRRecommendFRecyclerAdapter(getContext(), this, recommendList, hotRankingList, contentList);
recommendRecyclerView.setAdapter(recommendRecyclerAdapter);
} else {
recommendRecyclerAdapter.setRecommendList(recommendList);
recommendRecyclerAdapter.setHotRankingList(hotRankingList);
recommendRecyclerAdapter.setContentList(contentList);
recommendRecyclerAdapter.notifyDataSetChanged();
}
bookRrefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
mPresenter.getNextPageContent(recommendRecyclerAdapter.getmContentListPage() + 1);
}
});
bookRrefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
mPresenter.initBookRRcommendData();
}
});
bookRrefreshLayout.finishRefresh();
}
use of com.scwang.smart.refresh.layout.listener.OnLoadMoreListener in project ManPinAPP by AnyMarvel.
the class BookRankListActivity method bindEvent.
@Override
protected void bindEvent() {
super.bindEvent();
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(RecyclerView.VERTICAL);
recommendRecyclerView.setLayoutManager(layoutManager);
recommendRecyclerView.setItemAnimator(new DefaultItemAnimator());
bookRrefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
if (bookRankListAdapter != null) {
mPresenter.getNextPageContent(bookRankUrl, bookRankListAdapter.getPageNumber() + 1);
}
}
});
bookRrefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
mPresenter.initBookRankListData(bookRankUrl);
}
});
}
Aggregations