use of org.apache.cordova.PluginResult in project barcodescanner-sdk-cordova by Scandit.
the class SubViewPickerController method didRecognizeText.
@Override
public int didRecognizeText(RecognizedText recognizedText) {
if (mPendingClose.get()) {
// return if there is a pending close. Otherwise we might deadlock
return TextRecognitionListener.PICKER_STATE_STOPPED;
}
JSONArray eventArgs = Marshal.createEventArgs(ScanditSDK.DID_RECOGNIZE_TEXT_EVENT, ResultRelay.jsonForRecognizedText(recognizedText));
PluginResult result = Marshal.createOkResult(eventArgs);
int nextState = sendPluginResultBlocking(result);
if (!mContinuousMode) {
nextState = PickerStateMachine.PAUSED;
}
if (!mContinuousMode) {
removeSubviewPicker();
}
PickerStateMachine stateMachine = mPickerStateMachine;
if (stateMachine != null) {
stateMachine.setState(nextState);
}
Marshal.rejectRecognizedTexts(recognizedText, mRejectedCodeIds);
if (nextState == PickerStateMachine.STOPPED) {
return TextRecognitionListener.PICKER_STATE_STOPPED;
} else if (nextState == PickerStateMachine.PAUSED) {
return TextRecognitionListener.PICKER_STATE_PAUSED;
} else {
return TextRecognitionListener.PICKER_STATE_ACTIVE;
}
}
use of org.apache.cordova.PluginResult in project barcodescanner-sdk-cordova by Scandit.
the class FullscreenPickerController method onRelayedResult.
@Override
public int onRelayedResult(Bundle bundle) {
PluginResult result = resultForBundle(bundle);
if (bundle.getBoolean("waitForResult", true)) {
return sendPluginResultBlocking(result);
}
mCallbackContext.sendPluginResult(resultForBundle(bundle));
return 0;
}
use of org.apache.cordova.PluginResult in project barcodescanner-sdk-cordova by Scandit.
the class Marshal method createOkResult.
public static PluginResult createOkResult(JSONArray args) {
PluginResult result = new PluginResult(PluginResult.Status.OK, args);
result.setKeepCallback(true);
return result;
}
Aggregations