mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
the plugins were executing on the UI thread. now on background thread. calls to loadUrl are now automatically on the ui thread
This commit is contained in:
parent
0c52ed44a0
commit
8ca1804de9
@ -280,9 +280,13 @@ public class DroidGap extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUrl(String url)
|
||||
public void loadUrl(final String url)
|
||||
{
|
||||
this.appView.loadUrl(url);
|
||||
this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
DroidGap.this.appView.loadUrl(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,12 +65,12 @@ public final class CommandManager {
|
||||
plugin.setView(this.app);
|
||||
|
||||
if (async) {
|
||||
// Run this async on the UI thread so that JavaScript can continue on
|
||||
app.post(new Runnable() {
|
||||
// Run this on a different thread so that this one can return back to JS
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
// Call execute on the plugin so that it can do it's thing
|
||||
CommandResult cr = plugin.execute(action, args);
|
||||
// Check if the
|
||||
// Check the status for 0 (success) or otherwise
|
||||
if (cr.getStatus() == 0) {
|
||||
app.loadUrl(cr.toSuccessCallbackString(callbackId));
|
||||
} else {
|
||||
@ -78,7 +78,7 @@ public final class CommandManager {
|
||||
}
|
||||
}
|
||||
});
|
||||
// Return ""
|
||||
thread.start();
|
||||
return "";
|
||||
} else {
|
||||
// Call execute on the plugin so that it can do it's thing
|
||||
|
Loading…
Reference in New Issue
Block a user