java - How to change the scanning area of a zxing qr-scanner using BarcodeView -


i'm using zxing scan qr codes , show camera preview using barcodeview class. of now, scanner works great if qrcode in exact middle of camera preview. however, if qr code placed in area of preview that's not middle not scan:

http://imgur.com/a/u8s3e

here relevant code:

getting barcodeview:

cordova.getactivity().runonuithread(new runnable() {  @override  public void run() {  // create our preview view , set content of our activity.  mbarcodeview = new barcodeview(cordova.getactivity());   //configure decoder  arraylist<barcodeformat> formatlist = new arraylist<barcodeformat>();  formatlist.add(barcodeformat.qr_code);  mbarcodeview.setdecoderfactory(new defaultdecoderfactory(formatlist, null, null));   //configure camera (front/back)  camerasettings settings = new camerasettings();  settings.setrequestedcameraid(getcurrentcameraid());  mbarcodeview.setcamerasettings(settings);   framelayout.layoutparams camerapreviewparams = new framelayout.layoutparams(framelayout.layoutparams.wrap_content, framelayout.layoutparams.wrap_content);  ((viewgroup) webview.getview().getparent()).addview(mbarcodeview, camerapreviewparams);   camerapreviewing = true;  webview.getview().bringtofront();   mbarcodeview.resume();  }  }); 

and scan:

this.nextscancallback = callbackcontext; final barcodecallback b = this; this.cordova.getactivity().runonuithread(new runnable() {     @override     public void run() {        if (mbarcodeview != null) {           mbarcodeview.decodesingle(b);        }     } }); 

if above code isn't sufficient, whole project can found here

i'm trying make qr code can detected in portion of camera preview, not middle. ideas on how accomplish this?


Comments