mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 20:33:07 +08:00
Cleanup formatting.
This commit is contained in:
parent
0b6a39bc6f
commit
e1b3a8cdce
@ -77,9 +77,6 @@ import com.phonegap.api.PluginManager;
|
|||||||
* // Initialize activity
|
* // Initialize activity
|
||||||
* super.init();
|
* super.init();
|
||||||
*
|
*
|
||||||
* // Add your plugins here or in JavaScript
|
|
||||||
* super.addService("MyService", "com.phonegap.examples.MyService");
|
|
||||||
*
|
|
||||||
* // Clear cache if you want
|
* // Clear cache if you want
|
||||||
* super.appView.clearCache(true);
|
* super.appView.clearCache(true);
|
||||||
*
|
*
|
||||||
@ -91,7 +88,7 @@ import com.phonegap.api.PluginManager;
|
|||||||
*
|
*
|
||||||
* Properties: The application can be configured using the following properties:
|
* Properties: The application can be configured using the following properties:
|
||||||
*
|
*
|
||||||
* // Display a native loading dialog. Format for value = "Title,Message".
|
* // Display a native loading dialog when loading app. Format for value = "Title,Message".
|
||||||
* // (String - default=null)
|
* // (String - default=null)
|
||||||
* super.setStringProperty("loadingDialog", "Wait,Loading Demo...");
|
* super.setStringProperty("loadingDialog", "Wait,Loading Demo...");
|
||||||
*
|
*
|
||||||
@ -233,7 +230,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
else {
|
else {
|
||||||
this.appView.setWebChromeClient(new EclairClient(DroidGap.this));
|
this.appView.setWebChromeClient(new EclairClient(DroidGap.this));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setWebViewClient(this.appView, new GapViewClient(this));
|
this.setWebViewClient(this.appView, new GapViewClient(this));
|
||||||
|
|
||||||
this.appView.setInitialScale(100);
|
this.appView.setInitialScale(100);
|
||||||
@ -272,7 +269,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
String url = this.getStringProperty("url", null);
|
String url = this.getStringProperty("url", null);
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
System.out.println("Loading initial URL="+url);
|
System.out.println("Loading initial URL="+url);
|
||||||
this.loadUrl(url);
|
this.loadUrl(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +390,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If timeout, then stop loading and handle error
|
// If timeout, then stop loading and handle error
|
||||||
if (me.loadUrlTimeout == currentLoadUrlTimeout) {
|
if (me.loadUrlTimeout == currentLoadUrlTimeout) {
|
||||||
@ -602,7 +599,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
public void setDoubleProperty(String name, double value) {
|
public void setDoubleProperty(String name, double value) {
|
||||||
this.getIntent().putExtra(name, value);
|
this.getIntent().putExtra(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/**
|
/**
|
||||||
* Called when the system is about to start resuming a previous activity.
|
* Called when the system is about to start resuming a previous activity.
|
||||||
@ -612,7 +609,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
if (this.appView == null) {
|
if (this.appView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send pause event to JavaScript
|
// Send pause event to JavaScript
|
||||||
this.appView.loadUrl("javascript:try{PhoneGap.onPause.fire();}catch(e){};");
|
this.appView.loadUrl("javascript:try{PhoneGap.onPause.fire();}catch(e){};");
|
||||||
|
|
||||||
@ -685,10 +682,9 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
|
|
||||||
// Load blank page so that JavaScript onunload is called
|
// Load blank page so that JavaScript onunload is called
|
||||||
this.appView.loadUrl("about:blank");
|
this.appView.loadUrl("about:blank");
|
||||||
|
|
||||||
// Forward to plugins
|
// Forward to plugins
|
||||||
this.pluginManager.onDestroy();
|
this.pluginManager.onDestroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,8 +707,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
public void sendJavascript(String statement) {
|
public void sendJavascript(String statement) {
|
||||||
this.callbackServer.sendJavascript(statement);
|
this.callbackServer.sendJavascript(statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a new browser with the specified URL.
|
* Display a new browser with the specified URL.
|
||||||
*
|
*
|
||||||
@ -914,13 +909,13 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Polling for JavaScript messages
|
// Polling for JavaScript messages
|
||||||
else if (reqOk && defaultValue != null && defaultValue.equals("gap_poll:")) {
|
else if (reqOk && defaultValue != null && defaultValue.equals("gap_poll:")) {
|
||||||
String r = callbackServer.getJavascript();
|
String r = callbackServer.getJavascript();
|
||||||
result.confirm(r);
|
result.confirm(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calling into CallbackServer
|
// Calling into CallbackServer
|
||||||
else if (reqOk && defaultValue != null && defaultValue.equals("gap_callbackServer:")) {
|
else if (reqOk && defaultValue != null && defaultValue.equals("gap_callbackServer:")) {
|
||||||
String r = "";
|
String r = "";
|
||||||
if (message.equals("usePolling")) {
|
if (message.equals("usePolling")) {
|
||||||
r = ""+callbackServer.usePolling();
|
r = ""+callbackServer.usePolling();
|
||||||
@ -939,7 +934,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
|
|
||||||
// PhoneGap JS has initialized, so show webview
|
// PhoneGap JS has initialized, so show webview
|
||||||
// (This solves white flash seen when rendering HTML)
|
// (This solves white flash seen when rendering HTML)
|
||||||
else if (reqOk && defaultValue != null && defaultValue.equals("gap_init:")) {
|
else if (reqOk && defaultValue != null && defaultValue.equals("gap_init:")) {
|
||||||
appView.setVisibility(View.VISIBLE);
|
appView.setVisibility(View.VISIBLE);
|
||||||
ctx.spinnerStop();
|
ctx.spinnerStop();
|
||||||
result.confirm("OK");
|
result.confirm("OK");
|
||||||
@ -1011,9 +1006,9 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
Log.d(TAG, "event raised onExceededDatabaseQuota estimatedSize: " + Long.toString(estimatedSize) + " currentQuota: " + Long.toString(currentQuota) + " totalUsedQuota: " + Long.toString(totalUsedQuota));
|
Log.d(TAG, "event raised onExceededDatabaseQuota estimatedSize: " + Long.toString(estimatedSize) + " currentQuota: " + Long.toString(currentQuota) + " totalUsedQuota: " + Long.toString(totalUsedQuota));
|
||||||
|
|
||||||
if( estimatedSize < MAX_QUOTA)
|
if( estimatedSize < MAX_QUOTA)
|
||||||
{
|
{
|
||||||
//increase for 1Mb
|
//increase for 1Mb
|
||||||
long newQuota = estimatedSize;
|
long newQuota = estimatedSize;
|
||||||
Log.d(TAG, "calling quotaUpdater.updateQuota newQuota: " + Long.toString(newQuota) );
|
Log.d(TAG, "calling quotaUpdater.updateQuota newQuota: " + Long.toString(newQuota) );
|
||||||
quotaUpdater.updateQuota(newQuota);
|
quotaUpdater.updateQuota(newQuota);
|
||||||
}
|
}
|
||||||
@ -1022,8 +1017,8 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// Set the quota to whatever it is and force an error
|
// Set the quota to whatever it is and force an error
|
||||||
// TODO: get docs on how to handle this properly
|
// TODO: get docs on how to handle this properly
|
||||||
quotaUpdater.updateQuota(currentQuota);
|
quotaUpdater.updateQuota(currentQuota);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log in api level 7: http://developer.android.com/guide/developing/debug-tasks.html
|
// console.log in api level 7: http://developer.android.com/guide/developing/debug-tasks.html
|
||||||
@Override
|
@Override
|
||||||
@ -1041,7 +1036,6 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
|
public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
super.onGeolocationPermissionsShowPrompt(origin, callback);
|
super.onGeolocationPermissionsShowPrompt(origin, callback);
|
||||||
callback.invoke(origin, true, false);
|
callback.invoke(origin, true, false);
|
||||||
}
|
}
|
||||||
@ -1398,7 +1392,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
public void setActivityResultCallback(IPlugin plugin) {
|
public void setActivityResultCallback(IPlugin plugin) {
|
||||||
this.activityResultCallback = plugin;
|
this.activityResultCallback = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
|
* Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
|
||||||
* The errorCode parameter corresponds to one of the ERROR_* constants.
|
* The errorCode parameter corresponds to one of the ERROR_* constants.
|
||||||
|
Loading…
Reference in New Issue
Block a user