protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.RegisterCamera); //ImageButton menu = FindViewById<ImageButton>(Resource.Id.Menu); imageview = FindViewById <ImageView>(Resource.Id.ImageView); layout = FindViewById <RelativeLayout>(Resource.Id.layout); changeCamera = FindViewById <ImageButton>(Resource.Id.ChangeCamera); takePhoto = FindViewById <ImageButton>(Resource.Id.TakePhoto); declinePhoto = FindViewById <ImageButton>(Resource.Id.DeclinePhoto); confirmPhoto = FindViewById <ImageButton>(Resource.Id.ConfirmPhoto); person = DataController.Instance().currentPerson; //menu.Click += OpenMenu; <--- for now, let's stay without menu for Register Camera changeCamera.Click += ChangeCameraFacing; takePhoto.Click += TakePhoto; declinePhoto.Click += DeclinePhoto; confirmPhoto.Click += ConfirmPhoto; // vvv hide the unwanted buttons declinePhoto.Visibility = ViewStates.Gone; confirmPhoto.Visibility = ViewStates.Gone; preview = FindViewById <CameraSourcePreview>(Resource.Id.preview); graphicOverlay = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay); CreateCameraSource(CameraFacing.Back); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Camera); ImageButton menu = FindViewById <ImageButton>(Resource.Id.Menu); ImageButton changeCamera = FindViewById <ImageButton>(Resource.Id.ChangeCamera); imageview = FindViewById <ImageView>(Resource.Id.ImageViewCamera); layout = FindViewById <RelativeLayout>(Resource.Id.layoutcamera); preview = FindViewById <CameraSourcePreview>(Resource.Id.preview); graphicOverlay = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay); loadingView = FindViewById <TextView>(Resource.Id.Loading); person = DataController.Instance().currentPerson; loadingView.Visibility = ViewStates.Gone; imageview.Visibility = ViewStates.Invisible; menu.Click += delegate(object sender, EventArgs e) { Intent i = new Intent(this, typeof(MenuActivity)); StartActivity(i); }; changeCamera.Click += delegate(object sender, EventArgs e) { if (cameraSource != null) { cameraSource.Release(); if (cameraSource.CameraFacing == CameraFacing.Back) { CreateCameraSource(CameraFacing.Front); } else { CreateCameraSource(CameraFacing.Back); } StartCameraSource(); } }; CreateCameraSource(CameraFacing.Back); DataController.Instance().openProfile = false; graphicOverlay.SetOnTouchListener(this); }
public FaceGraphic(GraphicOverlay overlay) : base(overlay) { var selectedColor = Color.Blue; mFacePositionPaint = new Paint() { Color = selectedColor }; mIdPaint = new Paint() { Color = selectedColor, TextSize = ID_TEXT_SIZE }; mBoxPaint = new Paint() { Color = selectedColor }; mBoxPaint.SetStyle(Paint.Style.Stroke); mBoxPaint.StrokeWidth = BOX_STROKE_WIDTH; }
public void Start(CameraSource cameraSource, GraphicOverlay overlay) { this.overlay = overlay; Start(cameraSource); }
public FaceDetection(GraphicOverlay overlay, CameraSource cameraSource = null) { mOverlay = overlay; mFaceGraphic = new FaceGraphic(overlay); mCameraSource = cameraSource; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.RegisterCamera); //ImageButton menu = FindViewById<ImageButton>(Resource.Id.Menu); changeCamera = FindViewById <ImageButton>(Resource.Id.ChangeCamera); takePhoto = FindViewById <ImageButton>(Resource.Id.TakePhoto); declinePhoto = FindViewById <ImageButton>(Resource.Id.DeclinePhoto); confirmPhoto = FindViewById <ImageButton>(Resource.Id.ConfirmPhoto); //menu.Click += OpenMenu; <--- for now, let's stay without menu for Register Camera changeCamera.Click += delegate(object sender, EventArgs e) { if (cameraSource != null) { cameraSource.Release(); if (cameraSource.CameraFacing == CameraFacing.Back) { CreateCameraSource(CameraFacing.Front); } else { CreateCameraSource(CameraFacing.Back); } StartCameraSource(); } }; takePhoto.Click += delegate(object sender, EventArgs e) { try { cameraSource.TakePicture(null, this); //cameraSource.Stop(); <--- just dont do it, dont stop it too early, he's to young to die and the whole program just goes nuts takePhoto.Visibility = ViewStates.Gone; changeCamera.Visibility = ViewStates.Gone; declinePhoto.Visibility = ViewStates.Visible; confirmPhoto.Visibility = ViewStates.Visible; } catch (Exception ex) { Toast.MakeText(ApplicationContext, "Error: " + ex.ToString(), ToastLength.Long).Show(); } }; declinePhoto.Click += DeclinePhoto; confirmPhoto.Click += delegate(object sender, EventArgs e) { if (DataController.Instance.SavePicture(bitmapPicture)) { Intent i = new Intent(this, typeof(CameraActivity)); if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Denied) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.Camera }, 10); } else { StartActivity(i); } } else { DeclinePhoto(null, null); Toast.MakeText(ApplicationContext, "Error: picture failed to be saved...", ToastLength.Long).Show(); } }; // vvv hide the unwanted buttons declinePhoto.Visibility = ViewStates.Gone; confirmPhoto.Visibility = ViewStates.Gone; preview = FindViewById <CameraSourcePreview>(Resource.Id.preview); graphicOverlay = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay); CreateCameraSource(CameraFacing.Back); }