public override async void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); view.FindViewById <ImageButton>(Resource.Id.closebtn).Click += MusicDialog_Click; try { List <Music> music = await Bootlegger.BootleggerClient.GetMusic(); listAdapter = new MusicAdapter(CurrentMusic); listAdapter.OnPreview += ListAdapter_OnPreview; listAdapter.OnSelected += ListAdapter_OnSelected; var listview = view.FindViewById <RecyclerView>(Resource.Id.listview); listview.SetAdapter(listAdapter); listview.SetLayoutManager(new LinearLayoutManager(Activity)); listview.AddItemDecoration(new Android.Support.V7.Widget.DividerItemDecoration(Activity, Android.Support.V7.Widget.DividerItemDecoration.Vertical)); listAdapter.Update(music); } catch (Exception e) { //dismiss dialog LoginFuncs.ShowError(Activity, e); Dismiss(); } }
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (data?.GetBooleanExtra("needsperms", false) ?? false && requestCode == VIDEOCAP) { LoginFuncs.ShowError(this, new NeedsPermissionsException()); } if (requestCode == EDIT_RESPONSE) { //coming back from edit, if it has been processed, show message if (data != null && data.GetBooleanExtra("processed", false)) { Toast.MakeText(this, Resource.String.editready, ToastLength.Long).Show(); //jump to edits tab: } _pager.SetCurrentItem(2, false); myedits.Refresh(); } if (requestCode == VIDEOCAP) { //refresh uploads list: myclips.RefreshUploads(); } if (requestCode == INGEST) { //myingest.Refresh(); //myingest.ChooserMode = AllClipsFragment.ClipViewMode.INGEST; myingest.Refresh(); } }
private async void _adapter_OnRestart(Edit obj) { AndHUD.Shared.Show(Activity, Resources.GetString(Resource.String.connecting), -1, MaskType.Black); try { cancel = new CancellationTokenSource(); await LoginFuncs.TryLogin(Activity, cancel.Token); await Bootlegger.BootleggerClient.RestartEdit(obj); _adapter.UpdateData(Bootlegger.BootleggerClient.MyEdits, true); _adapter.NotifyDataSetChanged(); } catch (TaskCanceledException) { //do nothing } catch (Exception e) { LoginFuncs.ShowError(Context, e); } finally { AndHUD.Shared.Dismiss(); } }
private async void Newtag_Click(object sender, EventArgs e) { if ((Application as BootleggerApp).IsReallyConnected) { AndHUD.Shared.Show(this, GetText(Resource.String.connecting), -1, MaskType.Black, null, null, true); try { await Bootlegger.BootleggerClient.Connect(Bootlegger.BootleggerClient.SessionCookie, new System.Threading.CancellationTokenSource().Token); Intent i = new Intent(this, typeof(Ingest)); i.PutExtra(EDIT, ""); StartActivityForResult(i, INGEST); Bootlegger.BootleggerClient.CanUpload = false; } catch (Exception ex) { LoginFuncs.ShowError(this, ex); } finally { AndHUD.Shared.Dismiss(); } } else { LoginFuncs.ShowError(this, new NoNetworkException()); } }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: if (_pager.CurrentItem == 1) { _pager.CurrentItem = 0; } else { Finish(); } if (!cancel.IsCancellationRequested) { cancel.Cancel(); } return(true); default: if (item.ItemId == Resource.Id.action_help) { LoginFuncs.ShowHelp(this, "#events"); } return(true); } }
private async void Popup_MenuItemClick(object sender, Android.Support.V7.Widget.PopupMenu.MenuItemClickEventArgs e) { //if (e.Item.ItemId == Resource.Id.share_menu_item) //ViewHolder_Click(null, null); //if (e.Item.ItemId == Resource.Id.restart_menu_item) // ViewHolder_Click2(null, null); if (e.Item.ItemId == Resource.Id.copy_menu_item) { try { var newedit = new Edit() { media = currentedit.media, title = view.Context.GetString(Resource.String.copyof, currentedit.title), user_id = currentedit.user_id }; await Bootlegger.BootleggerClient.SaveEdit(newedit); //refresh list: adpt.OnRefresh?.Invoke(); } catch (Exception ex) { LoginFuncs.ShowError(view.Context, ex); } } if (e.Item.ItemId == Resource.Id.delete_menu_item) { ViewHolder_Click1(null, null); } }
public override void OnConfigureFailed(CameraCaptureSession session) { if (null != fragment.Activity) { LoginFuncs.ShowToast(fragment.Activity, new Exception("Failed to open camera")); } //Toast.MakeText(fragment.Activity, "Failed", ToastLength.Short).Show(); }
private void BootleggerClient_OnCurrentUploadsFailed() { //reset UI: RunOnUiThread(() => { LoginFuncs.ShowError(this, new NoNetworkException()); myclips.RefreshUploads(); }); }
private async void PlayEdit(Edit edit) { var videofile = edit.shortlink; shareedit = edit; Bootlegger.BootleggerClient.LogUserAction("Preview", new KeyValuePair <string, string>("editid", edit.id)); //AndHUD.Shared.Show(this, "Loading...", -1, MaskType.Black, null, null, true); //FindViewById<EditVideoView>(Resource.Id.videoplayer).ClearVideoSource(); //FindViewById<ImageButton>(Resource.Id.sharebtn).Visibility = ViewStates.Visible; //get video url: try { //set other fields: FindViewById <TextView>(Resource.Id.metadata).Text = edit.title; FindViewById <TextView>(Resource.Id.timemeta).Text = edit.createdAt.LocalizeFormat("ha E d MMM yy"); if (string.IsNullOrEmpty(edit.description)) { FindViewById <TextView>(Resource.Id.description).Visibility = ViewStates.Gone; } else { FindViewById <TextView>(Resource.Id.description).Text = edit.description; FindViewById <TextView>(Resource.Id.description).Visibility = ViewStates.Visible; } string url = await Bootlegger.BootleggerClient.GetEditUrl(edit); //DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory("BootleggerPreview"); ////var ok = new OkHttpClient(); //int cacheSize = 300 * 1024 * 1024; // 300 MiB //Square.OkHttp3.Cache cache = new Square.OkHttp3.Cache(FilesDir, cacheSize); var client = new OkHttpClient.Builder() //.Cache((Application as BootleggerApp).FilesCache) .Build(); OkHttpDataSourceFactory httpDataSourceFactory = new OkHttpDataSourceFactory(client, "BootleggerPreview"); var extractorsFactory = new DefaultExtractorsFactory(); mediaSource = new ExtractorMediaSource(Android.Net.Uri.Parse(url), httpDataSourceFactory, extractorsFactory, null, null); _player.Prepare(mediaSource); } catch (Exception e) { //adjust to what kind of exception it is: LoginFuncs.ShowToast(this, e); } finally { //AndHUD.Shared.Dismiss(); } }
private void _adapter_OnEdit(Edit obj) { if (string.IsNullOrEmpty(obj.path) && obj.progress == null) { OnOpenEdit?.Invoke(obj); } else { LoginFuncs.ShowMessage(Activity, Resource.String.editready); } }
void SettingsFrag_CheckedChange(object sender, CompoundButton.CheckedChangeEventArgs e) { try { Bootlegger.BootleggerClient.SetUserPrivacy(e.IsChecked, Bootlegger.BootleggerClient.CurrentEvent.id); } catch (Exception ex) { LoginFuncs.ShowError(Context, ex); } }
private void HomePageList_Click(object sender, EventArgs e) { if ((Context.ApplicationContext as BootleggerApp).IsReallyConnected) { var intent = new Intent(Context, typeof(Events)); intent.PutExtra("listtype", "all"); StartActivityForResult(intent, UI.LoginFuncs.NEW_SHOOT_REQUEST); } else { LoginFuncs.ShowError(Activity, new NoNetworkException()); } }
internal async void Refresh() { _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.DOWNLOADING, 0); try { cancel = new CancellationTokenSource(); var info = await Bootlegger.BootleggerClient.GetEventInfo(Bootlegger.BootleggerClient.CurrentEvent.id, new System.Threading.CancellationToken()); OnEventInfoUpdate?.Invoke(info); await Bootlegger.BootleggerClient.GetMyMedia(cancel.Token); //if I can edit everyones media: if (Bootlegger.BootleggerClient.CurrentEvent.publicedit) { //load everyones media: Bootlegger.BootleggerClient.GetEveryonesMedia(cancel.Token); } _adapter.UpdateData(Bootlegger.BootleggerClient.UploadQueueEditing, Bootlegger.BootleggerClient.MyMediaEditing); _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK, 0); OnRefresh?.Invoke(); } catch (TaskCanceledException) { //do nothing, moving screens } catch (Exception e) { try { LoginFuncs.ShowError(Activity, e); _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK, 0); } catch { //fails as the fragment is lost. } } finally { //if not waiting for everyones media to download: //_adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK,0); } }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: Finish(); return(true); case 99: IngestWizard.ShowWizard(this, true); return(true); default: LoginFuncs.ShowHelp(this, "#ingest"); return(true); } }
public override void OnBackPressed() { try { if (TRIMMODE) { TRIMMODE = false; _adapter.TrimMode(null, false); preview.StopPlayback(); _adapter.UpdatePlaying(null); TrimOff(); return; } if (IsExpanded) { currentpick = null; CollapsePane(); (allclipsfragment as IImagePausable).Pause(); } else { Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetMessage(Resource.String.savecancelmsg); builder.SetPositiveButton(Resource.String.savebtnshort, (e, o) => { ExitSave(); }) .SetNegativeButton(Resource.String.cancelbtn, async(e, o) => { //Reset back to old version: //CurrentEdit = OriginalVersion; ShouldAutoSave = false; await Bootlegger.BootleggerClient.SaveEdit(OriginalVersion); autosaver.Dispose(); Finish(); }); builder.Create().Show(); } } catch (Exception e) { LoginFuncs.ShowError(this, e); } }
private async void CaptureClick(object sender, EventArgs e) { var Event = Bootlegger.BootleggerClient.CurrentEvent; cancel = new CancellationTokenSource(); AndHUD.Shared.Show(this, Resources.GetString(Resource.String.connecting), -1, MaskType.Black, null, null, true, cancel.Cancel); try { await Bootlegger.BootleggerClient.OfflineConnect(Event.id, cancel.Token); StartActivityForResult(typeof(Video), VIDEOCAP); Bootlegger.BootleggerClient.CanUpload = false; } catch (RoleNotSelectedException) { //connect and start the role screen.... //only do this if we are actually online: if ((Application as BootleggerApp).IsReallyConnected) { cancel = new CancellationTokenSource(); //start roles screen: Intent i = new Intent(this, typeof(Roles)); i.PutExtra("id", Event.id); StartActivityForResult(i, 0); Bootlegger.BootleggerClient.CanUpload = false; } else { LoginFuncs.ShowError(this, new RoleNotSelectedException()); //Toast.MakeText(this, Resource.String.norolechosen, ToastLength.Long).Show(); } } catch (Exception ex) { LoginFuncs.ShowError(this, ex); //Toast.MakeText(this, Resource.String.noconnectionshort, ToastLength.Long).Show(); } finally { AndHUD.Shared.Dismiss(); } //} }
private void StartPlayback() { TRIMMODE = false; _adapter.UpdatePlaying(null); _adapter.TrimMode(null, false); TrimOff(); FindViewById(Resource.Id.edittimeline).Visibility = ViewStates.Visible; //FindViewById(Resource.Id.pausebtn).Visibility = ViewStates.Invisible; if (CurrentEdit.media.Count == 1) { return; } //play current index: if (play_index < 0) { play_index = 0; } if (play_index > CurrentEdit.media.Count - 2) { play_index = CurrentEdit.media.Count - 2; } current_media = CurrentEdit.media[play_index]; try { preview.PlaySequence(CurrentEdit.media, current_media); } catch (Exception e) { //Toast.MakeText(this, e.Message, ToastLength.Short).Show(); LoginFuncs.ShowToast(this, e); } Bootlegger.BootleggerClient.LogUserAction("EditScreenPlaySeq", new KeyValuePair <string, string>("mediaid", current_media.id), new KeyValuePair <string, string>("editid", CurrentEdit.id), new KeyValuePair <string, string>("eventid", Bootlegger.BootleggerClient.CurrentEvent.id)); }
private async void HomePageList_Refresh(object sender, EventArgs e) { try { View.FindViewById <SwipeRefreshLayout>(Resource.Id.swiperefresh).Refreshing = false; //refresh featured: if ((Context.ApplicationContext as BootleggerApp).IsReallyConnected) { await nearby.RefreshMe(true); } } catch (Exception ex) { LoginFuncs.ShowError(Activity, ex); } finally { } }
async void Events_Refresh(object sender, EventArgs e) { try { try { await updater(canceller); } catch (TaskCanceledException) { //do nothing... } catch (Exception) { OnError?.Invoke(new Exception(Resources.GetString(Resource.String.noconnectionshort))); } if (parent == null) { LoadEvents(Bootlegger.BootleggerClient.GetType().GetProperty(propertyname).GetValue(Bootlegger.BootleggerClient) as List <Shoot>, null, eventviewtype); } else { LoadEvents((Bootlegger.BootleggerClient.GetType().GetProperty(propertyname).GetValue(Bootlegger.BootleggerClient) as List <Shoot>).Find(ec => ec.group == parent.group).events, parent, eventviewtype); } } catch (Exception ex) { try { LoginFuncs.ShowError(Activity, ex); } catch { //failed if fragment destroyed } } finally { theview.FindViewById <SwipeRefreshLayout>(Resource.Id.swiperefresh).Refreshing = false; } }
private void ListAdapter_OnPreview(Music obj) { listAdapter.UpdatePlaying(obj); currentPreview = obj; _audioPlayer.PlayWhenReady = false; mediaSource = new ExtractorMediaSource(Android.Net.Uri.Parse(obj.url), httpDataSourceFactory, extractorsFactory, null, null); try { _audioPlayer.Prepare(mediaSource); _audioPlayer.PlayWhenReady = true; } catch (Exception e) { LoginFuncs.ShowError(Context.ApplicationContext, e); } Bootlegger.BootleggerClient.LogUserAction("MusicPreview", new KeyValuePair <string, string>("music", obj.url), new KeyValuePair <string, string>("eventid", Bootlegger.BootleggerClient.CurrentEvent.id)); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: Finish(); return(true); case 88: Download(); return(true); case 99: FixMissing(); return(true); default: LoginFuncs.ShowHelp(this, "#review"); return(true); } }
private void _adapter_OnTrim(MediaItem obj) { if (!TRIMMODE) { TRIMMODE = true; _adapter.TrimMode(obj, true); _adapter.UpdatePlaying(obj); //open in trim mode current_media = obj; play_index = CurrentEdit.media.IndexOf(current_media); FindViewById(Resource.Id.edittimeline).Visibility = ViewStates.Invisible; TrimOn(); try { preview.StopPlayback(); _adapter.UpdatePlaying(null); preview.TrimVideo(current_media); } catch (Exception e) { //Toast.MakeText(this, e.Message, ToastLength.Short).Show(); LoginFuncs.ShowToast(this, e); } Bootlegger.BootleggerClient.LogUserAction("EditScreenTrim", new KeyValuePair <string, string>("mediaid", current_media.id), new KeyValuePair <string, string>("editid", CurrentEdit.id), new KeyValuePair <string, string>("eventid", Bootlegger.BootleggerClient.CurrentEvent.id)); } else { preview.StopPlayback(); TRIMMODE = false; _adapter.UpdatePlaying(null); _adapter.TrimMode(null, false); TrimOff(); } }
void Comms_OnSessionLost() { //start login screen: if (!sessionlostdialogopen) { sessionlostdialogopen = true; Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity); builder.SetPositiveButton(Android.Resource.String.Ok, (o, e) => { sessionlostdialogopen = false; if (Bootlegger.BootleggerClient.CurrentUser != null) { LoginFuncs.OpenLogin(this, Bootlegger.BootleggerClient.CurrentUser?.profile["provider"].ToString()); } }); var diag = builder.Create(); diag.SetTitle(Resource.String.connectionissuetitle); diag.SetMessage(GetString(Resource.String.connectionissuebody)); diag.SetCancelable(false); diag.Show(); } }
public bool IsPlayServicesAvailable() { int resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.Success) { if (GoogleApiAvailability.Instance.IsUserResolvableError(resultCode)) { LoginFuncs.ShowError(this, new Exception(GoogleApiAvailability.Instance.GetErrorString(resultCode))); } else { //msgText.Text = "This device is not supported"; LoginFuncs.ShowError(this, new Exception(GetString(Resource.String.googleplayerror))); Finish(); } return(false); } else { return(true); } }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: Finish(); return(true); case 88: var message = new StreamReader(Assets.Open("credits.txt")).ReadToEnd(); new Android.Support.V7.App.AlertDialog.Builder(this) .SetNeutralButton(Android.Resource.String.Ok, new EventHandler <DialogClickEventArgs>((oe, eo) => { })).SetMessage(message) .SetTitle(Resource.String.opensource) .Show(); return(true); default: LoginFuncs.ShowHelp(this, "#about"); return(base.OnOptionsItemSelected(item)); } }
private async void Tab_OnRoleSelected(Role selected) { if (!selectingrole) { selectingrole = true; //if its the initial connection: if (!dark) { //Shoot selected = obj; cancel = new CancellationTokenSource(); AndHUD.Shared.Show(Activity, Resources.GetString(Resource.String.connecting), -1, MaskType.Black, null, null, true, () => { cancel.Cancel(); selectingrole = false; }); try { cancel = new CancellationTokenSource(); await AskPermissions(Activity, CurrentEvent); await Bootlegger.BootleggerClient.ConnectToEvent(CurrentEvent, false, cancel.Token); } catch (ServerErrorException) { AndHUD.Shared.Dismiss(); //show dialog: new Android.Support.V7.App.AlertDialog.Builder(Activity).SetMessage(Resources.GetString(Resource.String.role_repeat)) .SetNegativeButton(Android.Resource.String.No, new EventHandler <DialogClickEventArgs>((oe, eo) => { })) .SetPositiveButton(Android.Resource.String.Yes, new EventHandler <DialogClickEventArgs>(async(oe, eo) => { AndHUD.Shared.Show(Activity, Resources.GetString(Resource.String.connecting), -1, MaskType.Black, null, null, true, () => { cancel.Cancel(); }); cancel = new CancellationTokenSource(); await Bootlegger.BootleggerClient.ConnectToEvent(CurrentEvent, true, cancel.Token); await AskPermissions(Activity, CurrentEvent); selectingrole = false; })) .SetTitle(Resource.String.areyousure) .SetCancelable(false) .Show(); } catch (NotGivenPermissionException e) { AndHUD.Shared.Dismiss(); selectingrole = false; try { LoginFuncs.ShowError(this.Activity, e); //Toast.MakeText(Activity, Resource.String.acceptperms, ToastLength.Long).Show(); } catch { } return; } catch (Exception e) { AndHUD.Shared.Dismiss(); selectingrole = false; try { //Toast.MakeText(Activity, Resource.String.problemconnecting, ToastLength.Long).Show(); LoginFuncs.ShowError(this.Activity, e); } catch { } return; } } //ROLE SELECTION WHEN SHOOTING: //AndHUD.Shared.Show(Activity, Resources.GetString(Resource.String.loading), -1, MaskType.Black, null, null, true, () => //{ // cancel.Cancel(); // selectingrole = false; //}); //await Task.Delay(100); try { cancel = new CancellationTokenSource(); var res = await Bootlegger.BootleggerClient.SelectRole(selected, false, cancel.Token); if (res.State == API.Model.RoleStatus.RoleState.OK) { OnRoleChanged?.Invoke(); rolelist?.Update(); map?.Update(); //AndHUD.Shared.Dismiss(); selectingrole = false; } else if (res.State == API.Model.RoleStatus.RoleState.CONFIRM) { new Android.Support.V7.App.AlertDialog.Builder(Activity).SetMessage(res.Message) .SetNegativeButton(Android.Resource.String.No, new EventHandler <DialogClickEventArgs>(async(oe, eo) => { cancel = new CancellationTokenSource(); var ress = await Bootlegger.BootleggerClient.SelectRole(selected as Role, true, cancel.Token); //listview.Enabled = true; if (ress.State == API.Model.RoleStatus.RoleState.OK) { OnRoleChanged?.Invoke(); rolelist?.Update(); map?.Update(); //AndHUD.Shared.Dismiss(); selectingrole = false; } else { //you are live -- so cant do this anyway //AndHUD.Shared.Dismiss(); selectingrole = false; } })) .SetPositiveButton(Android.Resource.String.Yes, new EventHandler <DialogClickEventArgs>((oe, eo) => { //AndHUD.Shared.Dismiss(); selectingrole = false; })) .SetTitle(Resource.String.roledescision) .SetCancelable(false) .Show(); } else if (res.State == API.Model.RoleStatus.RoleState.NO) { //you are live and cant do it //AndHUD.Shared.Dismiss(); selectingrole = false; try { LoginFuncs.ShowError(this.Activity, new RoleNotSelectedException()); } catch { } } } catch (Exception e) { //AndHUD.Shared.Dismiss(); selectingrole = false; try { LoginFuncs.ShowError(this.Activity, e); } catch { } } } }
void RefreshOnline(bool data) { try { loading = true; if (data) { theview.FindViewById <ProgressBar>(Resource.Id.progressBar).Post(() => { theview.FindViewById <ProgressBar>(Resource.Id.progressBar).Visibility = ViewStates.Visible; }); cancel = new CancellationTokenSource(); Bootlegger.BootleggerClient.GetEveryonesMedia(cancel.Token); } if (ChooserMode == ClipViewMode.INGEST) { listAdapter.UpdateData(Bootlegger.BootleggerClient.QueryMedia(sortFilter, sortDirection)); } else if (ChooserMode == ClipViewMode.EDITING) { var dat = Bootlegger.BootleggerClient.QueryMediaByTopic(tagfilter.Select((arg) => arg.id).ToList()) .GroupBy(n => n.Contributor) .OrderBy(a => (a.Key == Bootlegger.BootleggerClient.CurrentUser.displayName) ? 1 : 2) .ToDictionary(n => n.Key, n => n.ToList()); listAdapter.UpdateData(dat); } else { listAdapter.UpdateData(new Dictionary <string, List <MediaItem> >() { { "all", Bootlegger.BootleggerClient.QueryMediaByTopic(new List <string>()) } }); } if (!data) { theview.FindViewById <ProgressBar>(Resource.Id.progressBar).Post(() => { theview.FindViewById <ProgressBar>(Resource.Id.progressBar).Visibility = ViewStates.Gone; }); if (listAdapter.ItemCount == ((ChooserMode == ClipViewMode.LIST) ? 1 : 0)) { theview.FindViewById <View>(Resource.Id.emptytext).Visibility = ViewStates.Visible; } else { theview.FindViewById <View>(Resource.Id.emptytext).Visibility = ViewStates.Gone; } } } catch (Exception e) { LoginFuncs.ShowError(Activity, e); } finally { if (!data) { loading = false; } } //if doing a hard-reload, dont hide progress }
public void ExitSave() { ShouldAutoSave = false; preview.StopPlayback(); _adapter.UpdatePlaying(null); if (!CurrentEdit.media.Any(n => n.MediaType != Shot.ShotTypes.TITLE && n.Status != MediaItem.MediaStatus.PLACEHOLDER)) { Toast.MakeText(this, Resource.String.includevideo, ToastLength.Long).Show(); ShouldAutoSave = true; return; } Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); FrameLayout frameView = new FrameLayout(this); builder.SetView(frameView); var diag = builder.Create(); diag.SetTitle(Resource.String.saveedit); LayoutInflater inflater = diag.LayoutInflater; View dialoglayout = inflater.Inflate(Resource.Layout.editsavedlg, frameView); //set title of video if there is one: if (string.IsNullOrWhiteSpace(CurrentEdit.title)) { if (CurrentEdit.media.First().MediaType == Shot.ShotTypes.TITLE) { CurrentEdit.title = CurrentEdit.media.First().titletext; } } //adjust for audio: if (CurrentMusic != null) { foreach (var m in CurrentEdit.media) { m.audio = null; m.credits = null; } CurrentEdit.media.First().audio = CurrentMusic.path; CurrentEdit.media.First().credits = CurrentMusic.caption; } dialoglayout.FindViewById <TextView>(Resource.Id.title).Text = CurrentEdit.title; if (WhiteLabelConfig.USE_EDIT_DESCRIPTION) { dialoglayout.FindViewById <TextView>(Resource.Id.description).Text = CurrentEdit.description; } else { dialoglayout.FindViewById <TextView>(Resource.Id.description).Visibility = ViewStates.Gone; } dialoglayout.FindViewById <Button>(Resource.Id.savebtn).Click += async(o, e) => { bool doit = true; if (dialoglayout.FindViewById <TextView>(Resource.Id.title).Text.Length < 5) { TextInputLayout titlelayout = dialoglayout.FindViewById <TextInputLayout>(Resource.Id.title_layout); titlelayout.ErrorEnabled = true; titlelayout.Error = Resources.GetString(Resource.String.entertitle); doit = false; } if (WhiteLabelConfig.USE_EDIT_DESCRIPTION) { if (dialoglayout.FindViewById <TextView>(Resource.Id.description).Text.Length < 5) { TextInputLayout titlelayout = dialoglayout.FindViewById <TextInputLayout>(Resource.Id.description_layout); titlelayout.ErrorEnabled = true; titlelayout.Error = Resources.GetString(Resource.String.enterdescription); doit = false; } } if (doit) { CurrentEdit.title = dialoglayout.FindViewById <TextView>(Resource.Id.title).Text; CurrentEdit.description = dialoglayout.FindViewById <TextView>(Resource.Id.description).Text; AndHUD.Shared.Show(this, Resources.GetString(Resource.String.loading), -1, MaskType.Black, null, null, true); try { await Bootlegger.BootleggerClient.SaveEdit(CurrentEdit); Intent i = new Intent(this.ApplicationContext, typeof(Review)); i.PutExtra("processed", true); StartActivity(i); Finish(); } catch (Exception ex) { _adapter.UpdateData(CurrentEdit.media); _sliveradapter.UpdateData(CurrentEdit.media); UpdateTimings(); //Toast.MakeText(this, Resources.GetString(Resource.String.editerror), ToastLength.Long).Show(); LoginFuncs.ShowToast(this, ex); } finally { AndHUD.Shared.Dismiss(); diag.Cancel(); } } }; dialoglayout.FindViewById <Button>(Resource.Id.sharebtn).Click += async(o, e) => { bool doit = true; if (dialoglayout.FindViewById <TextView>(Resource.Id.title).Text.Length < 5) { TextInputLayout titlelayout = dialoglayout.FindViewById <TextInputLayout>(Resource.Id.title_layout); titlelayout.ErrorEnabled = true; titlelayout.Error = Resources.GetString(Resource.String.entertitle); doit = false; } if (WhiteLabelConfig.USE_EDIT_DESCRIPTION) { if (dialoglayout.FindViewById <TextView>(Resource.Id.description).Text.Length < 5) { TextInputLayout titlelayout = dialoglayout.FindViewById <TextInputLayout>(Resource.Id.description_layout); titlelayout.ErrorEnabled = true; titlelayout.Error = Resources.GetString(Resource.String.enterdescription); doit = false; } } if (doit) { CurrentEdit.title = dialoglayout.FindViewById <TextView>(Resource.Id.title).Text; CurrentEdit.description = dialoglayout.FindViewById <TextView>(Resource.Id.description).Text; AndHUD.Shared.Show(this, Resources.GetString(Resource.String.loading), -1, MaskType.Black, null, null, true); try { await Bootlegger.BootleggerClient.StartEdit(CurrentEdit); Bundle conData = new Bundle(); conData.PutBoolean("processed", true); Intent intent = new Intent(); intent.PutExtras(conData); SetResult(Result.Ok, intent); Intent i = new Intent(this.ApplicationContext, typeof(Review)); StartActivity(i); } catch (Exception ex) { _adapter.UpdateData(CurrentEdit.media); _sliveradapter.UpdateData(CurrentEdit.media); UpdateTimings(); LoginFuncs.ShowToast(this, ex); } finally { AndHUD.Shared.Dismiss(); diag.Cancel(); } } }; diag.SetCancelable(true); diag.CancelEvent += (o, e) => { ShouldAutoSave = true; }; diag.Show(); dialoglayout.Post(() => { dialoglayout.FindViewById <TextView>(Resource.Id.title).RequestFocus(); }); }
void Link_Click(object sender, EventArgs e) { LoginFuncs.ShowHelp(this, ""); }
public override void OnResume() { base.OnResume(); Bootlegger.BootleggerClient.OnMediaLoadingComplete += BootleggerClient_OnMediaLoadingComplete; RefreshUploads(); //Bootlegger.BootleggerClient.OnMoreMediaLoaded += BootleggerClient_OnMoreMediaLoaded; var listView = theview.FindViewById <RecyclerView>(Resource.Id.myclips); if (firstload) { firstload = false; //show summary of the data: if (!doing_work) { doing_work = true; _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.SYNCING, 0); theview.Post(async() => { try { var info = await Bootlegger.BootleggerClient.GetEventInfo(Bootlegger.BootleggerClient.CurrentEvent.id, new System.Threading.CancellationToken()); OnEventInfoUpdate?.Invoke(info); var mediahave = Bootlegger.BootleggerClient.MyMediaEditing.Count; //update ui: if (info.numberofclips > mediahave) { //if can see the clips: if (Bootlegger.BootleggerClient.CurrentEvent.publicedit) { //if (Bootlegger.publicedit || ) _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.MISSING, (info.numberofclips - mediahave)); } else { _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK, 0); } } else { _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK, 0); } doing_work = false; } catch (Exception e) { try { if ((Context.ApplicationContext as BootleggerApp).IsReallyConnected) { LoginFuncs.ShowError(Context, e); } _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK, 0); } catch { //unknown error... } } }); } } }