Skip to content

Commit 7a339ef

Browse files
fix: browser download (Acode-Foundation#1587)
1 parent 4a6135f commit 7a339ef

File tree

1 file changed

+10
-1
lines changed
  • src/plugins/browser/android/com/foxdebug/browser

1 file changed

+10
-1
lines changed

src/plugins/browser/android/com/foxdebug/browser/Browser.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
import android.webkit.URLUtil;
4848
import android.webkit.WebView;
4949
import android.widget.Toast;
50+
import android.os.Handler;
51+
import android.os.Looper;
52+
5053

5154

5255

@@ -164,7 +167,9 @@ public void onDownloadStart(String url, String userAgent,
164167

165168
String fileName = URLUtil.guessFileName(url, contentDisposition, mimeType);
166169

167-
new AlertDialog.Builder(getContext())
170+
new Handler(Looper.getMainLooper()).post(() -> {
171+
172+
new AlertDialog.Builder(getContext())
168173
.setTitle("Download file")
169174
.setMessage("Do you want to download \"" + fileName + "\"?")
170175
.setPositiveButton("Yes", (dialog, which) -> {
@@ -184,6 +189,10 @@ public void onDownloadStart(String url, String userAgent,
184189
})
185190
.setNegativeButton("Cancel", null)
186191
.show();
192+
193+
194+
});
195+
187196
}
188197
});
189198

0 commit comments

Comments
 (0)