public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); presentController = GetVisibleViewController(); imageEditor = new SfImageEditor(new CGRect(View.Frame.Location.X, 60, View.Frame.Size.Width, View.Frame.Size.Height - 60)); imageEditor.SetToolbarItemVisibility("text,transform,shape,path,effects", false); CustomViewItems = new List<ToolbarItem>() { new CustomToolbarItem(){ CustomName = "Typogy1",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy1.png"),IconHeight=70 }, new CustomToolbarItem(){CustomName = "Typogy2",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy2.png"),IconHeight=70 }, new CustomToolbarItem(){CustomName = "Typogy3",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy3.png"),IconHeight=70 }, new CustomToolbarItem(){CustomName = "Typogy4",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy4.png"),IconHeight=70 }, new CustomToolbarItem(){CustomName = "Typogy5",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy5.png"),IconHeight=70 }, new CustomToolbarItem(){CustomName = "Typogy6",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy6.png"),IconHeight=70 }, }; // Add the custom tool bar items var item1 = new FooterToolbarItem() { Text = "Add", Icon = UIImage.FromBundle("Images/ImageEditor/AddIcon.png"), SubItems = CustomViewItems, TextHeight = 20, }; var item2 = new FooterToolbarItem() { Text = "Replace", Icon = UIImage.FromBundle("Images/ImageEditor/ReplaceIcon.png"), SubItems = CustomViewItems, TextHeight = 20 }; var item3 = new FooterToolbarItem() { Icon = UIImage.FromBundle("Images/ImageEditor/BringFrontIcon"), Text = "Bring Front", TextHeight = 20 }; var item4 = new FooterToolbarItem() { Icon = UIImage.FromBundle("Images/ImageEditor/SendBack"), Text = "Send Back", TextHeight = 20 }; imageEditor.ToolBarSettings.ToolbarItems.Add(item1); imageEditor.ToolBarSettings.ToolbarItems.Add(item2); imageEditor.ToolBarSettings.ToolbarItems.Add(item3); imageEditor.ToolBarSettings.ToolbarItems.Add(item4); imageEditor.ToolBarSettings.SubItemToolbarHeight = 70; imageEditor.ItemSelected += ImageEditor_ItemSelected; imageEditor.ToolBarSettings.ToolbarItemSelected += OnToolbarItemSelected; imageEditor.Image = image; this.View.AddSubview(imageEditor); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); editor = new SfImageEditor(new CGRect(View.Frame.Location.X, 60, View.Frame.Size.Width, View.Frame.Size.Height - 60)); editor.ImageLoaded += Editor_ImageLoaded; editor.Image = editorImage; this.View.AddSubview(editor); editor.ToolBarSettings.ToolbarItems.Add(new FooterToolbarItem() { Text = "Crop" }); editor.SetToolbarItemVisibility("Text, Shape, Brightness, Effects, Bradley Hand, Path, 3:1, 3:2, 4:3, 5:4, 16:9, Undo, Redo, Transform", false); editor.ImageSaving += Editor_ImageSaving; editor.ToolBarSettings.ToolbarItemSelected += ToolBarSettings_ToolbarItemSelected; }
protected override void OnCreate(Bundle savedInstanceState) { imageEditor = new SfImageEditor(this); imageEditor.ToolbarSettings.ToolbarItemSelected += OnToolbarItemSelected; imageEditor.ImageSaving += ImageEditor_ImageSaving; imageEditor.ImageLoaded += ImageEditor_ImageLoaded; Android.Graphics.Drawables.BitmapDrawable bd = (Android.Graphics.Drawables.BitmapDrawable)ProfileEditor.ImageView.Drawable; imageEditor.Bitmap = bd.Bitmap; SetContentView(imageEditor); base.OnCreate(savedInstanceState); imageEditor.SetToolbarItemVisibility("Text, Shape, Brightness, Effects, Bradley Hand, Path, 3:1, 3:2, 4:3, 5:4, 16:9, Undo, Redo, Transform", false); // Add the custom tool bar items var item = new FooterToolbarItem() { Text = "Crop", TextHeight = 20, }; imageEditor.ToolbarSettings.ToolbarItems.Add(item); }
protected override void OnCreate(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.From(this); view = layoutInflater.Inflate(Resource.Layout.editorSavePopup, null); popipView = view.FindViewById <LinearLayout>(Resource.Id.editorPopUp); var deviceDensity = (int)this.Resources.DisplayMetrics.Density; popipView.Visibility = ViewStates.Invisible; var SaveButton = view.FindViewById <Button>(Resource.Id.Savebutton); var CancelButton = view.FindViewById <Button>(Resource.Id.Cancelbutton); entry = view.FindViewById <EditText>(Resource.Id.editTextDialogUserInput); SaveButton.Click += SaveButton_Click; CancelButton.Click += CancelButton_Click; imm = (InputMethodManager)GetSystemService(Context.InputMethodService); if (IsTabletDevice(this)) { height = 150; } else { height = 200 * deviceDensity; } var Params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent - 100, height, GravityFlags.CenterHorizontal); Params.SetMargins(0, 300, 0, 0); popipView.LayoutParameters = Params; FrameLayout mainLayout = new FrameLayout(this); var tParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent, GravityFlags.Fill); mainLayout.SetBackgroundColor(Color.Transparent); editor = new SfImageEditor(this); DelayActionAsync(500, LoadStreamToEditor); editor.ImageSaving += Editor_ImageSaving; base.OnCreate(savedInstanceState); editor.SetToolbarItemVisibility("save", false); HeaderToolbarItem item1 = new HeaderToolbarItem(); item1.Text = "Save"; editor.SetBackgroundColor(Color.White); editor.ToolbarSettings.ToolbarItems.Add(item1); editor.ToolbarSettings.ToolbarItemSelected += (sender, e) => { if (e.ToolbarItem is HeaderToolbarItem) { var text = (e.ToolbarItem as HeaderToolbarItem).Text; if (text == "Save") { if (Serialization.SelectedItem.Name == "CreateNew") { overView.Visibility = ViewStates.Visible; popipView.Visibility = ViewStates.Visible; } else { editor.Save(); } } } }; overView = new FrameLayout(this); var overViewParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent, GravityFlags.Fill); overView.LayoutParameters = overViewParams; overView.Alpha = 0.5f; overView.Visibility = ViewStates.Invisible; overView.SetBackgroundColor(Color.Black); mainLayout.AddView(editor); mainLayout.AddView(overView); mainLayout.AddView(popipView); SetContentView(mainLayout); }
protected override void OnCreate(Bundle savedInstanceState) { imageEditor = new SfImageEditor(this); var bitmap = BitmapFactory.DecodeResource(Resources, ImageEditorCustomView.Image); imageEditor.Bitmap = bitmap; imageEditor.ItemSelected += ImageEditor_ItemSelected; SetContentView(imageEditor); base.OnCreate(savedInstanceState); imageEditor.SetToolbarItemVisibility("text,transform,shape,path,effects", false); CustomViewItems = new List <ToolbarItem>() { new CustomToolbarItem() { Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy1), CustomName = "ITypogy1", IconHeight = 70 }, new CustomToolbarItem() { Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy2), CustomName = "ITypogy2", IconHeight = 70 }, new CustomToolbarItem() { Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy3), CustomName = "ITypogy3", IconHeight = 70 }, new CustomToolbarItem() { Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy4), CustomName = "ITypogy4", IconHeight = 70 }, new CustomToolbarItem() { Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy5), CustomName = "ITypogy5", IconHeight = 70 }, new CustomToolbarItem() { Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy6), CustomName = "ITypogy6", IconHeight = 70 } }; // Add the custom tool bar items var item = new FooterToolbarItem() { Text = "Add", Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.AddIcon), SubItems = CustomViewItems, TextHeight = 20, }; imageEditor.ToolbarSettings.ToolbarItems.Add(item); item = new FooterToolbarItem() { Text = "Replace", Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ReplaceIcon), SubItems = CustomViewItems, TextHeight = 20 }; imageEditor.ToolbarSettings.ToolbarItems.Add(item); item = new FooterToolbarItem() { Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.BringFrontIcon), Text = "Bring Front", TextHeight = 20 }; imageEditor.ToolbarSettings.ToolbarItems.Add(item); item = new FooterToolbarItem() { Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.SendBack), Text = "Send Back", TextHeight = 20 }; imageEditor.ToolbarSettings.ToolbarItems.Add(item); imageEditor.ToolbarSettings.SubItemToolbarHeight = 70; imageEditor.ToolbarSettings.ToolbarItemSelected += OnToolbarItemSelected; }