Exemple #1
0
 /**
  * Set the options of the crop image view to the given values.
  */
 public void SetCropImageViewOptions(CropImageViewOptions options)
 {
     _cropImageView.SetScaleType(options.ScaleType);
     _cropImageView.SetCropShape(options.CropShape);
     _cropImageView.SetGuidelines(options.Guidelines);
     _cropImageView.SetAspectRatio(options.AspectRatio.AspectRatioX, options.AspectRatio.AspectRatioY);
     _cropImageView.SetFixedAspectRatio(options.FixAspectRatio);
     _cropImageView.SetMultiTouchEnabled(options.Multitouch);
     _cropImageView.ShowCropOverlay     = options.ShowCropOverlay;
     _cropImageView.ShowProgressBar     = options.ShowProgressBar;
     _cropImageView.AutoZoomEnabled     = options.AutoZoomEnabled;
     _cropImageView.MaxZoom             = options.MaxZoomLevel;
     _cropImageView.FlippedHorizontally = options.FlipHorizontally;
     _cropImageView.FlippedVertically   = options.FlipVertically;
 }
Exemple #2
0
        public void UpdateCurrentCropViewOptions()
        {
            CropImageViewOptions options = new CropImageViewOptions();

            options.ScaleType        = _cropImageView.GetScaleType();
            options.CropShape        = _cropImageView.GetCropShape();
            options.Guidelines       = _cropImageView.GetGuidelines();
            options.AspectRatio      = ((int)_cropImageView.AspectRatio.First, (int)_cropImageView.AspectRatio.Second);
            options.FixAspectRatio   = _cropImageView.IsFixAspectRatio;
            options.ShowCropOverlay  = _cropImageView.ShowCropOverlay;
            options.ShowProgressBar  = _cropImageView.ShowProgressBar;
            options.AutoZoomEnabled  = _cropImageView.AutoZoomEnabled;
            options.MaxZoomLevel     = _cropImageView.MaxZoom;
            options.FlipHorizontally = _cropImageView.FlippedHorizontally;
            options.FlipVertically   = _cropImageView.FlippedVertically;
            ((MainActivity)Activity).SetCurrentOptions(options);
        }
        private void UpdateDrawerTogglesByOptions(CropImageViewOptions options)
        {
            FindViewById <TextView>(Resource.Id.drawer_option_toggle_scale).Text             = Resources.GetString(Resource.String.drawer_option_toggle_scale, options.ScaleType.Name());
            FindViewById <TextView>(Resource.Id.drawer_option_toggle_shape).Text             = Resources.GetString(Resource.String.drawer_option_toggle_shape, options.CropShape.Name());
            FindViewById <TextView>(Resource.Id.drawer_option_toggle_guidelines).Text        = Resources.GetString(Resource.String.drawer_option_toggle_guidelines, options.Guidelines.Name());
            FindViewById <TextView>(Resource.Id.drawer_option_toggle_multitouch).Text        = Resources.GetString(Resource.String.drawer_option_toggle_multitouch, options.Multitouch.ToString());
            FindViewById <TextView>(Resource.Id.drawer_option_toggle_show_overlay).Text      = Resources.GetString(Resource.String.drawer_option_toggle_show_overlay, options.ShowCropOverlay.ToString());
            FindViewById <TextView>(Resource.Id.drawer_option_toggle_show_progress_bar).Text = Resources.GetString(Resource.String.drawer_option_toggle_show_progress_bar, options.ShowProgressBar.ToString());

            var aspectRatio = "FREE";

            if (options.FixAspectRatio)
            {
                aspectRatio = options.AspectRatio.AspectRatioX + ":" + options.AspectRatio.AspectRatioY;
            }
            ((TextView)FindViewById(Resource.Id.drawer_option_toggle_aspect_ratio)).Text = Resources.GetString(Resource.String.drawer_option_toggle_aspect_ratio, aspectRatio);

            ((TextView)FindViewById(Resource.Id.drawer_option_toggle_auto_zoom)).Text = Resources.GetString(Resource.String.drawer_option_toggle_auto_zoom, options.AutoZoomEnabled ? "Enabled" : "Disabled");
            ((TextView)FindViewById(Resource.Id.drawer_option_toggle_max_zoom)).Text  = Resources.GetString(Resource.String.drawer_option_toggle_max_zoom, options.MaxZoomLevel);
        }
 public void SetCurrentOptions(CropImageViewOptions options)
 {
     _cropImageViewOptions = options;
     UpdateDrawerTogglesByOptions(options);
 }