文件上传的逻辑
This commit is contained in:
parent
f586a6d0e3
commit
f8adef2a9e
|
|
@ -262,6 +262,7 @@ public class FirstActivity extends BaseActivity {
|
|||
private long currentDownloadId = -1; // 保存当前下载任务ID
|
||||
|
||||
private void downloadFile(String url) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
Toast.makeText(this, "下载地址为空", Toast.LENGTH_SHORT).show();
|
||||
|
|
@ -306,6 +307,7 @@ public class FirstActivity extends BaseActivity {
|
|||
e.printStackTrace();
|
||||
Toast.makeText(this, "下载失败: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -553,15 +555,6 @@ public class FirstActivity extends BaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
// ✅ 供前端调用的文件选择方法
|
||||
@JavascriptInterface
|
||||
public void previewFile(String url) {
|
||||
FirstActivity activity = activityRef.get();
|
||||
if (activity != null && !TextUtils.isEmpty(url)) {
|
||||
activity.runOnUiThread(() -> activity.previewFile(url));
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ 供前端调用的文件选择方法
|
||||
@JavascriptInterface
|
||||
public void setToken(String token) {
|
||||
|
|
@ -570,6 +563,7 @@ public class FirstActivity extends BaseActivity {
|
|||
activity.runOnUiThread(() -> activity.setToken(token));
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void showLog(String message) {
|
||||
FirstActivity activity = activityRef.get();
|
||||
|
|
|
|||
Loading…
Reference in New Issue