// Path: src/android/com/mirasense/scanditsdk/plugin/BarcodePickerWithSearchBar.java
// public static class Constraints {
//     private Integer mLeftMargin = null;
//     private Integer mTopMargin = null;
//     private Integer mRightMargin = null;
//     private Integer mBottomMargin = null;
//     private Integer mWidth = null;
//     private Integer mHeight = null;
// 
//     public Constraints() {}
// 
//     public Constraints(Rect margins) {
//         if (margins != null) {
//             mLeftMargin = margins.left;
//             mTopMargin = margins.top;
//             mRightMargin = margins.right;
//             mBottomMargin = margins.bottom;
//         }
//     }
// 
//     public Integer getLeftMargin() {
//         if (mLeftMargin == null && (mRightMargin == null || mWidth == null)) return 0;
//         return mLeftMargin;
//     }
//     public void setLeftMargin(Integer value) { mLeftMargin = value; }
// 
//     public Integer getTopMargin() {
//         if (mTopMargin == null && (mBottomMargin == null || mHeight == null)) return 0;
//         return mTopMargin;
//     }
//     public void setTopMargin(Integer value) { mTopMargin = value; }
// 
//     public Integer getRightMargin() {
//         return mRightMargin;
//     }
//     public void setRightMargin(Integer value) { mRightMargin = value; }
// 
//     public Integer getBottomMargin() {
//         return mBottomMargin;
//     }
//     public void setBottomMargin(Integer value) { mBottomMargin = value; }
// 
//     public Integer getWidth() {
//         if (mLeftMargin != null && mRightMargin != null) return null;
//         return mWidth;
//     }
//     public void setWidth(Integer value) { mWidth = value; }
// 
//     public Integer getHeight() {
//         if (mTopMargin != null && mBottomMargin != null) return null;
//         return mHeight;
//     }
//     public void setHeight(Integer value) { mHeight = value; }
// }


import android.app.Activity;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import com.mirasense.scanditsdk.plugin.BarcodePickerWithSearchBar.Constraints;
import com.scandit.barcodepicker.OnScanListener;
import com.scandit.barcodepicker.ProcessFrameListener;
import com.scandit.barcodepicker.LicenseValidationListener;
import com.scandit.barcodepicker.PropertyChangeListener;
import com.scandit.barcodepicker.ScanSession;
import com.scandit.barcodepicker.ScanSettings;
import com.scandit.barcodepicker.ocr.RecognizedText;
import com.scandit.barcodepicker.ocr.TextRecognitionListener;
import com.scandit.base.util.JSONParseException;
import com.scandit.recognition.TrackedBarcode;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONObject;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
            }
        });
    }

    @Override
    public void updateLayout(final Bundle layoutOptions) {
        final Activity pluginActivity = mPlugin.cordova.getActivity();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                PhonegapParamParser.updateLayout(pluginActivity, mPickerStateMachine.getPicker(),
                        layoutOptions, mScreenDimensions);
                callPickerResizedListener(layoutOptions);
            }
        });
    }

    private void runOnUiThread(Runnable r) {
        mPlugin.cordova.getActivity().runOnUiThread(r);
    }

    private void internalUpdateUI(Bundle overlayOptions, Bundle options) {
        BarcodePickerWithSearchBar picker = mPickerStateMachine.getPicker();
        UIParamParser.updatePickerUI(picker, overlayOptions);
        PhonegapParamParser.updatePicker(picker, overlayOptions, this);
    }
    
    private void callPickerResizedListener(Bundle bundle) {
        ResizeScannerInterface listener = resizeListener.get();
        if (listener != null) {
// Path: src/android/com/mirasense/scanditsdk/plugin/BarcodePickerWithSearchBar.java
// public static class Constraints {
//     private Integer mLeftMargin = null;
//     private Integer mTopMargin = null;
//     private Integer mRightMargin = null;
//     private Integer mBottomMargin = null;
//     private Integer mWidth = null;
//     private Integer mHeight = null;
// 
//     public Constraints() {}
// 
//     public Constraints(Rect margins) {
//         if (margins != null) {
//             mLeftMargin = margins.left;
//             mTopMargin = margins.top;
//             mRightMargin = margins.right;
//             mBottomMargin = margins.bottom;
//         }
//     }
// 
//     public Integer getLeftMargin() {
//         if (mLeftMargin == null && (mRightMargin == null || mWidth == null)) return 0;
//         return mLeftMargin;
//     }
//     public void setLeftMargin(Integer value) { mLeftMargin = value; }
// 
//     public Integer getTopMargin() {
//         if (mTopMargin == null && (mBottomMargin == null || mHeight == null)) return 0;
//         return mTopMargin;
//     }
//     public void setTopMargin(Integer value) { mTopMargin = value; }
// 
//     public Integer getRightMargin() {
//         return mRightMargin;
//     }
//     public void setRightMargin(Integer value) { mRightMargin = value; }
// 
//     public Integer getBottomMargin() {
//         return mBottomMargin;
//     }
//     public void setBottomMargin(Integer value) { mBottomMargin = value; }
// 
//     public Integer getWidth() {
//         if (mLeftMargin != null && mRightMargin != null) return null;
//         return mWidth;
//     }
//     public void setWidth(Integer value) { mWidth = value; }
// 
//     public Integer getHeight() {
//         if (mTopMargin != null && mBottomMargin != null) return null;
//         return mHeight;
//     }
//     public void setHeight(Integer value) { mHeight = value; }
// }


// Path: src/android/com/mirasense/scanditsdk/plugin/SubViewPickerController.java
import android.app.Activity;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import com.mirasense.scanditsdk.plugin.BarcodePickerWithSearchBar.Constraints;
import com.scandit.barcodepicker.OnScanListener;
import com.scandit.barcodepicker.ProcessFrameListener;
import com.scandit.barcodepicker.LicenseValidationListener;
import com.scandit.barcodepicker.PropertyChangeListener;
import com.scandit.barcodepicker.ScanSession;
import com.scandit.barcodepicker.ScanSettings;
import com.scandit.barcodepicker.ocr.RecognizedText;
import com.scandit.barcodepicker.ocr.TextRecognitionListener;
import com.scandit.base.util.JSONParseException;
import com.scandit.recognition.TrackedBarcode;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONObject;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

            }
        });
    }

    @Override
    public void updateLayout(final Bundle layoutOptions) {
        final Activity pluginActivity = mPlugin.cordova.getActivity();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                PhonegapParamParser.updateLayout(pluginActivity, mPickerStateMachine.getPicker(),
                        layoutOptions, mScreenDimensions);
                callPickerResizedListener(layoutOptions);
            }
        });
    }

    private void runOnUiThread(Runnable r) {
        mPlugin.cordova.getActivity().runOnUiThread(r);
    }

    private void internalUpdateUI(Bundle overlayOptions, Bundle options) {
        BarcodePickerWithSearchBar picker = mPickerStateMachine.getPicker();
        UIParamParser.updatePickerUI(picker, overlayOptions);
        PhonegapParamParser.updatePicker(picker, overlayOptions, this);
    }
    
    private void callPickerResizedListener(Bundle bundle) {
        ResizeScannerInterface listener = resizeListener.get();
        if (listener != null) {
            Constraints portrait = PhonegapParamParser.extractConstraints(bundle,