本文整理汇总了Java中org.apache.cordova.api.PluginResult.Status方法的典型用法代码示例。如果您正苦于以下问题:Java PluginResult.Status方法的具体用法?Java PluginResult.Status怎么用?Java PluginResult.Status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cordova.api.PluginResult
的用法示例。
在下文中一共展示了PluginResult.Status方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendUpdate
import org.apache.cordova.api.PluginResult; //导入方法依赖的package包/类
private void sendUpdate(JSONObject paramJSONObject, boolean paramBoolean, PluginResult.Status paramStatus)
{
PluginResult localPluginResult = new PluginResult(paramStatus, paramJSONObject);
localPluginResult.setKeepCallback(paramBoolean);
this.callbackContext.sendPluginResult(localPluginResult);
}
示例2: execute
import org.apache.cordova.api.PluginResult; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
throws JSONException
{
PluginResult.Status localStatus = PluginResult.Status.OK;
if (paramString.equals("startRecordingAudio"))
startRecordingAudio(paramJSONArray.getString(0), FileHelper.stripFileProtocol(paramJSONArray.getString(1)));
while (true)
{
paramCallbackContext.sendPluginResult(new PluginResult(localStatus, ""));
return true;
if (paramString.equals("stopRecordingAudio"))
{
stopRecordingAudio(paramJSONArray.getString(0));
continue;
}
if (paramString.equals("startPlayingAudio"))
{
startPlayingAudio(paramJSONArray.getString(0), FileHelper.stripFileProtocol(paramJSONArray.getString(1)));
continue;
}
if (paramString.equals("seekToAudio"))
{
seekToAudio(paramJSONArray.getString(0), paramJSONArray.getInt(1));
continue;
}
if (paramString.equals("pausePlayingAudio"))
{
pausePlayingAudio(paramJSONArray.getString(0));
continue;
}
if (paramString.equals("stopPlayingAudio"))
{
stopPlayingAudio(paramJSONArray.getString(0));
continue;
}
if (paramString.equals("setVolume"))
{
try
{
setVolume(paramJSONArray.getString(0), Float.parseFloat(paramJSONArray.getString(1)));
}
catch (NumberFormatException localNumberFormatException)
{
}
continue;
}
if (paramString.equals("getCurrentPositionAudio"))
{
paramCallbackContext.sendPluginResult(new PluginResult(localStatus, getCurrentPositionAudio(paramJSONArray.getString(0))));
return true;
}
if (paramString.equals("getDurationAudio"))
{
paramCallbackContext.sendPluginResult(new PluginResult(localStatus, getDurationAudio(paramJSONArray.getString(0), paramJSONArray.getString(1))));
return true;
}
if (!paramString.equals("create"))
break;
String str = paramJSONArray.getString(0);
AudioPlayer localAudioPlayer = new AudioPlayer(this, str, FileHelper.stripFileProtocol(paramJSONArray.getString(1)));
this.players.put(str, localAudioPlayer);
}
if (paramString.equals("release"))
{
paramCallbackContext.sendPluginResult(new PluginResult(localStatus, release(paramJSONArray.getString(0))));
return true;
}
return false;
}
示例3: execute
import org.apache.cordova.api.PluginResult; //导入方法依赖的package包/类
public boolean execute(String paramString, JSONArray paramJSONArray, CallbackContext paramCallbackContext)
throws JSONException
{
PluginResult.Status localStatus = PluginResult.Status.OK;
while (true)
{
try
{
if (!paramString.equals("clearCache"))
continue;
clearCache();
paramCallbackContext.sendPluginResult(new PluginResult(localStatus, ""));
return true;
if (paramString.equals("show"))
{
this.cordova.getActivity().runOnUiThread(new Runnable()
{
public void run()
{
App.this.webView.postMessage("spinner", "stop");
}
});
continue;
}
}
catch (JSONException localJSONException)
{
paramCallbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
return false;
}
if (paramString.equals("loadUrl"))
{
loadUrl(paramJSONArray.getString(0), paramJSONArray.optJSONObject(1));
continue;
}
if (paramString.equals("cancelLoadUrl"))
continue;
if (paramString.equals("clearHistory"))
{
clearHistory();
continue;
}
if (paramString.equals("backHistory"))
{
backHistory();
continue;
}
if (paramString.equals("overrideButton"))
{
overrideButton(paramJSONArray.getString(0), paramJSONArray.getBoolean(1));
continue;
}
if (paramString.equals("overrideBackbutton"))
{
overrideBackbutton(paramJSONArray.getBoolean(0));
continue;
}
if (!paramString.equals("exitApp"))
continue;
exitApp();
}
}
示例4: JacksonSerializedPluginResult
import org.apache.cordova.api.PluginResult; //导入方法依赖的package包/类
public JacksonSerializedPluginResult(PluginResult.Status paramStatus, JSONArray paramJSONArray)
{
super(paramStatus, new JacksonSerializedJSONArray(paramJSONArray));
}
示例5: execute
import org.apache.cordova.api.PluginResult; //导入方法依赖的package包/类
/**
* Executes the request and returns PluginResult.
*
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param callbackContext The callback context from which we were invoked.
* @return A PluginResult object with a status and message.
*/
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
PluginResult.Status status = PluginResult.Status.OK;
String result = "";
try {
if (action.equals("clearCache")) {
this.clearCache();
}
else if (action.equals("show")) {
// This gets called from JavaScript onCordovaReady to show the webview.
// I recommend we change the name of the Message as spinner/stop is not
// indicative of what this actually does (shows the webview).
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
webView.postMessage("spinner", "stop");
}
});
}
else if (action.equals("loadUrl")) {
this.loadUrl(args.getString(0), args.optJSONObject(1));
}
else if (action.equals("cancelLoadUrl")) {
//this.cancelLoadUrl();
}
else if (action.equals("clearHistory")) {
this.clearHistory();
}
else if (action.equals("backHistory")) {
this.backHistory();
}
else if (action.equals("overrideButton")) {
this.overrideButton(args.getString(0), args.getBoolean(1));
}
else if (action.equals("overrideBackbutton")) {
this.overrideBackbutton(args.getBoolean(0));
}
else if (action.equals("exitApp")) {
this.exitApp();
}
callbackContext.sendPluginResult(new PluginResult(status, result));
return true;
} catch (JSONException e) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
return false;
}
}
示例6: PluginResult
import org.apache.cordova.api.PluginResult; //导入方法依赖的package包/类
/**
* Create a new plugin result and send it back to JavaScript
*
* @param obj a JSONObject contain event payload information
* @param status the status code to return to the JavaScript environment
*/ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) {
PluginResult result = new PluginResult(status, obj);
result.setKeepCallback(keepCallback);
this.callbackContext.sendPluginResult(result);
}