private void Fragment_OnChosen(MediaItem obj) { var index = CurrentEdit.media.IndexOf(currentpick); try { CurrentEdit.media.RemoveAt(index); } catch { index = CurrentEdit.media.Count() - 1; } var newobj = obj.Copy(); newobj.inpoint = TimeSpan.Zero; newobj.outpoint = newobj.ClipLength; CurrentEdit.media.Insert(index, newobj); allclipsfragment.UpdateEdit(CurrentEdit.media); currentpick = null; _adapter.UpdateData(CurrentEdit.media); _sliveradapter.UpdateData(CurrentEdit.media); UpdateTimings(); CollapsePane(); (allclipsfragment as IImagePausable).Pause(); Bootlegger.BootleggerClient.LogUserAction("EditScreenAdd", new KeyValuePair <string, string>("mediaid", obj.id), new KeyValuePair <string, string>("index", index.ToString()), new KeyValuePair <string, string>("editid", CurrentEdit.id), new KeyValuePair <string, string>("eventid", Bootlegger.BootleggerClient.CurrentEvent.id)); }
private void _adapter_OnChange(MediaItem obj, Shot.ShotTypes tp) { if (!TRIMMODE) { currentpick = obj; if (tp == Shot.ShotTypes.TITLE) { //show dialog: var builder = new Android.Support.V7.App.AlertDialog.Builder(this); preview.StopPlayback(); _adapter.UpdatePlaying(null); FrameLayout frameView = new FrameLayout(this); var di = LayoutInflater.Inflate(Resource.Layout.textentrydialog, frameView); di.FindViewById <EditText>(Resource.Id.text).Text = obj.titletext; if (!string.IsNullOrEmpty(obj.titletext)) { var lines = obj.titletext?.Split('\n'); di.FindViewById <TextView>(Resource.Id.counter).Text = GetString(Resource.String.linecounter, lines.Count()); } builder.SetView(frameView); builder.SetPositiveButton(Android.Resource.String.Ok, (o, e) => { }); builder.SetTitle(Resource.String.entertitledialog); builder.SetCancelable(true); var dialog = builder.Show(); var cantsubmit = false; Button positiveButton = (Button)dialog.GetButton((int)DialogButtonType.Positive); positiveButton.Click += delegate { if (cantsubmit) { return; } var lns = di.FindViewById <EditText>(Resource.Id.text).Text.ToString().Split('\n'); if (lns.Length > 8) { //LoginFuncs.ShowError(this, Resource.String.titlelengthwarning); TextInputLayout lay = dialog.FindViewById <TextInputLayout>(Resource.Id.textlayout); lay.ErrorEnabled = true; lay.Error = GetString(Resource.String.titlelengthwarning); } else { var sanitisetext = Regex.Replace(di.FindViewById <TextView>(Resource.Id.text).Text, @"\p{Cs}", "").Replace('"', '\'').TrimStart('\n'); currentpick.titletext = sanitisetext; if (!string.IsNullOrEmpty(currentpick.titletext)) { var index = CurrentEdit.media.IndexOf(currentpick); try { CurrentEdit.media.RemoveAt(index); } catch { index = CurrentEdit.media.Count() - 1; } var newobj = obj.Copy(); newobj.MediaType = Shot.ShotTypes.TITLE; newobj.Status = MediaItem.MediaStatus.DONE; newobj.inpoint = TimeSpan.Zero; newobj.outpoint = TimeSpan.FromSeconds(3); newobj.event_id = Bootlegger.BootleggerClient.CurrentEvent.id; CurrentEdit.media.Insert(index, newobj); allclipsfragment.UpdateEdit(CurrentEdit.media); _adapter.UpdateData(CurrentEdit.media); _sliveradapter.UpdateData(CurrentEdit.media); UpdateTimings(); Bootlegger.BootleggerClient.LogUserAction("EditScreenAddTitle", new KeyValuePair <string, string>("title", currentpick.titletext), new KeyValuePair <string, string>("editid", CurrentEdit.id), new KeyValuePair <string, string>("eventid", Bootlegger.BootleggerClient.CurrentEvent.id)); currentpick = null; dialog.Dismiss(); } else { //dont insert blank title: //currentpick = null; } } }; dialog.FindViewById <EditText>(Resource.Id.text).RequestFocus(); dialog.FindViewById <EditText>(Resource.Id.text).TextChanged += (sender, e) => { int linetoolong = -1; var lns = e.Text.ToString().Split('\n'); for (int line = 0; line < lns.Length; line++) { if (lns[line].Length > 29) { linetoolong = line; break; } } if (linetoolong != -1) { TextInputLayout titlelayout = dialog.FindViewById <TextInputLayout>(Resource.Id.textlayout); titlelayout.ErrorEnabled = true; titlelayout.Error = Resources.GetString(Resource.String.linetoolong, (linetoolong + 1)); cantsubmit = true; } else { TextInputLayout titlelayout = dialog.FindViewById <TextInputLayout>(Resource.Id.textlayout); titlelayout.ErrorEnabled = false; cantsubmit = false; } dialog.FindViewById <TextView>(Resource.Id.counter).Text = GetString(Resource.String.linecounter, lns.Length); }; //dialog.Show(); } else { ExpandPane(); (allclipsfragment as IImagePausable).Resume(); } } }