Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetTheme(Resource.Style.Theme_Normal);

            SetContentView(Resource.Layout.Editor);

            bottompanel = FindViewById <FrameLayout>(Resource.Id.selector);

            FindViewById <FloatingActionButton>(Resource.Id.savebtn).Click += Editor_Click;
            FindViewById <ImageButton>(Resource.Id.audiobtn).Click         += Editor_Click1;
            FindViewById <ImageButton>(Resource.Id.helpbtn).Click          += Editor_Click2;

            //selector:
            var fragmentTransaction = SupportFragmentManager.BeginTransaction();

            allclipsfragment = new AllClipsFragment(AllClipsFragment.ClipViewMode.EDITING);
            fragmentTransaction.Add(Resource.Id.selector, allclipsfragment);
            fragmentTransaction.Commit();
            (allclipsfragment as IImagePausable).Pause();

            allclipsfragment.OnPreview    += Fragment_OnPreview;
            allclipsfragment.OnChosen     += Fragment_OnChosen;
            allclipsfragment.OnOpenIngest += IngestOpen;


            //recyclerview
            var listView       = FindViewById <RecyclerView>(Resource.Id.editlist);
            var mLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            _adapter              = new SingleEditAdapter(this);
            _adapter.OnChange    += _adapter_OnChange;
            _adapter.OnPreview   += _adapter_OnPreview;
            _adapter.OnTrim      += _adapter_OnTrim;
            _adapter.OnDelete    += _adapter_OnDelete;
            _adapter.HasStableIds = true;
            listView.SetLayoutManager(mLayoutManager);
            listView.SetAdapter(_adapter);

            timeline = FindViewById <RecyclerView>(Resource.Id.timeline);
            var mLayoutManager1 = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            timeline.SetLayoutManager(mLayoutManager1);
            _sliveradapter = new SliverEditAdapter(this);
            timeline.SetAdapter(_sliveradapter);

            preview = FindViewById <EditVideoView>(Resource.Id.edit_preview);
            //preview.OnEndOfVideo += Preview_OnEndOfVideo;
            preview.OnInPointChanged  += Preview_OnInPointChanged;
            preview.OnOutPointChanged += Preview_OnOutPointChanged;
            preview.OnPositionChange  += Preview_OnPositionChange;
            preview.HideDetails();

            lefttimetotal = FindViewById <TextView>(Resource.Id.lefttimetotal);

            tracker = FindViewById <View>(Resource.Id.pos);

            ItemTouchHelper.Callback callback    = new SwapCallback(this, _adapter, _sliveradapter);
            ItemTouchHelper          touchHelper = new ItemTouchHelper(callback);

            touchHelper.AttachToRecyclerView(listView);

            EditorWizard.ShowWizard(this, false);

            //autosave function:
            autosaver = new BackgroundWorker();
            autosaver.WorkerSupportsCancellation = true;
            autosaver.DoWork += Autosaver_DoWork;
            autosaver.RunWorkerAsync();
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (Bootlegger.BootleggerClient.CurrentEvent == null)
            {
                Finish();
                return;
            }

            CurrentEvent = Bootlegger.BootleggerClient.CurrentEvent;

            SetTheme(Resource.Style.Theme_Normal);

            SetContentView(Resource.Layout.Review);


            //AndHUD.Shared.Show(this, Resources.GetString(Resource.String.loading), -1, MaskType.Black, null, null, true);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            Window.ClearFlags(WindowManagerFlags.TranslucentStatus);

            if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            {
                // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                // finally change the color
                Window.SetStatusBarColor(new Color(ContextCompat.GetColor(this, Android.Resource.Color.Transparent)));
            }

            //FindViewById<TextView>(Resource.Id.customTitle).Text = CurrentEvent.name;

            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetTitle(CurrentEvent.name);

            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetExpandedTitleTextAppearance(Resource.Style.ExpandedAppBar);
            Typeface font = ResourcesCompat.GetFont(this, Resource.Font.montserratregular);

            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).CollapsedTitleTypeface = font;
            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).ExpandedTitleTypeface  = font;

            FindViewById <AppBarLayout>(Resource.Id.appbar).SetExpanded(false, false);

            //if (!string.IsNullOrEmpty(CurrentEvent.iconbackground) && !WhiteLabelConfig.REDUCE_BANDWIDTH)
            //    Picasso.With(this).Load(CurrentEvent.iconbackground).CenterCrop().Fit().MemoryPolicy(MemoryPolicy.NoCache, MemoryPolicy.NoStore).Tag(this).Into(FindViewById<ImageView>(Resource.Id.defaultback), new Action(() =>
            //    {
            //        var bitmap = ((BitmapDrawable)FindViewById<ImageView>(Resource.Id.defaultback).Drawable).Bitmap;
            //        Palette palette = Palette.From(bitmap).Generate();
            //        int vibrant = palette.GetLightVibrantColor(0);
            //        if (vibrant == 0)
            //            vibrant = palette.GetMutedColor(0);
            //        int dark = palette.GetVibrantColor(0);
            //        if (dark == 0)
            //            dark = palette.GetLightMutedColor(0);
            //        //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetContentScrimColor(vibrant);
            //        //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetStatusBarScrimColor(dark);
            //    }), null);
            //else
            //{
            //Picasso.With(this).Load(Resource.Drawable.user_back).CenterCrop().Fit().Into(FindViewById<ImageView>(Resource.Id.defaultback));
            //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetContentScrimColor(Color.Transparent);
            //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetStatusBarScrimColor(dark);
            //}

            FindViewById <TextView>(Resource.Id.organisedby).Text = CurrentEvent.organisedby;
            Picasso.With(this).Load(CurrentEvent.organiserprofile.Replace("sz=50", "")).Tag(this).Fit().Transform(new CircleTransform()).Into(FindViewById <ImageView>(Resource.Id.imgGravatar));

            FindViewById <TextView>(Resource.Id.contributors).Text  = Java.Lang.String.Format("%d", CurrentEvent.numberofcontributors);
            FindViewById <TextView>(Resource.Id.contributions).Text = Java.Lang.String.Format("%d", CurrentEvent.numberofclips);

            _pager = FindViewById <ViewPager>(Resource.Id.tabpager);

            capture = FindViewById <FloatingActionButton>(Resource.Id.capture);
            newedit = FindViewById <FloatingActionButton>(Resource.Id.newedit);
            newtag  = FindViewById <FloatingActionButton>(Resource.Id.newtag);


            capture.Click += CaptureClick;
            newedit.Click += Review_Click;
            newtag.Click  += Newtag_Click;

            var dip16 = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 16, Resources.DisplayMetrics);

            capture.LayoutParameters = new CoordinatorLayout.LayoutParams(capture.LayoutParameters)
            {
                Behavior = new MyFABAwareScrollingViewBehavior(this, capture, 0, _pager), Gravity = (int)(GravityFlags.End | GravityFlags.Right | GravityFlags.Bottom), MarginEnd = dip16, BottomMargin = dip16
            };
            newtag.LayoutParameters = new CoordinatorLayout.LayoutParams(newtag.LayoutParameters)
            {
                Behavior = new MyFABAwareScrollingViewBehavior(this, newtag, 1, _pager), Gravity = (int)(GravityFlags.End | GravityFlags.Right | GravityFlags.Bottom), MarginEnd = dip16, BottomMargin = dip16
            };
            newedit.LayoutParameters = new CoordinatorLayout.LayoutParams(newedit.LayoutParameters)
            {
                Behavior = new MyFABAwareScrollingViewBehavior(this, newedit, 2, _pager), Gravity = (int)(GravityFlags.End | GravityFlags.Right | GravityFlags.Bottom), MarginEnd = dip16, BottomMargin = dip16
            };

            _tabs            = FindViewById <Android.Support.Design.Widget.TabLayout>(Resource.Id.tabs);
            _tabs.TabGravity = 0;
            _tabs.TabMode    = 1;

            _adapter       = new ReviewPageAdapter(SupportFragmentManager, this);
            _pager.Adapter = _adapter;

            if (savedInstanceState == null)
            {
                myclips                    = new MyClipsFragment(this);
                myclips.OnPreview         += Myclips_OnPreview;
                myclips.OnRefresh         += Myclips_OnRefresh;
                myclips.OnEventInfoUpdate += Myclips_OnEventInfoUpdate;
                myclips.OnStartUpload     += Myclips_OnStartUpload;

                myedits             = new MyEditsFragment();
                myedits.OnOpenEdit += Myedits_OnOpenEdit;
                myedits.OnPreview  += Myedits_OnPreview;

                myingest            = new AllClipsFragment(AllClipsFragment.ClipViewMode.LIST);
                myingest.OnPreview += Myingest_OnPreview;
            }
            else
            {
                myclips                    = SupportFragmentManager.FindFragmentByTag("android:switcher:" + Resource.Id.tabpager + ":0") as MyClipsFragment;
                myclips.OnPreview         += Myclips_OnPreview;
                myclips.OnRefresh         += Myclips_OnRefresh;
                myclips.OnEventInfoUpdate += Myclips_OnEventInfoUpdate;
                myclips.OnStartUpload     += Myclips_OnStartUpload;

                myingest             = SupportFragmentManager.FindFragmentByTag("android:switcher:" + Resource.Id.tabpager + ":1") as AllClipsFragment;
                myingest.ChooserMode = AllClipsFragment.ClipViewMode.LIST;
                myingest.OnPreview  += Myingest_OnPreview;

                myedits = SupportFragmentManager.FindFragmentByTag("android:switcher:" + Resource.Id.tabpager + ":2") as MyEditsFragment;
                if (myedits == null)
                {
                    myedits = new MyEditsFragment();
                }

                myedits.OnOpenEdit += Myedits_OnOpenEdit;
                myedits.OnPreview  += Myedits_OnPreview;
            }

            //myedits.Reattach();

            _adapter.AddTab(GetString(Resource.String.videos), myclips, ReviewPageAdapter.TabType.CLIPS);
            _adapter.AddTab(GetString(Resource.String.tagging), myingest, ReviewPageAdapter.TabType.INGEST);
            _adapter.AddTab(GetString(Resource.String.edits), myedits, ReviewPageAdapter.TabType.EDITS);

            _pager.Post(() => {
                _tabs.SetupWithViewPager(_pager);
            });

            _pager.PageSelected += _pager_PageSelected;

            if (Intent?.GetBooleanExtra("needsperms", false) ?? false)
            {
                LoginFuncs.ShowError(this, new NeedsPermissionsException());
            }
        }