protected internal override void onResume() { base.onResume(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!checkRequiredFeatures()) { return; } mSCameraManager = mSCamera.SCameraManager; mTextureView = (AutoFitTextureView)findViewById(R.id.texture); // Set SurfaceTextureListener that handle life cycle of TextureView mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this); findViewById(R.id.picture).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); startBackgroundThread(); openCamera(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _popper = Mvx.Resolve <IPopperService>(); _dialogService = Mvx.Resolve <IDialog>(); SetContentView(Resource.Layout.DisplayView); Toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); if (Toolbar != null) { SetSupportActionBar(Toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); } _textureView = FindViewById <AutoFitTextureView>(Resource.Id.texture_view); _imageView = FindViewById <ImageView>(Resource.Id.image_view); _loadingSpinner = FindViewById <ProgressBar>(Resource.Id.progressBar1); var set = this.CreateBindingSet <DisplayView, DisplayViewModel>(); set.Bind(this).For(v => v.MediaUrl).To(vm => vm.MediaUrl); set.Apply(); }
public CameraDroid(Context context) : base(context) { _context = context; var inflater = LayoutInflater.FromContext(context); if (inflater == null) { return; } var view = inflater.Inflate(Resource.Layout.CameraLayout, this); _cameraTexture = view.FindViewById <AutoFitTextureView>(Resource.Id.CameraTexture); _faceDetectBoundsView = view.FindViewById <FaceBoundsView>(Resource.Id.FaceDetectBounds); _cameraTexture.SurfaceTextureListener = this; _cameraStateListener = new CameraStateListener { Camera = this }; _cameraCaptureListener = new CameraCaptureListener(this); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { TextureView = (AutoFitTextureView)view.FindViewById(Resource.Id.texture); buttonVideo = (Button)view.FindViewById(Resource.Id.video); buttonVideo.SetOnClickListener(this); TextureView.KeepScreenOn = true; view.FindViewById(Resource.Id.info).SetOnClickListener(this); }
protected async override void OnElementChanged(ElementChangedEventArgs <CameraPreview> e) { if (Xamarin.Forms.DesignMode.IsDesignModeEnabled) { return; } if (e.OldElement != null) // Clear old element event { } if (e.NewElement != null) { await RequestCameraPermission.RequestPermissionsAsync(); e.NewElement.StartRecording = (() => { TakePicture(); }); e.NewElement.StopRecording = (() => { CloseCamera(); }); if (Control == null) { Activity = this.Context as Activity; frameLayout = new FrameLayout(Context); frameLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent); autoFitTextureView = new AutoFitTextureView(Context); autoFitTextureView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent); frameLayout.AddView(autoFitTextureView); SetNativeControl(frameLayout); } mTextureView = Control.GetChildAt(0) as AutoFitTextureView; mStateCallback = new CameraStateListener(this); mSurfaceTextureListener = new Camera2BasicSurfaceTextureListener(this, autoFitTextureView); //mFile = new File(Activity.GetExternalFilesDir(null), $"{Element.Filename}.jpg"); //var path = System.IO.Path.Combine( // System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), // $"{Element.Filename}" //); string pathyo = DependencyService.Get <IMediaFolder>().Path; var path = System.IO.Path.Combine( pathyo, Element.Filename); mFile = new File( path ); mCaptureCallback = new CameraCaptureListener(this); mOnImageAvailableListener = new ImageAvailableListener(this, mFile); StartTheCamera(); } base.OnElementChanged(e); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { mTextureView = (AutoFitTextureView)view.FindViewById(Resource.Id.texture); view.FindViewById(Resource.Id.takePictureBtn).SetOnClickListener(this); CameraActivity thisAct = ((CameraActivity)Activity); thisAct.LoadIfPhotoMatch(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); SetContentView(Resource.Layout.VideoRecorderLayout); imgThumbnail = FindViewById <ImageView>(Resource.Id.imgThumbnail); imgUpload = FindViewById <ImageView>(Resource.Id.imgUpload); imgSwitchCamera = FindViewById <ImageView>(Resource.Id.imgSwitchCamera); imgPlayPauseMedia = FindViewById <ImageView>(Resource.Id.imgPlayPauseMedia); txtStop = FindViewById <TextView>(Resource.Id.txtStop); txtTime = FindViewById <TextView>(Resource.Id.txtTime); framePlayPause = FindViewById <FrameLayout>(Resource.Id.framePlayPause); mainFrame = FindViewById <FrameLayout>(Resource.Id.mainFrame); imgAudio = FindViewById <ImageView>(Resource.Id.imgAudio); textureView = FindViewById <AutoFitTextureView>(Resource.Id.texture); framePlayPause.Click += FramePlayPause_Click; txtStop.Click += TxtStop_Click; imgUpload.Click += ImgUpload_Click; txtTime.Text = "00:30"; UserResponseType = (UserResponse)this.Intent.GetIntExtra("UserResponseType", 0); videoId = this.Intent.GetStringExtra("videoId"); VideoManager = new RecordResponseManager(this, UserResponseType); if (UserResponseType == UserResponse.Video) { imgAudio.Visibility = ViewStates.Gone; mainFrame.SetBackgroundResource(Resource.Color.gnt_black); VideoManager.StartBackgroundThread(); if (textureView.IsAvailable) { VideoManager.openCamera(textureView.Width, textureView.Height, VideoManager.LensFacing); } else { textureView.SurfaceTextureListener = VideoManager.surfaceTextureListener; } imgSwitchCamera.Click += ImgSwitchCamera_Click; textureView.Visibility = ViewStates.Visible; imgSwitchCamera.Visibility = ViewStates.Visible; } else { textureView.Visibility = ViewStates.Gone; imgSwitchCamera.Visibility = ViewStates.Gone; imgAudio.Visibility = ViewStates.Visible; mainFrame.SetBackgroundResource(Resource.Color.gnt_white); } var pathStr = VideoManager.GetFilePath(); }
public Camera2BasicSurfaceTextureListener(ICamera2Basic owner, AutoFitTextureView textureView) { if (owner == null) { throw new System.ArgumentNullException("owner"); } this.owner = owner; _textureView = textureView; skippedFirstFrame = false; }
/// <summary> /// Prepares an UI, like button, dialog, etc. /// </summary> private void createUI() { mPictureButton = (Button)findViewById(R.id.picture); mPictureButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); mTextureView = (AutoFitTextureView)findViewById(R.id.texture); mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this); mPanoramaPreview = (ImageView)findViewById(R.id.panorama_preview); mPanoramaRectView = (RectView)findViewById(R.id.panorama_rect); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { this.autoFitTextureView = (AutoFitTextureView)view.FindViewById(Resource.Id.texture); this.autoFitTextureView.SurfaceTextureListener = this.mSurfaceTextureListener; var takePictureButton = view.FindViewById(Resource.Id.takePictureButton); takePictureButton.Click += this.TakePictureButtonOnClick; var switchCameraButton = view.FindViewById(Resource.Id.switchCameraButton); switchCameraButton.Click += this.SwitchCameraButtonOnClick; }
protected override void OnElementChanged(ElementChangedEventArgs <CameraPreview> e) { if (Xamarin.Forms.DesignMode.IsDesignModeEnabled) { return; } if (e.OldElement != null) //// Clear old element event { } this.element = e.NewElement; if (element == null) { return; } element.TakePicture = () => { return(TakePictureAsync()); }; if (Control == null) { Activity = this.Context as Activity; SetNativeControl(new FrameLayout(Context)); } mFrameLayout = Control as FrameLayout; mTextureView = new AutoFitTextureView(Context); mFrameLayout.AddView(mTextureView); mStateCallback = new CameraStateListener(this); mSurfaceTextureListener = new CameraSurfaceTextureListener(this); mOnImageAvailableListener = new ImageAvailableListener(this); if (element.EnableTensorflowAnalysis) { mOnImageAvailableListener.EnableTensorflowAnalysis(); } StartTheCamera(); base.OnElementChanged(e); }
/// <summary> /// Prepares an UI, like button, etc. /// </summary> private void createUI() { ArrayAdapter <VideoParameter> videoParameterArrayAdapter = new ArrayAdapter <VideoParameter>(this, android.R.layout.simple_spinner_item, mVideoParameterList); mVideoSpinner = (Spinner)findViewById(R.id.videolist); mVideoSpinner.Adapter = videoParameterArrayAdapter; mVideoSpinner.OnItemSelectedListener = this; mVideoParameter = mVideoParameterList[0]; mVideoSpinner.Selection = 0; mRecordButton = (Button)findViewById(R.id.record); mRecordButton.Enabled = true; mRecordButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); mTextureView = (AutoFitTextureView)findViewById(R.id.texture); // Set SurfaceTextureListener that handle life cycle of TextureView mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this); }
public XCameraCaptureView(Context context, CameraOptions option) : base(context) { cameraOption = option; // TODO Move to Initialize mStateCallback = new CameraStateListener(this); mSurfaceTextureListener = new Camera2BasicSurfaceTextureListener(this); // fill ORIENTATIONS list ORIENTATIONS.Append((int)SurfaceOrientation.Rotation0, 90); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation90, 0); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation180, 270); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation270, 180); mTextureView = new AutoFitTextureView(context); AddView(mTextureView); var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); File = new File(path, "pic.jpg"); CaptureCallback = new CameraCaptureListener(this); mOnImageAvailableListener = new ImageAvailableListener(this); }
protected internal override void onResume() { base.onResume(); // initialize SCamera mSCamera = new SCamera(); try { mSCamera.initialize(this); } catch (SsdkUnsupportedException) { showAlertDialog("Fail to initialize SCamera.", true); return; } if (!checkRequiredFeatures()) { return; } mSCameraManager = mSCamera.SCameraManager; mTextureView = (AutoFitTextureView) findViewById(R.id.texture); // Set SurfaceTextureListener that handle life cycle of TextureView mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this); findViewById(R.id.picture).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); startBackgroundThread(); openCamera(); }
public override void OnViewCreated (View view, Bundle savedInstanceState) { mTextureView = (AutoFitTextureView)view.FindViewById (Resource.Id.texture); mTextureView.SurfaceTextureListener = mSurfaceTextureListener; view.FindViewById (Resource.Id.picture).SetOnClickListener (this); view.FindViewById (Resource.Id.info).SetOnClickListener (this); }
/// <summary> /// Prepares an UI, like button, dialog, etc. /// </summary> private void createUI() { mSettingDialog = new SettingDialog(this); mSettingDialog.OnCaptureRequestUpdatedListener = this; findViewById(R.id.picture).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); findViewById(R.id.setting).setOnClickListener(new OnClickListenerAnonymousInnerClassHelper2(this)); findViewById(R.id.info).OnClickListener = new OnClickListenerAnonymousInnerClassHelper3(this); mTextureView = (AutoFitTextureView) findViewById(R.id.texture); mFaceRectView = (FaceRectView) findViewById(R.id.face); // Set SurfaceTextureListener that handle life cycle of TextureView mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { mTextureView = (AutoFitTextureView)view.FindViewById(Resource.Id.texture); view.FindViewById(Resource.Id.scanner).SetOnClickListener(this); view.FindViewById(Resource.Id.info).SetOnClickListener(this); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { mTextureView = (AutoFitTextureView)view.FindViewById(Resource.Id.textureVw); }
/// <summary> /// Prepares an UI, like button, dialog, etc. /// </summary> private void createUI() { Button button = (Button) findViewById(R.id.picture); button.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); mTextureView = (AutoFitTextureView) findViewById(R.id.texture); // Set SurfaceTextureListener that handle life cycle of TextureView mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this); }