public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.aspect_ratio: if (mCameraView != null && SupportFragmentManager.FindFragmentByTag(FRAGMENT_DIALOG) == null) { AspectRatio[] ratios = mCameraView.SupportedAspectRatios.ToArray(); AspectRatio currentRatio = mCameraView.AspectRatio; AspectRatioFragment.NewInstance(ratios, currentRatio).Show(SupportFragmentManager, FRAGMENT_DIALOG); } return(true); case Resource.Id.switch_flash: if (mCameraView != null) { mCurrentFlash = (mCurrentFlash + 1) % FLASH_OPTIONS.Length; item.SetTitle(FLASH_TITLES[mCurrentFlash]); item.SetIcon(FLASH_ICONS[mCurrentFlash]); mCameraView.Flash = FLASH_OPTIONS[mCurrentFlash]; } return(true); case Resource.Id.switch_camera: if (mCameraView != null) { int facing = mCameraView.Facing; mCameraView.Facing = facing == CameraView.FacingFront ? CameraView.FacingBack : CameraView.FacingFront; } return(true); } return(base.OnOptionsItemSelected(item)); }
public static AspectRatioFragment NewInstance(IList <AspectRatio> ratios, AspectRatio currentRatio) { AspectRatioFragment fragment = new AspectRatioFragment(); Bundle args = new Bundle(); args.PutParcelableArray(ARG_ASPECT_RATIOS, ratios.ToArray()); args.PutParcelable(ARG_CURRENT_ASPECT_RATIO, currentRatio); fragment.Arguments = args; return(fragment); }