Ejemplo n.º 1
0
        private void updateSwipeLeftOnboardingStep(MainLogCellViewHolder lastTimeEntry)
        {
            swipeLeftPopup?.Dismiss();

            if (lastTimeEntry == null)
            {
                return;
            }

            if (swipeLeftOnboardingStepDisposable != null)
            {
                swipeLeftOnboardingStepDisposable.Dispose();
                swipeLeftOnboardingStepDisposable = null;
            }

            swipeLeftOnboardingStepDisposable = swipeLeftOnboardingStep
                                                .ManageVisibilityOf(
                visibilityChanged,
                swipeLeftPopup,
                lastTimeEntry.ItemView,
                (window, view) => window.BottomRightOffsetsTo(view, -16, -4));

            if (swipeLeftOnboardingAnimationStepDisposable != null)
            {
                swipeLeftOnboardingAnimationStepDisposable.Dispose();
                swipeLeftOnboardingAnimationStepDisposable = null;
            }

            swipeLeftOnboardingAnimationStepDisposable = swipeLeftOnboardingStep
                                                         .ManageSwipeActionAnimationOf(mainRecyclerView, lastTimeEntry, AnimationSide.Left);
        }
Ejemplo n.º 2
0
        private void updateSwipeRightOnboardingStep(MainLogCellViewHolder lastTimeEntry)
        {
            swipeRightPopup?.Dismiss();

            if (lastTimeEntry == null)
            {
                return;
            }

            if (swipeRightOnboardingStepDisposable != null)
            {
                swipeRightOnboardingStepDisposable.Dispose();
                swipeRightOnboardingStepDisposable = null;
            }

            swipeRightOnboardingStepDisposable = swipeRightOnboardingStep
                                                 .ManageVisibilityOf(
                swipeRightPopup,
                lastTimeEntry.ItemView,
                (window, view) => PopupOffsets.FromDp(16, -4, this));

            if (swipeRightOnboardingAnimationStepDisposable != null)
            {
                swipeRightOnboardingAnimationStepDisposable.Dispose();
                swipeRightOnboardingAnimationStepDisposable = null;
            }

            swipeRightOnboardingAnimationStepDisposable = swipeRightOnboardingStep
                                                          .ManageSwipeActionAnimationOf(mainRecyclerView, lastTimeEntry, AnimationSide.Right);
        }
Ejemplo n.º 3
0
        private void updateTapToEditOnboardingStep(MainLogCellViewHolder oldestVisibleTimeEntryViewHolder)
        {
            tapToEditPopup?.Dismiss();

            if (oldestVisibleTimeEntryViewHolder == null)
            {
                return;
            }

            if (editTimeEntryOnboardingStepDisposable != null)
            {
                editTimeEntryOnboardingStepDisposable.Dispose();
                editTimeEntryOnboardingStepDisposable = null;
            }

            editTimeEntryOnboardingStepDisposable = editTimeEntryOnboardingStep
                                                    .ManageVisibilityOf(
                tapToEditPopup,
                oldestVisibleTimeEntryViewHolder.ItemView,
                (window, view) => PopupOffsets.FromDp(16, -4, this));
        }
Ejemplo n.º 4
0
        public static IDisposable ManageSwipeActionAnimationOf(this IOnboardingStep step, RecyclerView recyclerView, MainLogCellViewHolder viewHolder, AnimationSide side)
        {
            Ensure.Argument.IsNotNull(viewHolder, nameof(viewHolder));

            void toggleVisibilityOnMainThread(bool shouldBeVisible)
            {
                if (shouldBeVisible && !viewHolder.IsAnimating)
                {
                    viewHolder.StartAnimating(side);
                    recyclerView.ScrollBy(0, 1);
                }
            }

            var subscriptionDisposable = step.ShouldBeVisible
                                         .ObserveOn(SynchronizationContext.Current)
                                         .Subscribe(toggleVisibilityOnMainThread);

            return(Disposable.Create(() =>
            {
                viewHolder.StopAnimating();
                subscriptionDisposable?.Dispose();
                subscriptionDisposable = null;
            }));
        }