Browse Source

Merge branch 'feature' of https://gitlab.com/Arisono/SkWeiChat-Baidu into feature_raomeng

raomeng 8 years ago
parent
commit
857ed9bd9c

+ 0 - 128
app_core/common/src/main/java/com/core/net/http/HttpUtil.java

@@ -6,10 +6,7 @@ import android.util.Log;
 import com.common.LogUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ObjectUtils;
-import com.common.data.StringUtil;
 import com.common.hmac.HmacUtils;
-import com.common.thread.ThreadUtil;
-import com.core.utils.OpenFilesUtils;
 
 import org.apache.http.HttpResponse;
 import org.apache.http.NameValuePair;
@@ -296,132 +293,7 @@ public class HttpUtil {
     }
 
 
-    public static void download(final String httpurl, final String path, final String fileName,final OpenFilesUtils.OnFileLoadListener onFileLoadListener) {
-        if (Looper.myLooper() == Looper.getMainLooper()) {
-            ThreadUtil.getInstance().addTask(new Runnable() {
-                @Override
-                public void run() {
-                    onFileLoadResult(downloadAsyn(httpurl, path, fileName, onFileLoadListener), onFileLoadListener);
-                }
-            });
-        } else {
-            onFileLoadResult(downloadAsyn(httpurl, path, fileName, onFileLoadListener), onFileLoadListener);
-        }
-    }
-
-    private static void onFileLoadResult(final String filePath,    final OpenFilesUtils.OnFileLoadListener onFileLoadListener) {
-        boolean ok;
-        LogUtil.i("filePath=" + filePath);
-        if (!StringUtil.isEmpty(filePath) && new File(filePath).exists()) {
-            ok = true;
-        } else {
-            ok = false;
-        }
-        if (Looper.myLooper() == Looper.getMainLooper()) {
-            if (ok) {
-                onFileLoadListener.onSuccess(new File(filePath));
-            } else {
-                onFileLoadListener.onFailure(filePath);
-            }
-        } else {
-            final boolean finalOk = ok;
-//            OAHttpHelper.getInstance().post(new Runnable() {
-//                @Override
-//                public void run() {
-//                    if (finalOk) {
-//                        onFileLoadListener.onSuccess(new File(filePath));
-//                    } else {
-//                        onFileLoadListener.onFailure(filePath);
-//                    }
-//                }
-//            });
-        }
-
-
-    }
-
 
-    private static String downloadAsyn(String httpurl, String path, String fileName, final OpenFilesUtils.OnFileLoadListener onFileLoadListener) {
-        URL url = null;
-        try {
-            url = new URL(httpurl);
-            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-            boolean useHttps = httpurl.startsWith("https");
-            if (useHttps) {
-                SSLContext sscontext = SSLContext.getInstance("SSL");
-                sscontext.init(null, SSLUtil.trustAllCerts, new java.security.SecureRandom());
-                javax.net.ssl.SSLSocketFactory ssf = sscontext.getSocketFactory();
-                HttpsURLConnection https = (HttpsURLConnection) connection;
-                https.setSSLSocketFactory(ssf);
-                https.setHostnameVerifier(SSLUtil.DO_NOT_VERIFY);
-            }
-            connection.setRequestMethod("GET");
-            connection.setRequestProperty("Charset", "UTF-8");
-            connection.setReadTimeout(50 * 1000);
-            connection.setConnectTimeout(50 * 1000);
-            connection.connect();
 
-            final int file_leng = connection.getContentLength();
-            InputStream bin = connection.getInputStream();
-            LogUtil.i("path=" + path);
-            LogUtil.i("fileName=" + fileName);
-            File file = new File(path);
-            if (!file.exists()) {
-                LogUtil.i("!file.exists()");
-                file.mkdirs();
-            }
-            file = new File(path + "/" + fileName);
-            if (!file.exists()) {
-                LogUtil.i("!file.exists()2");
-                file.createNewFile();
-            }
-            OutputStream out = new FileOutputStream(file);
-            int size = 0;
-            int len = 0;
-            byte[] buf = new byte[1024];
-            while ((size = bin.read(buf)) != -1) {
-                len += size;
-                out.write(buf, 0, size);
-                //TODO 下载过程
-                final int finalLen = len;
-//                OAHttpHelper.getInstance().post(new Runnable() {
-//                    @Override
-//                    public void run() {
-//                        onFileLoadListener.onLoadIng(finalLen * 100, file_leng);
-//                    }
-//                });
-                LogUtil.i("下载了=" + len * 100 / file_leng);
-            }
-            bin.close();
-            out.close();
-            return path + "/" + fileName;
-        } catch (MalformedURLException e) {
-            if (e != null) {
-                LogUtil.i("MalformedURLException=" + e.getMessage());
-                return e.getMessage();
-            }
-        } catch (IOException e) {
-            if (e != null) {
-                LogUtil.i("IOException=" + e.getMessage());
-                return e.getMessage();
-            }
-        } catch (NoSuchAlgorithmException e) {
-            if (e != null) {
-                LogUtil.i("NoSuchAlgorithmException=" + e.getMessage());
-                return e.getMessage();
-            }
-        } catch (KeyManagementException e) {
-            if (e != null) {
-                LogUtil.i("KeyManagementException=" + e.getMessage());
-                return e.getMessage();
-            }
-        } catch (Exception e) {
-            if (e != null) {
-                LogUtil.i("Exception=" + e.getMessage());
-                return e.getMessage();
-            }
-        }
-        return "";
-    }
 
 }

+ 51 - 2
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MessageWebActivity.java

@@ -6,6 +6,8 @@ import android.graphics.Bitmap;
 import android.net.http.SslError;
 import android.os.Build;
 import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
@@ -24,10 +26,14 @@ import android.webkit.WebViewClient;
 import android.widget.ProgressBar;
 import android.widget.ZoomButtonsController;
 
+import com.alibaba.fastjson.JSON;
 import com.common.LogUtil;
+import com.common.data.JSONUtil;
+import com.common.preferences.PreferenceUtils;
 import com.common.system.SystemUtil;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
+import com.core.net.http.ViewUtil;
 import com.core.utils.CommonUtil;
 import com.core.utils.IntentUtils;
 import com.core.utils.ToastUtil;
@@ -39,8 +45,12 @@ import com.umeng.socialize.bean.SHARE_MEDIA;
 import com.umeng.socialize.media.UMImage;
 
 import org.apache.http.cookie.Cookie;
+import org.json.JSONException;
+import org.json.JSONObject;
 
 import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
 
 public class MessageWebActivity extends BaseActivity {
 
@@ -177,7 +187,7 @@ public class MessageWebActivity extends BaseActivity {
         };
     }
 
-    protected boolean loadUrlViewClient(WebView view, String url){
+    protected boolean loadUrlViewClient(WebView view, String url) {
         LogUtil.i("shouldOverrideUrlLoading url=" + url);
         if (needCookie) {
             synCookies(ct, url);
@@ -189,7 +199,7 @@ public class MessageWebActivity extends BaseActivity {
     protected WebViewClient getWebViewClient() {
         return new WebViewClient() {
             public boolean shouldOverrideUrlLoading(WebView view, String url) {
-               return loadUrlViewClient(view,url);
+                return loadUrlViewClient(view, url);
             }
 
             @Override
@@ -205,6 +215,9 @@ public class MessageWebActivity extends BaseActivity {
             public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
                 if (needCookie) {
                     ToastUtil.showToast(ct, "Cookie已经过期,请重新登陆");
+                    if (loginHandler == null) {
+                        login();
+                    }
                 }
                 super.onReceivedHttpError(view, request, errorResponse);
             }
@@ -288,6 +301,42 @@ public class MessageWebActivity extends BaseActivity {
             cookieManager.setCookie(url, cookieStr);//cookies是在HttpClient中获得的cookie
             CookieSyncManager.getInstance().sync();
         }
+    }
+
+
+    private Handler loginHandler = null;
+
+    private void login() {
+        if (loginHandler == null) {
+            loginHandler = newLoginHandler();
+        }
+        ViewUtil.ct = MyApplication.getInstance();
+        ViewUtil.LoginERPTask(this, loginHandler, 11);
+    }
+
+
+    private Handler newLoginHandler() {
+        return new Handler() {
+            @Override
+            public void handleMessage(Message msg) {
+                if (msg.what == 11) {
+                    //登录成功
+                    String result = msg.getData().getString("result");
+                    if (JSONUtil.getBoolean(result, "success")) {
+                        doNextLoadURL();
+                    }
+                }
+            }
+        };
+    }
 
+    private void doNextLoadURL() {
+        if (needCookie) {
+            synCookies(this, url);
+        }
+        Map<String, String> headers = new HashMap<>();
+        headers.put("clientType", "uas client");
+        webViewRefresh.loadUrl(url, headers);
     }
+
 }

+ 4 - 3
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MsgThirdWebActivity.java

@@ -9,10 +9,9 @@ import android.webkit.WebChromeClient;
 import android.webkit.WebView;
 
 import com.common.LogUtil;
-import com.core.net.ProgressResponseBody;
 import com.core.utils.CommonUtil;
 import com.core.utils.IntentUtils;
-import com.core.utils.OpenFilesUtils;
+import com.modular.apputils.utils.OpenFilesUtils;
 import com.core.utils.ToastUtil;
 import com.core.widget.CustomProgressDialog;
 import com.modular.appmessages.R;
@@ -20,7 +19,6 @@ import com.modular.apputils.network.FileDownloader;
 import com.uas.appworks.OA.erp.activity.CommonDocDetailsActivity;
 
 import java.io.File;
-import java.io.IOException;
 
 /**
  * Created by Bitlike on 2018/1/16.
@@ -131,6 +129,9 @@ public class MsgThirdWebActivity extends MessageWebActivity {
                 LogUtil.i("onFailure=" + (exception == null ? "" : exception));
                 if (ct != null) {
                     ToastUtil.showToast(ct, exception);
+                    if (progressDialog != null) {
+                        progressDialog.dismiss();
+                    }
                 }
             }
         });

+ 54 - 38
app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/ApprovalAdapter.java

@@ -12,7 +12,6 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.webkit.WebView;
-import android.widget.CompoundButton;
 import android.widget.EditText;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
@@ -27,9 +26,8 @@ import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.core.app.AppConstant;
 import com.core.app.MyApplication;
-import com.core.base.OABaseActivity;
 import com.core.model.Approval;
-import com.core.utils.OpenFilesUtils;
+import com.modular.apputils.utils.OpenFilesUtils;
 import com.core.utils.ToastUtil;
 import com.core.utils.helper.AvatarHelper;
 import com.core.utils.time.wheel.DatePicker;
@@ -37,7 +35,7 @@ import com.core.widget.CustomProgressDialog;
 import com.core.widget.listener.EditChangeListener;
 import com.modular.appmessages.R;
 import com.modular.appmessages.activity.ApprovalActivity;
-import com.modular.apputils.activity.SelectNetAcitivty;
+import com.modular.apputils.network.FileDownloader;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -332,43 +330,61 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
                 intent.putExtra(AppConstant.EXTRA_IMAGE_URI, url);
                 ct.startActivity(intent);
             } else {
-                OpenFilesUtils.downLoadFile(url, approval.getCaption(), new OpenFilesUtils.OnFileLoadListener() {
-                    @Override
-                    public void onLoadIng(int progress, int allProgress) {
-                        if (progressDialog != null)
-                            progressDialog.show();
-                        LogUtil.i("TODO 下载进行中回调");
-                    }
+                downFile(url);
+            }
+        }
+    }
 
-                    @Override
-                    public void onSuccess(final File file) {
-                        if (progressDialog != null)
-                            progressDialog.dismiss();
-                        try {
-                            ct.requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, new Runnable() {
-                                @Override
-                                public void run() {
-                                    OpenFilesUtils.openCommonFils(ct, file);
-                                }
-                            }, new Runnable() {
-                                @Override
-                                public void run() {
-                                    ct.showToast(R.string.not_system_permission);
-                                }
-                            });
-                        } catch (Exception e) {
 
-                        }
+    private void downFile(String downloadUrl) {
+        final CustomProgressDialog progressDialog = CustomProgressDialog.createDialog(ct);
+        progressDialog.setTitile("正在预览");
+        progressDialog.setMessage("正在生成附件预览,请勿关闭程序");
+        if (progressDialog != null && ct != null) {
+            progressDialog.show();
+        }
+        FileDownloader fileDownloader = new FileDownloader(downloadUrl, new FileDownloader.OnDownloaderListener() {
+            @Override
+            public void onProgress(long allProress, long progress) {
+            }
+            @Override
+            public void onSuccess(final File file) {
+                LogUtil.i("onSuccess=" + (file == null ? "" : file.getPath()));
+                if (ct != null) {
+                    if (progressDialog != null) {
+                        progressDialog.dismiss();
                     }
+                    try {
+                        ct.requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, new Runnable() {
+                            @Override
+                            public void run() {
+                                OpenFilesUtils.openCommonFils(ct, file);
+                            }
+                        }, new Runnable() {
+                            @Override
+                            public void run() {
+                                ToastUtil.showToast(ct, R.string.not_system_permission);
+                            }
+                        });
+                    } catch (Exception e) {
 
-                    @Override
-                    public void onFailure(String exception) {
-                        LogUtil.i("exception=" + exception);
-                        ToastUtil.showToast(ct, exception);
                     }
-                });
+                }
+
             }
-        }
+
+            @Override
+            public void onFailure(String exception) {
+                LogUtil.i("onFailure=" + (exception == null ? "" : exception));
+                if (ct != null) {
+                    ToastUtil.showToast(ct, exception);
+                    if (progressDialog != null) {
+                        progressDialog.dismiss();
+                    }
+                }
+            }
+        });
+        fileDownloader.download(0L);
     }
 
     private void bindBaseRVView(final BaseRVViewHodler holder, final int position) {
@@ -472,16 +488,16 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
                 if (ListUtils.getSize(approvals) > position) {
                     Approval approval = approvals.get(position);
                     if (approval.inputType() == 5) {
-                        LogUtil.i("checkedId"+approval.getValues());
+                        LogUtil.i("checkedId" + approval.getValues());
                         if (checkedId == R.id.yesRB) {
-                            if (!"是".equals(approval.getValues())){
+                            if (!"是".equals(approval.getValues())) {
                                 approval.setValues("是");
 //                                notifyItemChanged(position);
                             }
                             LogUtil.i("checkedId == R.id.yesRB ");
                         } else {
                             LogUtil.i("checkedId !!!!!!= R.id.yesRB ");
-                            if (!"否".equals(approval.getValues())){
+                            if (!"否".equals(approval.getValues())) {
                                 approval.setValues("否");
 //                                notifyItemChanged(position);
                             }

+ 2 - 1
app_modular/apputils/src/main/AndroidManifest.xml

@@ -54,7 +54,8 @@
                     android:scheme="app"></data>
             </intent-filter>
         </activity>
-
+    <activity android:name=".activity.PDFViewActivity"
+        android:label="PDF预览"/>
     </application>
 
 </manifest>

+ 81 - 0
app_modular/apputils/src/main/java/com/modular/apputils/activity/PDFViewActivity.java

@@ -0,0 +1,81 @@
+package com.modular.apputils.activity;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.RelativeLayout;
+
+import com.core.base.BaseActivity;
+import com.core.utils.ToastUtil;
+import com.modular.apputils.R;
+import com.modular.apputils.utils.OpenFilesUtils;
+import com.tencent.smtt.sdk.TbsReaderView;
+
+import java.io.File;
+
+/**
+ * Created by Bitlike on 2018/3/15.
+ */
+
+public class PDFViewActivity extends BaseActivity {
+    private TbsReaderView mTbsReaderView;
+    private String filepath = null;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_pdf_view);
+        initView();
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == R.id.openOther) {
+            File file = new File(filepath);
+            if (file != null && file.exists()) {
+                Intent intent = new Intent("android.intent.action.VIEW");
+                intent.addCategory("android.intent.category.DEFAULT");
+                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                Uri uri = Uri.fromFile(file);
+                intent.setDataAndType(uri, "application/pdf");
+                startActivity(intent);
+                finish();
+            } else {
+                ToastUtil.showToast(ct, "文件不存在或是已损坏");
+            }
+
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.menu_other_open, menu);
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    private void initView() {
+        mTbsReaderView = new TbsReaderView(this, new TbsReaderView.ReaderCallback() {
+            @Override
+            public void onCallBackAction(Integer integer, Object o, Object o1) {
+
+            }
+        });
+        RelativeLayout rootRl = findViewById(R.id.rl_root);
+        rootRl.addView(mTbsReaderView, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
+        Intent intent = getIntent();
+        if (intent != null) {
+            filepath = intent.getStringExtra("filepath");
+        }
+        Bundle bundle = new Bundle();
+        bundle.putString("filePath", filepath);
+        bundle.putString("tempPath", Environment.getExternalStorageDirectory().getPath());
+        boolean result = mTbsReaderView.preOpen("pdf", false);
+        if (result) {
+            mTbsReaderView.openFile(bundle);
+        }
+    }
+}

+ 19 - 1
app_modular/apputils/src/main/java/com/modular/apputils/network/FileDownloader.java

@@ -9,6 +9,8 @@ import com.common.LogUtil;
 import com.core.app.MyApplication;
 import com.core.net.ProgressDownloader;
 import com.core.net.ProgressResponseBody;
+import com.me.network.app.http.ssl.TrustAllCerts;
+import com.me.network.app.http.ssl.TrustAllHostnameVerifier;
 
 import java.io.File;
 import java.io.IOException;
@@ -16,6 +18,11 @@ import java.io.InputStream;
 import java.io.RandomAccessFile;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
+import java.security.SecureRandom;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
 
 import okhttp3.Call;
 import okhttp3.Callback;
@@ -88,9 +95,20 @@ public class FileDownloader {
 
         return new OkHttpClient.Builder()
                 .addNetworkInterceptor(interceptor)
+                .sslSocketFactory(createSSLSocketFactory(), new TrustAllCerts())// 信任所有证书
+                .hostnameVerifier(new TrustAllHostnameVerifier())
                 .build();
     }
-
+    public SSLSocketFactory createSSLSocketFactory() {
+        SSLSocketFactory ssfFactory = null;
+        try {
+            SSLContext sc = SSLContext.getInstance("TLS");
+            sc.init(null, new TrustManager[]{new TrustAllCerts()}, new SecureRandom());
+            ssfFactory = sc.getSocketFactory();
+        } catch (Exception e) {
+        }
+        return ssfFactory;
+    }
     // startsPoint指定开始下载的点
     public void download(final long startsPoint) {
         call = newCall(startsPoint);

+ 11 - 112
app_core/common/src/main/java/com/core/utils/OpenFilesUtils.java → app_modular/apputils/src/main/java/com/modular/apputils/utils/OpenFilesUtils.java

@@ -1,4 +1,4 @@
-package com.core.utils;
+package com.modular.apputils.utils;
 
 import android.app.DownloadManager;
 import android.content.BroadcastReceiver;
@@ -6,19 +6,13 @@ import android.content.Context;
 import android.content.Intent;
 import android.database.Cursor;
 import android.net.Uri;
-import android.os.Build;
-import android.os.Environment;
 import android.webkit.MimeTypeMap;
 import android.widget.Toast;
 
 import com.common.LogUtil;
 import com.core.app.R;
 import com.core.app.MyApplication;
-import com.core.net.http.HttpUtil;
-import com.lidroid.xutils.HttpUtils;
-import com.lidroid.xutils.exception.HttpException;
-import com.lidroid.xutils.http.ResponseInfo;
-import com.lidroid.xutils.http.callback.RequestCallBack;
+import com.modular.apputils.activity.PDFViewActivity;
 
 import java.io.File;
 
@@ -72,9 +66,16 @@ public class OpenFilesUtils {
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         Uri uri = Uri.fromFile(file);
         intent.setDataAndType(uri, "application/pdf");
+
+
         return intent;
     }
 
+    private static Intent openFileByTBS(Context context, String filepath) {
+        return new Intent(context, PDFViewActivity.class)
+                .putExtra("filepath", filepath);
+    }
+
     //android获取一个用于打开文本文件的intent
     public static Intent getTextFileIntent(File file) {
         Intent intent = new Intent("android.intent.action.VIEW");
@@ -198,7 +199,7 @@ public class OpenFilesUtils {
                     ct.startActivity(intent);
                 } else if (checkEndsWithInStringArray(fileName, ct.getResources().
                         getStringArray(R.array.fileEndingPdf))) {
-                    intent = getPdfFileIntent(currentPath);
+                    intent = openFileByTBS(ct, currentPath.getPath());
                     ct.startActivity(intent);
                 } else if (checkEndsWithInStringArray(fileName, ct.getResources().
                         getStringArray(R.array.fileEndingWord))) {
@@ -304,111 +305,9 @@ public class OpenFilesUtils {
     }
 
 
-//    public static void downLoadFile(String url, String fileName, RequestCallBack<File> requestCallBack) {
-//        // 判断是否有SD卡
-//        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
-//            HttpUtils utils = new HttpUtils();
-//            String target = Environment.getDataDirectory() + "/uu/download/" + fileName;
-//            utils.download(url, target, requestCallBack);
-//        } else {
-//            Toast.makeText(MyApplication.getInstance(), "请先插入SD卡", Toast.LENGTH_SHORT).show();
-//        }
-//    }
-
-    public static void downLoadFile(final String url, String fileName, final OnFileLoadListener onFileLoadListener) {
-        // 判断是否有SD卡
-        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
-            final String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/uu/download";
-
-            //如果存在文件,不在下载
-            File file = new File(path + "/" + fileName);
-            if (file != null && file.exists()) {
-                if (onFileLoadListener != null) {
-                    onFileLoadListener.onSuccess(file);
-                }
-            } else {
-                if (Build.VERSION.SDK_INT > 19) {
-                    HttpUtil.download(url, path, fileName, onFileLoadListener);
-                } else {
-                    HttpUtils utils = new HttpUtils();
-                    utils.download(url, path + fileName, new RequestCallBack<File>() {
-                        @Override
-                        public void onSuccess(ResponseInfo<File> responseInfo) {
-                            File file = responseInfo.result;
-                            onFileLoadListener.onSuccess(file);
-                            LogUtil.i("file=" + file.getPath());
-                        }
-
-                        @Override
-                        public void onFailure(HttpException e, String s) {
-                            LogUtil.i("e=" + e.getMessage());
-                            LogUtil.i("s=" + s);
-                            onFileLoadListener.onFailure(e.getMessage());
-
-                        }
-                    });
-                }
-            }
-
-        } else {
-            Toast.makeText(MyApplication.getInstance(), "请先插入SD卡", Toast.LENGTH_SHORT).show();
-        }
-    }
-
     public static void showFileToast(String word) {
         Toast.makeText(MyApplication.getInstance(), word, Toast.LENGTH_LONG).show();
     }
 
-    // 生成文件
-//    public File makeFilePath(String filePath, String fileName) {
-//        File file = null;
-//        makeRootDirectory(filePath);
-//        try {
-//            file = new File(filePath + fileName);
-//            if (!file.exists()) {
-//                file.createNewFile();
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//        return file;
-//    }
-
-    // 生成文件夹
-//    public static void makeRootDirectory(String filePath) {
-//        File file = null;
-//        try {
-//            file = new File(filePath);
-//            if (!file.exists()) {
-//                file.mkdir();
-//            }
-//        } catch (Exception e) {
-//        }
-//    }    public static void makeRootDirectory(String filePath) {
-//        File file = null;
-//        try {
-//            file = new File(filePath);
-//            if (!file.exists()) {
-//                file.mkdir();
-//            }
-//        } catch (Exception e) {
-//        }
-//    }    public static void makeRootDirectory(String filePath) {
-//        File file = null;
-//        try {
-//            file = new File(filePath);
-//            if (!file.exists()) {
-//                file.mkdir();
-//            }
-//        } catch (Exception e) {
-//        }
-//    }
-
-    public interface OnFileLoadListener {
-        void onLoadIng(int progress, int allProgress);
-
-        void onSuccess(File file);
-
-        void onFailure(String exception);
-    }
+
 }

+ 9 - 0
app_modular/apputils/src/main/res/layout/activity_pdf_view.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:id="@+id/rl_root"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+
+</RelativeLayout>

+ 8 - 0
app_modular/apputils/src/main/res/menu/menu_other_open.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+    <item
+        android:id="@+id/openOther"
+        app:showAsAction="always"
+        android:title="本地软件打开" />
+</menu>

+ 2 - 2
app_modular/appworks/src/main/java/com/uas/appworks/CRM/erp/activity/DeviceDataFormAddActivity.java

@@ -510,8 +510,8 @@ public class DeviceDataFormAddActivity extends BaseActivity implements View.OnCl
                         va_id = JSONUtil.getInt(object, "dc_id", "db_id");
                         LogUtil.i("va_id=" + va_id);
                         LogUtil.i("result=" + result);
-//                       judgeApprovers(va_id);//TODO 默认先不使用审批流
-                        commitSuccess();
+                       judgeApprovers(va_id);//TODO 默认先不使用审批流
+//                        commitSuccess();
                     } catch (Exception e) {
                         e.printStackTrace();
                         ToastMessage(result);

+ 0 - 49
app_modular/appworks/src/main/java/com/uas/appworks/activity/PublicInquiryDetailActivity.java

@@ -19,7 +19,6 @@ import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.activity.BaseMVPActivity;
 import com.core.utils.CommonUtil;
-import com.core.utils.OpenFilesUtils;
 import com.core.utils.ToastUtil;
 import com.core.widget.CustomProgressDialog;
 import com.me.network.app.base.HttpCallback;
@@ -314,55 +313,7 @@ public class PublicInquiryDetailActivity extends BaseMVPActivity<WorkPlatPresent
         }
     }
 
-    private void gotoReadEnclosure(B2BAttachBean attach) {
-        String url = attach.getPath();
-        final CustomProgressDialog progressDialog = CustomProgressDialog.createDialog(ct);
-        progressDialog.setTitile("正在预览");
-        progressDialog.setMessage("正在生成附件预览,请勿关闭程序");
-        if (!StringUtil.isEmpty(attach.getName())) {
-            if (isImage(attach.getName())) {
-                Intent intent = new Intent("com.modular.tool.SingleImagePreviewActivity");
-                intent.putExtra(AppConstant.EXTRA_IMAGE_URI, url);
-                ct.startActivity(intent);
-            } else {
-                OpenFilesUtils.downLoadFile(url, attach.getName(), new OpenFilesUtils.OnFileLoadListener() {
-                    @Override
-                    public void onLoadIng(int progress, int allProgress) {
-                        if (progressDialog != null) {
-                            progressDialog.show();
-                        }
-                    }
-
-                    @Override
-                    public void onSuccess(final File file) {
-                        if (progressDialog != null)
-                            progressDialog.dismiss();
-                        try {
-                            requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, new Runnable() {
-                                @Override
-                                public void run() {
-                                    OpenFilesUtils.openCommonFils(ct, file);
-                                }
-                            }, new Runnable() {
-                                @Override
-                                public void run() {
-                                    toast(R.string.not_system_permission);
-                                }
-                            });
-                        } catch (Exception e) {
 
-                        }
-                    }
-
-                    @Override
-                    public void onFailure(String exception) {
-                        LogUtil.i("exception=" + exception);
-                        ToastUtil.showToast(ct, exception);
-                    }
-                });
-            }
-        }
-    }
 
     private boolean isImage(String name) {
         return name.toUpperCase().endsWith("jpeg".toUpperCase())