Initial commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package com.ubt.jimu.community.view.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import com.recyclelib.URecyclerView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class CommonFragment<T> extends BaseFragment {
|
||||
protected String a;
|
||||
private Unbinder b;
|
||||
ImageView imgNoContent;
|
||||
URecyclerView ryContent;
|
||||
TextView tvNoContent;
|
||||
|
||||
public abstract void c(String str);
|
||||
|
||||
public void d(int i) {
|
||||
if (i > 0) {
|
||||
this.ryContent.setVisibility(0);
|
||||
this.tvNoContent.setVisibility(8);
|
||||
this.imgNoContent.setVisibility(8);
|
||||
} else {
|
||||
this.ryContent.setVisibility(8);
|
||||
this.tvNoContent.setVisibility(0);
|
||||
this.imgNoContent.setVisibility(0);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void initData();
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
return layoutInflater.inflate(R.layout.fragment_search_content, viewGroup, false);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroyView() {
|
||||
this.b.unbind();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
this.b = ButterKnife.a(this, view);
|
||||
initData();
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package com.ubt.jimu.community.view.fragment;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.recyclelib.URecyclerView;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CommonFragment_ViewBinding implements Unbinder {
|
||||
private CommonFragment b;
|
||||
|
||||
public CommonFragment_ViewBinding(CommonFragment commonFragment, View view) {
|
||||
this.b = commonFragment;
|
||||
commonFragment.tvNoContent = (TextView) Utils.b(view, R.id.tv_no_content, "field 'tvNoContent'", TextView.class);
|
||||
commonFragment.imgNoContent = (ImageView) Utils.b(view, R.id.img_no_content, "field 'imgNoContent'", ImageView.class);
|
||||
commonFragment.ryContent = (URecyclerView) Utils.b(view, R.id.ry_content, "field 'ryContent'", URecyclerView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
CommonFragment commonFragment = this.b;
|
||||
if (commonFragment == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
commonFragment.tvNoContent = null;
|
||||
commonFragment.imgNoContent = null;
|
||||
commonFragment.ryContent = null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
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.SearchContentBean;
|
||||
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.ContentAdapter;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ContentFragment extends CommonFragment {
|
||||
private ArrayList<SearchContentBean.RecordsBean> c;
|
||||
private ContentAdapter d;
|
||||
private ApiObserver<SearchContentBean> e;
|
||||
private int f = 1;
|
||||
|
||||
static /* synthetic */ int b(ContentFragment contentFragment) {
|
||||
int i = contentFragment.f;
|
||||
contentFragment.f = i + 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void requestData() {
|
||||
CommunityManager.create().userSearchResult(this.a, "post", Cache.getInstance().getUserId(), this.f, 12, this.e);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.fragment.CommonFragment
|
||||
protected void initData() {
|
||||
this.c = new ArrayList<>();
|
||||
this.e = new ApiObserver<SearchContentBean>(((SearchActivity) this.mActivity).viewLoading) { // from class: com.ubt.jimu.community.view.fragment.ContentFragment.1
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(SearchContentBean searchContentBean) {
|
||||
ALog.a(ContentFragment.this.TAG).d("searchModel==" + searchContentBean.getPages());
|
||||
if (searchContentBean.getRecords() == null || searchContentBean.getRecords().size() <= 0) {
|
||||
ContentFragment.this.ryContent.setNoMore(true);
|
||||
} else {
|
||||
if (ContentFragment.this.f == 1) {
|
||||
ContentFragment.this.c.clear();
|
||||
}
|
||||
ContentFragment.this.c.addAll(searchContentBean.getRecords());
|
||||
if (ContentFragment.this.f == searchContentBean.getTotal()) {
|
||||
ContentFragment.this.ryContent.setNoMore(true);
|
||||
} else {
|
||||
ContentFragment.this.ryContent.setNoMore(false);
|
||||
}
|
||||
}
|
||||
ContentFragment.this.d.notifyDataSetChanged();
|
||||
ContentFragment contentFragment = ContentFragment.this;
|
||||
contentFragment.d(contentFragment.c.size());
|
||||
}
|
||||
};
|
||||
this.d = new ContentAdapter(this.mActivity, this.c);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.mActivity, 1, false);
|
||||
this.ryContent.setAdapter(this.d);
|
||||
this.ryContent.setLayoutManager(linearLayoutManager);
|
||||
this.ryContent.setLoadingListener(new URecyclerView.LoadingListener() { // from class: com.ubt.jimu.community.view.fragment.ContentFragment.2
|
||||
@Override // com.recyclelib.URecyclerView.LoadingListener
|
||||
public void onLoadingMore() {
|
||||
ContentFragment.b(ContentFragment.this);
|
||||
ContentFragment.this.requestData();
|
||||
((SearchActivity) ((BaseFragment) ContentFragment.this).mActivity).viewLoading.setVisibility(8);
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.URecyclerView.LoadingListener
|
||||
public void onRefreshing() {
|
||||
ContentFragment.this.f = 1;
|
||||
ContentFragment.this.requestData();
|
||||
((SearchActivity) ((BaseFragment) ContentFragment.this).mActivity).viewLoading.setVisibility(8);
|
||||
}
|
||||
});
|
||||
((BaseActivity) getActivity()).loadComplete(this.ryContent, this.e);
|
||||
}
|
||||
|
||||
public static ContentFragment b() {
|
||||
ContentFragment contentFragment = new ContentFragment();
|
||||
ALog.a("ContentFragment").d(contentFragment.toString());
|
||||
return contentFragment;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.fragment.CommonFragment
|
||||
public void c(String str) {
|
||||
this.a = str;
|
||||
this.f = 1;
|
||||
this.d.a(this.a);
|
||||
requestData();
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package com.ubt.jimu.community.view.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import com.recyclelib.URecyclerView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class IssueCommonFragment extends BaseFragment {
|
||||
private Unbinder a;
|
||||
LoadingView lvLoading;
|
||||
URecyclerView rvIssue;
|
||||
|
||||
public abstract void initData();
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
return layoutInflater.inflate(R.layout.fragment_issue, viewGroup, false);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroyView() {
|
||||
this.lvLoading.a();
|
||||
this.a.unbind();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
this.a = ButterKnife.a(this, view);
|
||||
initData();
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.ubt.jimu.community.view.fragment;
|
||||
|
||||
import android.view.View;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.recyclelib.URecyclerView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class IssueCommonFragment_ViewBinding implements Unbinder {
|
||||
private IssueCommonFragment b;
|
||||
|
||||
public IssueCommonFragment_ViewBinding(IssueCommonFragment issueCommonFragment, View view) {
|
||||
this.b = issueCommonFragment;
|
||||
issueCommonFragment.lvLoading = (LoadingView) Utils.b(view, R.id.lv_loading, "field 'lvLoading'", LoadingView.class);
|
||||
issueCommonFragment.rvIssue = (URecyclerView) Utils.b(view, R.id.rv_issue, "field 'rvIssue'", URecyclerView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
IssueCommonFragment issueCommonFragment = this.b;
|
||||
if (issueCommonFragment == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
issueCommonFragment.lvLoading = null;
|
||||
issueCommonFragment.rvIssue = null;
|
||||
}
|
||||
}
|
132
sources/com/ubt/jimu/community/view/fragment/IssueFragment.java
Normal file
132
sources/com/ubt/jimu/community/view/fragment/IssueFragment.java
Normal file
@@ -0,0 +1,132 @@
|
||||
package com.ubt.jimu.community.view.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import com.recyclelib.URecyclerView;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.MyPostListEntities;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.manager.CommunityManager;
|
||||
import com.ubt.jimu.community.view.adapter.IssueNewsAdapter;
|
||||
import com.ubt.jimu.course.view.GridItemDecoration;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class IssueFragment extends IssueCommonFragment {
|
||||
private List<MyPostListEntities.RecordsBean> b;
|
||||
private IssueNewsAdapter c;
|
||||
private ApiObserver<MyPostListEntities> d;
|
||||
private CompositeDisposable e = new CompositeDisposable();
|
||||
private int f = 1;
|
||||
private String g;
|
||||
|
||||
static /* synthetic */ int c(IssueFragment issueFragment) {
|
||||
int i = issueFragment.f;
|
||||
issueFragment.f = i + 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void requestData() {
|
||||
CommunityManager.create().myReportList(this.g, this.f, 12, this.d);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.fragment.IssueCommonFragment
|
||||
public void initData() {
|
||||
this.g = getArguments().getString("userId");
|
||||
this.b = new ArrayList();
|
||||
this.c = new IssueNewsAdapter(this.mActivity, this.b, 2, this.g);
|
||||
this.rvIssue.setLayoutManager(new GridLayoutManager((Context) this.mActivity, 4, 1, false));
|
||||
int dimensionPixelOffset = getResources().getDimensionPixelOffset(R.dimen.user_center_collection_item_margin);
|
||||
this.rvIssue.a(new GridItemDecoration(getResources().getDimensionPixelOffset(R.dimen.user_center_collection_item_margin_top), dimensionPixelOffset, 1));
|
||||
this.rvIssue.setAdapter(this.c);
|
||||
this.rvIssue.setLoadingMoreEnabled(true);
|
||||
b();
|
||||
requestData();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.fragment.IssueCommonFragment, androidx.fragment.app.Fragment
|
||||
public void onDestroyView() {
|
||||
this.e.dispose();
|
||||
this.e.a();
|
||||
if (this.d != null) {
|
||||
this.d = null;
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
private void b() {
|
||||
this.d = new ApiObserver<MyPostListEntities>(this.lvLoading) { // from class: com.ubt.jimu.community.view.fragment.IssueFragment.1
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(MyPostListEntities myPostListEntities) {
|
||||
if (myPostListEntities.getRecords() != null && myPostListEntities.getRecords().size() != 0) {
|
||||
IssueFragment.this.a(myPostListEntities);
|
||||
return;
|
||||
}
|
||||
IssueFragment.this.lvLoading.setServiceLoadingError(R.drawable.ic_try_reload);
|
||||
IssueFragment.this.lvLoading.setServiceTextError(R.string.loading_service_error);
|
||||
IssueFragment.this.lvLoading.f();
|
||||
if (IssueFragment.this.b.size() == myPostListEntities.getTotal()) {
|
||||
IssueFragment.this.rvIssue.setNoMore(true);
|
||||
} else {
|
||||
IssueFragment.this.rvIssue.setNoMore(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
super.onSubscribe(disposable);
|
||||
IssueFragment.this.e.b(disposable);
|
||||
}
|
||||
};
|
||||
this.rvIssue.setLoadingListener(new URecyclerView.LoadingListener() { // from class: com.ubt.jimu.community.view.fragment.IssueFragment.2
|
||||
@Override // com.recyclelib.URecyclerView.LoadingListener
|
||||
public void onLoadingMore() {
|
||||
IssueFragment.c(IssueFragment.this);
|
||||
IssueFragment.this.requestData();
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.URecyclerView.LoadingListener
|
||||
public void onRefreshing() {
|
||||
IssueFragment.this.f = 1;
|
||||
IssueFragment.this.lvLoading.setIsRefresh(true);
|
||||
IssueFragment.this.rvIssue.setNoMore(false);
|
||||
IssueFragment.this.requestData();
|
||||
}
|
||||
});
|
||||
((BaseActivity) getActivity()).loadComplete(this.rvIssue, this.d);
|
||||
}
|
||||
|
||||
public static IssueFragment c(String str) {
|
||||
IssueFragment issueFragment = new IssueFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("userId", str);
|
||||
issueFragment.setArguments(bundle);
|
||||
return issueFragment;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(MyPostListEntities myPostListEntities) {
|
||||
if (myPostListEntities != null) {
|
||||
if (this.f == 1) {
|
||||
this.b.clear();
|
||||
}
|
||||
this.b.addAll(myPostListEntities.getRecords());
|
||||
if (this.b.size() == myPostListEntities.getTotal()) {
|
||||
this.rvIssue.setNoMore(true);
|
||||
}
|
||||
}
|
||||
this.c.notifyDataSetChanged();
|
||||
}
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
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.SearchQuizBean;
|
||||
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.AskAdapter;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class QuizFragment extends CommonFragment {
|
||||
private ArrayList<SearchQuizBean.RecordsBean> c;
|
||||
private AskAdapter d;
|
||||
private ApiObserver<SearchQuizBean> e;
|
||||
private int f = 1;
|
||||
|
||||
static /* synthetic */ int b(QuizFragment quizFragment) {
|
||||
int i = quizFragment.f;
|
||||
quizFragment.f = i + 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void requestData() {
|
||||
CommunityManager.create().userSearchResult(this.a, "question", Cache.getInstance().getUserId(), this.f, 60, this.e);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.fragment.CommonFragment
|
||||
protected void initData() {
|
||||
this.c = new ArrayList<>();
|
||||
this.e = new ApiObserver<SearchQuizBean>(((SearchActivity) this.mActivity).viewLoading) { // from class: com.ubt.jimu.community.view.fragment.QuizFragment.1
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(SearchQuizBean searchQuizBean) {
|
||||
ALog.a(QuizFragment.this.TAG).d("searchModel==" + searchQuizBean.getPages());
|
||||
if (searchQuizBean.getRecords() != null) {
|
||||
if (QuizFragment.this.f == 1) {
|
||||
QuizFragment.this.c.clear();
|
||||
}
|
||||
QuizFragment.this.c.addAll(searchQuizBean.getRecords());
|
||||
if (QuizFragment.this.f == searchQuizBean.getTotal()) {
|
||||
QuizFragment.this.ryContent.setNoMore(true);
|
||||
} else {
|
||||
QuizFragment.this.ryContent.setNoMore(false);
|
||||
}
|
||||
} else {
|
||||
QuizFragment.this.ryContent.setNoMore(true);
|
||||
}
|
||||
QuizFragment.this.d.notifyDataSetChanged();
|
||||
QuizFragment quizFragment = QuizFragment.this;
|
||||
quizFragment.d(quizFragment.c.size());
|
||||
}
|
||||
};
|
||||
requestData();
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.mActivity, 1, false);
|
||||
this.d = new AskAdapter(this.mActivity, this.c);
|
||||
this.ryContent.setLayoutManager(linearLayoutManager);
|
||||
this.ryContent.setAdapter(this.d);
|
||||
this.ryContent.setLoadingListener(new URecyclerView.LoadingListener() { // from class: com.ubt.jimu.community.view.fragment.QuizFragment.2
|
||||
@Override // com.recyclelib.URecyclerView.LoadingListener
|
||||
public void onLoadingMore() {
|
||||
QuizFragment.b(QuizFragment.this);
|
||||
QuizFragment.this.requestData();
|
||||
((SearchActivity) ((BaseFragment) QuizFragment.this).mActivity).viewLoading.setVisibility(8);
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.URecyclerView.LoadingListener
|
||||
public void onRefreshing() {
|
||||
QuizFragment.this.f = 1;
|
||||
QuizFragment.this.requestData();
|
||||
((SearchActivity) ((BaseFragment) QuizFragment.this).mActivity).viewLoading.setVisibility(8);
|
||||
}
|
||||
});
|
||||
((BaseActivity) getActivity()).loadComplete(this.ryContent, this.e);
|
||||
}
|
||||
|
||||
public static QuizFragment b() {
|
||||
return new QuizFragment();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.fragment.CommonFragment
|
||||
public void c(String str) {
|
||||
this.f = 1;
|
||||
this.a = str;
|
||||
this.d.a(str);
|
||||
requestData();
|
||||
}
|
||||
}
|
@@ -0,0 +1,170 @@
|
||||
package com.ubt.jimu.community.view.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.base.entities.RecommendBean;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.community.presenter.SearchPresenter;
|
||||
import com.ubt.jimu.community.view.SearchActivity;
|
||||
import com.ubt.jimu.community.view.adapter.search.SearchRecommendAdapter;
|
||||
import com.ubt.jimu.push.JimuPushMessage;
|
||||
import com.ubt.jimu.widgets.SpaceItemDecoration;
|
||||
import com.ubt.jimu.widgets.screenAdaptive.XLinearLayout;
|
||||
import com.ubt.jimu.widgets.screenAdaptive.XRelativeLayout;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RecommendFragment extends BaseFragment {
|
||||
private SearchPresenter a;
|
||||
private SearchRecommendAdapter b;
|
||||
private SharePreferenceHelper c;
|
||||
private List<String> d;
|
||||
private Unbinder e;
|
||||
RecyclerView rvRecommend;
|
||||
RecyclerView rvSearchHistory;
|
||||
TextView tvClear;
|
||||
TextView tvHistory;
|
||||
TextView tvKeywords;
|
||||
TextView tvSearch;
|
||||
TextView tvSearchHistory;
|
||||
XLinearLayout xlIntroduce;
|
||||
XRelativeLayout xrHistory;
|
||||
|
||||
private void bindClick() {
|
||||
this.tvClear.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.community.view.fragment.a
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
RecommendFragment.this.a(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void h(List<String> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
this.rvSearchHistory.setVisibility(8);
|
||||
this.tvHistory.setVisibility(0);
|
||||
} else {
|
||||
this.rvSearchHistory.setVisibility(0);
|
||||
this.tvHistory.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
this.c = new SharePreferenceHelper();
|
||||
this.d = (List) this.c.readObject(SharePreferenceHelper.SP_KEY_SEARCH_HISTORY);
|
||||
if (this.d == null) {
|
||||
this.d = new ArrayList();
|
||||
}
|
||||
this.b = new SearchRecommendAdapter(this.mActivity, this, "history", this.d, this.a);
|
||||
this.rvSearchHistory.setLayoutManager(new LinearLayoutManager(this.mActivity, 1, false));
|
||||
this.rvSearchHistory.a(new SpaceItemDecoration(10, 0));
|
||||
this.rvSearchHistory.setAdapter(this.b);
|
||||
final SearchRecommendAdapter searchRecommendAdapter = new SearchRecommendAdapter(this.mActivity, this, JimuPushMessage.TYPE_MODEL_RECOMMEMD, new RecommendBean().getKeys(), this.a);
|
||||
this.rvRecommend.setLayoutManager(new GridLayoutManager(this.mActivity, 4));
|
||||
this.rvRecommend.setAdapter(searchRecommendAdapter);
|
||||
this.a.a(this, searchRecommendAdapter, new ApiObserver<RecommendBean>(((SearchActivity) this.mActivity).viewLoading) { // from class: com.ubt.jimu.community.view.fragment.RecommendFragment.1
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(RecommendBean recommendBean) {
|
||||
if (recommendBean.getKeys() == null) {
|
||||
RecommendFragment.this.j(null);
|
||||
} else {
|
||||
searchRecommendAdapter.notifyChanged(recommendBean.getKeys());
|
||||
RecommendFragment.this.j(recommendBean.getKeys());
|
||||
}
|
||||
}
|
||||
});
|
||||
b();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void j(List<String> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
this.rvRecommend.setVisibility(8);
|
||||
this.tvKeywords.setVisibility(0);
|
||||
} else {
|
||||
this.rvRecommend.setVisibility(0);
|
||||
this.tvKeywords.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
public static RecommendFragment o() {
|
||||
return new RecommendFragment();
|
||||
}
|
||||
|
||||
public void b() {
|
||||
List<String> list = (List) this.c.readObject(SharePreferenceHelper.SP_KEY_SEARCH_HISTORY);
|
||||
if (list == null) {
|
||||
this.tvClear.setAlpha(0.3f);
|
||||
return;
|
||||
}
|
||||
this.b.notifyChanged(list);
|
||||
h(list);
|
||||
if (list.size() > 0) {
|
||||
this.tvClear.setAlpha(1.0f);
|
||||
} else {
|
||||
this.tvClear.setAlpha(0.3f);
|
||||
}
|
||||
}
|
||||
|
||||
public void c(String str) {
|
||||
this.b.a(str);
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
XLinearLayout xLinearLayout = this.xlIntroduce;
|
||||
if (xLinearLayout == null || this.xrHistory == null) {
|
||||
return;
|
||||
}
|
||||
if (i == 0) {
|
||||
xLinearLayout.setVisibility(0);
|
||||
this.xrHistory.setVisibility(0);
|
||||
} else {
|
||||
xLinearLayout.setVisibility(8);
|
||||
this.xrHistory.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
return layoutInflater.inflate(R.layout.fragment_search_rd, viewGroup, false);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroyView() {
|
||||
this.e.unbind();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
this.e = ButterKnife.a(this, view);
|
||||
initData();
|
||||
bindClick();
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
this.d.clear();
|
||||
this.c.saveObject(SharePreferenceHelper.SP_KEY_SEARCH_HISTORY, this.d);
|
||||
this.b.notifyDataSetChanged();
|
||||
h(this.d);
|
||||
this.tvClear.setAlpha(0.3f);
|
||||
}
|
||||
|
||||
public void a(SearchPresenter searchPresenter) {
|
||||
this.a = searchPresenter;
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package com.ubt.jimu.community.view.fragment;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.screenAdaptive.XLinearLayout;
|
||||
import com.ubt.jimu.widgets.screenAdaptive.XRelativeLayout;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RecommendFragment_ViewBinding implements Unbinder {
|
||||
private RecommendFragment b;
|
||||
|
||||
public RecommendFragment_ViewBinding(RecommendFragment recommendFragment, View view) {
|
||||
this.b = recommendFragment;
|
||||
recommendFragment.xrHistory = (XRelativeLayout) Utils.b(view, R.id.xr_history, "field 'xrHistory'", XRelativeLayout.class);
|
||||
recommendFragment.tvSearch = (TextView) Utils.b(view, R.id.tv_search, "field 'tvSearch'", TextView.class);
|
||||
recommendFragment.tvClear = (TextView) Utils.b(view, R.id.tv_clear, "field 'tvClear'", TextView.class);
|
||||
recommendFragment.rvSearchHistory = (RecyclerView) Utils.b(view, R.id.rv_search_history, "field 'rvSearchHistory'", RecyclerView.class);
|
||||
recommendFragment.tvHistory = (TextView) Utils.b(view, R.id.tv_history, "field 'tvHistory'", TextView.class);
|
||||
recommendFragment.xlIntroduce = (XLinearLayout) Utils.b(view, R.id.xl_introduce, "field 'xlIntroduce'", XLinearLayout.class);
|
||||
recommendFragment.tvSearchHistory = (TextView) Utils.b(view, R.id.tv_search_history, "field 'tvSearchHistory'", TextView.class);
|
||||
recommendFragment.rvRecommend = (RecyclerView) Utils.b(view, R.id.rv_recommend, "field 'rvRecommend'", RecyclerView.class);
|
||||
recommendFragment.tvKeywords = (TextView) Utils.b(view, R.id.tv_keywords, "field 'tvKeywords'", TextView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
RecommendFragment recommendFragment = this.b;
|
||||
if (recommendFragment == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
recommendFragment.xrHistory = null;
|
||||
recommendFragment.tvSearch = null;
|
||||
recommendFragment.tvClear = null;
|
||||
recommendFragment.rvSearchHistory = null;
|
||||
recommendFragment.tvHistory = null;
|
||||
recommendFragment.xlIntroduce = null;
|
||||
recommendFragment.tvSearchHistory = null;
|
||||
recommendFragment.rvRecommend = null;
|
||||
recommendFragment.tvKeywords = null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user