Esempio n. 1
0
            public override bool OnMove(RecyclerView p0, RecyclerView.ViewHolder p1, RecyclerView.ViewHolder p2)
            {
                _adapter.OnItemMove(p1.AdapterPosition, p2.AdapterPosition);
                _adapter.NotifyDataSetChanged();
                _timeline.NotifyDataSetChanged();
                //editor.preview.StopPlayback();
                _adapter.UpdatePlaying(null);



                return(true);
            }
Esempio n. 2
0
        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();
            });
        }