Anyline / anyline-ocr-cordova-module

Anyline Cordova Module for iOS and Android
https://anyline.com/
Other
27 stars 25 forks source link

View config - segment not working #11

Closed fab-hw closed 6 years ago

fab-hw commented 6 years ago

Trying to set up a radio group as per your Cordova documentation using the "segment" parameter in the view config, but it's not doing anything on Android or iOS - no error (scan works in the mode set in the initial call) but no radio buttons are displayed, not sure what we're doing wrong, here is our view configuration (NOTE: your doc uses the parameter "titles" in the code example but "title" everywhere else - we've tried both but no difference):

anylineOcrViewConfig: { "captureResolution": "1080", "cutout": { "style": "rect", "maxWidthPercent": "80%", "maxHeightPercent": "80%", "alignment": "top_half", "width": 870, "ratioFromSize": { "width": 5, "height": 1 }, "strokeWidth": 2, "cornerRadius": 10, "strokeColor": "FFFFFF", "outerColor": "000000", "outerAlpha": 0.3 }, "flash": { "mode": "manual", "alignment": "bottom_right" }, "beepOnResult": true, "vibrateOnResult": true, "blinkAnimationOnResult": true, "cancelOnResult": true, "reportingEnabled": false, "segment": { // use this to generate a RadioGroup/SegmentedControl "title": ["Text", "Barcode"], // Titles for the Segment "modes": ["ANYLINE_OCR", "BARCODE"], // The Energy Scan modes for the Segment "tintColor": "CCCCCC", // Tint color of the Semgent. Work on Android for API Level > 21 "offset": { // Values for the offset are in dp on android and on iOS 2x the points "x": 0, // X Offset of the element relative to the left edge of the cutout. On iOS the Element is center in the view. "y": 400 // The Y Offset releative to the top edge of the cutout } }, "doneButton": { // iOS only. Android uses hardware back button. "title": "Cancel", "type": "rect", // fullwidth, rect "cornerRadius": 0, //"backgroundColor":"#EEEEEE", // default clearcolor "textColor": "FFFFFF", "textColorHighlighted": "CCCCCC", "fontSize": 33, "fontName": "HelveticaNeue", "positionXAlignment": "center", // left,right,center - no affect on fullwidth "positionYAlignment": "bottom", // top, center, bottom "offset": { "x": 0, // postive -> right "y": -88, // postive -> down } } },

Thanks in advance

JonasLaux commented 6 years ago

Hi @Coolcat13 , Segmentation is currently limited to Energy Meter.

fab-hw commented 6 years ago

OK thanks, that's a pity. I don't think the documentation specifies this so it might be an idea to update it (link below). Do you think you might be able to extend it to non-energy modes?

https://documentation.anyline.com/toc/platforms/cordova/getting_started.html#cordova-add-view-confiuration

Thanks