139 lines
5.0 KiB
Java
139 lines
5.0 KiB
Java
package com.ubt.jimu.user.view.fragment;
|
|
|
|
import android.os.Bundle;
|
|
import android.util.Log;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
import butterknife.ButterKnife;
|
|
import com.recyclelib.URecyclerView;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.base.cache.Cache;
|
|
import com.ubt.jimu.base.entities.FollowEntities;
|
|
import com.ubt.jimu.base.entities.Rank;
|
|
import com.ubt.jimu.base.http.ApiObserver;
|
|
import com.ubt.jimu.base.http.manager.CommunityManager;
|
|
import com.ubt.jimu.user.contract.RankContract$Presenter;
|
|
import com.ubt.jimu.user.contract.RankContract$View;
|
|
import com.ubt.jimu.user.view.UserCenterActivity;
|
|
import com.ubt.jimu.user.view.adapter.RankAdapter;
|
|
import com.ubtech.view.fragment.BaseFragment;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class RankFragment extends BaseFragment implements RankContract$View {
|
|
public static final String e = RankFragment.class.getSimpleName();
|
|
private RankContract$Presenter a;
|
|
private List<Rank> b = new ArrayList();
|
|
private RankAdapter c;
|
|
private long d;
|
|
URecyclerView rankRecyclerView;
|
|
|
|
private void initView() {
|
|
this.c = new RankAdapter(this.mActivity, this.b);
|
|
this.c.a(new RankAdapter.Callback() { // from class: com.ubt.jimu.user.view.fragment.RankFragment.1
|
|
@Override // com.ubt.jimu.user.view.adapter.RankAdapter.Callback
|
|
public void a(long j) {
|
|
UserCenterActivity.a(((BaseFragment) RankFragment.this).mActivity, j);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.view.adapter.RankAdapter.Callback
|
|
public void a(Rank rank, int i) {
|
|
CommunityManager.create().subscriptionAdd((int) rank.getUserId(), new ApiObserver<FollowEntities>(null) { // from class: com.ubt.jimu.user.view.fragment.RankFragment.1.1
|
|
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(FollowEntities followEntities) {
|
|
super.onNext(followEntities);
|
|
RankFragment.this.a.subscribe();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
this.rankRecyclerView.setAdapter(this.c);
|
|
this.rankRecyclerView.setLayoutManager(new LinearLayoutManager(this.mActivity, 1, false));
|
|
this.rankRecyclerView.setLoadingMoreEnabled(false);
|
|
this.rankRecyclerView.setLoadingListener(new URecyclerView.LoadingListener() { // from class: com.ubt.jimu.user.view.fragment.RankFragment.2
|
|
@Override // com.recyclelib.URecyclerView.LoadingListener
|
|
public void onLoadingMore() {
|
|
}
|
|
|
|
@Override // com.recyclelib.URecyclerView.LoadingListener
|
|
public void onRefreshing() {
|
|
RankFragment.this.a.c(RankFragment.this.m());
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.contract.RankContract$View
|
|
public void a() {
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.contract.RankContract$View
|
|
public long d() {
|
|
return this.d;
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.contract.RankContract$View
|
|
public void l(List<Rank> list) {
|
|
if (list == null || list.size() == 0) {
|
|
return;
|
|
}
|
|
Log.i(e, list.toString());
|
|
this.b.clear();
|
|
this.b.addAll(list);
|
|
this.c.notifyDataSetChanged();
|
|
}
|
|
|
|
public long m() {
|
|
return Cache.getInstance().getLoginUserIntId();
|
|
}
|
|
|
|
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
|
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
|
View inflate = layoutInflater.inflate(R.layout.fragment_rank, (ViewGroup) null);
|
|
ButterKnife.a(this, inflate);
|
|
initView();
|
|
if (getArguments() != null) {
|
|
this.d = getArguments().getLong("view_user_id");
|
|
}
|
|
return inflate;
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.contract.RankContract$View
|
|
public void onError() {
|
|
}
|
|
|
|
@Override // androidx.fragment.app.Fragment
|
|
public void onPause() {
|
|
super.onPause();
|
|
this.a.unSubscribe();
|
|
}
|
|
|
|
@Override // androidx.fragment.app.Fragment
|
|
public void onResume() {
|
|
super.onResume();
|
|
this.a.subscribe();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.contract.RankContract$View
|
|
public void onSuccess() {
|
|
this.rankRecyclerView.A();
|
|
}
|
|
|
|
public static RankFragment a(long j) {
|
|
RankFragment rankFragment = new RankFragment();
|
|
Bundle bundle = new Bundle();
|
|
bundle.putLong("view_user_id", j);
|
|
rankFragment.setArguments(bundle);
|
|
return rankFragment;
|
|
}
|
|
|
|
@Override // com.ubtech.view.BaseView
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void setPresenter(RankContract$Presenter rankContract$Presenter) {
|
|
this.a = rankContract$Presenter;
|
|
}
|
|
}
|