mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-16 16:51:02 +08:00
Remove dependency on notification.activityStart/Stop so they can be deprecated to an optional plugin. Also remove hideLoadingDialogOnPage option, since it no longer is relevant.
This commit is contained in:
parent
f19d8f9bba
commit
5de4ae7554
@ -365,10 +365,6 @@ PhoneGap.Channel.join(function() {
|
|||||||
// Fire onDeviceReady event once all constructors have run and PhoneGap info has been
|
// Fire onDeviceReady event once all constructors have run and PhoneGap info has been
|
||||||
// received from native side, and any user defined initialization channels.
|
// received from native side, and any user defined initialization channels.
|
||||||
PhoneGap.Channel.join(function() {
|
PhoneGap.Channel.join(function() {
|
||||||
|
|
||||||
// Turn off app loading dialog
|
|
||||||
navigator.notification.activityStop();
|
|
||||||
|
|
||||||
PhoneGap.onDeviceReady.fire();
|
PhoneGap.onDeviceReady.fire();
|
||||||
|
|
||||||
// Fire the onresume event, since first one happens before JavaScript is loaded
|
// Fire the onresume event, since first one happens before JavaScript is loaded
|
||||||
|
@ -15,6 +15,7 @@ import org.json.JSONException;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -94,10 +95,6 @@ import com.phonegap.api.PluginManager;
|
|||||||
* // (String - default=null)
|
* // (String - default=null)
|
||||||
* super.setStringProperty("loadingDialog", "Wait,Loading Demo...");
|
* super.setStringProperty("loadingDialog", "Wait,Loading Demo...");
|
||||||
*
|
*
|
||||||
* // Hide loadingDialog when page loaded instead of when deviceready event
|
|
||||||
* // occurs. (Boolean - default=false)
|
|
||||||
* super.setBooleanProperty("hideLoadingDialogOnPage", true);
|
|
||||||
*
|
|
||||||
* // Cause all links on web page to be loaded into existing web view,
|
* // Cause all links on web page to be loaded into existing web view,
|
||||||
* // instead of being loaded into new browser. (Boolean - default=false)
|
* // instead of being loaded into new browser. (Boolean - default=false)
|
||||||
* super.setBooleanProperty("loadInWebView", true);
|
* super.setBooleanProperty("loadInWebView", true);
|
||||||
@ -129,6 +126,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
protected PluginManager pluginManager;
|
protected PluginManager pluginManager;
|
||||||
protected boolean cancelLoadUrl = false;
|
protected boolean cancelLoadUrl = false;
|
||||||
protected boolean clearHistory = false;
|
protected boolean clearHistory = false;
|
||||||
|
protected ProgressDialog spinnerDialog = null;
|
||||||
|
|
||||||
// The initial URL for our app
|
// The initial URL for our app
|
||||||
// ie http://server/path/index.html#abc?query
|
// ie http://server/path/index.html#abc?query
|
||||||
@ -150,10 +148,6 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
* The variables below are used to cache some of the activity properties.
|
* The variables below are used to cache some of the activity properties.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Flag indicates that "app loading" dialog should be hidden once page is loaded.
|
|
||||||
// The default is to hide it once PhoneGap JavaScript code has initialized.
|
|
||||||
protected boolean hideLoadingDialogOnPageLoad = false;
|
|
||||||
|
|
||||||
// Flag indicates that a URL navigated to from PhoneGap app should be loaded into same webview
|
// Flag indicates that a URL navigated to from PhoneGap app should be loaded into same webview
|
||||||
// instead of being loaded into the web browser.
|
// instead of being loaded into the web browser.
|
||||||
protected boolean loadInWebView = false;
|
protected boolean loadInWebView = false;
|
||||||
@ -309,9 +303,6 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
root.setBackgroundResource(this.splashscreen);
|
root.setBackgroundResource(this.splashscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If hideLoadingDialogOnPageLoad
|
|
||||||
this.hideLoadingDialogOnPageLoad = this.getBooleanProperty("hideLoadingDialogOnPageLoad", false);
|
|
||||||
|
|
||||||
// If loadInWebView
|
// If loadInWebView
|
||||||
this.loadInWebView = this.getBooleanProperty("loadInWebView", false);
|
this.loadInWebView = this.getBooleanProperty("loadInWebView", false);
|
||||||
|
|
||||||
@ -373,10 +364,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
message = loading;
|
message = loading;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONArray parm = new JSONArray();
|
me.spinnerStart(title, message);
|
||||||
parm.put(title);
|
|
||||||
parm.put(message);
|
|
||||||
me.pluginManager.exec("Notification", "activityStart", null, parm.toString(), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a timeout timer for loadUrl
|
// Create a timeout timer for loadUrl
|
||||||
@ -762,6 +750,36 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the spinner. Must be called from the UI thread.
|
||||||
|
*
|
||||||
|
* @param title Title of the dialog
|
||||||
|
* @param message The message of the dialog
|
||||||
|
*/
|
||||||
|
public void spinnerStart(final String title, final String message) {
|
||||||
|
if (this.spinnerDialog != null) {
|
||||||
|
this.spinnerDialog.dismiss();
|
||||||
|
this.spinnerDialog = null;
|
||||||
|
}
|
||||||
|
final DroidGap me = this;
|
||||||
|
this.spinnerDialog = ProgressDialog.show(DroidGap.this, title , message, true, true,
|
||||||
|
new DialogInterface.OnCancelListener() {
|
||||||
|
public void onCancel(DialogInterface dialog) {
|
||||||
|
me.spinnerDialog = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop spinner.
|
||||||
|
*/
|
||||||
|
public void spinnerStop() {
|
||||||
|
if (this.spinnerDialog != null) {
|
||||||
|
this.spinnerDialog.dismiss();
|
||||||
|
this.spinnerDialog = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a hook for calling "alert" from javascript. Useful for
|
* Provides a hook for calling "alert" from javascript. Useful for
|
||||||
* debugging your javascript.
|
* debugging your javascript.
|
||||||
@ -1102,7 +1120,6 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
try {
|
try {
|
||||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("loadingDialog", "");
|
params.put("loadingDialog", "");
|
||||||
params.put("hideLoadingDialogOnPageLoad", true);
|
|
||||||
this.ctx.showWebPage(url, true, false, params);
|
this.ctx.showWebPage(url, true, false, params);
|
||||||
} catch (android.content.ActivityNotFoundException e) {
|
} catch (android.content.ActivityNotFoundException e) {
|
||||||
System.out.println("Error loading url into DroidGap - "+url+":"+ e.toString());
|
System.out.println("Error loading url into DroidGap - "+url+":"+ e.toString());
|
||||||
@ -1147,10 +1164,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
appView.setVisibility(View.VISIBLE);
|
appView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
// Stop "app loading" spinner if showing
|
// Stop "app loading" spinner if showing
|
||||||
if (this.ctx.hideLoadingDialogOnPageLoad) {
|
this.ctx.spinnerStop();
|
||||||
this.ctx.hideLoadingDialogOnPageLoad = false;
|
|
||||||
this.ctx.pluginManager.exec("Notification", "activityStop", null, "[]", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear history, so that previous screen isn't there when Back button is pressed
|
// Clear history, so that previous screen isn't there when Back button is pressed
|
||||||
if (this.ctx.clearHistory) {
|
if (this.ctx.clearHistory) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user