个人文档目录增删改
This commit is contained in:
parent
747a44141d
commit
5f72808271
@ -2,6 +2,11 @@
|
|||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="@drawable/shape_btn_red_re_tr" android:state_enabled="false" />
|
<item android:drawable="@drawable/shape_btn_red_re_tr" android:state_enabled="false" />
|
||||||
<item android:drawable="@drawable/shape_btn_red_re" android:state_pressed="false" />
|
<item android:drawable="@drawable/shape_btn_red_re" android:state_pressed="false" />
|
||||||
|
<item android:drawable="@drawable/shape_btn_red_re" android:state_selected="false" />
|
||||||
|
|
||||||
<item android:drawable="@drawable/shape_btn_red_re_tr" android:state_pressed="true" />
|
<item android:drawable="@drawable/shape_btn_red_re_tr" android:state_pressed="true" />
|
||||||
<item android:drawable="@drawable/shape_btn_red_re" android:state_enabled="true" />
|
<item android:drawable="@drawable/shape_btn_red_re" android:state_enabled="true" />
|
||||||
|
<item android:drawable="@drawable/shape_btn_nomal_gray_no_size" android:state_selected="true" />
|
||||||
|
|
||||||
|
<item android:drawable="@drawable/shape_btn_red_re" />
|
||||||
</selector>
|
</selector>
|
@ -24,7 +24,6 @@
|
|||||||
style="@style/item_title"
|
style="@style/item_title"
|
||||||
android:text="目录名称" />
|
android:text="目录名称" />
|
||||||
|
|
||||||
<View style="@style/vertical_line" />
|
|
||||||
|
|
||||||
<com.tenlionsoft.baselib.core.widget.views.TypeFaceEditText
|
<com.tenlionsoft.baselib.core.widget.views.TypeFaceEditText
|
||||||
android:id="@+id/et_name"
|
android:id="@+id/et_name"
|
||||||
@ -42,7 +41,6 @@
|
|||||||
style="@style/item_title"
|
style="@style/item_title"
|
||||||
android:text="排序编号" />
|
android:text="排序编号" />
|
||||||
|
|
||||||
<View style="@style/vertical_line" />
|
|
||||||
|
|
||||||
<com.tenlionsoft.baselib.core.widget.views.TypeFaceEditText
|
<com.tenlionsoft.baselib.core.widget.views.TypeFaceEditText
|
||||||
android:id="@+id/et_order"
|
android:id="@+id/et_order"
|
||||||
@ -55,13 +53,12 @@
|
|||||||
|
|
||||||
<com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView
|
<com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView
|
||||||
style="@style/item_title_vertical"
|
style="@style/item_title_vertical"
|
||||||
android:drawableLeft="@drawable/ic_start_hint"
|
|
||||||
android:text="备注" />
|
android:text="备注" />
|
||||||
|
|
||||||
<com.tenlionsoft.baselib.core.widget.views.TypeFaceEditText
|
<com.tenlionsoft.baselib.core.widget.views.TypeFaceEditText
|
||||||
android:id="@+id/et_remark"
|
android:id="@+id/et_remark"
|
||||||
style="@style/item_content_edit"
|
style="@style/item_content_edit"
|
||||||
android:hint="请输入内容"
|
android:hint="请输入备注"
|
||||||
android:minLines="5" />
|
android:minLines="5" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@
|
|||||||
<style name="item_title">
|
<style name="item_title">
|
||||||
<item name="android:layout_width">0dp</item>
|
<item name="android:layout_width">0dp</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_weight">0.4</item>
|
<item name="android:layout_weight">0.3</item>
|
||||||
<item name="android:padding">2dp</item>
|
<item name="android:padding">2dp</item>
|
||||||
<item name="android:textColor">@color/black</item>
|
<item name="android:textColor">@color/black</item>
|
||||||
<item name="android:layout_gravity">center_vertical</item>
|
<item name="android:layout_gravity">center_vertical</item>
|
||||||
|
@ -1,38 +1,51 @@
|
|||||||
package com.tenlionsoft.oamodule.activity.document;
|
package com.tenlionsoft.oamodule.activity.document;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.google.android.flexbox.FlexDirection;
|
import com.google.android.flexbox.FlexDirection;
|
||||||
import com.google.android.flexbox.FlexWrap;
|
import com.google.android.flexbox.FlexWrap;
|
||||||
import com.google.android.flexbox.FlexboxLayoutManager;
|
import com.google.android.flexbox.FlexboxLayoutManager;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import com.tenlionsoft.baselib.constant.PathConfig;
|
import com.tenlionsoft.baselib.constant.PathConfig;
|
||||||
|
import com.tenlionsoft.baselib.core.beans.BaseSuccessBean;
|
||||||
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.BaseActivity;
|
import com.tenlionsoft.baselib.core.widget.base.BaseActivity;
|
||||||
import com.tenlionsoft.baselib.core.widget.views.CustomStateView;
|
import com.tenlionsoft.baselib.core.widget.views.CustomStateView;
|
||||||
|
import com.tenlionsoft.baselib.core.widget.views.ItemSplitDivider;
|
||||||
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
||||||
|
import com.tenlionsoft.baselib.utils.UIUtil;
|
||||||
import com.tenlionsoft.oamodule.R;
|
import com.tenlionsoft.oamodule.R;
|
||||||
import com.tenlionsoft.oamodule.R2;
|
import com.tenlionsoft.oamodule.R2;
|
||||||
import com.tenlionsoft.oamodule.adapter.ChooseDocTypeAdapter;
|
import com.tenlionsoft.oamodule.adapter.ChooseDocTypeAdapter;
|
||||||
import com.tenlionsoft.oamodule.adapter.SelDocTypeAdapter;
|
import com.tenlionsoft.oamodule.adapter.SelDocTypeAdapter;
|
||||||
import com.tenlionsoft.oamodule.adapter.SelectedDocTypeAdapter;
|
import com.tenlionsoft.oamodule.adapter.SelectedDocTypeAdapter;
|
||||||
import com.tenlionsoft.oamodule.beans.DocumentTypeList;
|
import com.tenlionsoft.oamodule.beans.DocumentTypeList;
|
||||||
|
import com.tenlionsoft.oamodule.beans.SaveDocumentTypeBean;
|
||||||
import com.tenlionsoft.oamodule.net.OAApi;
|
import com.tenlionsoft.oamodule.net.OAApi;
|
||||||
|
import com.tenlionsoft.oamodule.widget.CenterDocTypeView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import io.reactivex.rxjava3.annotations.NonNull;
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
import io.reactivex.rxjava3.core.Observer;
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
import io.reactivex.rxjava3.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作者: Adam
|
* 作者: Adam
|
||||||
@ -52,6 +65,10 @@ public class ChooseDocTypeActivity extends BaseActivity {
|
|||||||
CustomStateView mCsvState;
|
CustomStateView mCsvState;
|
||||||
@BindView(R2.id.rlv_selected)
|
@BindView(R2.id.rlv_selected)
|
||||||
RecyclerView mRlvSelected;
|
RecyclerView mRlvSelected;
|
||||||
|
@BindView(R2.id.btn_edit_type)
|
||||||
|
Button mBtnEditType;
|
||||||
|
@BindView(R2.id.btn_add_type)
|
||||||
|
Button mBtnAddType;
|
||||||
|
|
||||||
private List<Object> mSelCatalog = new ArrayList<>();
|
private List<Object> mSelCatalog = new ArrayList<>();
|
||||||
private SelDocTypeAdapter mTypeAdapter;
|
private SelDocTypeAdapter mTypeAdapter;
|
||||||
@ -91,8 +108,9 @@ public class ChooseDocTypeActivity extends BaseActivity {
|
|||||||
mRlvSel.setLayoutManager(manager);
|
mRlvSel.setLayoutManager(manager);
|
||||||
mTypeAdapter = new SelDocTypeAdapter(mActivity, mSelCatalog);
|
mTypeAdapter = new SelDocTypeAdapter(mActivity, mSelCatalog);
|
||||||
mRlvSel.setAdapter(mTypeAdapter);
|
mRlvSel.setAdapter(mTypeAdapter);
|
||||||
mAdapter = new ChooseDocTypeAdapter(mActivity, mDatas);
|
mAdapter = new ChooseDocTypeAdapter(mActivity, mDatas, 1);
|
||||||
mRlvContent.setLayoutManager(new LinearLayoutManager(mActivity));
|
mRlvContent.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||||
|
mRlvContent.addItemDecoration(new ItemSplitDivider(mActivity, LinearLayoutManager.VERTICAL, 1, Color.parseColor("#F4F4F4")));
|
||||||
mRlvContent.setAdapter(mAdapter);
|
mRlvContent.setAdapter(mAdapter);
|
||||||
mCsvState.setState(CustomStateView.STATE_LOAD);
|
mCsvState.setState(CustomStateView.STATE_LOAD);
|
||||||
mTvPublish.setVisibility(View.VISIBLE);
|
mTvPublish.setVisibility(View.VISIBLE);
|
||||||
@ -175,6 +193,207 @@ public class ChooseDocTypeActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
mAdapter.setData(mDatas);
|
mAdapter.setData(mDatas);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mBtnAddType.setOnClickListener(v -> {
|
||||||
|
showAddTypeDialog();
|
||||||
|
});
|
||||||
|
|
||||||
|
mBtnEditType.setOnClickListener(v -> {
|
||||||
|
int type = mAdapter.getType();
|
||||||
|
if (type == 1) {
|
||||||
|
mAdapter.setType(2);
|
||||||
|
mBtnEditType.setText("取消");
|
||||||
|
} else {
|
||||||
|
mAdapter.setType(1);
|
||||||
|
mBtnEditType.setText("编辑");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//编辑或删除
|
||||||
|
mAdapter.addOnControlListener(new ChooseDocTypeAdapter.OnControlListener() {
|
||||||
|
@Override
|
||||||
|
public void doEdit(DocumentTypeList bean, int pos) {
|
||||||
|
showEditDialog(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doDel(DocumentTypeList bean, int pos) {
|
||||||
|
new AlertDialog.Builder(mActivity)
|
||||||
|
.setTitle("提示")
|
||||||
|
.setMessage("删除后该目录下所有文件将被删除,确定要删除该目录吗?")
|
||||||
|
.setPositiveButton("删除", (dialog, which) -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
doDelType(bean);
|
||||||
|
})
|
||||||
|
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss())
|
||||||
|
.create()
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showEditDialog(DocumentTypeList bean) {
|
||||||
|
CenterDocTypeView typeDialog = new CenterDocTypeView.DialogBuilder(mActivity)
|
||||||
|
.setBean(bean)
|
||||||
|
.build();
|
||||||
|
typeDialog.addOnChoseListener((name, order, remark) -> {
|
||||||
|
//当前选中的目录
|
||||||
|
typeDialog.dismiss();
|
||||||
|
typeDialog.hideSoftKeyBoardDialog(mActivity);
|
||||||
|
doEditType(name, order, remark, bean);
|
||||||
|
});
|
||||||
|
typeDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
private void doEditType(String name, String order, String remark, DocumentTypeList bean) {
|
||||||
|
ProgressDialog dialog = UIUtil.initDialog(mActivity, "保存中...");
|
||||||
|
dialog.show();
|
||||||
|
RequestBody body = buildTypeEditParams(name, order, remark, bean);
|
||||||
|
RetrofitManager.getInstance()
|
||||||
|
.create(OAApi.class)
|
||||||
|
.doEditDocumentType(bean.getFileCatalogueId(), body)
|
||||||
|
.compose(RxTransformer.getTransformer())
|
||||||
|
.subscribe(new Observer<BaseSuccessBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseSuccessBean baseSuccessBean) {
|
||||||
|
dialog.dismiss();
|
||||||
|
ToastUtils.show("修改成功");
|
||||||
|
getCataLogList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
dialog.dismiss();
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param bean
|
||||||
|
*/
|
||||||
|
private void doDelType(DocumentTypeList bean) {
|
||||||
|
ProgressDialog dialog = UIUtil.initDialog(mActivity, "删除中...");
|
||||||
|
dialog.show();
|
||||||
|
RetrofitManager.getInstance()
|
||||||
|
.create(OAApi.class)
|
||||||
|
.doDelDocumentType(bean.getFileCatalogueId())
|
||||||
|
.compose(RxTransformer.getTransformer())
|
||||||
|
.subscribe(new Observer<BaseSuccessBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseSuccessBean baseSuccessBean) {
|
||||||
|
dialog.dismiss();
|
||||||
|
ToastUtils.show("删除成功");
|
||||||
|
getCataLogList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
dialog.dismiss();
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示目录添加
|
||||||
|
*/
|
||||||
|
private void showAddTypeDialog() {
|
||||||
|
CenterDocTypeView typeDialog = new CenterDocTypeView.DialogBuilder(mActivity)
|
||||||
|
.build();
|
||||||
|
typeDialog.addOnChoseListener((name, order, remark) -> {
|
||||||
|
//当前选中的目录
|
||||||
|
typeDialog.dismiss();
|
||||||
|
typeDialog.hideSoftKeyBoardDialog(mActivity);
|
||||||
|
doSaveType(name, order, remark);
|
||||||
|
});
|
||||||
|
typeDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存目录
|
||||||
|
*/
|
||||||
|
private void doSaveType(String name, String order, String remark) {
|
||||||
|
ProgressDialog dialog = UIUtil.initDialog(mActivity, "保存中...");
|
||||||
|
dialog.show();
|
||||||
|
RequestBody body = buildTypeParams(name, order, remark);
|
||||||
|
RetrofitManager.getInstance()
|
||||||
|
.create(OAApi.class)
|
||||||
|
.doSaveDocumentType(body)
|
||||||
|
.compose(RxTransformer.getTransformer())
|
||||||
|
.subscribe(new Observer<BaseSuccessBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseSuccessBean baseSuccessBean) {
|
||||||
|
dialog.dismiss();
|
||||||
|
ToastUtils.show("保存成功");
|
||||||
|
//刷新
|
||||||
|
getCataLogList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
dialog.dismiss();
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestBody buildTypeParams(String name, String order, String remark) {
|
||||||
|
SaveDocumentTypeBean bean = new SaveDocumentTypeBean();
|
||||||
|
bean.setName(name);
|
||||||
|
bean.setSortNum(Integer.parseInt(order));
|
||||||
|
bean.setRemake(remark);
|
||||||
|
bean.setType("0");
|
||||||
|
bean.setViewRange("0");
|
||||||
|
Object o = mSelCatalog.get(mSelCatalog.size() - 1);
|
||||||
|
DocumentTypeList b = (DocumentTypeList) o;
|
||||||
|
bean.setParentId(b.getFileCatalogueId());
|
||||||
|
return RequestBody.create(new Gson().toJson(bean), MediaType.parse("application/json; charset=utf-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestBody buildTypeEditParams(String name, String order, String remark, DocumentTypeList b) {
|
||||||
|
SaveDocumentTypeBean bean = new SaveDocumentTypeBean();
|
||||||
|
bean.setName(name);
|
||||||
|
bean.setSortNum(Integer.parseInt(order));
|
||||||
|
bean.setRemake(remark);
|
||||||
|
bean.setType("0");
|
||||||
|
bean.setViewRange("0");
|
||||||
|
bean.setParentId(b.getParentId());
|
||||||
|
return RequestBody.create(new Gson().toJson(bean), MediaType.parse("application/json; charset=utf-8"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -213,50 +432,51 @@ public class ChooseDocTypeActivity extends BaseActivity {
|
|||||||
* 获取目录列表
|
* 获取目录列表
|
||||||
*/
|
*/
|
||||||
private void getCataLogList() {
|
private void getCataLogList() {
|
||||||
|
mCsvState.setState(CustomStateView.STATE_LOAD);
|
||||||
mDatas.clear();
|
mDatas.clear();
|
||||||
mAdapter.setData(mDatas);
|
mAdapter.setData(mDatas);
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(OAApi.class)
|
.create(OAApi.class)
|
||||||
.getDocumentTypeListByPid(mSelCatalogId, "0")
|
.getDocumentTypeListByPid(mSelCatalogId, "0")
|
||||||
.compose(RxTransformer.getTransformer())
|
.compose(RxTransformer.getTransformer())
|
||||||
.subscribe(new Observer<List<DocumentTypeList>>() {
|
.subscribe(new Observer<List<DocumentTypeList>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull List<DocumentTypeList> documentTypeLists) {
|
public void onNext(@NonNull List<DocumentTypeList> documentTypeLists) {
|
||||||
if (documentTypeLists.size() > 0) {
|
if (documentTypeLists.size() > 0) {
|
||||||
mCsvState.setState(CustomStateView.STATE_SUCCESS);
|
mCsvState.setState(CustomStateView.STATE_SUCCESS);
|
||||||
mDatas.addAll(documentTypeLists);
|
mDatas.addAll(documentTypeLists);
|
||||||
for (int i = 0; i < mSelectedCatalog.size(); i++) {
|
for (int i = 0; i < mSelectedCatalog.size(); i++) {
|
||||||
DocumentTypeList selBean = mSelectedCatalog.get(i);
|
DocumentTypeList selBean = mSelectedCatalog.get(i);
|
||||||
for (int j = 0; j < mDatas.size(); j++) {
|
for (int j = 0; j < mDatas.size(); j++) {
|
||||||
DocumentTypeList bean = mDatas.get(j);
|
DocumentTypeList bean = mDatas.get(j);
|
||||||
if (selBean.getFileCatalogueId().equals(bean.getFileCatalogueId())) {
|
if (selBean.getFileCatalogueId().equals(bean.getFileCatalogueId())) {
|
||||||
bean.setChecked(true);
|
bean.setChecked(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mCsvState.setState(CustomStateView.STATE_EMPTY);
|
||||||
}
|
}
|
||||||
} else {
|
mAdapter.setData(mDatas);
|
||||||
mCsvState.setState(CustomStateView.STATE_EMPTY);
|
|
||||||
}
|
}
|
||||||
mAdapter.setData(mDatas);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
ExceptionHandler.handleException(e);
|
ExceptionHandler.handleException(e);
|
||||||
mAdapter.setData(mDatas);
|
mAdapter.setData(mDatas);
|
||||||
mCsvState.setState(CustomStateView.STATE_ERROR);
|
mCsvState.setState(CustomStateView.STATE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,9 +22,11 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class ChooseDocTypeAdapter extends BaseRecyclerAdapter<DocumentTypeList, ChooseDocTypeHolder> {
|
public class ChooseDocTypeAdapter extends BaseRecyclerAdapter<DocumentTypeList, ChooseDocTypeHolder> {
|
||||||
public List<DeptBean> mSelBeans = new ArrayList<>();
|
public List<DeptBean> mSelBeans = new ArrayList<>();
|
||||||
|
public int mType = 1;
|
||||||
|
|
||||||
public ChooseDocTypeAdapter(Context ctx, List<DocumentTypeList> list) {
|
public ChooseDocTypeAdapter(Context ctx, List<DocumentTypeList> list, int type) {
|
||||||
super(ctx, list);
|
super(ctx, list);
|
||||||
|
this.mType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -33,6 +35,15 @@ public class ChooseDocTypeAdapter extends BaseRecyclerAdapter<DocumentTypeList,
|
|||||||
return new ChooseDocTypeHolder(itemView);
|
return new ChooseDocTypeHolder(itemView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.mType = type;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindHolder(ChooseDocTypeHolder holder, int i) {
|
public void bindHolder(ChooseDocTypeHolder holder, int i) {
|
||||||
DocumentTypeList bean = mData.get(i);
|
DocumentTypeList bean = mData.get(i);
|
||||||
@ -41,6 +52,19 @@ public class ChooseDocTypeAdapter extends BaseRecyclerAdapter<DocumentTypeList,
|
|||||||
holder.mCbCheck.setChecked(bean.isChecked());
|
holder.mCbCheck.setChecked(bean.isChecked());
|
||||||
holder.mCbCheck.setOnCheckedChangeListener((buttonView, isChecked) -> mLis.onItemCheckChange(bean, isChecked, i));
|
holder.mCbCheck.setOnCheckedChangeListener((buttonView, isChecked) -> mLis.onItemCheckChange(bean, isChecked, i));
|
||||||
holder.mTvName.setOnClickListener(v -> mLis.onLowerDept(bean, i));
|
holder.mTvName.setOnClickListener(v -> mLis.onLowerDept(bean, i));
|
||||||
|
if (mType == 1) {
|
||||||
|
//默认选择
|
||||||
|
holder.mLlBtns.setVisibility(View.GONE);
|
||||||
|
holder.mIvArrow.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
//编辑
|
||||||
|
holder.mLlBtns.setVisibility(View.VISIBLE);
|
||||||
|
holder.mIvArrow.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (mControlListener != null) {
|
||||||
|
holder.mBtnDel.setOnClickListener(v -> mControlListener.doDel(bean, i));
|
||||||
|
holder.mBtnEdit.setOnClickListener(v -> mControlListener.doEdit(bean, i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private OnItemCheckChange mLis;
|
private OnItemCheckChange mLis;
|
||||||
@ -54,4 +78,18 @@ public class ChooseDocTypeAdapter extends BaseRecyclerAdapter<DocumentTypeList,
|
|||||||
|
|
||||||
void onLowerDept(DocumentTypeList bean, int pos);
|
void onLowerDept(DocumentTypeList bean, int pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private OnControlListener mControlListener;
|
||||||
|
|
||||||
|
public void addOnControlListener(OnControlListener listener) {
|
||||||
|
this.mControlListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnControlListener {
|
||||||
|
void doEdit(DocumentTypeList bean, int pos);
|
||||||
|
|
||||||
|
void doDel(DocumentTypeList bean, int pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,11 @@ import android.widget.RadioGroup;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
||||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||||
@ -49,10 +54,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import androidx.activity.result.ActivityResultLauncher;
|
|
||||||
import androidx.activity.result.contract.ActivityResultContracts;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.Unbinder;
|
import butterknife.Unbinder;
|
||||||
@ -151,14 +152,17 @@ public class DocFragment extends BaseFragment {
|
|||||||
mSelCatalog.add(mRootPersonBean);
|
mSelCatalog.add(mRootPersonBean);
|
||||||
mSelCatalogId = "0";
|
mSelCatalogId = "0";
|
||||||
mRlvSel.setVisibility(View.VISIBLE);
|
mRlvSel.setVisibility(View.VISIBLE);
|
||||||
|
mIvAdd.setVisibility(View.VISIBLE);
|
||||||
} else if (checkedId == R.id.rb_share) {
|
} else if (checkedId == R.id.rb_share) {
|
||||||
mType = "共享文档";//共享
|
mType = "共享文档";//共享
|
||||||
mRlvSel.setVisibility(View.GONE);
|
mRlvSel.setVisibility(View.GONE);
|
||||||
|
mIvAdd.setVisibility(View.GONE);
|
||||||
} else if (checkedId == R.id.rb_pub) {
|
} else if (checkedId == R.id.rb_pub) {
|
||||||
mType = "公共文档";//公共
|
mType = "公共文档";//公共
|
||||||
mSelCatalog.add(mRootPublicbean);
|
mSelCatalog.add(mRootPublicbean);
|
||||||
mSelCatalogId = "0";
|
mSelCatalogId = "0";
|
||||||
mRlvSel.setVisibility(View.VISIBLE);
|
mRlvSel.setVisibility(View.VISIBLE);
|
||||||
|
mIvAdd.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
mSelCatalogAdapter.setData(mSelCatalog);
|
mSelCatalogAdapter.setData(mSelCatalog);
|
||||||
doRefresh();
|
doRefresh();
|
||||||
@ -280,11 +284,11 @@ public class DocFragment extends BaseFragment {
|
|||||||
mTvTitleType.setText(mSelType == null ? "文档类型" : mSelType.getTypeName());
|
mTvTitleType.setText(mSelType == null ? "文档类型" : mSelType.getTypeName());
|
||||||
doRefresh();
|
doRefresh();
|
||||||
})
|
})
|
||||||
.setTitleText("请选择")
|
.setTitleText("请选择")
|
||||||
.setCancelColor(Color.parseColor("#1189FF"))
|
.setCancelColor(Color.parseColor("#1189FF"))
|
||||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||||
.setTitleColor(Color.parseColor("#1189FF"))
|
.setTitleColor(Color.parseColor("#1189FF"))
|
||||||
.build();
|
.build();
|
||||||
mDataSourcePicker.setPicker(mDocTypes);
|
mDataSourcePicker.setPicker(mDocTypes);
|
||||||
}
|
}
|
||||||
mDataSourcePicker.show();
|
mDataSourcePicker.show();
|
||||||
@ -300,40 +304,40 @@ public class DocFragment extends BaseFragment {
|
|||||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "加载中...");
|
ProgressDialog dialog = UIUtil.initDialog(mActivity, "加载中...");
|
||||||
dialog.show();
|
dialog.show();
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(OAApi.class)
|
.create(OAApi.class)
|
||||||
.getDocTypes()
|
.getDocTypes()
|
||||||
.compose(RxTransformer.getTransformer())
|
.compose(RxTransformer.getTransformer())
|
||||||
.subscribe(new Observer<List<DocTypeBean>>() {
|
.subscribe(new Observer<List<DocTypeBean>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(@NonNull List<DocTypeBean> docTypeBeans) {
|
|
||||||
dialog.dismiss();
|
|
||||||
if (docTypeBeans.size() > 0) {
|
|
||||||
mDocTypes = docTypeBeans;
|
|
||||||
DocTypeBean allBean = new DocTypeBean();
|
|
||||||
allBean.setTypeName("全部");
|
|
||||||
mDocTypes.add(0, allBean);
|
|
||||||
onShowDocType();
|
|
||||||
} else {
|
|
||||||
ToastUtils.show("暂无数据");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onNext(@NonNull List<DocTypeBean> docTypeBeans) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
ExceptionHandler.handleException(e);
|
if (docTypeBeans.size() > 0) {
|
||||||
}
|
mDocTypes = docTypeBeans;
|
||||||
|
DocTypeBean allBean = new DocTypeBean();
|
||||||
|
allBean.setTypeName("全部");
|
||||||
|
mDocTypes.add(0, allBean);
|
||||||
|
onShowDocType();
|
||||||
|
} else {
|
||||||
|
ToastUtils.show("暂无数据");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onError(@NonNull Throwable e) {
|
||||||
|
dialog.dismiss();
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
});
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -363,64 +367,64 @@ public class DocFragment extends BaseFragment {
|
|||||||
private void getDocumentList(int currentPage) {
|
private void getDocumentList(int currentPage) {
|
||||||
mCurrentPage = currentPage;
|
mCurrentPage = currentPage;
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(OAApi.class)
|
.create(OAApi.class)
|
||||||
.getDocumentList(mKeywords, mType, mSelCatalogId, mCurrentPage + "")
|
.getDocumentList(mKeywords, mType, mSelCatalogId, mCurrentPage + "")
|
||||||
.compose(RxTransformer.getTransformer())
|
.compose(RxTransformer.getTransformer())
|
||||||
.subscribe(new Observer<DocumentListBean>() {
|
.subscribe(new Observer<DocumentListBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull DocumentListBean listBean) {
|
public void onNext(@NonNull DocumentListBean listBean) {
|
||||||
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
||||||
++mCurrentPage;
|
++mCurrentPage;
|
||||||
if (currentPage == 1) {
|
if (currentPage == 1) {
|
||||||
mDatas.addAll(listBean.getRows());
|
mDatas.addAll(listBean.getRows());
|
||||||
} else {
|
} else {
|
||||||
mDatas.addAll(listBean.getRows());
|
mDatas.addAll(listBean.getRows());
|
||||||
}
|
}
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
mSrlContent.finishRefresh();
|
mSrlContent.finishRefresh();
|
||||||
if (mDatas.size() >= listBean.getTotal()) {
|
if (mDatas.size() >= listBean.getTotal()) {
|
||||||
mSrlContent.finishLoadMore();
|
mSrlContent.finishLoadMore();
|
||||||
mSrlContent.setNoMoreData(true);
|
mSrlContent.setNoMoreData(true);
|
||||||
|
} else {
|
||||||
|
mSrlContent.finishLoadMore();
|
||||||
|
mSrlContent.setNoMoreData(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mSrlContent.finishLoadMore();
|
mSrlContent.finishLoadMore();
|
||||||
mSrlContent.setNoMoreData(false);
|
mSrlContent.finishRefresh();
|
||||||
}
|
if (currentPage > 1) {
|
||||||
} else {
|
mSrlContent.setNoMoreData(true);
|
||||||
mSrlContent.finishLoadMore();
|
} else {
|
||||||
mSrlContent.finishRefresh();
|
if (!TextUtils.isEmpty(mKeywords)) {
|
||||||
if (currentPage > 1) {
|
ToastUtils.show("未查询到相关内容");
|
||||||
mSrlContent.setNoMoreData(true);
|
}
|
||||||
} else {
|
|
||||||
if (!TextUtils.isEmpty(mKeywords)) {
|
|
||||||
ToastUtils.show("未查询到相关内容");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mDatas.size() > 0) {
|
||||||
|
refreshStateView(LionActions.STATE_SUCCESS);
|
||||||
|
} else {
|
||||||
|
refreshStateView(LionActions.STATE_EMPTY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mDatas.size() > 0) {
|
|
||||||
refreshStateView(LionActions.STATE_SUCCESS);
|
@Override
|
||||||
} else {
|
public void onError(@NonNull Throwable e) {
|
||||||
refreshStateView(LionActions.STATE_EMPTY);
|
mSrlContent.finishLoadMore();
|
||||||
|
mSrlContent.finishRefresh();
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
refreshStateView(LionActions.STATE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onComplete() {
|
||||||
mSrlContent.finishLoadMore();
|
|
||||||
mSrlContent.finishRefresh();
|
|
||||||
ExceptionHandler.handleException(e);
|
|
||||||
refreshStateView(LionActions.STATE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void onComplete() {
|
});
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -430,64 +434,64 @@ public class DocFragment extends BaseFragment {
|
|||||||
private void getShareList(int currentPage) {
|
private void getShareList(int currentPage) {
|
||||||
mCurrentPage = currentPage;
|
mCurrentPage = currentPage;
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(OAApi.class)
|
.create(OAApi.class)
|
||||||
.getShareDocList(mKeywords, mCurrentPage + "")
|
.getShareDocList(mKeywords, mCurrentPage + "")
|
||||||
.compose(RxTransformer.getTransformer())
|
.compose(RxTransformer.getTransformer())
|
||||||
.subscribe(new Observer<DocumentListBean>() {
|
.subscribe(new Observer<DocumentListBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull DocumentListBean listBean) {
|
public void onNext(@NonNull DocumentListBean listBean) {
|
||||||
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
if (listBean.getRows() != null && listBean.getRows().size() > 0) {
|
||||||
++mCurrentPage;
|
++mCurrentPage;
|
||||||
if (currentPage == 1) {
|
if (currentPage == 1) {
|
||||||
mDatas.addAll(listBean.getRows());
|
mDatas.addAll(listBean.getRows());
|
||||||
} else {
|
} else {
|
||||||
mDatas.addAll(listBean.getRows());
|
mDatas.addAll(listBean.getRows());
|
||||||
}
|
}
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
mSrlContent.finishRefresh();
|
mSrlContent.finishRefresh();
|
||||||
if (mDatas.size() >= listBean.getTotal()) {
|
if (mDatas.size() >= listBean.getTotal()) {
|
||||||
mSrlContent.finishLoadMore();
|
mSrlContent.finishLoadMore();
|
||||||
mSrlContent.setNoMoreData(true);
|
mSrlContent.setNoMoreData(true);
|
||||||
|
} else {
|
||||||
|
mSrlContent.finishLoadMore();
|
||||||
|
mSrlContent.setNoMoreData(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mSrlContent.finishLoadMore();
|
mSrlContent.finishLoadMore();
|
||||||
mSrlContent.setNoMoreData(false);
|
mSrlContent.finishRefresh();
|
||||||
}
|
if (currentPage > 1) {
|
||||||
} else {
|
mSrlContent.setNoMoreData(true);
|
||||||
mSrlContent.finishLoadMore();
|
} else {
|
||||||
mSrlContent.finishRefresh();
|
if (!TextUtils.isEmpty(mKeywords)) {
|
||||||
if (currentPage > 1) {
|
ToastUtils.show("未查询到相关内容");
|
||||||
mSrlContent.setNoMoreData(true);
|
}
|
||||||
} else {
|
|
||||||
if (!TextUtils.isEmpty(mKeywords)) {
|
|
||||||
ToastUtils.show("未查询到相关内容");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mDatas.size() > 0) {
|
||||||
|
refreshStateView(LionActions.STATE_SUCCESS);
|
||||||
|
} else {
|
||||||
|
refreshStateView(LionActions.STATE_EMPTY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mDatas.size() > 0) {
|
|
||||||
refreshStateView(LionActions.STATE_SUCCESS);
|
@Override
|
||||||
} else {
|
public void onError(@NonNull Throwable e) {
|
||||||
refreshStateView(LionActions.STATE_EMPTY);
|
mSrlContent.finishLoadMore();
|
||||||
|
mSrlContent.finishRefresh();
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
refreshStateView(LionActions.STATE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onComplete() {
|
||||||
mSrlContent.finishLoadMore();
|
|
||||||
mSrlContent.finishRefresh();
|
|
||||||
ExceptionHandler.handleException(e);
|
|
||||||
refreshStateView(LionActions.STATE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void onComplete() {
|
});
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshStateView(int state) {
|
private void refreshStateView(int state) {
|
||||||
@ -530,38 +534,38 @@ public class DocFragment extends BaseFragment {
|
|||||||
*/
|
*/
|
||||||
private void getPersonCatalog() {
|
private void getPersonCatalog() {
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(OAApi.class)
|
.create(OAApi.class)
|
||||||
.getDocumentTypeListByPid(mSelCatalogId, "0")
|
.getDocumentTypeListByPid(mSelCatalogId, "0")
|
||||||
.compose(RxTransformer.getTransformer())
|
.compose(RxTransformer.getTransformer())
|
||||||
.subscribe(new Observer<List<DocumentTypeList>>() {
|
.subscribe(new Observer<List<DocumentTypeList>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(@NonNull List<DocumentTypeList> documentTypeLists) {
|
|
||||||
mDatas.clear();
|
|
||||||
if (documentTypeLists.size() > 0) {
|
|
||||||
mDatas.addAll(documentTypeLists);
|
|
||||||
}
|
}
|
||||||
mAdapter.setData(mDatas);
|
|
||||||
getDocumentList(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onNext(@NonNull List<DocumentTypeList> documentTypeLists) {
|
||||||
mSrlContent.finishLoadMore();
|
mDatas.clear();
|
||||||
mSrlContent.finishRefresh();
|
if (documentTypeLists.size() > 0) {
|
||||||
refreshStateView(LionActions.STATE_ERROR);
|
mDatas.addAll(documentTypeLists);
|
||||||
ExceptionHandler.handleException(e);
|
}
|
||||||
}
|
mAdapter.setData(mDatas);
|
||||||
|
getDocumentList(1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onError(@NonNull Throwable e) {
|
||||||
|
mSrlContent.finishLoadMore();
|
||||||
|
mSrlContent.finishRefresh();
|
||||||
|
refreshStateView(LionActions.STATE_ERROR);
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
});
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -569,38 +573,38 @@ public class DocFragment extends BaseFragment {
|
|||||||
*/
|
*/
|
||||||
private void getPublicCatalog() {
|
private void getPublicCatalog() {
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.create(OAApi.class)
|
.create(OAApi.class)
|
||||||
.getPublicDocTypeList(mSelCatalogId, "1")
|
.getPublicDocTypeList(mSelCatalogId, "1")
|
||||||
.compose(RxTransformer.getTransformer())
|
.compose(RxTransformer.getTransformer())
|
||||||
.subscribe(new Observer<List<DocTypeTreeListBean>>() {
|
.subscribe(new Observer<List<DocTypeTreeListBean>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(@NonNull List<DocTypeTreeListBean> docTypeTreeListBeans) {
|
|
||||||
mDatas.clear();
|
|
||||||
if (docTypeTreeListBeans.size() > 0) {
|
|
||||||
mDatas.addAll(docTypeTreeListBeans);
|
|
||||||
}
|
}
|
||||||
mAdapter.setData(mDatas);
|
|
||||||
getDocumentList(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onNext(@NonNull List<DocTypeTreeListBean> docTypeTreeListBeans) {
|
||||||
mSrlContent.finishLoadMore();
|
mDatas.clear();
|
||||||
mSrlContent.finishRefresh();
|
if (docTypeTreeListBeans.size() > 0) {
|
||||||
refreshStateView(LionActions.STATE_ERROR);
|
mDatas.addAll(docTypeTreeListBeans);
|
||||||
ExceptionHandler.handleException(e);
|
}
|
||||||
}
|
mAdapter.setData(mDatas);
|
||||||
|
getDocumentList(1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onError(@NonNull Throwable e) {
|
||||||
|
mSrlContent.finishLoadMore();
|
||||||
|
mSrlContent.finishRefresh();
|
||||||
|
refreshStateView(LionActions.STATE_ERROR);
|
||||||
|
ExceptionHandler.handleException(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
});
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
package com.tenlionsoft.oamodule.holder;
|
package com.tenlionsoft.oamodule.holder;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.tenlionsoft.baselib.core.widget.base.BaseViewHolder;
|
import com.tenlionsoft.baselib.core.widget.base.BaseViewHolder;
|
||||||
import com.tenlionsoft.oamodule.R2;
|
import com.tenlionsoft.oamodule.R2;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,6 +25,14 @@ public class ChooseDocTypeHolder extends BaseViewHolder {
|
|||||||
public TextView mTvName;
|
public TextView mTvName;
|
||||||
@BindView(R2.id.cb_check)
|
@BindView(R2.id.cb_check)
|
||||||
public CheckBox mCbCheck;
|
public CheckBox mCbCheck;
|
||||||
|
@BindView(R2.id.iv_arrow)
|
||||||
|
public ImageView mIvArrow;
|
||||||
|
@BindView(R2.id.ll_btns)
|
||||||
|
public LinearLayout mLlBtns;
|
||||||
|
@BindView(R2.id.btn_edit)
|
||||||
|
public Button mBtnEdit;
|
||||||
|
@BindView(R2.id.btn_del)
|
||||||
|
public Button mBtnDel;
|
||||||
|
|
||||||
public ChooseDocTypeHolder(@NonNull View itemView) {
|
public ChooseDocTypeHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
@ -214,7 +214,7 @@ public interface OAApi {
|
|||||||
*/
|
*/
|
||||||
@Headers({"base_url_name:oa", "need_token:true", "Content-Type: application/json", "Accept: application/json"})
|
@Headers({"base_url_name:oa", "need_token:true", "Content-Type: application/json", "Accept: application/json"})
|
||||||
@PUT("app/filecatalogue/updatefilecatalogue/{fileCatalogueId}")
|
@PUT("app/filecatalogue/updatefilecatalogue/{fileCatalogueId}")
|
||||||
Observable<BaseSuccessBean> doEditDocumentType(@Path("fileTypeId") String id, @Body RequestBody body);
|
Observable<BaseSuccessBean> doEditDocumentType(@Path("fileCatalogueId") String id, @Body RequestBody body);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除文档类型
|
* 删除文档类型
|
||||||
|
@ -3,7 +3,6 @@ package com.tenlionsoft.oamodule.widget;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@ -14,13 +13,12 @@ import android.view.View;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
|
||||||
import com.bigkoo.pickerview.view.TimePickerView;
|
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import com.tenlionsoft.baselib.R;
|
import com.tenlionsoft.baselib.R;
|
||||||
|
import com.tenlionsoft.oamodule.beans.DocumentTypeList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,13 +36,15 @@ public class CenterDocTypeView extends Dialog {
|
|||||||
private OnChoseListener mListener;
|
private OnChoseListener mListener;
|
||||||
private boolean mIsShow;
|
private boolean mIsShow;
|
||||||
private boolean mIsShowOther;
|
private boolean mIsShowOther;
|
||||||
private TextView mTvTime;
|
private EditText mEtName;
|
||||||
private TimePickerView mTimePicker;
|
private EditText mEtOrder;
|
||||||
private EditText mEtContent;
|
private EditText mEtRemark;
|
||||||
|
private DocumentTypeList bean;
|
||||||
|
|
||||||
private CenterDocTypeView(Context context) {
|
private CenterDocTypeView(Context context, DocumentTypeList b) {
|
||||||
super(context, R.style.dialog_center_alpha);
|
super(context, R.style.dialog_center_alpha);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
this.bean = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,11 +54,20 @@ public class CenterDocTypeView extends Dialog {
|
|||||||
setContentView(view);
|
setContentView(view);
|
||||||
setCancelable(iscancelable);
|
setCancelable(iscancelable);
|
||||||
setCanceledOnTouchOutside(isBackCancelable);
|
setCanceledOnTouchOutside(isBackCancelable);
|
||||||
mTvTime = view.findViewById(R.id.tv_time);
|
mEtName = view.findViewById(R.id.et_name);
|
||||||
mEtContent = view.findViewById(R.id.et_content);
|
mEtOrder = view.findViewById(R.id.et_order);
|
||||||
mTvTime.setOnClickListener(v -> onShowTimePicker());
|
mEtRemark = view.findViewById(R.id.et_remark);
|
||||||
|
Button btnConfirm = view.findViewById(R.id.btn_confirm);
|
||||||
|
if (bean != null) {
|
||||||
|
mEtName.setText(bean.getName());
|
||||||
|
mEtRemark.setText(bean.getRemake());
|
||||||
|
mEtOrder.setText(bean.getSortNum() + "");
|
||||||
|
btnConfirm.setText("保存");
|
||||||
|
} else {
|
||||||
|
btnConfirm.setText("添加");
|
||||||
|
}
|
||||||
view.findViewById(R.id.btn_cancel).setOnClickListener(v -> this.dismiss());
|
view.findViewById(R.id.btn_cancel).setOnClickListener(v -> this.dismiss());
|
||||||
view.findViewById(R.id.btn_confirm).setOnClickListener(v -> doConfirm());
|
btnConfirm.setOnClickListener(v -> doConfirm());
|
||||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
||||||
Window window = this.getWindow();
|
Window window = this.getWindow();
|
||||||
window.setGravity(Gravity.CENTER);
|
window.setGravity(Gravity.CENTER);
|
||||||
@ -70,37 +79,36 @@ public class CenterDocTypeView extends Dialog {
|
|||||||
window.setBackgroundDrawable(new ColorDrawable());
|
window.setBackgroundDrawable(new ColorDrawable());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onShowTimePicker() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doConfirm() {
|
private void doConfirm() {
|
||||||
if (checkParams()) {
|
if (checkParams()) {
|
||||||
String time = mTvTime.getText().toString().trim();
|
String name = mEtName.getText().toString().trim();
|
||||||
String content = mEtContent.getText().toString().trim();
|
String order = mEtOrder.getText().toString().trim();
|
||||||
mListener.doConfirm(time, content);
|
String remark = mEtRemark.getText().toString().trim();
|
||||||
|
mListener.doConfirm(name, order, remark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideSoftKeyBoardDialog(Activity activity) {
|
public void hideSoftKeyBoardDialog(Activity activity) {
|
||||||
try {
|
try {
|
||||||
InputMethodManager imm = (InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE);
|
||||||
imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0);
|
imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验参数
|
* 校验参数
|
||||||
*/
|
*/
|
||||||
private boolean checkParams() {
|
private boolean checkParams() {
|
||||||
String time = mTvTime.getText().toString().trim();
|
String name = mEtName.getText().toString().trim();
|
||||||
if (TextUtils.isEmpty(time)) {
|
if (TextUtils.isEmpty(name)) {
|
||||||
ToastUtils.show("请选择时间");
|
ToastUtils.show("请输入目录名称");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String content = mEtContent.getText().toString().trim();
|
String order = mEtOrder.getText().toString().trim();
|
||||||
if (TextUtils.isEmpty(content)) {
|
if (TextUtils.isEmpty(order)) {
|
||||||
ToastUtils.show("请输入原由");
|
ToastUtils.show("请输入排序编号");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -121,7 +129,7 @@ public class CenterDocTypeView extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface OnChoseListener {
|
public interface OnChoseListener {
|
||||||
void doConfirm(String list, String ids);
|
void doConfirm(String name, String order, String remark);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DialogBuilder {
|
public static class DialogBuilder {
|
||||||
@ -163,12 +171,16 @@ public class CenterDocTypeView extends Dialog {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DocumentTypeList b;
|
||||||
|
|
||||||
|
public DialogBuilder setBean(DocumentTypeList b) {
|
||||||
|
this.b = b;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public CenterDocTypeView build() {
|
public CenterDocTypeView build() {
|
||||||
return new CenterDocTypeView(this.mContext);
|
return new CenterDocTypeView(this.mContext, this.b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -37,7 +37,10 @@
|
|||||||
android:id="@+id/rlv_content"
|
android:id="@+id/rlv_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginBottom="65dp"
|
||||||
android:background="@color/gray_f8"
|
android:background="@color/gray_f8"
|
||||||
tools:listitem="@layout/item_choose_doc_type" />
|
tools:listitem="@layout/item_choose_doc_type" />
|
||||||
|
|
||||||
@ -46,5 +49,32 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true" />
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_add_type"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/sel_btn_blue_gray_cir"
|
||||||
|
android:text="新增"
|
||||||
|
android:textColor="@color/col_white_gray_press" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_edit_type"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/sel_btn_activity_sign_up"
|
||||||
|
android:text="编辑"
|
||||||
|
android:textColor="@color/col_white_gray_press" />
|
||||||
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -4,6 +4,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
@ -24,11 +25,11 @@
|
|||||||
|
|
||||||
<com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView
|
<com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView
|
||||||
android:id="@+id/tv_name"
|
android:id="@+id/tv_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:drawableLeft="@drawable/ic_folder_icon"
|
android:drawableLeft="@drawable/ic_folder_icon"
|
||||||
android:drawableRight="@drawable/ic_arrow_cir"
|
|
||||||
android:drawablePadding="10dp"
|
android:drawablePadding="10dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@ -37,7 +38,44 @@
|
|||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
tools:text="测试" />
|
tools:text="测试" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_arrow"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_arrow_cir" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_btns"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_del"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/sel_btn_red_gray_re_5"
|
||||||
|
android:minWidth="0dp"
|
||||||
|
android:minHeight="0dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="删除"
|
||||||
|
android:textColor="@color/col_white_gray_press"
|
||||||
|
android:textSize="@dimen/text_12" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_edit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:background="@drawable/sel_btn_blue_gray_re_5"
|
||||||
|
android:minWidth="0dp"
|
||||||
|
android:minHeight="0dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="编辑"
|
||||||
|
android:textColor="@color/col_white_gray_press"
|
||||||
|
android:textSize="@dimen/text_12" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user