コード例 #1
1
		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;
		}
コード例 #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;

		}
コード例 #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);
        }
コード例 #4
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);
			}
		}
コード例 #5
0
        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);
        }
コード例 #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;
        }
コード例 #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);
            }
        }
コード例 #8
0
ファイル: ZxingActivity.cs プロジェクト: GSerjo/Seminars
		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);
			};

		}
コード例 #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);
            };
        }
コード例 #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();
            }
        }