protected override void OnCreate(Bundle bundle) { Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn); base.OnCreate(bundle); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); SetContentView(Resource.Layout.DocumentActivity); SetTitle(Resource.String.scan_document); _textView = FindViewById <TextView>(Resource.Id.text_feedback); _textView.Text = ""; _scanView = FindViewById <DocumentScanView>(Resource.Id.document_scan_view); _imageViewResult = FindViewById <ImageView>(Resource.Id.image_result); // clear image _imageViewResult.Click += ResultImage_Click; _scanView.SetConfigFromAsset("DocumentConfig.json"); // you can set the max output resolution of your image here so it will be scaled to a desired size //_scanView.SetMaxDocumentOutputResolution(new Java.Lang.Double(width), new Java.Lang.Double(height)); // you can limit the supported document ratios as follows: //Java.Lang.Double[] ratios = { new Java.Lang.Double(DocumentRatio.DinAxLandscape.Ratio), new Java.Lang.Double(DocumentRatio.DinAxPortrait.Ratio) }; //_scanView.SetDocumentRatios(ratios); _scanView.InitAnyline(MainActivity.LicenseKey, this); _scanView.CameraOpened += (s, e) => { Log.Debug(TAG, "Camera opened successfully. Frame resolution " + e.Width + " x " + e.Height); _scanView.StartScanning(); }; _scanView.CameraError += (s, e) => { Log.Error(TAG, "OnCameraError: " + e.Event.Message); }; }
protected override void OnCreate(Bundle bundle) { Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn); base.OnCreate(bundle); SetContentView(Resource.Layout.DocumentActivity); _scanView = FindViewById <DocumentScanView>(Resource.Id.document_scan_view); _imageViewResult = FindViewById <ImageView>(Resource.Id.image_result); _imageViewFull = FindViewById <ImageView>(Resource.Id.full_image); _scanView.SetConfigFromAsset("DocumentConfig.json"); _scanView.InitAnyline(MainActivity.LicenseKey, this); _scanView.CameraOpened += (s, e) => { Log.Debug(TAG, "Camera opened successfully. Frame resolution " + e.Width + " x " + e.Height); _scanView.StartScanning(); }; _scanView.CameraError += (s, e) => { Log.Error(TAG, "OnCameraError: " + e.Event.Message); }; }
protected override void OnResume() { base.OnResume(); _scanView.StartScanning(); }