public static TrophyFragment newInstance(string trophyName, TrophyCameraActivity context) { TrophyFragment frag = new TrophyFragment(trophyName, context); return(frag); }
public CustomScrollListener(TrophyFragment trophyFragment) { this.trophyFragment = trophyFragment; }
public DialogCustom(TrophyFragment trophyFragment, DialogFragmentStyle theme) : base(trophyFragment.context, Resource.Style.AppThemepp) { this.trophyFragment = trophyFragment; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Window.SetFormat(Format.Translucent); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); fmanager = FragmentManager; Window.SetBackgroundDrawable(new ColorDrawable(Color.Black)); Bundle extras = Intent.Extras; if (extras != null) { TrophyName = extras.GetString("TrophyName"); } trophyFragment = TrophyFragment.newInstance(TrophyName, this); //trophyFragment.SetStyle(DialogFragmentStyle.Normal, Resource.Style.AppThemepp); trophyFragment.Show(fmanager, "fragment_edit_name"); trophyFragment.Cancelable = false; trophyFragment.OnCAptureClick += (Bitmap obj, LinearLayout linearButton) => { if (obj != null) { try { bitmaptrophy = obj; mCamera.TakePicture(null, null, mPreview); } catch (System.Exception ex) { trophyFragment.progressBarLL.Visibility = ViewStates.Gone; System.Console.WriteLine("Take Picture Exception:" + ex.ToString()); } } }; trophyFragment.ResetAcitivity += (bool obj) => { System.GC.Collect(); }; trophyFragment.BackPressEvent += (bool obj) => { trophyFragment.Dismiss(); Finish(); }; trophyFragment.ChangeCameraFace += (bool obj) => { if (previewing) { mCamera.StopPreview(); } //NB: if you don't release the current camera before switching, you app will crash mCamera.Release(); //swap the id of the camera to be used if (currentCameraId == Android.Hardware.Camera.CameraInfo.CameraFacingBack) { currentCameraId = Android.Hardware.Camera.CameraInfo.CameraFacingFront; IsFrontCamera = true; } else { currentCameraId = Android.Hardware.Camera.CameraInfo.CameraFacingBack; IsFrontCamera = false; } mCamera = Android.Hardware.Camera.Open((int)currentCameraId); SetCameraDisplayOrientation(this, (int)currentCameraId, mCamera); try { mCamera.SetPreviewDisplay(mPreview.mHolder); } catch (System.Exception exx) { System.Console.WriteLine("Exception Changeing Camera:" + exx.ToString()); } //Android.Hardware.Camera.Parameters parameters = mCamera.GetParameters(); //parameters.SetPreviewSize(mPreview.mPreviewSize.Width, mPreview.mPreviewSize.Height); //System.Console.WriteLine("Param mPreviewSize.Width:" + mPreview.mPreviewSize.Width + " mPreviewSize.height:" + mPreview.mPreviewSize.Height); //parameters.SetPictureSize(mPreview.mPreviewSize.Width, mPreview.mPreviewSize.Height); //parameters.JpegQuality = (100); //parameters.PictureFormat = (ImageFormat.Jpeg); //parameters.FocusMode = Android.Hardware.Camera.Parameters.FocusModeAuto; //if (parameters.IsZoomSupported) // parameters.Zoom = (0); //mCamera.SetParameters(parameters); //mCamera.StartPreview(); previewing = false; mPreview.Dispose(); mPreview = new Preview(this); SetContentView(mPreview); mPreview.PreviewCamera = mCamera; }; //numberOfCameras = Android.Hardware.Camera.NumberOfCameras; //// Find the ID of the default camera //Android.Hardware.Camera.CameraInfo cameraInfo = new Android.Hardware.Camera.CameraInfo(); //for (int i = 0; i < numberOfCameras; i++) //{ // Android.Hardware.Camera.GetCameraInfo(i, cameraInfo); // if (cameraInfo.Facing == CameraFacing.Back) // { // defaultCameraId = i; // } //} }