Java Code Examples for org.apache.cordova.PluginResult#getKeepCallback()

The following examples show how to use org.apache.cordova.PluginResult#getKeepCallback() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeToJsMessageQueue.java    From CordovaYoutubeVideoPlayer with MIT License 6 votes vote down vote up
/**
 * Add a JavaScript statement to the list.
 */
public void addPluginResult(PluginResult result, String callbackId) {
    if (callbackId == null) {
        Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
        return;
    }
    // Don't send anything if there is no result and there is no need to
    // clear the callbacks.
    boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
    boolean keepCallback = result.getKeepCallback();
    if (noResult && keepCallback) {
        return;
    }
    JsMessage message = new JsMessage(result, callbackId);
    if (FORCE_ENCODE_USING_EVAL) {
        StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
        message.encodeAsJsMessage(sb);
        message = new JsMessage(sb.toString());
    }

    enqueueMessage(message);
}
 
Example 2
Source File: NativeToJsMessageQueue.java    From crosswalk-cordova-android with Apache License 2.0 6 votes vote down vote up
/**
 * Add a JavaScript statement to the list.
 */
public void addPluginResult(PluginResult result, String callbackId) {
    if (callbackId == null) {
        Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
        return;
    }
    // Don't send anything if there is no result and there is no need to
    // clear the callbacks.
    boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
    boolean keepCallback = result.getKeepCallback();
    if (noResult && keepCallback) {
        return;
    }
    JsMessage message = new JsMessage(result, callbackId);
    if (FORCE_ENCODE_USING_EVAL) {
        StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
        message.encodeAsJsMessage(sb);
        message = new JsMessage(sb.toString());
    }

    enqueueMessage(message);
}
 
Example 3
Source File: NativeToJsMessageQueue.java    From reader with MIT License 6 votes vote down vote up
/**
 * Add a JavaScript statement to the list.
 */
public void addPluginResult(PluginResult result, String callbackId) {
    if (callbackId == null) {
        Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
        return;
    }
    // Don't send anything if there is no result and there is no need to
    // clear the callbacks.
    boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
    boolean keepCallback = result.getKeepCallback();
    if (noResult && keepCallback) {
        return;
    }
    JsMessage message = new JsMessage(result, callbackId);
    if (FORCE_ENCODE_USING_EVAL) {
        StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
        message.encodeAsJsMessage(sb);
        message = new JsMessage(sb.toString());
    }

    enqueueMessage(message);
}
 
Example 4
Source File: NativeToJsMessageQueue.java    From L.TileLayer.Cordova with MIT License 6 votes vote down vote up
/**
 * Add a JavaScript statement to the list.
 */
public void addPluginResult(PluginResult result, String callbackId) {
    if (callbackId == null) {
        Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
        return;
    }
    // Don't send anything if there is no result and there is no need to
    // clear the callbacks.
    boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
    boolean keepCallback = result.getKeepCallback();
    if (noResult && keepCallback) {
        return;
    }
    JsMessage message = new JsMessage(result, callbackId);
    if (FORCE_ENCODE_USING_EVAL) {
        StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
        message.encodeAsJsMessage(sb);
        message = new JsMessage(sb.toString());
    }

    enqueueMessage(message);
}
 
Example 5
Source File: NativeToJsMessageQueue.java    From IoTgo_Android_App with MIT License 6 votes vote down vote up
/**
 * Add a JavaScript statement to the list.
 */
public void addPluginResult(PluginResult result, String callbackId) {
    if (callbackId == null) {
        Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
        return;
    }
    // Don't send anything if there is no result and there is no need to
    // clear the callbacks.
    boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
    boolean keepCallback = result.getKeepCallback();
    if (noResult && keepCallback) {
        return;
    }
    JsMessage message = new JsMessage(result, callbackId);
    if (FORCE_ENCODE_USING_EVAL) {
        StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
        message.encodeAsJsMessage(sb);
        message = new JsMessage(sb.toString());
    }

    enqueueMessage(message);
}
 
Example 6
Source File: NativeToJsMessageQueue.java    From wildfly-samples with MIT License 6 votes vote down vote up
/**
 * Add a JavaScript statement to the list.
 */
public void addPluginResult(PluginResult result, String callbackId) {
    if (callbackId == null) {
        Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
        return;
    }
    // Don't send anything if there is no result and there is no need to
    // clear the callbacks.
    boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
    boolean keepCallback = result.getKeepCallback();
    if (noResult && keepCallback) {
        return;
    }
    JsMessage message = new JsMessage(result, callbackId);
    if (FORCE_ENCODE_USING_EVAL) {
        StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
        message.encodeAsJsMessage(sb);
        message = new JsMessage(sb.toString());
    }

    enqueueMessage(message);
}
 
Example 7
Source File: NativeToJsMessageQueue.java    From phonegapbootcampsite with MIT License 6 votes vote down vote up
/**
 * Add a JavaScript statement to the list.
 */
public void addPluginResult(PluginResult result, String callbackId) {
    if (callbackId == null) {
        Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
        return;
    }
    // Don't send anything if there is no result and there is no need to
    // clear the callbacks.
    boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
    boolean keepCallback = result.getKeepCallback();
    if (noResult && keepCallback) {
        return;
    }
    JsMessage message = new JsMessage(result, callbackId);
    if (FORCE_ENCODE_USING_EVAL) {
        StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
        message.encodeAsJsMessage(sb);
        message = new JsMessage(sb.toString());
    }

    enqueueMessage(message);
}
 
Example 8
Source File: NativeToJsMessageQueue.java    From bluemix-parking-meter with MIT License 6 votes vote down vote up
/**
 * Add a JavaScript statement to the list.
 */
public void addPluginResult(PluginResult result, String callbackId) {
    if (callbackId == null) {
        Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
        return;
    }
    // Don't send anything if there is no result and there is no need to
    // clear the callbacks.
    boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
    boolean keepCallback = result.getKeepCallback();
    if (noResult && keepCallback) {
        return;
    }
    JsMessage message = new JsMessage(result, callbackId);
    if (FORCE_ENCODE_USING_EVAL) {
        StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
        message.encodeAsJsMessage(sb);
        message = new JsMessage(sb.toString());
    }

    enqueueMessage(message);
}
 
Example 9
Source File: CallbackContext.java    From reader with MIT License 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            Log.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 10
Source File: CallbackContext.java    From BigDataPlatform with GNU General Public License v3.0 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            LOG.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 11
Source File: CallbackContext.java    From lona with GNU General Public License v3.0 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            LOG.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 12
Source File: CallbackContext.java    From pychat with MIT License 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            LOG.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 13
Source File: CallbackContext.java    From crosswalk-cordova-android with Apache License 2.0 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            Log.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 14
Source File: CallbackContext.java    From wildfly-samples with MIT License 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            Log.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 15
Source File: CallbackContext.java    From phonegap-plugin-loading-spinner with Apache License 2.0 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            Log.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 16
Source File: CallbackContext.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            Log.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 17
Source File: CallbackContext.java    From cordova-plugin-app-update-demo with MIT License 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            Log.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 18
Source File: CallbackContext.java    From keemob with MIT License 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            LOG.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 19
Source File: CallbackContext.java    From cordova-amazon-fireos with Apache License 2.0 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            Log.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}
 
Example 20
Source File: CallbackContext.java    From xmall with MIT License 5 votes vote down vote up
public void sendPluginResult(PluginResult pluginResult) {
    synchronized (this) {
        if (finished) {
            LOG.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
            return;
        } else {
            finished = !pluginResult.getKeepCallback();
        }
    }
    webView.sendPluginResult(pluginResult, callbackId);
}