void SaveButton_Click(object sender, EventArgs e) { name = entry.Text; editor.Save(); popipView.Visibility = ViewStates.Invisible; overView.Visibility = ViewStates.Invisible; entry.Text = ""; this.imm?.HideSoftInputFromWindow(this.entry.WindowToken, HideSoftInputFlags.None); }
void ShareImage() { editor.Save(); editor.ImageSaving += (sender, e) => { e.Cancel = false; }; editor.ImageSaved += (sender, e) => { location = e.Location; }; DelayActionAsync(2500, Sharing); }
void ToolbarItemSelected(object sender, ToolbarItemSelectedEventArgs e) { if (e.ToolbarItem is ToolbarItem) { var toolitem = e.ToolbarItem as ToolbarItem; if (!(toolitem is HeaderToolbarItem)) { CropSelectionMenu.Hidden = false; } if (toolitem is HeaderToolbarItem) { sfImageEditor.Save(); } else if (toolitem.Text == "Facebook Post") { sfImageEditor.ToggleCropping(1200, 900); } else if (toolitem.Text == "Facebook Cover") { sfImageEditor.ToggleCropping(851, 315); } else if (toolitem.Text == "Twitter Cover") { sfImageEditor.ToggleCropping(1500, 500); } else if (toolitem.Text == "Twitter Post") { sfImageEditor.ToggleCropping(1024, 512); } else if (toolitem.Text == "YouTubeChannel Cover") { sfImageEditor.ToggleCropping(2560, 1440); } else if (toolitem.Text == "Banner Types") { sfImageEditor.ToggleCropping(1200, 900); } } }
void Share_TouchUpInside(object sender, EventArgs e) { sfImageEditor.Save(); sfImageEditor.ImageSaved += SfImageEditor_ImageSaved; }
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); }