Exemplo n.º 1
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			this.RequestWindowFeature (WindowFeatures.NoTitle);

			this.Window.AddFlags (WindowManagerFlags.Fullscreen); //to show
			this.Window.AddFlags (WindowManagerFlags.KeepScreenOn); //Don't go to sleep while scanning

			scanner = new ZxingSurfaceView (this, ScanningOptions);
			SetContentView (scanner);

			var layoutParams = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);

			if (!UseCustomView)
			{
				zxingOverlay = new ZxingOverlayView (this);
				zxingOverlay.TopText = TopText;
				zxingOverlay.BottomText = BottomText;

				this.AddContentView (zxingOverlay, layoutParams);
			}
			else if (CustomOverlayView != null)
			{
				this.AddContentView(CustomOverlayView, layoutParams);
			}

			OnCancelRequested += () => {
				this.CancelScan();
			};

			OnAutoFocusRequested += () => {
				this.AutoFocus();
			};

			OnTorchRequested += (bool on) => {
				this.SetTorch(on);
			};

		}
Exemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            this.RequestWindowFeature(WindowFeatures.NoTitle);

            this.Window.AddFlags(WindowManagerFlags.Fullscreen);              //to show
            this.Window.AddFlags(WindowManagerFlags.KeepScreenOn);            //Don't go to sleep while scanning

            scanner = new ZxingSurfaceView(this, ScanningOptions);
            SetContentView(scanner);

            var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);

            if (!UseCustomView)
            {
                zxingOverlay            = new ZxingOverlayView(this);
                zxingOverlay.TopText    = TopText;
                zxingOverlay.BottomText = BottomText;

                this.AddContentView(zxingOverlay, layoutParams);
            }
            else if (CustomOverlayView != null)
            {
                this.AddContentView(CustomOverlayView, layoutParams);
            }

            OnCancelRequested += () => {
                this.CancelScan();
            };

            OnAutoFocusRequested += () => {
                this.AutoFocus();
            };

            OnTorchRequested += (bool on) => {
                this.SetTorch(on);
            };
        }