手机端文档中心接口修改

This commit is contained in:
itgaojian 2023-04-14 17:49:19 +08:00
parent bb433ed8f8
commit 79ed157dce
2 changed files with 86 additions and 91 deletions

View File

@ -11,7 +11,6 @@ import android.view.inputmethod.EditorInfo;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
@ -34,6 +33,7 @@ import com.tenlionsoft.baselib.core.beans.OperateBean;
import com.tenlionsoft.baselib.core.retrofit_net.RetrofitManager; import com.tenlionsoft.baselib.core.retrofit_net.RetrofitManager;
import com.tenlionsoft.baselib.core.retrofit_net.conver.RxTransformer; import com.tenlionsoft.baselib.core.retrofit_net.conver.RxTransformer;
import com.tenlionsoft.baselib.core.widget.base.BaseFragment; import com.tenlionsoft.baselib.core.widget.base.BaseFragment;
import com.tenlionsoft.baselib.core.widget.views.CustomStateView;
import com.tenlionsoft.baselib.core.widget.views.OperatePopup; import com.tenlionsoft.baselib.core.widget.views.OperatePopup;
import com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView; import com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView;
import com.tenlionsoft.baselib.utils.ExceptionHandler; import com.tenlionsoft.baselib.utils.ExceptionHandler;
@ -89,14 +89,7 @@ public class DocFragment extends BaseFragment {
RadioGroup mRgType; RadioGroup mRgType;
@BindView(R2.id.rlv_doc) @BindView(R2.id.rlv_doc)
RecyclerView mRlvDoc; RecyclerView mRlvDoc;
@BindView(R2.id.pb_loading)
ProgressBar mPbLoading;
@BindView(R2.id.iv_empty_data)
ImageView mIvEmptyData;
@BindView(R2.id.tv_error_hint)
TextView mTvErrorHint;
@BindView(R2.id.ll_hint)
LinearLayout mLlHint;
@BindView(R2.id.srl_content) @BindView(R2.id.srl_content)
SmartRefreshLayout mSrlContent; SmartRefreshLayout mSrlContent;
@BindView(R2.id.et_base_search_cancel) @BindView(R2.id.et_base_search_cancel)
@ -107,6 +100,8 @@ public class DocFragment extends BaseFragment {
LinearLayout mLlBaseSearchCancel; LinearLayout mLlBaseSearchCancel;
@BindView(R2.id.rlv_sel) @BindView(R2.id.rlv_sel)
RecyclerView mRlvSel; RecyclerView mRlvSel;
@BindView(R2.id.csv_state)
CustomStateView mCsvState;
private Unbinder mBind; private Unbinder mBind;
private List<Object> mDatas; private List<Object> mDatas;
@ -149,7 +144,7 @@ public class DocFragment extends BaseFragment {
mSrlView.setEnableLoadMore(false); mSrlView.setEnableLoadMore(false);
mSrlView.setEnableRefresh(false); mSrlView.setEnableRefresh(false);
mRgType.setOnCheckedChangeListener((group, checkedId) -> { mRgType.setOnCheckedChangeListener((group, checkedId) -> {
refreshStateView(LionActions.STATE_LOAD); mCsvState.setState(CustomStateView.STATE_LOAD);
mSelCatalog.clear(); mSelCatalog.clear();
if (checkedId == R.id.rb_pri) { if (checkedId == R.id.rb_pri) {
mType = "个人文档";//个人 mType = "个人文档";//个人
@ -233,7 +228,7 @@ public class DocFragment extends BaseFragment {
mRlvSel.setAdapter(mSelCatalogAdapter); mRlvSel.setAdapter(mSelCatalogAdapter);
//选中的目录点击 //选中的目录点击
mSelCatalogAdapter.setOnItemChoose((bean, pos) -> { mSelCatalogAdapter.setOnItemChoose((bean, pos) -> {
refreshStateView(LionActions.STATE_LOAD); mCsvState.setState(CustomStateView.STATE_LOAD);
mSelCatalog = mSelCatalog.subList(0, pos + 1); mSelCatalog = mSelCatalog.subList(0, pos + 1);
mSelCatalogAdapter.setData(mSelCatalog); mSelCatalogAdapter.setData(mSelCatalog);
mRlvSel.scrollToPosition(mSelCatalog.size() - 1); mRlvSel.scrollToPosition(mSelCatalog.size() - 1);
@ -265,6 +260,7 @@ public class DocFragment extends BaseFragment {
manageCategoryBean.setId("manageCategory"); manageCategoryBean.setId("manageCategory");
manageCategoryBean.setName("目录管理"); manageCategoryBean.setName("目录管理");
mControls.add(manageCategoryBean); mControls.add(manageCategoryBean);
} }
/** /**
@ -278,7 +274,7 @@ public class DocFragment extends BaseFragment {
getPersonCatalog(); getPersonCatalog();
} else if ("公共文档".equals(mType)) { } else if ("公共文档".equals(mType)) {
//获取目录 //获取目录
getPublicCatalog(); getPublicCatalog(1);
} else { } else {
getShareList(1); getShareList(1);
} }
@ -448,9 +444,9 @@ public class DocFragment extends BaseFragment {
} }
} }
if (mDatas.size() > 0) { if (mDatas.size() > 0) {
refreshStateView(LionActions.STATE_SUCCESS); mCsvState.setState(CustomStateView.STATE_SUCCESS);
} else { } else {
refreshStateView(LionActions.STATE_EMPTY); mCsvState.setState(CustomStateView.STATE_EMPTY);
} }
} }
@ -459,7 +455,7 @@ public class DocFragment extends BaseFragment {
mSrlContent.finishLoadMore(); mSrlContent.finishLoadMore();
mSrlContent.finishRefresh(); mSrlContent.finishRefresh();
ExceptionHandler.handleException(e); ExceptionHandler.handleException(e);
refreshStateView(LionActions.STATE_ERROR); mCsvState.setState(CustomStateView.STATE_ERROR);
} }
@Override @Override
@ -515,9 +511,9 @@ public class DocFragment extends BaseFragment {
} }
} }
if (mDatas.size() > 0) { if (mDatas.size() > 0) {
refreshStateView(LionActions.STATE_SUCCESS); mCsvState.setState(CustomStateView.STATE_SUCCESS);
} else { } else {
refreshStateView(LionActions.STATE_EMPTY); mCsvState.setState(CustomStateView.STATE_EMPTY);
} }
} }
@ -526,7 +522,7 @@ public class DocFragment extends BaseFragment {
mSrlContent.finishLoadMore(); mSrlContent.finishLoadMore();
mSrlContent.finishRefresh(); mSrlContent.finishRefresh();
ExceptionHandler.handleException(e); ExceptionHandler.handleException(e);
refreshStateView(LionActions.STATE_ERROR); mCsvState.setState(CustomStateView.STATE_ERROR);
} }
@Override @Override
@ -536,40 +532,6 @@ public class DocFragment extends BaseFragment {
}); });
} }
private void refreshStateView(int state) {
switch (state) {
case LionActions.STATE_LOAD:
mRlvDoc.setVisibility(View.GONE);
mLlHint.setVisibility(View.VISIBLE);
mPbLoading.setVisibility(View.VISIBLE);
mIvEmptyData.setVisibility(View.GONE);
mTvErrorHint.setVisibility(View.VISIBLE);
mTvErrorHint.setText("加载中...");
break;
case LionActions.STATE_EMPTY:
mRlvDoc.setVisibility(View.GONE);
mLlHint.setVisibility(View.VISIBLE);
mPbLoading.setVisibility(View.GONE);
mIvEmptyData.setVisibility(View.VISIBLE);
mIvEmptyData.setImageResource(R.drawable.ic_empty_data);
mTvErrorHint.setVisibility(View.VISIBLE);
mTvErrorHint.setText("暂无数据");
break;
case LionActions.STATE_ERROR:
mRlvDoc.setVisibility(View.GONE);
mLlHint.setVisibility(View.VISIBLE);
mPbLoading.setVisibility(View.GONE);
mIvEmptyData.setVisibility(View.VISIBLE);
mIvEmptyData.setImageResource(R.drawable.ic_load_error);
mTvErrorHint.setVisibility(View.VISIBLE);
mTvErrorHint.setText("加载失败,请稍后重试");
break;
case LionActions.STATE_SUCCESS:
mRlvDoc.setVisibility(View.VISIBLE);
mLlHint.setVisibility(View.GONE);
break;
}
}
/** /**
* 获取个人类型目录 * 获取个人类型目录
@ -599,7 +561,7 @@ public class DocFragment extends BaseFragment {
public void onError(@NonNull Throwable e) { public void onError(@NonNull Throwable e) {
mSrlContent.finishLoadMore(); mSrlContent.finishLoadMore();
mSrlContent.finishRefresh(); mSrlContent.finishRefresh();
refreshStateView(LionActions.STATE_ERROR); mCsvState.setState(CustomStateView.STATE_ERROR);
ExceptionHandler.handleException(e); ExceptionHandler.handleException(e);
} }
@ -613,33 +575,60 @@ public class DocFragment extends BaseFragment {
/** /**
* 获取公共文档目录 * 获取公共文档目录
*/ */
private void getPublicCatalog() { private void getPublicCatalog(int currentPage) {
mCurrentPage = currentPage;
RetrofitManager.getInstance() RetrofitManager.getInstance()
.create(OAApi.class) .create(OAApi.class)
.getPublicDocTypeList(mSelCatalogId, "1") .getPublicDocumentFileList(mKeywords, mCurrentPage + "")
.compose(RxTransformer.getTransformer()) .compose(RxTransformer.getTransformer())
.subscribe(new Observer<List<DocTypeTreeListBean>>() { .subscribe(new Observer<DocumentListBean>() {
@Override @Override
public void onSubscribe(@NonNull Disposable d) { public void onSubscribe(@NonNull Disposable d) {
} }
@Override @Override
public void onNext(@NonNull List<DocTypeTreeListBean> docTypeTreeListBeans) { public void onNext(@NonNull DocumentListBean listBean) {
mDatas.clear(); if (listBean.getRows() != null && listBean.getRows().size() > 0) {
if (docTypeTreeListBeans.size() > 0) { ++mCurrentPage;
mDatas.addAll(docTypeTreeListBeans); if (currentPage == 1) {
mDatas.addAll(listBean.getRows());
} else {
mDatas.addAll(listBean.getRows());
}
mAdapter.notifyDataSetChanged();
mSrlContent.finishRefresh();
if (mDatas.size() >= listBean.getTotal()) {
mSrlContent.finishLoadMore();
mSrlContent.setNoMoreData(true);
} else {
mSrlContent.finishLoadMore();
mSrlContent.setNoMoreData(false);
}
} else {
mSrlContent.finishLoadMore();
mSrlContent.finishRefresh();
if (currentPage > 1) {
mSrlContent.setNoMoreData(true);
} else {
if (!TextUtils.isEmpty(mKeywords)) {
ToastUtils.show("未查询到相关内容");
}
}
}
if (mDatas.size() > 0) {
mCsvState.setState(CustomStateView.STATE_SUCCESS);
} else {
mCsvState.setState(CustomStateView.STATE_EMPTY);
} }
mAdapter.setData(mDatas);
getDocumentList(1);
} }
@Override @Override
public void onError(@NonNull Throwable e) { public void onError(@NonNull Throwable e) {
mSrlContent.finishLoadMore(); mSrlContent.finishLoadMore();
mSrlContent.finishRefresh(); mSrlContent.finishRefresh();
refreshStateView(LionActions.STATE_ERROR);
ExceptionHandler.handleException(e); ExceptionHandler.handleException(e);
mCsvState.setState(CustomStateView.STATE_ERROR);
} }
@Override @Override

View File

@ -76,7 +76,8 @@
android:padding="6dp" android:padding="6dp"
android:text="共享文档" android:text="共享文档"
android:textColor="@color/col_gray_black" android:textColor="@color/col_gray_black"
android:textSize="@dimen/text_16" /> android:textSize="@dimen/text_16"
android:visibility="gone" />
<RadioButton <RadioButton
android:id="@+id/rb_pub" android:id="@+id/rb_pub"
@ -124,37 +125,42 @@
android:id="@+id/rlv_doc" android:id="@+id/rlv_doc"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<com.tenlionsoft.baselib.core.widget.views.CustomStateView
<LinearLayout android:id="@+id/csv_state"
android:id="@+id/ll_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:gravity="center" android:layout_width="wrap_content"
android:orientation="vertical"> android:layout_height="wrap_content"/>
<ProgressBar <!-- <LinearLayout-->
android:id="@+id/pb_loading" <!-- android:id="@+id/ll_hint"-->
android:layout_width="50dp" <!-- android:layout_width="wrap_content"-->
android:layout_height="50dp" <!-- android:layout_height="wrap_content"-->
android:indeterminateBehavior="repeat" <!-- android:layout_centerInParent="true"-->
android:indeterminateDrawable="@drawable/anim_loading" /> <!-- android:gravity="center"-->
<!-- android:orientation="vertical">-->
<ImageView <!-- <ProgressBar-->
android:id="@+id/iv_empty_data" <!-- android:id="@+id/pb_loading"-->
android:layout_width="100dp" <!-- android:layout_width="50dp"-->
android:layout_height="100dp" <!-- android:layout_height="50dp"-->
android:layout_centerInParent="true" /> <!-- android:indeterminateBehavior="repeat"-->
<!-- android:indeterminateDrawable="@drawable/anim_loading" />-->
<com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView <!-- <ImageView-->
android:id="@+id/tv_error_hint" <!-- android:id="@+id/iv_empty_data"-->
android:layout_width="wrap_content" <!-- android:layout_width="100dp"-->
android:layout_height="wrap_content" <!-- android:layout_height="100dp"-->
android:layout_marginTop="10dp" <!-- android:layout_centerInParent="true" />-->
android:clickable="true"
android:textColor="@color/black" <!-- <com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView-->
tools:text="加载数据失败" /> <!-- android:id="@+id/tv_error_hint"-->
</LinearLayout> <!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="10dp"-->
<!-- android:clickable="true"-->
<!-- android:textColor="@color/black"-->
<!-- tools:text="加载数据失败" />-->
<!-- </LinearLayout>-->
</RelativeLayout> </RelativeLayout>
</com.scwang.smart.refresh.layout.SmartRefreshLayout> </com.scwang.smart.refresh.layout.SmartRefreshLayout>