页面调整
This commit is contained in:
parent
c5cfdec4e3
commit
0274bb9e9a
@ -7,8 +7,8 @@ package com.tenlionsoft.baselib.core.retrofit_net;
|
||||
*/
|
||||
public class BaseUrlApi {
|
||||
|
||||
public static final String IP = "http://192.168.0.120:8080/";/* 测试IP */
|
||||
// public static final String IP = "http://121.36.71.250/";/* 测试IP */
|
||||
// public static final String IP = "http://192.168.0.120:8080/";/* 测试IP */
|
||||
public static final String IP = "http://121.36.71.250/";/* 测试IP */
|
||||
// public static final String IP = "http://www.wlcbsyzl.cn/";/* 正式IP */
|
||||
public static final String SYS_USERCENTER = "usercenter/";
|
||||
public static final String SYS_POPULATION = "population/";/*人口系统*/
|
||||
|
@ -9,6 +9,7 @@ import android.app.ActivityManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
@ -41,6 +42,11 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
@ -54,11 +60,6 @@ import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
/**
|
||||
* 作者 : Adam on 2018/10/15.
|
||||
* 邮箱 : itgaojian@163.com
|
||||
@ -116,6 +117,10 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!isPad()) {
|
||||
//手机界面下锁定横竖屏切换
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
// getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
setContentView(R.layout.base_activity);
|
||||
//默认隐藏键盘
|
||||
@ -177,7 +182,8 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
deviceInfo = "navigationbar_is_min";
|
||||
} else if (brand.equalsIgnoreCase("xiaomi") || brand.equalsIgnoreCase("blackshark")) {
|
||||
deviceInfo = "force_fsg_nav_bar";
|
||||
} else if (brand.equalsIgnoreCase("VIVO") || brand.equalsIgnoreCase("OnePlus") || brand.equalsIgnoreCase("OPPO")) {
|
||||
} else if (brand.equalsIgnoreCase("VIVO") || brand.equalsIgnoreCase("OnePlus") || brand.equalsIgnoreCase(
|
||||
"OPPO")) {
|
||||
return !ImmersionBar.isGesture(this);
|
||||
} else {
|
||||
deviceInfo = "noah_navi_mode_value";
|
||||
@ -186,7 +192,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
int navigationBarIsMin = 0;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
navigationBarIsMin = Settings.System.getInt(ctx.getContentResolver(),
|
||||
deviceInfo, 0);
|
||||
deviceInfo, 0);
|
||||
} else {
|
||||
if (Build.BRAND.equalsIgnoreCase("VIVO") || Build.BRAND.equalsIgnoreCase("OPPO")) {
|
||||
navigationBarIsMin = Settings.Secure.getInt(ctx.getContentResolver(), deviceInfo, 0);
|
||||
@ -413,7 +419,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
public void setEditTextInhibitInputSpeChat(EditText editText) {
|
||||
InputFilter inputFilter = new InputFilter() {
|
||||
Pattern emoji = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]",
|
||||
Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);
|
||||
Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);
|
||||
|
||||
@Override
|
||||
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
|
||||
@ -552,8 +558,8 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
private void openActivity(String path) {
|
||||
ARouter.getInstance()
|
||||
.build(path)
|
||||
.navigation();
|
||||
.build(path)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
private String getRunningTopActivity() {
|
||||
@ -626,9 +632,9 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
int[] l = {0, 0};
|
||||
v.getLocationInWindow(l);
|
||||
int left = l[0], top = l[1], bottom = top + v.getHeight(), right = left
|
||||
+ v.getWidth();
|
||||
+ v.getWidth();
|
||||
if (ev.getX() > left && ev.getX() < right && ev.getY() > top
|
||||
&& ev.getY() < bottom) {
|
||||
&& ev.getY() < bottom) {
|
||||
//判断点击处与EditText距离
|
||||
return false;
|
||||
} else {
|
||||
@ -642,7 +648,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
if (token != null) {
|
||||
InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
manager.hideSoftInputFromWindow(token,
|
||||
InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,12 +760,12 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
protected void checkIsLogin(String path) {
|
||||
if (TextUtils.isEmpty(UserLgUtils.getToken())) {
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_MAIN_LOGIN)
|
||||
.navigation(mActivity, 2333);
|
||||
.build(PathConfig.PATH_MODULE_MAIN_LOGIN)
|
||||
.navigation(mActivity, 2333);
|
||||
} else {
|
||||
ARouter.getInstance()
|
||||
.build(path)
|
||||
.navigation();
|
||||
.build(path)
|
||||
.navigation();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.tenlionsoft.oamodule.pad.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@ -23,6 +24,7 @@ import com.tenlionsoft.baselib.core.widget.base.FragmentUtils;
|
||||
import com.tenlionsoft.baselib.core.widget.base.FunctionTitleNumAdapter;
|
||||
import com.tenlionsoft.baselib.core.widget.views.CustomStateView;
|
||||
import com.tenlionsoft.baselib.utils.ExceptionHandler;
|
||||
import com.tenlionsoft.baselib.utils.LogUtils;
|
||||
import com.tenlionsoft.baselib.utils.TimeUtils;
|
||||
import com.tenlionsoft.oamodule.R;
|
||||
import com.tenlionsoft.oamodule.R2;
|
||||
@ -150,14 +152,7 @@ public class PadOaMainFragment extends BaseFragment {
|
||||
scheduleDetailBean.getScheduleId());
|
||||
mPadMainActivity.addFragment(1, fragment);
|
||||
});
|
||||
//常用功能
|
||||
mFuncBeans = new ArrayList<>();
|
||||
FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(mActivity, FlexDirection.ROW,
|
||||
FlexWrap.WRAP);
|
||||
mFunctionAdapter = new FunctionTitleNumAdapter(mActivity, mFuncBeans, 6, 140);
|
||||
mRlvFuncs.setLayoutManager(flexboxLayoutManager);
|
||||
mRlvFuncs.setAdapter(mFunctionAdapter);
|
||||
mFunctionAdapter.addOnItemClickListener(this::choosePage);
|
||||
|
||||
//通知公告
|
||||
mNoticeListBeanRows = new ArrayList<>();
|
||||
mNoticeShowAdapter = new NoticeShowAdapter(mActivity, mNoticeListBeanRows);
|
||||
@ -251,10 +246,44 @@ public class PadOaMainFragment extends BaseFragment {
|
||||
mPadMainActivity = (PadMainActivity) getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(@androidx.annotation.NonNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
//竖屏
|
||||
mFunctionAdapter = new FunctionTitleNumAdapter(mActivity, mFuncBeans, 6, 140);
|
||||
} else {
|
||||
//横屏
|
||||
mFunctionAdapter = new FunctionTitleNumAdapter(mActivity, mFuncBeans, 11, 20);
|
||||
}
|
||||
mFunctionAdapter.setData(mFuncBeans);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新页面
|
||||
*/
|
||||
private void doRefresh() {
|
||||
//常用功能
|
||||
mFuncBeans = new ArrayList<>();
|
||||
FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(mActivity, FlexDirection.ROW,
|
||||
FlexWrap.WRAP);
|
||||
//判断横竖屏
|
||||
Configuration configuration = mActivity.getResources().getConfiguration();
|
||||
int orientation = configuration.orientation;
|
||||
LogUtils.e(orientation);
|
||||
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
//竖屏
|
||||
mFunctionAdapter = new FunctionTitleNumAdapter(mActivity, mFuncBeans, 6, 140);
|
||||
} else {
|
||||
//横屏
|
||||
mFunctionAdapter = new FunctionTitleNumAdapter(mActivity, mFuncBeans, 11, 20);
|
||||
}
|
||||
|
||||
mRlvFuncs.setLayoutManager(flexboxLayoutManager);
|
||||
mRlvFuncs.setAdapter(mFunctionAdapter);
|
||||
mFunctionAdapter.addOnItemClickListener(this::choosePage);
|
||||
|
||||
|
||||
mCsvSchedule.setState(CustomStateView.STATE_LOAD);
|
||||
mCsvFuncs.setState(CustomStateView.STATE_LOAD);
|
||||
mCsvNotice.setState(CustomStateView.STATE_LOAD);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.tenlionsoft.oamodule.pad.fragments.home.oaflow;
|
||||
|
||||
import static com.tenlionsoft.baselib.core.widget.PhotoActivity.TAG_IMGURL;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
@ -26,6 +28,13 @@ import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.google.gson.Gson;
|
||||
@ -86,12 +95,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@ -101,13 +104,11 @@ import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static com.tenlionsoft.baselib.core.widget.PhotoActivity.TAG_IMGURL;
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2022/6/20 - 10:53
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
* 描述: 平板页面发起流程
|
||||
*/
|
||||
@Route(path = PathConfig.PATH_MODULE_OA_FRAGMENT_OA_FLOW_APPLY)
|
||||
public class OaFlowApplyFragment extends BaseFragment {
|
||||
@ -165,24 +166,24 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
private int mCurrentSigned = 0;//当前会签框
|
||||
private List<OperateBean> mControls;
|
||||
private String[] fileFilter = new String[]{
|
||||
".doc",
|
||||
".docx",
|
||||
".xls",
|
||||
".xlsx",
|
||||
".pptx",
|
||||
".ppt",
|
||||
".txt",
|
||||
".pdf",
|
||||
".jpg",
|
||||
".jpeg",
|
||||
".png",
|
||||
".mp4",
|
||||
".avi",
|
||||
".mkv",
|
||||
".flv",
|
||||
".mp3",
|
||||
".wmv",
|
||||
".amr"};
|
||||
".doc",
|
||||
".docx",
|
||||
".xls",
|
||||
".xlsx",
|
||||
".pptx",
|
||||
".ppt",
|
||||
".txt",
|
||||
".pdf",
|
||||
".jpg",
|
||||
".jpeg",
|
||||
".png",
|
||||
".mp4",
|
||||
".avi",
|
||||
".mkv",
|
||||
".flv",
|
||||
".mp3",
|
||||
".wmv",
|
||||
".amr"};
|
||||
private PadMainActivity mMainActivity;
|
||||
private ActivityResultLauncher<Intent> mFileLauncher;
|
||||
private ActivityResultLauncher<Intent> mTrLauncher;
|
||||
@ -244,7 +245,9 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
mIsShowOnlyThree = !mIsShowOnlyThree;
|
||||
mLogAdapter.setShowOnlyThree(mIsShowOnlyThree);
|
||||
//改变箭头方向
|
||||
@SuppressLint("UseCompatLoadingForDrawables") Drawable drawable1 = mActivity.getResources().getDrawable(mIsShowOnlyThree ? R.drawable.ic_close_more_icon : R.drawable.ic_show_more_icon);
|
||||
@SuppressLint("UseCompatLoadingForDrawables") Drawable drawable1 =
|
||||
mActivity.getResources().getDrawable(mIsShowOnlyThree ? R.drawable.ic_close_more_icon :
|
||||
R.drawable.ic_show_more_icon);
|
||||
drawable1.setBounds(0, 0, drawable1.getMinimumWidth(), drawable1.getMinimumHeight());
|
||||
mTvShowMoreLog.setCompoundDrawables(null, null, drawable1, null);
|
||||
mTvShowMoreLog.setText(mIsShowOnlyThree ? "展开" : "收起");
|
||||
@ -271,19 +274,19 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
mTvPre.setEnabled(false);
|
||||
//让输入法
|
||||
mRlContent.getViewTreeObserver()
|
||||
.addOnGlobalLayoutListener(() -> {
|
||||
Rect rect = new Rect();
|
||||
mRlContent.getWindowVisibleDisplayFrame(rect);
|
||||
int screenHeight = mRlContent.getRootView().getHeight();
|
||||
int softHeight = screenHeight - rect.bottom;
|
||||
if (softHeight > 100) {//当输入法高度大于100判定为输入法打开了
|
||||
if (mEtCountersigned.hasFocus()) {
|
||||
mRlContent.scrollTo(0, softHeight + 10);
|
||||
.addOnGlobalLayoutListener(() -> {
|
||||
Rect rect = new Rect();
|
||||
mRlContent.getWindowVisibleDisplayFrame(rect);
|
||||
int screenHeight = mRlContent.getRootView().getHeight();
|
||||
int softHeight = screenHeight - rect.bottom;
|
||||
if (softHeight > 100) {//当输入法高度大于100判定为输入法打开了
|
||||
if (mEtCountersigned.hasFocus()) {
|
||||
mRlContent.scrollTo(0, softHeight + 10);
|
||||
}
|
||||
} else {//否则判断为输入法隐藏了
|
||||
mRlContent.scrollTo(0, 10);
|
||||
}
|
||||
} else {//否则判断为输入法隐藏了
|
||||
mRlContent.scrollTo(0, 10);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
mControls = new ArrayList<>();
|
||||
mBtnConfirm.setOnClickListener(v -> onShowConfirmDialog());
|
||||
@ -295,14 +298,14 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
private void onShowConfirmDialog() {
|
||||
if (mConfirmAssignees != null && mConfirmAssignees.size() > 0) {
|
||||
BOaConfirmCenterDialogView dialog = new BOaConfirmCenterDialogView.DialogBuilder(mActivity)
|
||||
.setBtnBean(mConfirmAssignees)
|
||||
.build();
|
||||
.setBtnBean(mConfirmAssignees)
|
||||
.build();
|
||||
dialog.addOnChoseListener(new BOaConfirmCenterDialogView.OnChoseListener() {
|
||||
@Override
|
||||
public void showSelect(OaFlowFormBean.ConfirmAssigneesBean b, int index) {
|
||||
mNsvScroll.post(() -> mNsvScroll.fullScroll(View.FOCUS_UP));
|
||||
mWebView.getJsAccessEntrace()
|
||||
.quickCallJs("appOaFormUtil.submitFormReport", index + 1 + "");
|
||||
.quickCallJs("appOaFormUtil.submitFormReport", index + 1 + "");
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@ -366,20 +369,20 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
*/
|
||||
private void doDelFile(AddFileBean bean, int i) {
|
||||
new AlertDialog.Builder(mActivity)
|
||||
.setTitle("提示")
|
||||
.setMessage("确定要删除该附件吗?")
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
//通知页面刷新附件
|
||||
dialog.dismiss();
|
||||
mFiles.remove(i);
|
||||
mFileBlueAdapter.setData(mFiles);
|
||||
if (mFiles.size() <= 0) {
|
||||
mCsvFiles.setState(CustomStateView.STATE_EMPTY);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss())
|
||||
.create()
|
||||
.show();
|
||||
.setTitle("提示")
|
||||
.setMessage("确定要删除该附件吗?")
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
//通知页面刷新附件
|
||||
dialog.dismiss();
|
||||
mFiles.remove(i);
|
||||
mFileBlueAdapter.setData(mFiles);
|
||||
if (mFiles.size() <= 0) {
|
||||
mCsvFiles.setState(CustomStateView.STATE_EMPTY);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss())
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -387,43 +390,43 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
*/
|
||||
private void getOaFlowLog() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.getOaFlowLogList(mProcessId)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<List<OaFlowLogBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
.create(OAApi.class)
|
||||
.getOaFlowLogList(mProcessId)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<List<OaFlowLogBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull List<OaFlowLogBean> oaFlowLogBeans) {
|
||||
if (oaFlowLogBeans.size() > 0) {
|
||||
mCsvLog.setState(CustomStateView.STATE_SUCCESS);
|
||||
mLogs = oaFlowLogBeans;
|
||||
mLogAdapter.setData(mLogs);
|
||||
if (mLogs.size() > 2) {
|
||||
mLogAdapter.setShowOnlyCount(true, 2);
|
||||
mLlShowMoreLog.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mLlShowMoreLog.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
mCsvLog.setState(CustomStateView.STATE_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
ExceptionHandler.handleException(e);
|
||||
mCsvLog.setState(CustomStateView.STATE_ERROR);
|
||||
}
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull List<OaFlowLogBean> oaFlowLogBeans) {
|
||||
if (oaFlowLogBeans.size() > 0) {
|
||||
mCsvLog.setState(CustomStateView.STATE_SUCCESS);
|
||||
mLogs = oaFlowLogBeans;
|
||||
mLogAdapter.setData(mLogs);
|
||||
if (mLogs.size() > 2) {
|
||||
mLogAdapter.setShowOnlyCount(true, 2);
|
||||
mLlShowMoreLog.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mLlShowMoreLog.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
mCsvLog.setState(CustomStateView.STATE_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
ExceptionHandler.handleException(e);
|
||||
mCsvLog.setState(CustomStateView.STATE_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -434,7 +437,8 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
mCsvWeb.setState(CustomStateView.STATE_LOAD);
|
||||
mWebChromeClient = new WebChromeClient() {
|
||||
@Override
|
||||
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
|
||||
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
|
||||
FileChooserParams fileChooserParams) {
|
||||
LogUtils.e(filePathCallback);
|
||||
if (mFilePathCallback != null) {
|
||||
mFilePathCallback.onReceiveValue(null);
|
||||
@ -456,57 +460,59 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
}
|
||||
};
|
||||
mWebView = AgentWeb.with(this)
|
||||
.setAgentWebParent(mFlContent, new FrameLayout.LayoutParams(-1, -1))
|
||||
.useDefaultIndicator(R.color.status_bar_blue)
|
||||
.addJavascriptInterface("android", new OnJsInterface())
|
||||
.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
handler.proceed();
|
||||
.setAgentWebParent(mFlContent, new FrameLayout.LayoutParams(-1, -1))
|
||||
.useDefaultIndicator(R.color.status_bar_blue)
|
||||
.addJavascriptInterface("android", new OnJsInterface())
|
||||
.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
handler.proceed();
|
||||
// NestedScrollAgentWebView
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
mCsvWeb.setState(CustomStateView.STATE_SUCCESS);
|
||||
LogUtils.e("加载完成");
|
||||
mActivity.runOnUiThread(() -> {
|
||||
WebView webView = mWebView.getWebCreator().getWebView();
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
webView.setLayoutParams(params);
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
mCsvWeb.setState(CustomStateView.STATE_SUCCESS);
|
||||
LogUtils.e("加载完成");
|
||||
mActivity.runOnUiThread(() -> {
|
||||
WebView webView = mWebView.getWebCreator().getWebView();
|
||||
FrameLayout.LayoutParams params =
|
||||
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
webView.setLayoutParams(params);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||
super.onPageStarted(view, url, favicon);
|
||||
LogUtils.e("加载中");
|
||||
}
|
||||
})
|
||||
.setWebChromeClient(mWebChromeClient)
|
||||
.setAgentWebWebSettings(new AbsAgentWebSettings() {
|
||||
@Override
|
||||
protected void bindAgentWebSupport(AgentWeb agentWeb) {
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||
super.onPageStarted(view, url, favicon);
|
||||
LogUtils.e("加载中");
|
||||
}
|
||||
})
|
||||
.setWebChromeClient(mWebChromeClient)
|
||||
.setAgentWebWebSettings(new AbsAgentWebSettings() {
|
||||
@Override
|
||||
protected void bindAgentWebSupport(AgentWeb agentWeb) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//自定义webview缓存
|
||||
@Override
|
||||
public IAgentWebSettings toSetting(WebView webView) {
|
||||
IAgentWebSettings iAgentWebSettings = super.toSetting(webView);
|
||||
iAgentWebSettings.getWebSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
iAgentWebSettings.getWebSettings().setAllowFileAccess(true);//允许选择文件
|
||||
iAgentWebSettings.getWebSettings().setAllowContentAccess(true);//允许选择文件
|
||||
iAgentWebSettings.getWebSettings().setAllowFileAccessFromFileURLs(true);//允许选择文件
|
||||
iAgentWebSettings.getWebSettings().setAllowUniversalAccessFromFileURLs(true);//允许选择文件
|
||||
iAgentWebSettings.getWebSettings().setSupportMultipleWindows(true);//是否允许多个窗口
|
||||
return iAgentWebSettings;
|
||||
}
|
||||
})
|
||||
.createAgentWeb()
|
||||
.ready()
|
||||
.go(mUrl);
|
||||
//自定义webview缓存
|
||||
@Override
|
||||
public IAgentWebSettings toSetting(WebView webView) {
|
||||
IAgentWebSettings iAgentWebSettings = super.toSetting(webView);
|
||||
iAgentWebSettings.getWebSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
iAgentWebSettings.getWebSettings().setAllowFileAccess(true);//允许选择文件
|
||||
iAgentWebSettings.getWebSettings().setAllowContentAccess(true);//允许选择文件
|
||||
iAgentWebSettings.getWebSettings().setAllowFileAccessFromFileURLs(true);//允许选择文件
|
||||
iAgentWebSettings.getWebSettings().setAllowUniversalAccessFromFileURLs(true);//允许选择文件
|
||||
iAgentWebSettings.getWebSettings().setSupportMultipleWindows(true);//是否允许多个窗口
|
||||
return iAgentWebSettings;
|
||||
}
|
||||
})
|
||||
.createAgentWeb()
|
||||
.ready()
|
||||
.go(mUrl);
|
||||
WebView webView = mWebView.getWebCreator().getWebView();
|
||||
webView.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||
}
|
||||
@ -518,13 +524,13 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
//我的待办
|
||||
MineTodoBean.RowsBean b = (MineTodoBean.RowsBean) mBean;
|
||||
String url = String.format(mActivity.getResources()
|
||||
.getString(R.string.mine_todo),
|
||||
b.getTaskId(),
|
||||
b.getFormCode(),
|
||||
b.getFormVersion() + "",
|
||||
b.getIsNeedClaim() + "",
|
||||
UserLgUtils.getToken(),
|
||||
b.getReportUid());
|
||||
.getString(R.string.mine_todo),
|
||||
b.getTaskId(),
|
||||
b.getFormCode(),
|
||||
b.getFormVersion() + "",
|
||||
b.getIsNeedClaim() + "",
|
||||
UserLgUtils.getToken(),
|
||||
b.getReportUid());
|
||||
String path = BaseUrlApi.BASE_OA + url;
|
||||
params.put("url", path);
|
||||
params.put("type", "edit");
|
||||
@ -534,11 +540,11 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
//发起流程
|
||||
OaFlowApplyBean.RowsBean b = (OaFlowApplyBean.RowsBean) mBean;
|
||||
String url = String.format(mActivity.getResources()
|
||||
.getString(R.string.apply_flow),
|
||||
b.getProcessDefinitionId(),
|
||||
b.getFormCode(),
|
||||
b.getFormVersion() + "",
|
||||
UserLgUtils.getToken());
|
||||
.getString(R.string.apply_flow),
|
||||
b.getProcessDefinitionId(),
|
||||
b.getFormCode(),
|
||||
b.getFormVersion() + "",
|
||||
UserLgUtils.getToken());
|
||||
String path = BaseUrlApi.BASE_OA + url;
|
||||
params.put("url", path);
|
||||
params.put("type", "create");
|
||||
@ -546,12 +552,12 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
//我的已办
|
||||
MineDoneBean.RowsBean b = (MineDoneBean.RowsBean) mBean;
|
||||
String url = String.format(mActivity.getResources()
|
||||
.getString(R.string.mine_todo_detail),
|
||||
b.getFormCode(),
|
||||
b.getFormVersion() + "",
|
||||
UserLgUtils.getToken(),
|
||||
b.getReportUid(),
|
||||
b.getProcessInstanceId());
|
||||
.getString(R.string.mine_todo_detail),
|
||||
b.getFormCode(),
|
||||
b.getFormVersion() + "",
|
||||
UserLgUtils.getToken(),
|
||||
b.getReportUid(),
|
||||
b.getProcessInstanceId());
|
||||
String path = BaseUrlApi.BASE_OA + url;
|
||||
params.put("url", path);
|
||||
params.put("type", "show");
|
||||
@ -560,13 +566,13 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
} else if (mBean instanceof MineReadBean.RowsBean) {
|
||||
MineReadBean.RowsBean b = (MineReadBean.RowsBean) mBean;
|
||||
String url = String.format(mActivity.getResources()
|
||||
.getString(R.string.mine_read),
|
||||
b.getFormCode(),
|
||||
b.getFormVersion() + "",
|
||||
b.getCcId(),
|
||||
UserLgUtils.getToken(),
|
||||
b.getReportUid(),
|
||||
b.getProcessInstanceId());
|
||||
.getString(R.string.mine_read),
|
||||
b.getFormCode(),
|
||||
b.getFormVersion() + "",
|
||||
b.getCcId(),
|
||||
UserLgUtils.getToken(),
|
||||
b.getReportUid(),
|
||||
b.getProcessInstanceId());
|
||||
String path = BaseUrlApi.BASE_OA + url;
|
||||
params.put("url", path);
|
||||
params.put("type", "show");
|
||||
@ -657,7 +663,7 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
*/
|
||||
private void doCopyTo(String ids) {
|
||||
mWebView.getJsAccessEntrace()
|
||||
.quickCallJs("appOaFormUtil.setCcs", ids);
|
||||
.quickCallJs("appOaFormUtil.setCcs", ids);
|
||||
}
|
||||
|
||||
|
||||
@ -685,36 +691,37 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
SaveTransferBean bodyBean = new SaveTransferBean();
|
||||
bodyBean.setAssignee(bean.getUserId());
|
||||
bodyBean.setReason(content);
|
||||
RequestBody body = RequestBody.create(new Gson().toJson(bodyBean), MediaType.parse("application/json; charset=utf-8"));
|
||||
RequestBody body = RequestBody.create(new Gson().toJson(bodyBean), MediaType.parse("application/json; " +
|
||||
"charset=utf-8"));
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.doOaFlowTransfer(mProcessId, mTaskId, body)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
.create(OAApi.class)
|
||||
.doOaFlowTransfer(mProcessId, mTaskId, body)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull BaseSuccessBean bean) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.show("提交成功");
|
||||
mMainActivity.getPreFragment().mIsRefresh = true;
|
||||
mMainActivity.backFragment(1, OaFlowApplyFragment.this);
|
||||
}
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull BaseSuccessBean bean) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.show("提交成功");
|
||||
mMainActivity.getPreFragment().mIsRefresh = true;
|
||||
mMainActivity.backFragment(1, OaFlowApplyFragment.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initControlBtn() {
|
||||
@ -816,13 +823,13 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
protected void hasManageFileManage() {
|
||||
//有权限
|
||||
new LFilePicker()
|
||||
.withFragment(OaFlowApplyFragment.this)
|
||||
.withFragmentLauncher(mFileLauncher)
|
||||
.withRequestCode(LionActions.REQUEST_CODE_AC)
|
||||
.withTitle("文件选择")
|
||||
.withMaxNum(4)
|
||||
.withFileFilter(fileFilter)
|
||||
.start();
|
||||
.withFragment(OaFlowApplyFragment.this)
|
||||
.withFragmentLauncher(mFileLauncher)
|
||||
.withRequestCode(LionActions.REQUEST_CODE_AC)
|
||||
.withTitle("文件选择")
|
||||
.withMaxNum(4)
|
||||
.withFileFilter(fileFilter)
|
||||
.start();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -845,36 +852,37 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
dialog.show();
|
||||
SaveTransferBean bodyBean = new SaveTransferBean();
|
||||
bodyBean.setReason(content);
|
||||
RequestBody body = RequestBody.create(new Gson().toJson(bodyBean), MediaType.parse("application/json; charset=utf-8"));
|
||||
RequestBody body = RequestBody.create(new Gson().toJson(bodyBean), MediaType.parse("application/json; " +
|
||||
"charset=utf-8"));
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.doForcedEnd(mProcessId, mTaskId, body)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
.create(OAApi.class)
|
||||
.doForcedEnd(mProcessId, mTaskId, body)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull BaseSuccessBean bean) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.show("结束成功");
|
||||
mMainActivity.getPreFragment().mIsRefresh = true;
|
||||
mMainActivity.backFragment(1, OaFlowApplyFragment.this);
|
||||
}
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull BaseSuccessBean bean) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.show("结束成功");
|
||||
mMainActivity.getPreFragment().mIsRefresh = true;
|
||||
mMainActivity.backFragment(1, OaFlowApplyFragment.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -891,8 +899,8 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
*/
|
||||
private void onShowBackNode(List<OaFlowFormButton.GoBackUserTasksBean> nodes) {
|
||||
OaBackNodeDialog dialog = new OaBackNodeDialog.Builder(mActivity)
|
||||
.setBean(nodes)
|
||||
.build();
|
||||
.setBean(nodes)
|
||||
.build();
|
||||
dialog.addOnChangeListener(bean -> {
|
||||
dialog.dismiss();
|
||||
doShowBackReason(bean);
|
||||
@ -922,36 +930,37 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
dialog.show();
|
||||
SaveTransferBean bodyBean = new SaveTransferBean();
|
||||
bodyBean.setReason(content);
|
||||
RequestBody body = RequestBody.create(new Gson().toJson(bodyBean), MediaType.parse("application/json; charset=utf-8"));
|
||||
RequestBody body = RequestBody.create(new Gson().toJson(bodyBean), MediaType.parse("application/json; " +
|
||||
"charset=utf-8"));
|
||||
RetrofitManager.getInstance()
|
||||
.create(OAApi.class)
|
||||
.doBackNode(mProcessId, mTaskId, bean.getNodeId(), body)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
.create(OAApi.class)
|
||||
.doBackNode(mProcessId, mTaskId, bean.getNodeId(), body)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull BaseSuccessBean bean) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.show("回退成功");
|
||||
mMainActivity.getPreFragment().mIsRefresh = true;
|
||||
mMainActivity.backFragment(1, OaFlowApplyFragment.this);
|
||||
}
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull BaseSuccessBean bean) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.show("回退成功");
|
||||
mMainActivity.getPreFragment().mIsRefresh = true;
|
||||
mMainActivity.backFragment(1, OaFlowApplyFragment.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -963,9 +972,9 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
for (int i = 0; i < mFiles.size(); i++) {
|
||||
AddFileBean fileBean = mFiles.get(i);
|
||||
sb.append(fileBean.getId())
|
||||
.append(":")
|
||||
.append(fileBean.getFileName())
|
||||
.append(",");
|
||||
.append(":")
|
||||
.append(fileBean.getFileName())
|
||||
.append(",");
|
||||
}
|
||||
if (sb.toString().endsWith(",")) {
|
||||
sb = new StringBuilder(sb.substring(0, sb.length() - 1));
|
||||
@ -983,6 +992,7 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
@JavascriptInterface
|
||||
public void invokeNative(String method, String params) {
|
||||
mActivity.runOnUiThread(() -> {
|
||||
LogUtils.e(method + "===" + params);
|
||||
if ("back".equals(method)) {
|
||||
LogUtils.e("关闭");
|
||||
mMainActivity.getPreFragment().mIsRefresh = true;
|
||||
@ -1057,10 +1067,10 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
if (addFileBean.getFileType() == 1) {
|
||||
//文档
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_BASELIB_ACTIVITY_PREVIEW_FILE)
|
||||
.withString("fileName", addFileBean.getFileName())
|
||||
.withString("fileId", addFileBean.getId())
|
||||
.navigation();
|
||||
.build(PathConfig.PATH_MODULE_BASELIB_ACTIVITY_PREVIEW_FILE)
|
||||
.withString("fileName", addFileBean.getFileName())
|
||||
.withString("fileId", addFileBean.getId())
|
||||
.navigation();
|
||||
} else if (2 == addFileBean.getFileType()) {
|
||||
//图片预览
|
||||
//遍历文件获取所有图片文件
|
||||
@ -1073,16 +1083,17 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_BASELIB_SHOW_IMG)
|
||||
.withStringArrayList(TAG_IMGURL, imgUrls)
|
||||
.navigation();
|
||||
.build(PathConfig.PATH_MODULE_BASELIB_SHOW_IMG)
|
||||
.withStringArrayList(TAG_IMGURL, imgUrls)
|
||||
.navigation();
|
||||
} else if (3 == addFileBean.getFileType() || 4 == addFileBean.getFileType()) {
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_PLAYER_SIMPLE_VIDEO)
|
||||
.withString("title", addFileBean.getFileName().substring(0, addFileBean.getFileName().lastIndexOf(".")))
|
||||
.withString("url", BaseUrlApi.BASE_IMG_URL + addFileBean.getId())
|
||||
.withString("type", addFileBean.getFileType() == 4 ? "audio" : "video")
|
||||
.navigation();
|
||||
.build(PathConfig.PATH_MODULE_PLAYER_SIMPLE_VIDEO)
|
||||
.withString("title", addFileBean.getFileName().substring(0,
|
||||
addFileBean.getFileName().lastIndexOf(".")))
|
||||
.withString("url", BaseUrlApi.BASE_IMG_URL + addFileBean.getId())
|
||||
.withString("type", addFileBean.getFileType() == 4 ? "audio" : "video")
|
||||
.navigation();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1107,53 +1118,53 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
Observable<BaseSuccessBean>[] observables1 = requests.toArray(new Observable[requests.size()]);
|
||||
|
||||
Observable.mergeArrayDelayError(observables1)
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
.compose(RxTransformer.getTransformer())
|
||||
.subscribe(new Observer() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull Object o) {
|
||||
++mUploadCount;
|
||||
if (o instanceof BaseSuccessBean) {
|
||||
//刷新文件
|
||||
BaseSuccessBean bean = (BaseSuccessBean) o;
|
||||
AddFileBean fileBean = new AddFileBean();
|
||||
fileBean.setId(bean.getData());
|
||||
fileBean.setPath(BaseUrlApi.BASE_IMG_URL + bean.getData());
|
||||
fileBean.setFileName(fileNames.get(mUploadCount - 1).replace(",", ""));
|
||||
fileBean.setFileType(FileUtils.getFileType(fileNames.get(mUploadCount - 1)));
|
||||
mFiles.add(0, fileBean);
|
||||
}
|
||||
if (mUploadCount == paths.size()) {
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull Object o) {
|
||||
++mUploadCount;
|
||||
if (o instanceof BaseSuccessBean) {
|
||||
//刷新文件
|
||||
BaseSuccessBean bean = (BaseSuccessBean) o;
|
||||
AddFileBean fileBean = new AddFileBean();
|
||||
fileBean.setId(bean.getData());
|
||||
fileBean.setPath(BaseUrlApi.BASE_IMG_URL + bean.getData());
|
||||
fileBean.setFileName(fileNames.get(mUploadCount - 1).replace(",", ""));
|
||||
fileBean.setFileType(FileUtils.getFileType(fileNames.get(mUploadCount - 1)));
|
||||
mFiles.add(0, fileBean);
|
||||
}
|
||||
if (mUploadCount == paths.size()) {
|
||||
mUploadCount = 0;
|
||||
ToastUtils.show("上传成功");
|
||||
if (progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
//刷新
|
||||
doSetFileToWebView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
e.printStackTrace();
|
||||
mUploadCount = 0;
|
||||
ToastUtils.show("上传成功");
|
||||
if (progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
//刷新
|
||||
ToastUtils.show("上传失败,请稍后重试.");
|
||||
doSetFileToWebView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
e.printStackTrace();
|
||||
mUploadCount = 0;
|
||||
if (progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
ToastUtils.show("上传失败,请稍后重试.");
|
||||
doSetFileToWebView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private Observable createObservable(File file) {
|
||||
@ -1163,28 +1174,28 @@ public class OaFlowApplyFragment extends BaseFragment {
|
||||
if (1 == fileType) {
|
||||
body = MultipartBody.Part.createFormData("file", file.getName(), requestFile);
|
||||
return RetrofitManager.getInstance()
|
||||
.create(BaseApiService.class)
|
||||
.uploadFile(body)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
.create(BaseApiService.class)
|
||||
.uploadFile(body)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
} else if (2 == fileType) {
|
||||
body = MultipartBody.Part.createFormData("image", file.getName(), requestFile);
|
||||
return RetrofitManager.getInstance()
|
||||
.create(BaseApiService.class)
|
||||
.uploadImage(body)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
.create(BaseApiService.class)
|
||||
.uploadImage(body)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
|
||||
} else if (3 == fileType) {
|
||||
body = MultipartBody.Part.createFormData("video", file.getName(), requestFile);
|
||||
return RetrofitManager.getInstance()
|
||||
.create(BaseApiService.class)
|
||||
.uploadVideo(body)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
.create(BaseApiService.class)
|
||||
.uploadVideo(body)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
} else if (4 == fileType) {
|
||||
body = MultipartBody.Part.createFormData("audio", file.getName(), requestFile);
|
||||
return RetrofitManager.getInstance()
|
||||
.create(BaseApiService.class)
|
||||
.uploadAudio(body)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
.create(BaseApiService.class)
|
||||
.uploadAudio(body)
|
||||
.compose(RxTransformer.getTransformer());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -61,6 +61,7 @@
|
||||
android:id="@+id/iv_banner"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="178dp"
|
||||
android:visibility="gone"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_empty_data" />
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user