protected override void OnPause() { base.OnPause (); if(handler != null) { handler.QuitSynchronously(); handler = null; } CameraManager.Get().CloseDriver(); }
protected virtual void OnCreate(Bundle bundle, RedLaserSettings settings) { base.OnCreate (bundle); this.settings = settings; StatusManager.Initialize(this); Log.Debug(TAG, "Starting capture activity"); var window = Window; window.AddFlags(WindowManagerFlags.KeepScreenOn); this.mBarcodeScanLayout = new BarcodeScanLayout(this, this.settings.HoldStill, this.settings.AlignBarcode); SetContentView(this.mBarcodeScanLayout); var metrics = new DisplayMetrics(); WindowManager.DefaultDisplay.GetMetrics(metrics); this.mWidth = metrics.WidthPixels; this.mHeight = metrics.HeightPixels; this.mDensity = metrics.Density; var logo = new ImageView(this); logo.SetScaleType(ImageView.ScaleType.Matrix); logo.SetImageResource(LogoResource); var matrix = new Matrix(); matrix.PostRotate(270.0f); if(mWidth < mHeight) { var temp = mWidth; mWidth = mHeight; mHeight = temp; } var offset = 0; if(mDensity == 1.0f) { offset = 100; } matrix.PostTranslate((float)(mWidth / 2.0d + mWidth / 8 * mDensity) + offset, (float)(mHeight / 2.80 + 160.0f * mDensity)); logo.ImageMatrix = matrix; CameraManager.Init(Application); viewfinderView = mBarcodeScanLayout.ViewFinderView; handler = null; hasSurface = false; }