You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2012/06/06 16:46:50 UTC
[6/7] Changing all tabs to spaces
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/DirectoryManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/DirectoryManager.java b/framework/src/org/apache/cordova/DirectoryManager.java
index 7b8e03f..4696d00 100644
--- a/framework/src/org/apache/cordova/DirectoryManager.java
+++ b/framework/src/org/apache/cordova/DirectoryManager.java
@@ -25,127 +25,127 @@ import android.os.Environment;
import android.os.StatFs;
/**
- * This class provides file directory utilities.
+ * This class provides file directory utilities.
* All file operations are performed on the SD card.
- *
+ *
* It is used by the FileUtils class.
*/
public class DirectoryManager {
-
- private static final String LOG_TAG = "DirectoryManager";
-
- /**
- * Determine if a file or directory exists.
- *
- * @param name The name of the file to check.
- * @return T=exists, F=not found
- */
- protected static boolean testFileExists(String name) {
- boolean status;
-
- // If SD card exists
- if ((testSaveLocationExists()) && (!name.equals(""))) {
- File path = Environment.getExternalStorageDirectory();
+
+ private static final String LOG_TAG = "DirectoryManager";
+
+ /**
+ * Determine if a file or directory exists.
+ *
+ * @param name The name of the file to check.
+ * @return T=exists, F=not found
+ */
+ protected static boolean testFileExists(String name) {
+ boolean status;
+
+ // If SD card exists
+ if ((testSaveLocationExists()) && (!name.equals(""))) {
+ File path = Environment.getExternalStorageDirectory();
File newPath = constructFilePaths(path.toString(), name);
status = newPath.exists();
- }
- // If no SD card
- else{
- status = false;
- }
- return status;
- }
-
- /**
- * Get the free disk space
- *
- * @return Size in KB or -1 if not available
- */
- protected static long getFreeDiskSpace(boolean checkInternal) {
- String status = Environment.getExternalStorageState();
- long freeSpace = 0;
-
- // If SD card exists
- if (status.equals(Environment.MEDIA_MOUNTED)) {
- freeSpace = freeSpaceCalculation(Environment.getExternalStorageDirectory().getPath());
- }
- else if (checkInternal) {
- freeSpace = freeSpaceCalculation("/");
- }
- // If no SD card and we haven't been asked to check the internal directory then return -1
- else {
- return -1;
- }
-
- return freeSpace;
- }
-
- /**
- * Given a path return the number of free KB
- *
- * @param path to the file system
- * @return free space in KB
- */
- private static long freeSpaceCalculation(String path) {
+ }
+ // If no SD card
+ else{
+ status = false;
+ }
+ return status;
+ }
+
+ /**
+ * Get the free disk space
+ *
+ * @return Size in KB or -1 if not available
+ */
+ protected static long getFreeDiskSpace(boolean checkInternal) {
+ String status = Environment.getExternalStorageState();
+ long freeSpace = 0;
+
+ // If SD card exists
+ if (status.equals(Environment.MEDIA_MOUNTED)) {
+ freeSpace = freeSpaceCalculation(Environment.getExternalStorageDirectory().getPath());
+ }
+ else if (checkInternal) {
+ freeSpace = freeSpaceCalculation("/");
+ }
+ // If no SD card and we haven't been asked to check the internal directory then return -1
+ else {
+ return -1;
+ }
+
+ return freeSpace;
+ }
+
+ /**
+ * Given a path return the number of free KB
+ *
+ * @param path to the file system
+ * @return free space in KB
+ */
+ private static long freeSpaceCalculation(String path) {
StatFs stat = new StatFs(path);
long blockSize = stat.getBlockSize();
long availableBlocks = stat.getAvailableBlocks();
return availableBlocks*blockSize/1024;
- }
-
- /**
- * Determine if SD card exists.
- *
- * @return T=exists, F=not found
- */
- protected static boolean testSaveLocationExists() {
- String sDCardStatus = Environment.getExternalStorageState();
- boolean status;
-
- // If SD card is mounted
- if (sDCardStatus.equals(Environment.MEDIA_MOUNTED)) {
- status = true;
- }
-
- // If no SD card
- else {
- status = false;
- }
- return status;
- }
-
- /**
- * Create a new file object from two file paths.
- *
- * @param file1 Base file path
- * @param file2 Remaining file path
- * @return File object
- */
- private static File constructFilePaths (String file1, String file2) {
- File newPath;
- if (file2.startsWith(file1)) {
- newPath = new File(file2);
- }
- else {
- newPath = new File(file1+"/"+file2);
- }
- return newPath;
- }
-
+ }
+
+ /**
+ * Determine if SD card exists.
+ *
+ * @return T=exists, F=not found
+ */
+ protected static boolean testSaveLocationExists() {
+ String sDCardStatus = Environment.getExternalStorageState();
+ boolean status;
+
+ // If SD card is mounted
+ if (sDCardStatus.equals(Environment.MEDIA_MOUNTED)) {
+ status = true;
+ }
+
+ // If no SD card
+ else {
+ status = false;
+ }
+ return status;
+ }
+
+ /**
+ * Create a new file object from two file paths.
+ *
+ * @param file1 Base file path
+ * @param file2 Remaining file path
+ * @return File object
+ */
+ private static File constructFilePaths (String file1, String file2) {
+ File newPath;
+ if (file2.startsWith(file1)) {
+ newPath = new File(file2);
+ }
+ else {
+ newPath = new File(file1+"/"+file2);
+ }
+ return newPath;
+ }
+
/**
- * Determine if we can use the SD Card to store the temporary file. If not then use
+ * Determine if we can use the SD Card to store the temporary file. If not then use
* the internal cache directory.
- *
+ *
* @return the absolute path of where to store the file
*/
protected static String getTempDirectoryPath(Context ctx) {
File cache = null;
-
+
// SD Card Mounted
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
- cache = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +
+ cache = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +
"/Android/data/" + ctx.getPackageName() + "/cache/");
- }
+ }
// Use internal storage
else {
cache = ctx.getCacheDir();
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/DroidGap.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java
index 5e2586d..ddd50a6 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -70,29 +70,29 @@ import android.widget.LinearLayout;
* This class is the main Android activity that represents the Cordova
* application. It should be extended by the user to load the specific
* html file that contains the application.
- *
+ *
* As an example:
- *
+ *
* package org.apache.cordova.examples;
* import android.app.Activity;
* import android.os.Bundle;
* import org.apache.cordova.*;
- *
+ *
* public class Examples extends DroidGap {
* @Override
* public void onCreate(Bundle savedInstanceState) {
* super.onCreate(savedInstanceState);
- *
+ *
* // Set properties for activity
* super.setStringProperty("loadingDialog", "Title,Message"); // show loading dialog
* super.setStringProperty("errorUrl", "file:///android_asset/www/error.html"); // if error loading file in super.loadUrl().
*
* // Initialize activity
* super.init();
- *
+ *
* // Clear cache if you want
* super.appView.clearCache(true);
- *
+ *
* // Load your application
* super.setIntegerProperty("splashscreen", R.drawable.splash); // load splash.jpg image from the resource drawable directory
* super.loadUrl("file:///android_asset/www/index.html", 3000); // show splash screen 3 sec before loading app
@@ -100,15 +100,15 @@ import android.widget.LinearLayout;
* }
*
* Properties: The application can be configured using the following properties:
- *
- * // Display a native loading dialog when loading app. Format for value = "Title,Message".
+ *
+ * // Display a native loading dialog when loading app. Format for value = "Title,Message".
* // (String - default=null)
* super.setStringProperty("loadingDialog", "Wait,Loading Demo...");
- *
- * // Display a native loading dialog when loading sub-pages. Format for value = "Title,Message".
+ *
+ * // Display a native loading dialog when loading sub-pages. Format for value = "Title,Message".
* // (String - default=null)
* super.setStringProperty("loadingPageDialog", "Loading page...");
- *
+ *
* // Load a splash screen image from the resource drawable directory.
* // (Integer - default=0)
* super.setIntegerProperty("splashscreen", R.drawable.splash);
@@ -116,21 +116,21 @@ import android.widget.LinearLayout;
* // Set the background color.
* // (Integer - default=0 or BLACK)
* super.setIntegerProperty("backgroundColor", Color.WHITE);
- *
+ *
* // Time in msec to wait before triggering a timeout error when loading
* // with super.loadUrl(). (Integer - default=20000)
* super.setIntegerProperty("loadUrlTimeoutValue", 60000);
- *
- * // URL to load if there's an error loading specified URL with loadUrl().
+ *
+ * // URL to load if there's an error loading specified URL with loadUrl().
* // Should be a local URL starting with file://. (String - default=null)
* super.setStringProperty("errorUrl", "file:///android_asset/www/error.html");
- *
+ *
* // Enable app to keep running in background. (Boolean - default=true)
* super.setBooleanProperty("keepRunning", false);
- *
+ *
* Cordova.xml configuration:
* Cordova uses a configuration file at res/xml/cordova.xml to specify the following settings.
- *
+ *
* Approved list of URLs that can be loaded into DroidGap
* <access origin="http://server regexp" subdomains="true" />
* Log level: ERROR, WARN, INFO, DEBUG, VERBOSE (default=ERROR)
@@ -141,7 +141,7 @@ import android.widget.LinearLayout;
* Before using a new plugin, a new element must be added to the file.
* name attribute is the service name passed to Cordova.exec() in JavaScript
* value attribute is the Java class name to call.
- *
+ *
* <plugins>
* <plugin name="App" value="org.apache.cordova.App"/>
* ...
@@ -149,7 +149,7 @@ import android.widget.LinearLayout;
*/
public class DroidGap extends Activity implements CordovaInterface {
public static String TAG = "DroidGap";
-
+
// The webview for our app
protected WebView appView;
protected WebViewClient webViewClient;
@@ -167,15 +167,15 @@ public class DroidGap extends Activity implements CordovaInterface {
// ie http://server/path/index.html#abc?query
private String url = null;
private Stack<String> urls = new Stack<String>();
-
+
// Url was specified from extras (activity was started programmatically)
private String initUrl = null;
-
+
private static int ACTIVITY_STARTING = 0;
private static int ACTIVITY_RUNNING = 1;
private static int ACTIVITY_EXITING = 2;
private int activityState = 0; // 0=starting, 1=running (after 1st resume), 2=shutting down
-
+
// The base of the initial URL for our app.
// Does not include file name. Ends with /
// ie http://server/path/
@@ -187,14 +187,14 @@ public class DroidGap extends Activity implements CordovaInterface {
// Flag indicates that a loadUrl timeout occurred
int loadUrlTimeout = 0;
-
- // Default background color for activity
+
+ // Default background color for activity
// (this is not the color for the webview, which is set in HTML)
private int backgroundColor = Color.BLACK;
-
+
/** The authorization tokens. */
private Hashtable<String, AuthenticationToken> authenticationTokens = new Hashtable<String, AuthenticationToken>();
-
+
/*
* The variables below are used to cache some of the activity properties.
*/
@@ -205,7 +205,7 @@ public class DroidGap extends Activity implements CordovaInterface {
// LoadUrl timeout value in msec (default of 20 sec)
protected int loadUrlTimeoutValue = 20000;
-
+
// Keep app running when pause is received. (default = true)
// If true, then the JavaScript and native code continue to run in the background
// when another application (activity) is started.
@@ -216,7 +216,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Sets the authentication token.
- *
+ *
* @param authenticationToken
* the authentication token
* @param host
@@ -225,21 +225,21 @@ public class DroidGap extends Activity implements CordovaInterface {
* the realm
*/
public void setAuthenticationToken(AuthenticationToken authenticationToken, String host, String realm) {
-
+
if(host == null) {
host = "";
}
-
+
if(realm == null) {
realm = "";
}
-
+
authenticationTokens.put(host.concat(realm), authenticationToken);
}
-
+
/**
* Removes the authentication token.
- *
+ *
* @param host
* the host
* @param realm
@@ -249,16 +249,16 @@ public class DroidGap extends Activity implements CordovaInterface {
public AuthenticationToken removeAuthenticationToken(String host, String realm) {
return authenticationTokens.remove(host.concat(realm));
}
-
+
/**
* Gets the authentication token.
- *
+ *
* In order it tries:
* 1- host + realm
* 2- host
* 3- realm
* 4- no host, no realm
- *
+ *
* @param host
* the host
* @param realm
@@ -267,38 +267,38 @@ public class DroidGap extends Activity implements CordovaInterface {
*/
public AuthenticationToken getAuthenticationToken(String host, String realm) {
AuthenticationToken token = null;
-
+
token = authenticationTokens.get(host.concat(realm));
-
+
if(token == null) {
// try with just the host
token = authenticationTokens.get(host);
-
+
// Try the realm
if(token == null) {
token = authenticationTokens.get(realm);
}
-
+
// if no host found, just query for default
- if(token == null) {
+ if(token == null) {
token = authenticationTokens.get("");
}
}
-
+
return token;
}
-
+
/**
* Clear all authentication tokens.
*/
public void clearAuthenticationTokens() {
authenticationTokens.clear();
}
-
-
- /**
- * Called when the activity is first created.
- *
+
+
+ /**
+ * Called when the activity is first created.
+ *
* @param savedInstanceState
*/
@Override
@@ -324,14 +324,14 @@ public class DroidGap extends Activity implements CordovaInterface {
}
// This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket!
- Display display = getWindowManager().getDefaultDisplay();
+ Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
-
+
root = new LinearLayoutSoftKeyboardDetect(this, width, height);
root.setOrientation(LinearLayout.VERTICAL);
root.setBackgroundColor(this.backgroundColor);
- root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
+ root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT, 0.0F));
// If url was passed in to intent, then init webview, which will load the url
@@ -345,35 +345,35 @@ public class DroidGap extends Activity implements CordovaInterface {
// Setup the hardware volume controls to handle volume control
setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
-
+
/**
* Create and initialize web container with default web view objects.
*/
public void init() {
- this.init(new WebView(DroidGap.this), new CordovaWebViewClient(this), new CordovaChromeClient(DroidGap.this));
+ this.init(new WebView(DroidGap.this), new CordovaWebViewClient(this), new CordovaChromeClient(DroidGap.this));
}
-
+
/**
* Initialize web container with web view objects.
- *
+ *
* @param webView
* @param webViewClient
* @param webChromeClient
*/
public void init(WebView webView, WebViewClient webViewClient, WebChromeClient webChromeClient) {
LOG.d(TAG, "DroidGap.init()");
-
+
// Set up web container
- this.appView = webView;
+ this.appView = webView;
this.appView.setId(100);
this.appView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
- ViewGroup.LayoutParams.FILL_PARENT,
+ ViewGroup.LayoutParams.FILL_PARENT,
1.0F));
- this.appView.setWebChromeClient(webChromeClient);
- this.setWebViewClient(this.appView, webViewClient);
+ this.appView.setWebChromeClient(webChromeClient);
+ this.setWebViewClient(this.appView, webViewClient);
this.appView.setInitialScale(0);
this.appView.setVerticalScrollBarEnabled(false);
@@ -384,18 +384,18 @@ public class DroidGap extends Activity implements CordovaInterface {
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
-
+
//Set the nav dump for HTC
settings.setNavDump(true);
// Enable database
settings.setDatabaseEnabled(true);
- String databasePath = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
+ String databasePath = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
settings.setDatabasePath(databasePath);
// Enable DOM storage
settings.setDomStorageEnabled(true);
-
+
// Enable built-in geolocation
settings.setGeolocationEnabled(true);
@@ -403,17 +403,17 @@ public class DroidGap extends Activity implements CordovaInterface {
this.appView.setVisibility(View.INVISIBLE);
root.addView(this.appView);
setContentView(root);
-
+
// Clear cancel flag
this.cancelLoadUrl = false;
-
+
// Create plugin manager
- this.pluginManager = new PluginManager(this.appView, this);
+ this.pluginManager = new PluginManager(this.appView, this);
}
-
+
/**
* Set the WebViewClient.
- *
+ *
* @param appView
* @param client
*/
@@ -440,18 +440,18 @@ public class DroidGap extends Activity implements CordovaInterface {
if (timeout > 0) {
this.loadUrlTimeoutValue = timeout;
}
-
+
// If keepRunning
this.keepRunning = this.getBooleanProperty("keepRunning", true);
}
-
+
/**
* Load the url into the webview.
- *
+ *
* @param url
*/
public void loadUrl(String url) {
-
+
// If first page of app, then set URL to load to be the one passed in
if (this.initUrl == null || (this.urls.size() > 0)) {
this.loadUrlIntoView(url);
@@ -461,10 +461,10 @@ public class DroidGap extends Activity implements CordovaInterface {
this.loadUrlIntoView(this.initUrl);
}
}
-
+
/**
* Load the url into the webview.
- *
+ *
* @param url
*/
private void loadUrlIntoView(final String url) {
@@ -485,7 +485,7 @@ public class DroidGap extends Activity implements CordovaInterface {
if (!url.startsWith("javascript:")) {
LOG.d(TAG, "DroidGap: url=%s baseUrl=%s", url, baseUrl);
}
-
+
// Load URL on UI thread
final DroidGap me = this;
this.runOnUiThread(new Runnable() {
@@ -502,7 +502,7 @@ public class DroidGap extends Activity implements CordovaInterface {
// Track URLs loaded instead of using appView history
me.urls.push(url);
me.appView.clearHistory();
-
+
// Create callback server and plugin manager
if (me.callbackServer == null) {
me.callbackServer = new CallbackServer();
@@ -512,14 +512,14 @@ public class DroidGap extends Activity implements CordovaInterface {
me.callbackServer.reinit(url);
}
me.pluginManager.init();
-
+
// If loadingDialog property, then show the App loading dialog for first page of app
String loading = null;
if (me.urls.size() == 1) {
loading = me.getStringProperty("loadingDialog", null);
}
else {
- loading = me.getStringProperty("loadingPageDialog", null);
+ loading = me.getStringProperty("loadingPageDialog", null);
}
if (loading != null) {
@@ -566,16 +566,16 @@ public class DroidGap extends Activity implements CordovaInterface {
}
});
}
-
+
/**
* Load the url into the webview after waiting for period of time.
* This is used to display the splashscreen for certain amount of time.
- *
+ *
* @param url
* @param time The number of ms to wait before loading webview
*/
public void loadUrl(final String url, int time) {
-
+
// If first page of app, then set URL to load to be the one passed in
if (this.initUrl == null || (this.urls.size() > 0)) {
this.loadUrlIntoView(url, time);
@@ -589,7 +589,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Load the url into the webview after waiting for period of time.
* This is used to display the splashscreen for certain amount of time.
- *
+ *
* @param url
* @param time The number of ms to wait before loading webview
*/
@@ -597,30 +597,30 @@ public class DroidGap extends Activity implements CordovaInterface {
// Clear cancel flag
this.cancelLoadUrl = false;
-
+
// If not first page of app, then load immediately
if (this.urls.size() > 0) {
this.loadUrlIntoView(url);
}
-
+
if (!url.startsWith("javascript:")) {
LOG.d(TAG, "DroidGap.loadUrl(%s, %d)", url, time);
}
-
+
this.handleActivityParameters();
if (this.splashscreen != 0) {
this.showSplashScreen(time);
}
this.loadUrlIntoView(url);
}
-
+
/**
* Cancel loadUrl before it has been loaded.
*/
public void cancelLoadUrl() {
this.cancelLoadUrl = true;
}
-
+
/**
* Clear the resource cache.
*/
@@ -637,16 +637,16 @@ public class DroidGap extends Activity implements CordovaInterface {
public void clearHistory() {
this.urls.clear();
this.appView.clearHistory();
-
+
// Leave current url on history stack
if (this.url != null) {
this.urls.push(this.url);
}
}
-
+
/**
* Go to previous page in history. (We manage our own history)
- *
+ *
* @return true if we went back, false if we are already at top
*/
public boolean backHistory() {
@@ -654,7 +654,7 @@ public class DroidGap extends Activity implements CordovaInterface {
// Check webview first to see if there is a history
// This is needed to support curPage#diffLink, since they are added to appView's history, but not our history url array (JQMobile behavior)
if (this.appView.canGoBack()) {
- this.appView.goBack();
+ this.appView.goBack();
return true;
}
@@ -665,24 +665,24 @@ public class DroidGap extends Activity implements CordovaInterface {
this.loadUrl(url);
return true;
}
-
+
return false;
}
@Override
/**
- * Called by the system when the device configuration changes while your activity is running.
- *
+ * Called by the system when the device configuration changes while your activity is running.
+ *
* @param Configuration newConfig
*/
public void onConfigurationChanged(Configuration newConfig) {
//don't reload the current page when the orientation is changed
super.onConfigurationChanged(newConfig);
}
-
+
/**
* Get boolean property for activity.
- *
+ *
* @param name
* @param defaultValue
* @return
@@ -701,7 +701,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Get int property for activity.
- *
+ *
* @param name
* @param defaultValue
* @return
@@ -720,7 +720,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Get string property for activity.
- *
+ *
* @param name
* @param defaultValue
* @return
@@ -739,7 +739,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Get double property for activity.
- *
+ *
* @param name
* @param defaultValue
* @return
@@ -758,27 +758,27 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Set boolean property on activity.
- *
+ *
* @param name
* @param value
*/
public void setBooleanProperty(String name, boolean value) {
this.getIntent().putExtra(name, value);
}
-
+
/**
* Set int property on activity.
- *
+ *
* @param name
* @param value
*/
public void setIntegerProperty(String name, int value) {
this.getIntent().putExtra(name, value);
}
-
+
/**
* Set string property on activity.
- *
+ *
* @param name
* @param value
*/
@@ -788,7 +788,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Set double property on activity.
- *
+ *
* @param name
* @param value
*/
@@ -798,11 +798,11 @@ public class DroidGap extends Activity implements CordovaInterface {
@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.
*/
protected void onPause() {
super.onPause();
-
+
// Don't process pause if shutting down, since onDestroy() will be called
if (this.activityState == ACTIVITY_EXITING) {
return;
@@ -817,9 +817,9 @@ public class DroidGap extends Activity implements CordovaInterface {
// Forward to plugins
if (this.pluginManager != null) {
- this.pluginManager.onPause(this.keepRunning);
+ this.pluginManager.onPause(this.keepRunning);
}
-
+
// If app doesn't want to run in background
if (!this.keepRunning) {
@@ -837,17 +837,17 @@ public class DroidGap extends Activity implements CordovaInterface {
//Forward to plugins
if (this.pluginManager != null) {
- this.pluginManager.onNewIntent(intent);
+ this.pluginManager.onNewIntent(intent);
}
}
-
+
@Override
/**
- * Called when the activity will start interacting with the user.
+ * Called when the activity will start interacting with the user.
*/
protected void onResume() {
super.onResume();
-
+
if (this.activityState == ACTIVITY_STARTING) {
this.activityState = ACTIVITY_RUNNING;
return;
@@ -862,9 +862,9 @@ public class DroidGap extends Activity implements CordovaInterface {
// Forward to plugins
if (this.pluginManager != null) {
- this.pluginManager.onResume(this.keepRunning || this.activityResultKeepRunning);
+ this.pluginManager.onResume(this.keepRunning || this.activityResultKeepRunning);
}
-
+
// If app doesn't want to run in background
if (!this.keepRunning || this.activityResultKeepRunning) {
@@ -878,14 +878,14 @@ public class DroidGap extends Activity implements CordovaInterface {
this.appView.resumeTimers();
}
}
-
+
@Override
/**
- * The final call you receive before your activity is destroyed.
+ * The final call you receive before your activity is destroyed.
*/
public void onDestroy() {
super.onDestroy();
-
+
if (this.appView != null) {
@@ -906,13 +906,13 @@ public class DroidGap extends Activity implements CordovaInterface {
}
/**
- * Send a message to all plugins.
- *
+ * Send a message to all plugins.
+ *
* @param id The message id
* @param data The message data
*/
public void postMessage(String id, Object data) {
-
+
// Forward to plugins
if (this.pluginManager != null) {
this.pluginManager.postMessage(id, data);
@@ -922,23 +922,23 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* @deprecated
* Add services to res/xml/plugins.xml instead.
- *
+ *
* Add a class that implements a service.
- *
+ *
* @param serviceType
* @param className
*/
@Deprecated
public void addService(String serviceType, String className) {
if (this.pluginManager != null) {
- this.pluginManager.addService(serviceType, className);
+ this.pluginManager.addService(serviceType, className);
}
}
-
+
/**
* Send JavaScript statement back to JavaScript.
* (This is a convenience method)
- *
+ *
* @param message
*/
public void sendJavascript(String statement) {
@@ -949,7 +949,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Load the specified URL in the Cordova webview or a new browser instance.
- *
+ *
* NOTE: If openExternal is false, only URLs listed in whitelist can be loaded.
*
* @param url The url to load.
@@ -959,24 +959,24 @@ public class DroidGap extends Activity implements CordovaInterface {
*/
public void showWebPage(String url, boolean openExternal, boolean clearHistory, HashMap<String, Object> params) { //throws android.content.ActivityNotFoundException {
LOG.d(TAG, "showWebPage(%s, %b, %b, HashMap", url, openExternal, clearHistory);
-
+
// If clearing history
if (clearHistory) {
this.clearHistory();
}
-
+
// If loading into our webview
if (!openExternal) {
-
+
// Make sure url is in whitelist
if (url.startsWith("file://") || url.indexOf(this.baseUrl) == 0 || isUrlWhiteListed(url)) {
// TODO: What about params?
-
+
// Clear out current url from history, since it will be replacing it
if (clearHistory) {
this.urls.clear();
}
-
+
// Load new URL
this.loadUrl(url);
}
@@ -992,7 +992,7 @@ public class DroidGap extends Activity implements CordovaInterface {
}
}
}
-
+
// Load in default view intent
else {
try {
@@ -1004,10 +1004,10 @@ public class DroidGap extends Activity implements CordovaInterface {
}
}
}
-
+
/**
* Show the spinner. Must be called from the UI thread.
- *
+ *
* @param title Title of the dialog
* @param message The message of the dialog
*/
@@ -1017,8 +1017,8 @@ public class DroidGap extends Activity implements CordovaInterface {
this.spinnerDialog = null;
}
final DroidGap me = this;
- this.spinnerDialog = ProgressDialog.show(DroidGap.this, title , message, true, true,
- new DialogInterface.OnCancelListener() {
+ this.spinnerDialog = ProgressDialog.show(DroidGap.this, title , message, true, true,
+ new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
me.spinnerDialog = null;
}
@@ -1034,7 +1034,7 @@ public class DroidGap extends Activity implements CordovaInterface {
this.spinnerDialog = null;
}
}
-
+
/**
* End this activity by calling finish for activity
*/
@@ -1042,10 +1042,10 @@ public class DroidGap extends Activity implements CordovaInterface {
this.activityState = ACTIVITY_EXITING;
this.finish();
}
-
+
/**
* Called when a key is de-pressed. (Key UP)
- *
+ *
* @param keyCode
* @param event
*/
@@ -1091,14 +1091,14 @@ public class DroidGap extends Activity implements CordovaInterface {
}
/**
- * Any calls to Activity.startActivityForResult must use method below, so
- * the result can be routed to them correctly.
- *
+ * Any calls to Activity.startActivityForResult must use method below, so
+ * the result can be routed to them correctly.
+ *
* This is done to eliminate the need to modify DroidGap.java to receive activity results.
- *
+ *
* @param intent The intent to start
* @param requestCode Identifies who to send the result to
- *
+ *
* @throws RuntimeException
*/
@Override
@@ -1108,9 +1108,9 @@ public class DroidGap extends Activity implements CordovaInterface {
}
/**
- * Launch an activity for which you would like a result when it finished. When this activity exits,
+ * Launch an activity for which you would like a result when it finished. When this activity exits,
* your onActivityResult() method will be called.
- *
+ *
* @param command The command object
* @param intent The intent to start
* @param requestCode The request code that is passed to callback to identify the activity
@@ -1118,12 +1118,12 @@ public class DroidGap extends Activity implements CordovaInterface {
public void startActivityForResult(IPlugin command, Intent intent, int requestCode) {
this.activityResultCallback = command;
this.activityResultKeepRunning = this.keepRunning;
-
+
// If multitasking turned on, then disable it for activities that return results
if (command != null) {
this.keepRunning = false;
}
-
+
// Start activity
super.startActivityForResult(intent, requestCode);
}
@@ -1131,9 +1131,9 @@ public class DroidGap extends Activity implements CordovaInterface {
@Override
/**
* Called when an activity you launched exits, giving you the requestCode you started it with,
- * the resultCode it returned, and any additional data from it.
- *
- * @param requestCode The request code originally supplied to startActivityForResult(),
+ * the resultCode it returned, and any additional data from it.
+ *
+ * @param requestCode The request code originally supplied to startActivityForResult(),
* allowing you to identify who this result came from.
* @param resultCode The integer result code returned by the child activity through its setResult().
* @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
@@ -1143,7 +1143,7 @@ public class DroidGap extends Activity implements CordovaInterface {
IPlugin callback = this.activityResultCallback;
if (callback != null) {
callback.onActivityResult(requestCode, resultCode, intent);
- }
+ }
}
public void setActivityResultCallback(IPlugin plugin) {
@@ -1151,12 +1151,12 @@ public class DroidGap extends Activity implements CordovaInterface {
}
/**
- * 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.
*
* @param errorCode The error code corresponding to an ERROR_* value.
* @param description A String describing the error.
- * @param failingUrl The url that failed to load.
+ * @param failingUrl The url that failed to load.
*/
public void onReceivedError(final int errorCode, final String description, final String failingUrl) {
final DroidGap me = this;
@@ -1168,7 +1168,7 @@ public class DroidGap extends Activity implements CordovaInterface {
// Load URL on UI thread
me.runOnUiThread(new Runnable() {
public void run() {
- me.showWebPage(errorUrl, false, true, null);
+ me.showWebPage(errorUrl, false, true, null);
}
});
}
@@ -1189,7 +1189,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Display an error dialog and optionally exit application.
- *
+ *
* @param title
* @param message
* @param button
@@ -1217,8 +1217,8 @@ public class DroidGap extends Activity implements CordovaInterface {
}
});
}
-
-
+
+
/**
* Load Cordova configuration from res/xml/cordova.xml.
* Approved list of URLs that can be loaded into DroidGap
@@ -1276,7 +1276,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Add entry to approved list of URLs (whitelist)
- *
+ *
* @param origin URL regular expression to allow
* @param subdomains T=include all subdomains under origin
*/
@@ -1305,7 +1305,7 @@ public class DroidGap extends Activity implements CordovaInterface {
whiteList.add(Pattern.compile("^https?://"+origin));
}
LOG.d(TAG, "Origin to allow: %s", origin);
- }
+ }
}
} catch(Exception e) {
LOG.d(TAG, "Failed to add origin %s", origin);
@@ -1314,7 +1314,7 @@ public class DroidGap extends Activity implements CordovaInterface {
/**
* Determine if URL is in approved list of URLs to load.
- *
+ *
* @param url
* @return
*/
@@ -1339,13 +1339,13 @@ public class DroidGap extends Activity implements CordovaInterface {
}
return false;
}
-
+
/*
* URL stack manipulators
*/
-
- /**
- * Returns the top url on the stack without removing it from
+
+ /**
+ * Returns the top url on the stack without removing it from
* the stack.
*/
public String peekAtUrlStack() {
@@ -1354,38 +1354,35 @@ public class DroidGap extends Activity implements CordovaInterface {
}
return "";
}
-
+
/**
* Add a url to the stack
- *
+ *
* @param url
*/
public void pushUrl(String url) {
urls.push(url);
}
-
- /*
+
+ /*
* Hook in DroidGap for menu plugins
- *
+ *
*/
-
+
@Override
- public boolean onCreateOptionsMenu(Menu menu)
- {
+ public boolean onCreateOptionsMenu(Menu menu) {
this.postMessage("onCreateOptionsMenu", menu);
return super.onCreateOptionsMenu(menu);
}
-
+
@Override
- public boolean onPrepareOptionsMenu(Menu menu)
- {
+ public boolean onPrepareOptionsMenu(Menu menu) {
this.postMessage("onPrepareOptionsMenu", menu);
return super.onPrepareOptionsMenu(menu);
}
-
+
@Override
- public boolean onOptionsItemSelected(MenuItem item)
- {
+ public boolean onOptionsItemSelected(MenuItem item) {
this.postMessage("onOptionsItemSelected", item);
return true;
}
@@ -1405,7 +1402,7 @@ public class DroidGap extends Activity implements CordovaInterface {
}
protected Dialog splashDialog;
-
+
/**
* Removes the Dialog that displays the splash screen
*/
@@ -1415,36 +1412,36 @@ public class DroidGap extends Activity implements CordovaInterface {
splashDialog = null;
}
}
-
+
/**
* Shows the splash screen over the full Activity
*/
protected void showSplashScreen(int time) {
// Get reference to display
Display display = getWindowManager().getDefaultDisplay();
-
+
// Create the layout for the dialog
LinearLayout root = new LinearLayout(this);
root.setMinimumHeight(display.getHeight());
root.setMinimumWidth(display.getWidth());
root.setOrientation(LinearLayout.VERTICAL);
root.setBackgroundColor(this.getIntegerProperty("backgroundColor", Color.BLACK));
- root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
+ root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT, 0.0F));
root.setBackgroundResource(this.splashscreen);
// Create and show the dialog
- splashDialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
+ splashDialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
splashDialog.setContentView(root);
splashDialog.setCancelable(false);
splashDialog.show();
-
+
// Set Runnable to remove splash screen just in case
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
- public void run() {
- removeSplashScreen();
- }
+ public void run() {
+ removeSplashScreen();
+ }
}, time);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/ExifHelper.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/ExifHelper.java b/framework/src/org/apache/cordova/ExifHelper.java
index 88c492a..8b4d179 100644
--- a/framework/src/org/apache/cordova/ExifHelper.java
+++ b/framework/src/org/apache/cordova/ExifHelper.java
@@ -41,31 +41,31 @@ public class ExifHelper {
private String make = null;
private String model = null;
private String orientation = null;
- private String whiteBalance = null;
-
+ private String whiteBalance = null;
+
private ExifInterface inFile = null;
private ExifInterface outFile = null;
-
+
/**
* The file before it is compressed
- *
- * @param filePath
+ *
+ * @param filePath
* @throws IOException
*/
public void createInFile(String filePath) throws IOException {
this.inFile = new ExifInterface(filePath);
}
-
- /**
+
+ /**
* The file after it has been compressed
- *
+ *
* @param filePath
* @throws IOException
*/
public void createOutFile(String filePath) throws IOException {
this.outFile = new ExifInterface(filePath);
}
-
+
/**
* Reads all the EXIF data from the input file.
*/
@@ -88,12 +88,12 @@ public class ExifHelper {
this.make = inFile.getAttribute(ExifInterface.TAG_MAKE);
this.model = inFile.getAttribute(ExifInterface.TAG_MODEL);
this.orientation = inFile.getAttribute(ExifInterface.TAG_ORIENTATION);
- this.whiteBalance = inFile.getAttribute(ExifInterface.TAG_WHITE_BALANCE);
+ this.whiteBalance = inFile.getAttribute(ExifInterface.TAG_WHITE_BALANCE);
}
-
+
/**
* Writes the previously stored EXIF data to the output file.
- *
+ *
* @throws IOException
*/
public void writeExifData() throws IOException {
@@ -101,7 +101,7 @@ public class ExifHelper {
if (this.outFile == null) {
return;
}
-
+
if (this.aperature != null) {
this.outFile.setAttribute(ExifInterface.TAG_APERTURE, this.aperature);
}
@@ -159,7 +159,7 @@ public class ExifHelper {
if (this.whiteBalance != null) {
this.outFile.setAttribute(ExifInterface.TAG_WHITE_BALANCE, this.whiteBalance);
}
-
+
this.outFile.saveAttributes();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/FileTransfer.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileTransfer.java b/framework/src/org/apache/cordova/FileTransfer.java
index 368d97a..c9b13a5 100644
--- a/framework/src/org/apache/cordova/FileTransfer.java
+++ b/framework/src/org/apache/cordova/FileTransfer.java
@@ -452,14 +452,14 @@ public class FileTransfer extends Plugin {
URL url = new URL(source);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
-
+
//Add cookie support
String cookie = CookieManager.getInstance().getCookie(source);
if(cookie != null)
{
connection.setRequestProperty("cookie", cookie);
}
-
+
connection.connect();
Log.d(LOG_TAG, "Download file: " + url);
@@ -538,7 +538,7 @@ public class FileTransfer extends Plugin {
/**
* Get a File object from the passed in path
- *
+ *
* @param path file path
* @return file object
*/
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/FileUploadResult.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUploadResult.java b/framework/src/org/apache/cordova/FileUploadResult.java
index b838dca..36fae93 100644
--- a/framework/src/org/apache/cordova/FileUploadResult.java
+++ b/framework/src/org/apache/cordova/FileUploadResult.java
@@ -25,39 +25,39 @@ import org.json.JSONObject;
* Encapsulates the result and/or status of uploading a file to a remote server.
*/
public class FileUploadResult {
-
+
private long bytesSent = 0; // bytes sent
private int responseCode = -1; // HTTP response code
private String response = null; // HTTP response
-
+
public long getBytesSent() {
return bytesSent;
}
-
+
public void setBytesSent(long bytes) {
this.bytesSent = bytes;
}
-
+
public int getResponseCode() {
return responseCode;
}
-
+
public void setResponseCode(int responseCode) {
this.responseCode = responseCode;
}
-
+
public String getResponse() {
return response;
}
-
+
public void setResponse(String response) {
this.response = response;
}
public JSONObject toJSONObject() throws JSONException {
return new JSONObject(
- "{bytesSent:" + bytesSent +
- ",responseCode:" + responseCode +
+ "{bytesSent:" + bytesSent +
+ ",responseCode:" + responseCode +
",response:" + JSONObject.quote(response) + "}");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java
index 32d3678..4d2b31e 100755
--- a/framework/src/org/apache/cordova/FileUtils.java
+++ b/framework/src/org/apache/cordova/FileUtils.java
@@ -41,7 +41,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
-import android.util.Log;
import android.webkit.MimeTypeMap;
@@ -727,7 +726,7 @@ public class FileUtils extends Plugin {
filePath = stripFileProtocol(filePath);
if (filePath.equals(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + ctx.getPackageName() + "/cache") ||
- filePath.equals(Environment.getExternalStorageDirectory().getAbsolutePath()) ||
+ filePath.equals(Environment.getExternalStorageDirectory().getAbsolutePath()) ||
filePath.equals("/data/data/" + ctx.getPackageName())) {
return true;
}
@@ -736,7 +735,7 @@ public class FileUtils extends Plugin {
/**
* This method removes the "file://" from the passed in filePath
- *
+ *
* @param filePath to be checked.
* @return
*/
@@ -746,10 +745,10 @@ public class FileUtils extends Plugin {
}
return filePath;
}
-
+
/**
* Create a File object from the passed in path
- *
+ *
* @param filePath
* @return
*/
@@ -840,7 +839,7 @@ public class FileUtils extends Plugin {
else {
throw new IOException("No filesystem of type requested");
}
-
+
return fs;
}
@@ -974,7 +973,7 @@ public class FileUtils extends Plugin {
/**/
public long write(String filename, String data, int offset) throws FileNotFoundException, IOException {
filename = stripFileProtocol(filename);
-
+
boolean append = false;
if (offset > 0) {
this.truncateFile(filename, offset);
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/GPSListener.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/GPSListener.java b/framework/src/org/apache/cordova/GPSListener.java
index 2b46c7c..daaf7ee 100755
--- a/framework/src/org/apache/cordova/GPSListener.java
+++ b/framework/src/org/apache/cordova/GPSListener.java
@@ -26,25 +26,25 @@ import android.location.LocationManager;
*
*/
public class GPSListener extends CordovaLocationListener {
- public GPSListener(LocationManager locationManager, GeoBroker m) {
- super(locationManager, m, "[Cordova GPSListener]");
- }
+ public GPSListener(LocationManager locationManager, GeoBroker m) {
+ super(locationManager, m, "[Cordova GPSListener]");
+ }
-
- /**
- * Start requesting location updates.
- *
- * @param interval
- */
- @Override
- protected void start() {
- if (!this.running) {
- if (this.locationManager.getProvider(LocationManager.GPS_PROVIDER) != null) {
- this.running = true;
- this.locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, this);
- } else {
- this.fail(CordovaLocationListener.POSITION_UNAVAILABLE, "GPS provider is not available.");
- }
- }
- }
+
+ /**
+ * Start requesting location updates.
+ *
+ * @param interval
+ */
+ @Override
+ protected void start() {
+ if (!this.running) {
+ if (this.locationManager.getProvider(LocationManager.GPS_PROVIDER) != null) {
+ this.running = true;
+ this.locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, this);
+ } else {
+ this.fail(CordovaLocationListener.POSITION_UNAVAILABLE, "GPS provider is not available.");
+ }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/GeoBroker.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/GeoBroker.java b/framework/src/org/apache/cordova/GeoBroker.java
index 6a150b3..6f77845 100755
--- a/framework/src/org/apache/cordova/GeoBroker.java
+++ b/framework/src/org/apache/cordova/GeoBroker.java
@@ -30,7 +30,7 @@ import android.location.LocationManager;
/*
* This class is the interface to the Geolocation. It's bound to the geo object.
- *
+ *
* This class only starts and stops various GeoListeners, which consist of a GPS and a Network Listener
*/
@@ -38,7 +38,7 @@ public class GeoBroker extends Plugin {
private GPSListener gpsListener;
private NetworkListener networkListener;
private LocationManager locationManager;
-
+
/**
* Constructor.
*/
@@ -47,74 +47,74 @@ public class GeoBroker extends Plugin {
/**
* Executes the request and returns PluginResult.
- *
+ *
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param callbackId The callback id used when calling back into JavaScript.
* @return A PluginResult object with a status and message.
*/
public PluginResult execute(String action, JSONArray args, String callbackId) {
- if (this.locationManager == null) {
- this.locationManager = (LocationManager) this.ctx.getSystemService(Context.LOCATION_SERVICE);
- this.networkListener = new NetworkListener(this.locationManager, this);
- this.gpsListener = new GPSListener(this.locationManager, this);
- }
+ if (this.locationManager == null) {
+ this.locationManager = (LocationManager) this.ctx.getSystemService(Context.LOCATION_SERVICE);
+ this.networkListener = new NetworkListener(this.locationManager, this);
+ this.gpsListener = new GPSListener(this.locationManager, this);
+ }
PluginResult.Status status = PluginResult.Status.NO_RESULT;
String message = "";
PluginResult result = new PluginResult(status, message);
result.setKeepCallback(true);
-
+
try {
if (action.equals("getLocation")) {
- boolean enableHighAccuracy = args.getBoolean(0);
- int maximumAge = args.getInt(1);
- Location last = this.locationManager.getLastKnownLocation((enableHighAccuracy ? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER));
- // Check if we can use lastKnownLocation to get a quick reading and use less battery
- if ((System.currentTimeMillis() - last.getTime()) <= maximumAge) {
- result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(last));
- } else {
- this.getCurrentLocation(callbackId, enableHighAccuracy);
- }
+ boolean enableHighAccuracy = args.getBoolean(0);
+ int maximumAge = args.getInt(1);
+ Location last = this.locationManager.getLastKnownLocation((enableHighAccuracy ? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER));
+ // Check if we can use lastKnownLocation to get a quick reading and use less battery
+ if ((System.currentTimeMillis() - last.getTime()) <= maximumAge) {
+ result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(last));
+ } else {
+ this.getCurrentLocation(callbackId, enableHighAccuracy);
+ }
}
else if (action.equals("addWatch")) {
- String id = args.getString(0);
- boolean enableHighAccuracy = args.getBoolean(1);
- this.addWatch(id, callbackId, enableHighAccuracy);
+ String id = args.getString(0);
+ boolean enableHighAccuracy = args.getBoolean(1);
+ this.addWatch(id, callbackId, enableHighAccuracy);
}
else if (action.equals("clearWatch")) {
- String id = args.getString(0);
- this.clearWatch(id);
+ String id = args.getString(0);
+ this.clearWatch(id);
}
} catch (JSONException e) {
- result = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
+ result = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
}
return result;
}
private void clearWatch(String id) {
- this.gpsListener.clearWatch(id);
- this.networkListener.clearWatch(id);
- }
-
- private void getCurrentLocation(String callbackId, boolean enableHighAccuracy) {
- if (enableHighAccuracy) {
- this.gpsListener.addCallback(callbackId);
- } else {
- this.networkListener.addCallback(callbackId);
- }
- }
-
+ this.gpsListener.clearWatch(id);
+ this.networkListener.clearWatch(id);
+ }
+
+ private void getCurrentLocation(String callbackId, boolean enableHighAccuracy) {
+ if (enableHighAccuracy) {
+ this.gpsListener.addCallback(callbackId);
+ } else {
+ this.networkListener.addCallback(callbackId);
+ }
+ }
+
private void addWatch(String timerId, String callbackId, boolean enableHighAccuracy) {
- if (enableHighAccuracy) {
- this.gpsListener.addWatch(timerId, callbackId);
- } else {
- this.networkListener.addWatch(timerId, callbackId);
- }
+ if (enableHighAccuracy) {
+ this.gpsListener.addWatch(timerId, callbackId);
+ } else {
+ this.networkListener.addWatch(timerId, callbackId);
+ }
}
- /**
+ /**
* Identifies if action to be executed returns a value and should be run synchronously.
- *
+ *
* @param action The action to execute
* @return T=returns value
*/
@@ -122,65 +122,65 @@ public class GeoBroker extends Plugin {
// Starting listeners is easier to run on main thread, so don't run async.
return true;
}
-
+
/**
* Called when the activity is to be shut down.
* Stop listener.
*/
public void onDestroy() {
- this.networkListener.destroy();
- this.gpsListener.destroy();
+ this.networkListener.destroy();
+ this.gpsListener.destroy();
this.networkListener = null;
this.gpsListener = null;
}
public JSONObject returnLocationJSON(Location loc) {
- JSONObject o = new JSONObject();
-
- try {
- o.put("latitude", loc.getLatitude());
- o.put("longitude", loc.getLongitude());
- o.put("altitude", (loc.hasAltitude() ? loc.getAltitude() : null));
- o.put("accuracy", loc.getAccuracy());
- o.put("heading", (loc.hasBearing() ? (loc.hasSpeed() ? loc.getBearing() : null) : null));
- o.put("speed", loc.getSpeed());
- o.put("timestamp", loc.getTime());
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
- return o;
+ JSONObject o = new JSONObject();
+
+ try {
+ o.put("latitude", loc.getLatitude());
+ o.put("longitude", loc.getLongitude());
+ o.put("altitude", (loc.hasAltitude() ? loc.getAltitude() : null));
+ o.put("accuracy", loc.getAccuracy());
+ o.put("heading", (loc.hasBearing() ? (loc.hasSpeed() ? loc.getBearing() : null) : null));
+ o.put("speed", loc.getSpeed());
+ o.put("timestamp", loc.getTime());
+ } catch (JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ return o;
}
public void win(Location loc, String callbackId) {
- PluginResult result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(loc));
- this.success(result, callbackId);
+ PluginResult result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(loc));
+ this.success(result, callbackId);
}
/**
* Location failed. Send error back to JavaScript.
- *
+ *
* @param code The error code
* @param msg The error message
- * @throws JSONException
+ * @throws JSONException
*/
public void fail(int code, String msg, String callbackId) {
- JSONObject obj = new JSONObject();
- String backup = null;
- try {
- obj.put("code", code);
- obj.put("message", msg);
- } catch (JSONException e) {
- obj = null;
- backup = "{'code':" + code + ",'message':'" + msg.replaceAll("'", "\'") + "'}";
- }
- PluginResult result;
- if (obj != null) {
- result = new PluginResult(PluginResult.Status.ERROR, obj);
- } else {
- result = new PluginResult(PluginResult.Status.ERROR, backup);
- }
-
- this.error(result, callbackId);
+ JSONObject obj = new JSONObject();
+ String backup = null;
+ try {
+ obj.put("code", code);
+ obj.put("message", msg);
+ } catch (JSONException e) {
+ obj = null;
+ backup = "{'code':" + code + ",'message':'" + msg.replaceAll("'", "\'") + "'}";
+ }
+ PluginResult result;
+ if (obj != null) {
+ result = new PluginResult(PluginResult.Status.ERROR, obj);
+ } else {
+ result = new PluginResult(PluginResult.Status.ERROR, backup);
+ }
+
+ this.error(result, callbackId);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/HttpHandler.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/HttpHandler.java b/framework/src/org/apache/cordova/HttpHandler.java
index f64b5fd..3ced2de 100755
--- a/framework/src/org/apache/cordova/HttpHandler.java
+++ b/framework/src/org/apache/cordova/HttpHandler.java
@@ -29,52 +29,52 @@ import org.apache.http.impl.client.DefaultHttpClient;
public class HttpHandler {
- protected Boolean get(String url, String file)
- {
- HttpEntity entity = getHttpEntity(url);
- try {
- writeToDisk(entity, file);
- } catch (Exception e) { e.printStackTrace(); return false; }
- try {
- entity.consumeContent();
- } catch (Exception e) { e.printStackTrace(); return false; }
- return true;
- }
-
- private HttpEntity getHttpEntity(String url)
- /**
- * get the http entity at a given url
- */
- {
- HttpEntity entity=null;
- try {
- DefaultHttpClient httpclient = new DefaultHttpClient();
- HttpGet httpget = new HttpGet(url);
- HttpResponse response = httpclient.execute(httpget);
- entity = response.getEntity();
- } catch (Exception e) { e.printStackTrace(); return null; }
- return entity;
- }
-
- private void writeToDisk(HttpEntity entity, String file) throws IllegalStateException, IOException
- /**
- * writes a HTTP entity to the specified filename and location on disk
- */
- {
- int i=0;
- String FilePath="/sdcard/" + file;
- InputStream in = entity.getContent();
- byte buff[] = new byte[1024];
- FileOutputStream out=
- new FileOutputStream(FilePath);
- do {
- int numread = in.read(buff);
- if (numread <= 0)
- break;
- out.write(buff, 0, numread);
- i++;
- } while (true);
- out.flush();
- out.close();
- }
+ protected Boolean get(String url, String file)
+ {
+ HttpEntity entity = getHttpEntity(url);
+ try {
+ writeToDisk(entity, file);
+ } catch (Exception e) { e.printStackTrace(); return false; }
+ try {
+ entity.consumeContent();
+ } catch (Exception e) { e.printStackTrace(); return false; }
+ return true;
+ }
+
+ private HttpEntity getHttpEntity(String url)
+ /**
+ * get the http entity at a given url
+ */
+ {
+ HttpEntity entity=null;
+ try {
+ DefaultHttpClient httpclient = new DefaultHttpClient();
+ HttpGet httpget = new HttpGet(url);
+ HttpResponse response = httpclient.execute(httpget);
+ entity = response.getEntity();
+ } catch (Exception e) { e.printStackTrace(); return null; }
+ return entity;
+ }
+
+ private void writeToDisk(HttpEntity entity, String file) throws IllegalStateException, IOException
+ /**
+ * writes a HTTP entity to the specified filename and location on disk
+ */
+ {
+ int i=0;
+ String FilePath="/sdcard/" + file;
+ InputStream in = entity.getContent();
+ byte buff[] = new byte[1024];
+ FileOutputStream out=
+ new FileOutputStream(FilePath);
+ do {
+ int numread = in.read(buff);
+ if (numread <= 0)
+ break;
+ out.write(buff, 0, numread);
+ i++;
+ } while (true);
+ out.flush();
+ out.close();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java b/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java
index a024b23..c6d9353 100755
--- a/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java
+++ b/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java
@@ -20,7 +20,6 @@ package org.apache.cordova;
import org.apache.cordova.api.LOG;
import android.content.Context;
-import android.view.View.MeasureSpec;
import android.widget.LinearLayout;
/**
@@ -29,15 +28,15 @@ import android.widget.LinearLayout;
public class LinearLayoutSoftKeyboardDetect extends LinearLayout {
private static final String TAG = "SoftKeyboardDetect";
-
+
private int oldHeight = 0; // Need to save the old height as not to send redundant events
- private int oldWidth = 0; // Need to save old width for orientation change
+ private int oldWidth = 0; // Need to save old width for orientation change
private int screenWidth = 0;
private int screenHeight = 0;
private DroidGap app = null;
-
+
public LinearLayoutSoftKeyboardDetect(Context context, int width, int height) {
- super(context);
+ super(context);
screenWidth = width;
screenHeight = height;
app = (DroidGap) context;
@@ -45,18 +44,18 @@ public class LinearLayoutSoftKeyboardDetect extends LinearLayout {
@Override
/**
- * Start listening to new measurement events. Fire events when the height
- * gets smaller fire a show keyboard event and when height gets bigger fire
+ * Start listening to new measurement events. Fire events when the height
+ * gets smaller fire a show keyboard event and when height gets bigger fire
* a hide keyboard event.
- *
+ *
* Note: We are using app.postMessage so that this is more compatible with the API
- *
+ *
* @param widthMeasureSpec
* @param heightMeasureSpec
*/
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
LOG.v(TAG, "We are in our onMeasure method");
// Get the current height of the visible part of the screen.
@@ -66,7 +65,7 @@ public class LinearLayoutSoftKeyboardDetect extends LinearLayout {
height = MeasureSpec.getSize(heightMeasureSpec);
width = MeasureSpec.getSize(widthMeasureSpec);
LOG.v(TAG, "Old Height = %d", oldHeight);
- LOG.v(TAG, "Height = %d", height);
+ LOG.v(TAG, "Height = %d", height);
LOG.v(TAG, "Old Width = %d", oldWidth);
LOG.v(TAG, "Width = %d", width);
@@ -83,13 +82,13 @@ public class LinearLayoutSoftKeyboardDetect extends LinearLayout {
screenWidth = tmp_var;
LOG.v(TAG, "Orientation Change");
}
- // If the height as gotten bigger then we will assume the soft keyboard has
+ // If the height as gotten bigger then we will assume the soft keyboard has
// gone away.
else if (height > oldHeight) {
if(app != null)
app.sendJavascript("cordova.fireDocumentEvent('hidekeyboard');");
- }
- // If the height as gotten smaller then we will assume the soft keyboard has
+ }
+ // If the height as gotten smaller then we will assume the soft keyboard has
// been displayed.
else if (height < oldHeight) {
if(app != null)
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/NetworkListener.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/NetworkListener.java b/framework/src/org/apache/cordova/NetworkListener.java
index 6eaa8ac..7d19259 100755
--- a/framework/src/org/apache/cordova/NetworkListener.java
+++ b/framework/src/org/apache/cordova/NetworkListener.java
@@ -26,7 +26,7 @@ import android.location.LocationManager;
*
*/
public class NetworkListener extends CordovaLocationListener {
- public NetworkListener(LocationManager locationManager, GeoBroker m) {
- super(locationManager, m, "[Cordova NetworkListener]");
- }
+ public NetworkListener(LocationManager locationManager, GeoBroker m) {
+ super(locationManager, m, "[Cordova NetworkListener]");
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/NetworkManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/NetworkManager.java b/framework/src/org/apache/cordova/NetworkManager.java
index 058757f..8b50869 100755
--- a/framework/src/org/apache/cordova/NetworkManager.java
+++ b/framework/src/org/apache/cordova/NetworkManager.java
@@ -33,7 +33,7 @@ import android.net.NetworkInfo;
import android.util.Log;
public class NetworkManager extends Plugin {
-
+
public static int NOT_REACHABLE = 0;
public static int REACHABLE_VIA_CARRIER_DATA_NETWORK = 1;
public static int REACHABLE_VIA_WIFI_NETWORK = 2;
@@ -66,14 +66,14 @@ public class NetworkManager extends Plugin {
public static final String TYPE_3G = "3g";
public static final String TYPE_4G = "4g";
public static final String TYPE_NONE = "none";
-
+
private static final String LOG_TAG = "NetworkManager";
private String connectionCallbackId;
ConnectivityManager sockMan;
BroadcastReceiver receiver;
-
+
/**
* Constructor.
*/
@@ -84,14 +84,14 @@ public class NetworkManager extends Plugin {
/**
* Sets the context of the Command. This can then be used to do things like
* get file paths associated with the Activity.
- *
+ *
* @param ctx The context of the main Activity.
*/
public void setContext(CordovaInterface ctx) {
super.setContext(ctx);
this.sockMan = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
this.connectionCallbackId = null;
-
+
// We need to listen to connectivity events to update navigator.connection
IntentFilter intentFilter = new IntentFilter() ;
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
@@ -99,17 +99,17 @@ public class NetworkManager extends Plugin {
this.receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- updateConnectionInfo((NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
+ updateConnectionInfo((NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
}
};
ctx.registerReceiver(this.receiver, intentFilter);
}
}
-
+
/**
* Executes the request and returns PluginResult.
- *
+ *
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param callbackId The callback id used when calling back into JavaScript.
@@ -118,7 +118,7 @@ public class NetworkManager extends Plugin {
public PluginResult execute(String action, JSONArray args, String callbackId) {
PluginResult.Status status = PluginResult.Status.INVALID_ACTION;
String result = "Unsupported Operation: " + action;
-
+
if (action.equals("getConnectionInfo")) {
this.connectionCallbackId = callbackId;
NetworkInfo info = sockMan.getActiveNetworkInfo();
@@ -126,20 +126,20 @@ public class NetworkManager extends Plugin {
pluginResult.setKeepCallback(true);
return pluginResult;
}
-
+
return new PluginResult(status, result);
}
/**
* Identifies if action to be executed returns a value and should be run synchronously.
- *
+ *
* @param action The action to execute
* @return T=returns value
*/
public boolean isSynch(String action) {
return true;
}
-
+
/**
* Stop network receiver.
*/
@@ -160,18 +160,18 @@ public class NetworkManager extends Plugin {
/**
* Updates the JavaScript side whenever the connection changes
- *
+ *
* @param info the current active network info
* @return
*/
- private void updateConnectionInfo(NetworkInfo info) {
+ private void updateConnectionInfo(NetworkInfo info) {
// send update to javascript "navigator.network.connection"
sendUpdate(this.getConnectionInfo(info));
}
- /**
+ /**
* Get the latest network connection information
- *
+ *
* @param info the current active network info
* @return a JSONObject that represents the network info
*/
@@ -188,24 +188,24 @@ public class NetworkManager extends Plugin {
}
return type;
}
-
+
/**
* Create a new plugin result and send it back to JavaScript
- *
+ *
* @param connection the network info to set as navigator.connection
*/
private void sendUpdate(String type) {
PluginResult result = new PluginResult(PluginResult.Status.OK, type);
result.setKeepCallback(true);
this.success(result, this.connectionCallbackId);
-
+
// Send to all plugins
this.ctx.postMessage("networkconnection", type);
}
-
+
/**
* Determine the type of connection
- *
+ *
* @param info the network info so we can determine connection type.
* @return the type of mobile network we are on
*/
@@ -218,12 +218,12 @@ public class NetworkManager extends Plugin {
}
else if (type.toLowerCase().equals(MOBILE)) {
type = info.getSubtypeName();
- if (type.toLowerCase().equals(GSM) ||
+ if (type.toLowerCase().equals(GSM) ||
type.toLowerCase().equals(GPRS) ||
type.toLowerCase().equals(EDGE)) {
return TYPE_2G;
}
- else if (type.toLowerCase().startsWith(CDMA) ||
+ else if (type.toLowerCase().startsWith(CDMA) ||
type.toLowerCase().equals(UMTS) ||
type.toLowerCase().equals(ONEXRTT) ||
type.toLowerCase().equals(EHRPD) ||
@@ -232,13 +232,13 @@ public class NetworkManager extends Plugin {
type.toLowerCase().equals(HSPA)) {
return TYPE_3G;
}
- else if (type.toLowerCase().equals(LTE) ||
+ else if (type.toLowerCase().equals(LTE) ||
type.toLowerCase().equals(UMB) ||
type.toLowerCase().equals(HSPA_PLUS)) {
return TYPE_4G;
}
}
- }
+ }
else {
return TYPE_NONE;
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/Notification.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Notification.java b/framework/src/org/apache/cordova/Notification.java
index b5834c3..4c5b929 100755
--- a/framework/src/org/apache/cordova/Notification.java
+++ b/framework/src/org/apache/cordova/Notification.java
@@ -36,11 +36,11 @@ import android.os.Vibrator;
* This class provides access to notifications on the device.
*/
public class Notification extends Plugin {
-
+
public int confirmResult = -1;
public ProgressDialog spinnerDialog = null;
- public ProgressDialog progressDialog = null;
-
+ public ProgressDialog progressDialog = null;
+
/**
* Constructor.
*/
@@ -49,7 +49,7 @@ public class Notification extends Plugin {
/**
* Executes the request and returns PluginResult.
- *
+ *
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param callbackId The callback id used when calling back into JavaScript.
@@ -57,8 +57,8 @@ public class Notification extends Plugin {
*/
public PluginResult execute(String action, JSONArray args, String callbackId) {
PluginResult.Status status = PluginResult.Status.OK;
- String result = "";
-
+ String result = "";
+
try {
if (action.equals("beep")) {
this.beep(args.getLong(0));
@@ -101,7 +101,7 @@ public class Notification extends Plugin {
/**
* Identifies if action to be executed returns a value and should be run synchronously.
- *
+ *
* @param action The action to execute
* @return T=returns value
*/
@@ -138,13 +138,13 @@ public class Notification extends Plugin {
/**
* Beep plays the default notification ringtone.
- *
+ *
* @param count Number of times to play notification
*/
public void beep(long count) {
Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone notification = RingtoneManager.getRingtone(this.ctx.getContext(), ringtone);
-
+
// If phone is not set to silent mode
if (notification != null) {
for (long i = 0; i < count; ++i) {
@@ -160,10 +160,10 @@ public class Notification extends Plugin {
}
}
}
-
+
/**
* Vibrates the device for the specified amount of time.
- *
+ *
* @param time Time to vibrate in ms.
*/
public void vibrate(long time){
@@ -174,22 +174,22 @@ public class Notification extends Plugin {
Vibrator vibrator = (Vibrator) this.ctx.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(time);
}
-
+
/**
* Builds and shows a native Android alert with given Strings
* @param message The message the alert should display
* @param title The title of the alert
- * @param buttonLabel The label of the button
+ * @param buttonLabel The label of the button
* @param callbackId The callback id
*/
public synchronized void alert(final String message, final String title, final String buttonLabel, final String callbackId) {
final CordovaInterface ctx = this.ctx;
final Notification notification = this;
-
+
Runnable runnable = new Runnable() {
public void run() {
-
+
AlertDialog.Builder dlg = new AlertDialog.Builder(ctx.getContext());
dlg.setMessage(message);
dlg.setTitle(title);
@@ -212,7 +212,7 @@ public class Notification extends Plugin {
* Builds and shows a native Android confirm dialog with given title, message, buttons.
* This dialog only shows up to 3 buttons. Any labels after that will be ignored.
* The index of the button pressed will be returned to the JavaScript callback identified by callbackId.
- *
+ *
* @param message The message the dialog should display
* @param title The title of the dialog
* @param buttonLabels A comma separated list of button labels (Up to 3 buttons)
@@ -244,7 +244,7 @@ public class Notification extends Plugin {
// Second button
if (fButtons.length > 1) {
- dlg.setNeutralButton(fButtons[1],
+ dlg.setNeutralButton(fButtons[1],
new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
@@ -274,7 +274,7 @@ public class Notification extends Plugin {
/**
* Show the spinner.
- *
+ *
* @param title Title of the dialog
* @param message The message of the dialog
*/
@@ -287,8 +287,8 @@ public class Notification extends Plugin {
final CordovaInterface ctx = this.ctx;
Runnable runnable = new Runnable() {
public void run() {
- notification.spinnerDialog = ProgressDialog.show(ctx.getContext(), title , message, true, true,
- new DialogInterface.OnCancelListener() {
+ notification.spinnerDialog = ProgressDialog.show(ctx.getContext(), title , message, true, true,
+ new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
notification.spinnerDialog = null;
}
@@ -297,7 +297,7 @@ public class Notification extends Plugin {
};
this.ctx.runOnUiThread(runnable);
}
-
+
/**
* Stop spinner.
*/
@@ -310,7 +310,7 @@ public class Notification extends Plugin {
/**
* Show the progress dialog.
- *
+ *
* @param title Title of the dialog
* @param message The message of the dialog
*/
@@ -331,7 +331,7 @@ public class Notification extends Plugin {
notification.progressDialog.setMax(100);
notification.progressDialog.setProgress(0);
notification.progressDialog.setOnCancelListener(
- new DialogInterface.OnCancelListener() {
+ new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
notification.progressDialog = null;
}
@@ -341,18 +341,18 @@ public class Notification extends Plugin {
};
this.ctx.runOnUiThread(runnable);
}
-
+
/**
* Set value of progress bar.
- *
+ *
* @param value 0-100
*/
public synchronized void progressValue(int value) {
if (this.progressDialog != null) {
this.progressDialog.setProgress(value);
- }
+ }
}
-
+
/**
* Stop progress dialog.
*/
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/6d1e0356/framework/src/org/apache/cordova/StandAlone.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/StandAlone.java b/framework/src/org/apache/cordova/StandAlone.java
index d41771d..a199dda 100644
--- a/framework/src/org/apache/cordova/StandAlone.java
+++ b/framework/src/org/apache/cordova/StandAlone.java
@@ -18,18 +18,15 @@
*/
package org.apache.cordova;
-import java.lang.reflect.Field;
-
-import android.app.Activity;
import android.os.Bundle;
public class StandAlone extends DroidGap {
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- super.loadUrl("file:///android_asset/www/index.html");
- }
-
+
+ super.loadUrl("file:///android_asset/www/index.html");
+ }
+
}