Port SplashScreen to CordovaPlugin. Untested, no tests for it.

This commit is contained in:
Braden Shepherdson 2012-10-12 17:00:14 -04:00
parent 621e1163f8
commit 29a0b010da

View File

@ -19,26 +19,25 @@
package org.apache.cordova; package org.apache.cordova;
import org.apache.cordova.api.Plugin; import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.PluginResult; import org.apache.cordova.api.CordovaPlugin;
import org.json.JSONArray; import org.json.JSONArray;
public class SplashScreen extends Plugin { public class SplashScreen extends CordovaPlugin {
@Override @Override
public PluginResult execute(String action, JSONArray args, String callbackId) { public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
PluginResult.Status status = PluginResult.Status.OK;
String result = "";
if (action.equals("hide")) { if (action.equals("hide")) {
this.webView.postMessage("splashscreen", "hide"); this.webView.postMessage("splashscreen", "hide");
} else if (action.equals("show")){ } else if (action.equals("show")){
this.webView.postMessage("splashscreen", "show"); this.webView.postMessage("splashscreen", "show");
} }
else { else {
status = PluginResult.Status.INVALID_ACTION; return false;
} }
return new PluginResult(status, result);
callbackContext.success();
return true;
} }
} }