mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Use endActivity() for consistency. Improve error handling.
This commit is contained in:
parent
ea87dfe08a
commit
1f8d6b4866
@ -761,7 +761,7 @@ public class DroidGap extends PhonegapActivity {
|
||||
this.pluginManager.onDestroy();
|
||||
}
|
||||
else {
|
||||
this.finish();
|
||||
this.endActivity();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1248,6 +1248,7 @@ public class DroidGap extends PhonegapActivity {
|
||||
}
|
||||
|
||||
// Make app visible after 2 sec in case there was a JS error and PhoneGap JS never initialized correctly
|
||||
if (appView.getVisibility() == View.INVISIBLE) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
@ -1263,7 +1264,7 @@ public class DroidGap extends PhonegapActivity {
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
|
||||
}
|
||||
|
||||
// Clear history, so that previous screen isn't there when Back button is pressed
|
||||
if (this.ctx.clearHistory) {
|
||||
@ -1276,7 +1277,7 @@ public class DroidGap extends PhonegapActivity {
|
||||
if (this.ctx.callbackServer != null) {
|
||||
this.ctx.callbackServer.destroy();
|
||||
}
|
||||
this.ctx.finish();
|
||||
this.ctx.endActivity();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1469,19 +1470,19 @@ public class DroidGap extends PhonegapActivity {
|
||||
|
||||
// If errorUrl specified, then load it
|
||||
final String errorUrl = me.getStringProperty("errorUrl", null);
|
||||
if ((errorUrl != null) && errorUrl.startsWith("file://") && (!failingUrl.equals(errorUrl))) {
|
||||
if ((errorUrl != null) && (errorUrl.startsWith("file://") || errorUrl.indexOf(me.baseUrl) == 0 || isUrlWhiteListed(errorUrl)) && (!failingUrl.equals(errorUrl))) {
|
||||
|
||||
// Load URL on UI thread
|
||||
me.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
me.appView.loadUrl(errorUrl);
|
||||
me.showWebPage(errorUrl, true, true, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// If not, then display error dialog
|
||||
else {
|
||||
me.appView.loadUrl("about:blank");
|
||||
me.appView.setVisibility(View.GONE);
|
||||
me.displayError("Application Error", description + " ("+failingUrl+")", "OK", true);
|
||||
}
|
||||
}
|
||||
@ -1507,7 +1508,7 @@ public class DroidGap extends PhonegapActivity {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
if (exit) {
|
||||
me.finish();
|
||||
me.endActivity();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user