public NotaInlineView(Context context, NotaUtente nota, ViewerScreen docView) : base(context) { _docView = docView; _nota = nota; View.Inflate(this.Context, Resource.Layout.NotaInlineView, this); NoteManager noteMan = new NoteManager(docView.Pubblicazione); noteMan.LoadNota(nota); _txtNota = FindViewById <EditText>(Resource.Id.txtNota); //txtNota.SetBackgroundColor(Color.Red); _txtNota.SetText(nota.Testo, TextView.BufferType.Normal); SetTextStyle(); _docView.ReaderView.OnSingleTap += OnParentTap; _txtNota.TextChanged += delegate { nota.Testo = _txtNota.Text; noteMan.EditNota(nota); }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Dialog.Window.RequestFeature(WindowFeatures.NoTitle); View view = inflater.Inflate(Resource.Layout.NoteEdit, container); _txtNota = (EditText)view.FindViewById <EditText>(Resource.Id.txtNote); var btnOption = view.FindViewById <ImageButton>(Resource.Id.btnOption); btnOption.Click += (object sender, EventArgs e) => { PopupMenu popup = new PopupMenu(Dialog.Context, btnOption); popup.Menu.Add(1, 1, 1, "Salva"); popup.Menu.Add(1, 2, 2, "Elimina"); popup.MenuItemClick += (object send, PopupMenu.MenuItemClickEventArgs ev) => { if (ev.Item.ItemId == 1) //salva { _nota.Testo = _txtNota.Text; _noteManager.EditNota(_nota); this.Dismiss(); } else if (ev.Item.ItemId == 2) //elimina { this.DeleteNote(); } }; popup.Show(); }; return(view); }