94 lines
4.0 KiB
Java
94 lines
4.0 KiB
Java
package com.ubt.jimu.community.view.fragment;
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
import com.recyclelib.URecyclerView;
|
|
import com.ubt.jimu.BaseActivity;
|
|
import com.ubt.jimu.base.cache.Cache;
|
|
import com.ubt.jimu.base.entities.SearchUserBean;
|
|
import com.ubt.jimu.base.http.ApiObserver;
|
|
import com.ubt.jimu.base.http.manager.CommunityManager;
|
|
import com.ubt.jimu.community.view.SearchActivity;
|
|
import com.ubt.jimu.community.view.adapter.search.UserAdapter;
|
|
import com.ubtech.view.fragment.BaseFragment;
|
|
import com.ubtrobot.log.ALog;
|
|
import java.util.ArrayList;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class UserFragment extends CommonFragment {
|
|
private UserAdapter c;
|
|
private ArrayList<SearchUserBean.RecordsBean> d;
|
|
private ApiObserver<SearchUserBean> e;
|
|
private int f = 1;
|
|
|
|
static /* synthetic */ int b(UserFragment userFragment) {
|
|
int i = userFragment.f;
|
|
userFragment.f = i + 1;
|
|
return i;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void requestData() {
|
|
CommunityManager.create().userSearchResult(this.a, "user", Cache.getInstance().getUserId(), this.f, 20, this.e);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.community.view.fragment.CommonFragment
|
|
protected void initData() {
|
|
this.d = new ArrayList<>();
|
|
this.e = new ApiObserver<SearchUserBean>(((SearchActivity) this.mActivity).viewLoading) { // from class: com.ubt.jimu.community.view.fragment.UserFragment.1
|
|
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(SearchUserBean searchUserBean) {
|
|
ALog.a(UserFragment.this.TAG).d("searchModel==" + searchUserBean.getPages());
|
|
if (searchUserBean.getRecords() == null || searchUserBean.getRecords().size() <= 0) {
|
|
UserFragment.this.ryContent.setNoMore(true);
|
|
} else {
|
|
if (UserFragment.this.f == 1) {
|
|
UserFragment.this.d.clear();
|
|
}
|
|
UserFragment.this.d.addAll(searchUserBean.getRecords());
|
|
if (UserFragment.this.f == searchUserBean.getTotal()) {
|
|
UserFragment.this.ryContent.setNoMore(true);
|
|
} else {
|
|
UserFragment.this.ryContent.setNoMore(false);
|
|
}
|
|
}
|
|
UserFragment.this.c.notifyDataSetChanged();
|
|
UserFragment userFragment = UserFragment.this;
|
|
userFragment.d(userFragment.d.size());
|
|
}
|
|
};
|
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.mActivity, 1, false);
|
|
this.c = new UserAdapter(this.mActivity, this.d);
|
|
this.ryContent.setLayoutManager(linearLayoutManager);
|
|
this.ryContent.setAdapter(this.c);
|
|
this.ryContent.setLoadingListener(new URecyclerView.LoadingListener() { // from class: com.ubt.jimu.community.view.fragment.UserFragment.2
|
|
@Override // com.recyclelib.URecyclerView.LoadingListener
|
|
public void onLoadingMore() {
|
|
UserFragment.b(UserFragment.this);
|
|
UserFragment.this.requestData();
|
|
((SearchActivity) ((BaseFragment) UserFragment.this).mActivity).viewLoading.setVisibility(8);
|
|
}
|
|
|
|
@Override // com.recyclelib.URecyclerView.LoadingListener
|
|
public void onRefreshing() {
|
|
UserFragment.this.f = 1;
|
|
UserFragment.this.requestData();
|
|
((SearchActivity) ((BaseFragment) UserFragment.this).mActivity).viewLoading.setVisibility(8);
|
|
}
|
|
});
|
|
((BaseActivity) getActivity()).loadComplete(this.ryContent, this.e);
|
|
}
|
|
|
|
public static UserFragment b() {
|
|
return new UserFragment();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.community.view.fragment.CommonFragment
|
|
public void c(String str) {
|
|
this.f = 1;
|
|
this.a = str;
|
|
this.c.a(str);
|
|
requestData();
|
|
}
|
|
}
|