コード例 #1
0
ファイル: MainFragment.cs プロジェクト: sk8tz/Xamarin-Cropper
 /**
  * Set the options of the crop image view to the given values.
  */
 public void setCropImageViewOptions(CropImageViewOptions options)
 {
     mCropImageView.SetScaleType(options.scaleType);
     mCropImageView.SetCropShape(options.cropShape);
     mCropImageView.SetGuidelines(options.guidelines);
     mCropImageView.SetAspectRatio((int)options.aspectRatio.First, (int)options.aspectRatio.Second);
     mCropImageView.SetFixedAspectRatio(options.fixAspectRatio);
     mCropImageView.ShowCropOverlay = options.showCropOverlay;
     mCropImageView.ShowProgressBar = options.showProgressBar;
     mCropImageView.AutoZoomEnabled = options.autoZoomEnabled;
     mCropImageView.MaxZoom         = options.maxZoomLevel;
 }
コード例 #2
0
 public void SetCropImageViewOptions(CropImageViewOptions options)
 {
     mCropImageView.SetScaleType(options.scaleType);
     mCropImageView.SetCropShape(options.cropShape);
     mCropImageView.SetGuidelines(options.guidelines);
     mCropImageView.SetAspectRatio(options.aspectRatio.Item1, options.aspectRatio.Item2);
     mCropImageView.SetFixedAspectRatio(options.fixAspectRatio);
     mCropImageView.SetMultiTouchEnabled(options.multitouch);
     mCropImageView.ShowCropOverlay     = (options.showCropOverlay);
     mCropImageView.ShowProgressBar     = (options.showProgressBar);
     mCropImageView.AutoZoomEnabled     = (options.autoZoomEnabled);
     mCropImageView.MaxZoom             = (options.maxZoomLevel);
     mCropImageView.FlippedHorizontally = (options.flipHorizontally);
     mCropImageView.FlippedVertically   = (options.flipVertically);
 }
コード例 #3
0
ファイル: MainFragment.cs プロジェクト: sk8tz/Xamarin-Cropper
        public void updateCurrentCropViewOptions()
        {
            CropImageViewOptions options = new CropImageViewOptions();

            options.scaleType       = mCropImageView.GetScaleType();
            options.cropShape       = mCropImageView.GetCropShape();
            options.guidelines      = mCropImageView.GetGuidelines();
            options.aspectRatio     = mCropImageView.AspectRatio;
            options.fixAspectRatio  = mCropImageView.IsFixAspectRatio;
            options.showCropOverlay = mCropImageView.ShowCropOverlay;
            options.showProgressBar = mCropImageView.ShowProgressBar;
            options.autoZoomEnabled = mCropImageView.AutoZoomEnabled;
            options.maxZoomLevel    = mCropImageView.MaxZoom;
            ((MainActivity)Activity).setCurrentOptions(options);
        }
コード例 #4
0
        public void UpdateCurrentCropViewOptions()
        {
            CropImageViewOptions options = new CropImageViewOptions();

            options.scaleType        = mCropImageView.GetScaleType();
            options.cropShape        = mCropImageView.GetCropShape();
            options.guidelines       = mCropImageView.GetGuidelines();
            options.aspectRatio      = new System.Tuple <int, int>((int)mCropImageView.AspectRatio.First, (int)mCropImageView.AspectRatio.Second);
            options.fixAspectRatio   = mCropImageView.IsFixAspectRatio;
            options.showCropOverlay  = mCropImageView.ShowCropOverlay;
            options.showProgressBar  = mCropImageView.ShowProgressBar;
            options.autoZoomEnabled  = mCropImageView.AutoZoomEnabled;
            options.maxZoomLevel     = mCropImageView.MaxZoom;
            options.flipHorizontally = mCropImageView.FlippedHorizontally;
            options.flipVertically   = mCropImageView.FlippedVertically;
            ((MainActivity)Activity).SetCurrentOptions(options);
        }
コード例 #5
0
        private void updateDrawerTogglesByOptions(CropImageViewOptions options)
        {
            ((TextView)FindViewById(Resource.Id.drawer_option_toggle_scale)).Text             = Resources.GetString(Resource.String.drawer_option_toggle_scale, options.scaleType.Name());
            ((TextView)FindViewById(Resource.Id.drawer_option_toggle_shape)).Text             = Resources.GetString(Resource.String.drawer_option_toggle_shape, options.cropShape.Name());
            ((TextView)FindViewById(Resource.Id.drawer_option_toggle_guidelines)).Text        = Resources.GetString(Resource.String.drawer_option_toggle_guidelines, options.guidelines.Name());
            ((TextView)FindViewById(Resource.Id.drawer_option_toggle_show_overlay)).Text      = Resources.GetString(Resource.String.drawer_option_toggle_show_overlay, options.showCropOverlay.ToString());
            ((TextView)FindViewById(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.First + ":" + options.aspectRatio.Second;
            }
            ((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);
        }
コード例 #6
0
 public void setCurrentOptions(CropImageViewOptions options)
 {
     mCropImageViewOptions = options;
     updateDrawerTogglesByOptions(options);
 }