文件下载提交
This commit is contained in:
parent
04b4e489e4
commit
4964c7e207
|
|
@ -207,9 +207,7 @@ public class FirstActivity extends BaseActivity {
|
|||
|
||||
private boolean isDownloadUrl(String url) {
|
||||
if (TextUtils.isEmpty(url)) return false;
|
||||
|
||||
return true;
|
||||
|
||||
// return url.endsWith(".pdf")
|
||||
// || url.endsWith(".doc")
|
||||
// || url.endsWith(".docx")
|
||||
|
|
@ -263,6 +261,15 @@ public class FirstActivity extends BaseActivity {
|
|||
// 保持空实现
|
||||
}
|
||||
|
||||
// 新增:供前端H5调用下载
|
||||
@JavascriptInterface
|
||||
public void downloadFile(String url) {
|
||||
FirstActivity activity = activityRef.get();
|
||||
if (activity != null && !TextUtils.isEmpty(url)) {
|
||||
activity.runOnUiThread(() -> activity.downloadFile(url));
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void showLog(String message) {
|
||||
FirstActivity activity = activityRef.get();
|
||||
|
|
|
|||
Loading…
Reference in New Issue