|
|
@@ -4,8 +4,9 @@
|
|
|
package com.xzjmyk.pm.activity;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
+import android.app.AlertDialog;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
-import android.net.Uri;
|
|
|
import android.os.Bundle;
|
|
|
import android.util.Log;
|
|
|
import android.view.KeyEvent;
|
|
|
@@ -16,10 +17,12 @@ import android.webkit.WebViewClient;
|
|
|
|
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
|
|
|
+import com.xzjmyk.pm.activity.util.DownloadUtil;
|
|
|
import com.xzjmyk.pm.activity.view.crouton.Crouton;
|
|
|
import com.xzjmyk.pm.activity.view.crouton.LifecycleCallback;
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* @author RaoMeng
|
|
|
*/
|
|
|
@@ -28,7 +31,6 @@ public class CaptureResultActivity extends Activity {
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
-
|
|
|
super.onCreate(savedInstanceState);
|
|
|
setContentView(R.layout.activity_capture_result);
|
|
|
initActivity();
|
|
|
@@ -46,27 +48,38 @@ public class CaptureResultActivity extends Activity {
|
|
|
webSettings.setLoadWithOverviewMode(true);
|
|
|
|
|
|
webSettings.setDomStorageEnabled(true);
|
|
|
- webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
|
|
|
mWebView.setWebViewClient(new WebViewClient() {
|
|
|
@Override
|
|
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
- /*view.loadUrl(url);
|
|
|
- return true;*/
|
|
|
+// view.loadUrl(url);
|
|
|
+// return true;
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
|
|
|
mWebView.setDownloadListener(new DownloadListener() {
|
|
|
@Override
|
|
|
- public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
|
|
- Uri uri = Uri.parse(url);
|
|
|
- Intent intent = new Intent(Intent.ACTION_VIEW,uri);
|
|
|
- startActivity(intent);
|
|
|
-// finish();
|
|
|
+ public void onDownloadStart(final String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
|
|
+// Uri uri = Uri.parse(url);
|
|
|
+// Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
|
|
+// startActivity(intent);
|
|
|
+ Log.d("fileurl", url);
|
|
|
+ String fileName = url.substring(url.lastIndexOf("/") + 1);
|
|
|
+
|
|
|
+ new AlertDialog.Builder(CaptureResultActivity.this).setTitle("提示").setMessage("确定下载文件<"+fileName+">吗?").setNegativeButton(R.string.cancel, null)
|
|
|
+ .setPositiveButton(R.string.sure, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ DownloadUtil.DownloadFile(CaptureResultActivity.this,url,"/sdcard/uu");
|
|
|
+
|
|
|
+ }
|
|
|
+ }).create().show();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void initData() {
|
|
|
|
|
|
Intent intent = getIntent();
|
|
|
@@ -110,4 +123,5 @@ public class CaptureResultActivity extends Activity {
|
|
|
}
|
|
|
return super.onKeyDown(keyCode, event);
|
|
|
}
|
|
|
+
|
|
|
}
|