public override View OnCreateView (LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle)
		{
			var frame = (FrameLayout)layoutInflater.Inflate(Resource.Layout.zxingscannerfragmentlayout, null);

			var layoutParams = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
							
			try
			{
				scanner = new ZXingSurfaceView (this.Activity, ScanningOptions, callback);
				frame.AddView(scanner, layoutParams);


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

					frame.AddView (zxingOverlay, layoutParams);
				}
				else if (CustomOverlayView != null)
				{
					frame.AddView(CustomOverlayView, layoutParams);
				}
			}
			catch (Exception ex)
			{
				Console.WriteLine ("Create Surface View Failed: " + ex);
			}
			return frame;
		}
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 += HandleCancelScan;
			OnAutoFocusRequested += HandleAutoFocus;
			OnTorchRequested += HandleTorchRequested;

		}
Exemplo n.º 3
0
        public override View OnCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle)
        {
            frame = (FrameLayout)layoutInflater.Inflate(ZXing.Net.Mobile.Resource.Layout.zxingscannerfragmentlayout, viewGroup, false);

            var layoutParams = GetChildLayoutParams();

            try
            {
                scanner = new ZXingSurfaceView(Activity, ScanningOptions, CustomOverlayView, CustomOverlayScanAreaView);

                frame.AddView(scanner, layoutParams);


                if (!UseCustomOverlayView)
                {
                    zxingOverlay            = new ZxingOverlayView(Activity);
                    zxingOverlay.TopText    = TopText ?? "";
                    zxingOverlay.BottomText = BottomText ?? "";

                    frame.AddView(zxingOverlay, layoutParams);
                }
                else if (CustomOverlayView != null)
                {
                    frame.AddView(CustomOverlayView, layoutParams);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Create Surface View Failed: " + ex);
            }

            Android.Util.Log.Debug(MobileBarcodeScanner.TAG, "ZXingScannerFragment->OnResume exit");

            return(frame);
        }
		public override void OnResume ()
		{
			base.OnResume ();

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

			try
			{
				scanner = new ZXingSurfaceView (this.Activity, ScanningOptions, Callback);

				frame.AddView(scanner, layoutParams);


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

					frame.AddView (zxingOverlay, layoutParams);
				}
				else if (CustomOverlayView != null)
				{
					frame.AddView(CustomOverlayView, layoutParams);
				}
			}
			catch (Exception ex)
			{
				Console.WriteLine ("Create Surface View Failed: " + ex);
			}
		}
        public override View OnCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle)
        {
            var frame = (FrameLayout)layoutInflater.Inflate(Resource.Layout.zxingscannerfragmentlayout, null);

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

            try
            {
                scanner = new ZXingSurfaceView(this.Activity, ScanningOptions, Callback);
                frame.AddView(scanner, layoutParams);


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

                    frame.AddView(zxingOverlay, layoutParams);
                }
                else if (CustomOverlayView != null)
                {
                    frame.AddView(CustomOverlayView, layoutParams);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Create Surface View Failed: " + ex);
            }
            return(frame);
        }
Exemplo n.º 6
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    += HandleCancelScan;
            OnAutoFocusRequested += HandleAutoFocus;
            OnTorchRequested     += HandleTorchRequested;
        }
Exemplo n.º 7
0
        public override void OnResume()
        {
            base.OnResume();

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

            layoutParams.Weight = 1;

            try
            {
                scanner = new ZXingSurfaceView(this.Activity, ScanningOptions, Callback);

                frame.AddView(scanner, layoutParams);


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

                    frame.AddView(zxingOverlay, layoutParams);
                }
                else if (CustomOverlayView != null)
                {
                    frame.AddView(CustomOverlayView, layoutParams);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Create Surface View Failed: " + ex);
            }
        }
Exemplo n.º 8
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)
			{
				Console.WriteLine("ZXING MOBILE: Using Default Overlay");

				zxingOverlay = new ZxingOverlayView (this);
				zxingOverlay.TopText = TopText;
				zxingOverlay.BottomText = BottomText;

				this.AddContentView (zxingOverlay, layoutParams);
			}
			else if (CustomOverlayView != null)
			{
				Console.WriteLine("ZXING MOBILE: Using Default Overlay");

				this.AddContentView(CustomOverlayView, layoutParams);
			}

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

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

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

		}
Exemplo n.º 9
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)
            {
                Console.WriteLine("ZXING MOBILE: Using Default Overlay");

                zxingOverlay            = new ZxingOverlayView(this);
                zxingOverlay.TopText    = TopText;
                zxingOverlay.BottomText = BottomText;

                this.AddContentView(zxingOverlay, layoutParams);
            }
            else if (CustomOverlayView != null)
            {
                Console.WriteLine("ZXING MOBILE: Using Default Overlay");

                this.AddContentView(CustomOverlayView, layoutParams);
            }

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

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

            OnTorchRequested += (bool on) => {
                this.SetTorch(on);
            };
        }
Exemplo n.º 10
0
        public override void OnResume()
        {
            base.OnResume();

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

            layoutParams.Weight = 1;

            try
            {
                scanner = new ZXingSurfaceView(this.Activity);

                frame.AddView(scanner, layoutParams);


                if (!UseCustomOverlayView)
                {
                    zxingOverlay            = new ZxingOverlayView(this.Activity);
                    zxingOverlay.TopText    = TopText ?? "";
                    zxingOverlay.BottomText = BottomText ?? "";

                    frame.AddView(zxingOverlay, layoutParams);
                }
                else if (CustomOverlayView != null)
                {
                    frame.AddView(CustomOverlayView, layoutParams);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Create Surface View Failed: " + ex);
            }

            Android.Util.Log.Debug(MobileBarcodeScanner.TAG, "ZXingScannerFragment->OnResume exit");


            if (scanImmediately)
            {
                scan();
            }
        }