public CameraCaptureListener(Camera2BasicFragment owner) { if (owner == null) { throw new System.ArgumentNullException("owner"); } this.owner = owner; }
public CameraCaptureStillPictureSessionCallback(Camera2BasicFragment owner) { if (owner == null) { throw new System.ArgumentNullException("owner"); } this.owner = owner; }
public ImageAvailableListener(Camera2BasicFragment fragment) { if (fragment == null) { throw new System.ArgumentNullException(nameof(fragment)); } _owner = fragment; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar.Hide(); SetContentView(Resource.Layout.activity_camera); if (savedInstanceState == null) { FragmentManager.BeginTransaction().Replace(Resource.Id.container, Camera2BasicFragment.NewInstance()).Commit(); } }
private Intent CreateCameraIntent(StoreMediaOptions options, int id) { Intent pickerIntent = new Intent(this.context, typeof(CameraActivity)); pickerIntent.PutExtra(Camera2BasicFragment.ExtraId, id); pickerIntent.PutExtra(Camera2BasicFragment.ExtraPath, options.Directory); pickerIntent.PutExtra(Camera2BasicFragment.ExtraFilename, options.Name); pickerIntent.PutExtra(Camera2BasicFragment.ExtraCameraFacingDirection, Camera2BasicFragment.ToLensFacingInteger(this.CameraFacingDirection)); Tracer.Create(this).Debug("CreateCameraIntent: ExtraCameraFacingDirection={0}", Camera2BasicFragment.ToLensFacingInteger(this.CameraFacingDirection)); pickerIntent.SetFlags(ActivityFlags.NewTask); return(pickerIntent); }
public ImageAvailableListener(Camera2BasicFragment fragment, File file) { if (fragment == null) { throw new System.ArgumentNullException("fragment"); } if (file == null) { throw new System.ArgumentNullException("file"); } owner = fragment; this.file = file; }
public ImageSaver(Image image, File file, Camera2BasicFragment fragment) { if (image == null) { throw new System.ArgumentNullException("image"); } if (file == null) { throw new System.ArgumentNullException("file"); } mImage = image; mFile = file; owner = fragment; }
public static void addImageToGallery(File filePath, Context context, Camera2BasicFragment owner) { try { var fileName = System.IO.Path.GetFileName(filePath.Path); var publicUri = MainActivity.GetOutputMediaFile(context, null, null); if (publicUri == null) { owner.ShowToast("File could not be saved. Please grant permission to write to external storage."); return; } using (System.IO.Stream input = System.IO.File.OpenRead(filePath.Path)) using (System.IO.Stream output = System.IO.File.Create(publicUri.Path)) input.CopyTo(output); var f = new Java.IO.File(publicUri.Path); Android.Media.MediaScannerConnection.ScanFile(context, new[] { f.AbsolutePath }, null, context as MainActivity); ContentValues values = new ContentValues(); values.Put(MediaStore.Images.Media.InterfaceConsts.Title, System.IO.Path.GetFileNameWithoutExtension(f.AbsolutePath)); values.Put(MediaStore.Images.Media.InterfaceConsts.Description, string.Empty); values.Put(MediaStore.Images.Media.InterfaceConsts.DateTaken, Java.Lang.JavaSystem.CurrentTimeMillis()); values.Put(MediaStore.Images.ImageColumns.BucketId, f.ToString().ToLowerInvariant().GetHashCode()); values.Put(MediaStore.Images.ImageColumns.BucketDisplayName, f.Name.ToLowerInvariant()); values.Put("_data", f.AbsolutePath); var cr = context.ContentResolver; var uri = cr.Insert(MediaStore.Images.Media.ExternalContentUri, values); var contentUri = uri; var mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile, contentUri); mediaScanIntent.SetData(contentUri); context.SendBroadcast(mediaScanIntent); } catch (Exception) { // Console.WriteLine("Unable to save to scan file: " + ex1); } }
public Camera2BasicSurfaceTextureListener(Camera2BasicFragment owner) { Owner = owner; }
public CameraCaptureSessionCallback(Camera2BasicFragment owner) { Owner = owner; }
public CameraCaptureStillPictureSessionCallback(Camera2BasicFragment owner, TesseractScanModule module) { Owner = owner; scanModule = module; }