手机端文档中心接口修改
This commit is contained in:
parent
bb433ed8f8
commit
79ed157dce
@ -11,7 +11,6 @@ import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
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.conver.RxTransformer;
|
||||
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.TypeFaceTextView;
|
||||
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
||||
@ -89,14 +89,7 @@ public class DocFragment extends BaseFragment {
|
||||
RadioGroup mRgType;
|
||||
@BindView(R2.id.rlv_doc)
|
||||
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)
|
||||
SmartRefreshLayout mSrlContent;
|
||||
@BindView(R2.id.et_base_search_cancel)
|
||||
@ -107,6 +100,8 @@ public class DocFragment extends BaseFragment {
|
||||
LinearLayout mLlBaseSearchCancel;
|
||||
@BindView(R2.id.rlv_sel)
|
||||
RecyclerView mRlvSel;
|
||||
@BindView(R2.id.csv_state)
|
||||
CustomStateView mCsvState;
|
||||
private Unbinder mBind;
|
||||
|
||||
private List<Object> mDatas;
|
||||
@ -149,7 +144,7 @@ public class DocFragment extends BaseFragment {
|
||||
mSrlView.setEnableLoadMore(false);
|
||||
mSrlView.setEnableRefresh(false);
|
||||
mRgType.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
refreshStateView(LionActions.STATE_LOAD);
|
||||
mCsvState.setState(CustomStateView.STATE_LOAD);
|
||||
mSelCatalog.clear();
|
||||
if (checkedId == R.id.rb_pri) {
|
||||
mType = "个人文档";//个人
|
||||
@ -233,7 +228,7 @@ public class DocFragment extends BaseFragment {
|
||||
mRlvSel.setAdapter(mSelCatalogAdapter);
|
||||
//选中的目录点击
|
||||
mSelCatalogAdapter.setOnItemChoose((bean, pos) -> {
|
||||
refreshStateView(LionActions.STATE_LOAD);
|
||||
mCsvState.setState(CustomStateView.STATE_LOAD);
|
||||
mSelCatalog = mSelCatalog.subList(0, pos + 1);
|
||||
mSelCatalogAdapter.setData(mSelCatalog);
|
||||
mRlvSel.scrollToPosition(mSelCatalog.size() - 1);
|
||||
@ -265,6 +260,7 @@ public class DocFragment extends BaseFragment {
|
||||
manageCategoryBean.setId("manageCategory");
|
||||
manageCategoryBean.setName("目录管理");
|
||||
mControls.add(manageCategoryBean);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -278,7 +274,7 @@ public class DocFragment extends BaseFragment {
|
||||
getPersonCatalog();
|
||||
} else if ("公共文档".equals(mType)) {
|
||||
//获取目录
|
||||
getPublicCatalog();
|
||||
getPublicCatalog(1);
|
||||
} else {
|
||||
getShareList(1);
|
||||
}
|
||||
@ -448,9 +444,9 @@ public class DocFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
if (mDatas.size() > 0) {
|
||||
refreshStateView(LionActions.STATE_SUCCESS);
|
||||
mCsvState.setState(CustomStateView.STATE_SUCCESS);
|
||||
} else {
|
||||
refreshStateView(LionActions.STATE_EMPTY);
|
||||
mCsvState.setState(CustomStateView.STATE_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,7 +455,7 @@ public class DocFragment extends BaseFragment {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.finishRefresh();
|
||||
ExceptionHandler.handleException(e);
|
||||
refreshStateView(LionActions.STATE_ERROR);
|
||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -515,9 +511,9 @@ public class DocFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
if (mDatas.size() > 0) {
|
||||
refreshStateView(LionActions.STATE_SUCCESS);
|
||||
mCsvState.setState(CustomStateView.STATE_SUCCESS);
|
||||
} else {
|
||||
refreshStateView(LionActions.STATE_EMPTY);
|
||||
mCsvState.setState(CustomStateView.STATE_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -526,7 +522,7 @@ public class DocFragment extends BaseFragment {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.finishRefresh();
|
||||
ExceptionHandler.handleException(e);
|
||||
refreshStateView(LionActions.STATE_ERROR);
|
||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||
}
|
||||
|
||||
@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) {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.finishRefresh();
|
||||
refreshStateView(LionActions.STATE_ERROR);
|
||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@ -613,33 +575,60 @@ public class DocFragment extends BaseFragment {
|
||||
/**
|
||||
* 获取公共文档目录
|
||||
*/
|
||||
private void getPublicCatalog() {
|
||||
private void getPublicCatalog(int currentPage) {
|
||||
mCurrentPage = currentPage;
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.getPublicDocTypeList(mSelCatalogId, "1")
|
||||
.getPublicDocumentFileList(mKeywords, mCurrentPage + "")
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<List<DocTypeTreeListBean>>() {
|
||||
.subscribe(new Observer<DocumentListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull List<DocTypeTreeListBean> docTypeTreeListBeans) {
|
||||
mDatas.clear();
|
||||
if (docTypeTreeListBeans.size() > 0) {
|
||||
mDatas.addAll(docTypeTreeListBeans);
|
||||
public void onNext(@NonNull DocumentListBean listBean) {
|
||||
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
||||
++mCurrentPage;
|
||||
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
|
||||
public void onError(@NonNull Throwable e) {
|
||||
mSrlContent.finishLoadMore();
|
||||
mSrlContent.finishRefresh();
|
||||
refreshStateView(LionActions.STATE_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,7 +76,8 @@
|
||||
android:padding="6dp"
|
||||
android:text="共享文档"
|
||||
android:textColor="@color/col_gray_black"
|
||||
android:textSize="@dimen/text_16" />
|
||||
android:textSize="@dimen/text_16"
|
||||
android:visibility="gone" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pub"
|
||||
@ -124,37 +125,42 @@
|
||||
android:id="@+id/rlv_doc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
<com.tenlionsoft.baselib.core.widget.views.CustomStateView
|
||||
android:id="@+id/csv_state"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_loading"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateDrawable="@drawable/anim_loading" />
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/ll_hint"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_centerInParent="true"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:orientation="vertical">-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_empty_data"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_centerInParent="true" />
|
||||
<!-- <ProgressBar-->
|
||||
<!-- android:id="@+id/pb_loading"-->
|
||||
<!-- android:layout_width="50dp"-->
|
||||
<!-- android:layout_height="50dp"-->
|
||||
<!-- android:indeterminateBehavior="repeat"-->
|
||||
<!-- android:indeterminateDrawable="@drawable/anim_loading" />-->
|
||||
|
||||
<com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_error_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:clickable="true"
|
||||
android:textColor="@color/black"
|
||||
tools:text="加载数据失败" />
|
||||
</LinearLayout>
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_empty_data"-->
|
||||
<!-- android:layout_width="100dp"-->
|
||||
<!-- android:layout_height="100dp"-->
|
||||
<!-- android:layout_centerInParent="true" />-->
|
||||
|
||||
<!-- <com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView-->
|
||||
<!-- android:id="@+id/tv_error_hint"-->
|
||||
<!-- 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>
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user