private void PlaybackAcceptPopup() { View dialogLayout = LayoutInflater.Inflate(Resource.Layout.DialogButton, null); playBtn = dialogLayout.FindViewById <Button>(Resource.Id.dialogBtn); playBtn.Text = Resources.GetString(Resource.String.ListenBtn); playBtn.Click += (e, o) => { if (player.IsPlaying) { player.Stop(); player.Reset(); playBtn.Text = Resources.GetString(Resource.String.ListenBtn); } else { player.SetDataSource(filePath); player.Prepare(); player.Start(); playBtn.Text = Resources.GetString(Resource.String.StopBtn); } }; global::Android.Support.V7.App.AlertDialog.Builder dialog = new global::Android.Support.V7.App.AlertDialog.Builder(this); dialog.SetTitle("Use this recording?"); dialog.SetMessage("Do you want to use this recording, or try recording another clip?"); dialog.SetView(dialogLayout); dialog.SetCancelable(false); dialog.SetNegativeButton("Record another", (s, e) => { player.Stop(); player.Reset(); }); dialog.SetPositiveButton("Use this", (s, e) => { player.Stop(); player.Reset(); ReturnWithFile(); }); dialog.Show(); }
public override Dialog OnCreateDialog(global::Android.OS.Bundle savedInstanceState) { _contextWeak.TryGetTarget(out Context context); var alertBuilder = new global::Android.Support.V7.App.AlertDialog.Builder(context); alertBuilder.SetTitle(_title); if (_message != null) { alertBuilder.SetMessage(_message); } _textInput = new EditText(context); _textInput.AddTextChangedListener(this); alertBuilder.SetView(_textInput); if (_hint != null) { _textInput.Text = _hint; _textInput.SelectAll(); } alertBuilder.SetCancelable(false); alertBuilder.SetNegativeButton(_cancelButton ?? "Cancel", delegate { Tcs.TrySetResult(null); }); alertBuilder.SetPositiveButton(_actionButton ?? "Ok", (EventHandler <DialogClickEventArgs>)null); var alert = alertBuilder.Create(); alert.SetOnShowListener(this); return(alert); }