use of com.rideread.rideread.common.adapter.SearchUserAdapter in project ride-read-android by Ride-Read.
the class SearchActivity method initView.
@Override
public void initView() {
mSearchUsers = new ArrayList<>();
mSwipeRefreshLayout.setOnRefreshListener(() -> {
search();
});
mRecycleView.setHasFixedSize(true);
mAdapter = new SearchUserAdapter(this, mSearchUsers);
mRecycleView.setAdapter(mAdapter);
mLayoutManager = new LinearLayoutManager(this);
mRecycleView.setLayoutManager(mLayoutManager);
mRecycleView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
int totalItemCount = mLayoutManager.getItemCount();
if (lastVisibleItem >= totalItemCount - 1 && dy > 0) {
if (!isLoadingMore) {
search();
}
}
}
});
mEdtSearch.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence keyword, int start, int before, int count) {
search();
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
Aggregations