Ejemplo n.º 1
0
            public void HasTimeEntriesIdsInAscendingOrder(NonEmptyArray <long> ids)
            {
                var timeEntries = ids.Get.Select(timeEntry).ToArray();

                var viewModel = new LogItemViewModel(
                    new GroupId(timeEntries.First()),
                    timeEntries.Select(te => te.Id).ToArray(),
                    LogItemVisualizationIntent.CollapsedGroupHeader,
                    false,
                    false,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    false,
                    false,
                    false,
                    false,
                    0,
                    0,
                    0,
                    false,
                    false);

                viewModel.RepresentedTimeEntriesIds.Should().BeInAscendingOrder();
            }
Ejemplo n.º 2
0
            public void RemembersAllIdsOfTheTimeEntries(NonEmptyArray <long> ids)
            {
                var timeEntries = ids.Get.Select(timeEntry).ToArray();

                var viewModel = new LogItemViewModel(
                    new GroupId(timeEntries.First()),
                    timeEntries.Select(te => te.Id).ToArray(),
                    LogItemVisualizationIntent.CollapsedGroupHeader,
                    false,
                    false,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    false,
                    false,
                    false,
                    false,
                    0,
                    0,
                    0,
                    false,
                    false);

                viewModel.RepresentedTimeEntriesIds.Should().BeEquivalentTo(ids.Get);
            }
Ejemplo n.º 3
0
 public TimeEntryViewData(Context context, LogItemViewModel viewModel)
 {
     ViewModel = viewModel;
     if (viewModel.HasProject)
     {
         ProjectArchivedIconTintColor  = Color.ParseColor(viewModel.ProjectColor);
         ProjectArchivedIconVisibility = (!viewModel.IsActive).ToVisibility();
     }
     else
     {
         ProjectArchivedIconVisibility = ViewStates.Gone;
     }
     ProjectTaskClientText = TimeEntryExtensions.ToProjectTaskClient(context,
                                                                     ViewModel.HasProject,
                                                                     ViewModel.ProjectName,
                                                                     ViewModel.ProjectColor,
                                                                     ViewModel.TaskName,
                                                                     ViewModel.ClientName,
                                                                     ViewModel.ProjectIsPlaceholder,
                                                                     ViewModel.TaskIsPlaceholder,
                                                                     displayPlaceholders: true);
     ProjectTaskClientVisibility   = viewModel.HasProject.ToVisibility();
     DescriptionVisibility         = viewModel.HasDescription.ToVisibility();
     AddDescriptionLabelVisibility = (!viewModel.HasDescription).ToVisibility();
     ContinueImageVisibility       = viewModel.CanContinue.ToVisibility();
     ErrorImageViewVisibility      = (!viewModel.CanContinue).ToVisibility();
     ErrorNeedsSyncVisibility      = viewModel.NeedsSync.ToVisibility();
     ContinueButtonVisibility      = viewModel.CanContinue.ToVisibility();
     BillableIconVisibility        = viewModel.IsBillable.ToVisibility();
     HasTagsIconVisibility         = viewModel.HasTags.ToVisibility();
 }
Ejemplo n.º 4
0
 public ContinueTimeEntryInfo(LogItemViewModel viewModel, ContinueTimeEntryMode continueMode)
 {
     Id            = viewModel.RepresentedTimeEntriesIds.First();
     IndexInLog    = viewModel.IndexInLog;
     DayInLog      = viewModel.DayInLog;
     DaysInThePast = viewModel.DaysInThePast;
     ContinueMode  = continueMode;
 }
Ejemplo n.º 5
0
        private EditTimeEntryInfo editEventInfo(LogItemViewModel item)
        {
            var origin = item.IsTimeEntryGroupHeader
                ? GroupHeader
                : item.BelongsToGroup
                    ? GroupTimeEntry
                    : SingleTimeEntry;

            return(new EditTimeEntryInfo(origin, item.RepresentedTimeEntriesIds));
        }
Ejemplo n.º 6
0
        private (long[], EditTimeEntryOrigin) editEventInfo(LogItemViewModel item)
        {
            var origin = item.IsTimeEntryGroupHeader
                ? EditTimeEntryOrigin.GroupHeader
                : item.BelongsToGroup
                    ? EditTimeEntryOrigin.GroupTimeEntry
                    : EditTimeEntryOrigin.SingleTimeEntry;

            return(item.RepresentedTimeEntriesIds, origin);
        }
        public NSAttributedString Convert(LogItemViewModel logItemViewModel)
        {
            var projectColor = new Color(logItemViewModel.ProjectColor).ToNativeColor();

            return(Convert(
                       logItemViewModel.ProjectName,
                       logItemViewModel.TaskName,
                       logItemViewModel.ClientName, projectColor,
                       logItemViewModel.ProjectIsPlaceholder,
                       logItemViewModel.TaskIsPlaceholder));
        }
Ejemplo n.º 8
0
        private (long, ContinueTimeEntryMode) timeEntryContinuation(LogItemViewModel itemViewModel, bool isSwipe)
        {
            var continueMode = default(ContinueTimeEntryMode);

            if (isSwipe)
            {
                continueMode = itemViewModel.IsTimeEntryGroupHeader
                    ? ContinueTimeEntryMode.TimeEntriesGroupSwipe
                    : ContinueTimeEntryMode.SingleTimeEntrySwipe;
            }
            else
            {
                continueMode = itemViewModel.IsTimeEntryGroupHeader
                    ? ContinueTimeEntryMode.TimeEntriesGroupContinueButton
                    : ContinueTimeEntryMode.SingleTimeEntryContinueButton;
            }

            return(itemViewModel.RepresentedTimeEntriesIds.First(), continueMode);
        }
Ejemplo n.º 9
0
        private ContinueTimeEntryInfo timeEntryContinuation(LogItemViewModel itemViewModel, bool isSwipe)
        {
            var continueMode = default(ContinueTimeEntryMode);

            if (isSwipe)
            {
                continueMode = itemViewModel.IsTimeEntryGroupHeader
                    ? ContinueTimeEntryMode.TimeEntriesGroupSwipe
                    : ContinueTimeEntryMode.SingleTimeEntrySwipe;
            }
            else
            {
                continueMode = itemViewModel.IsTimeEntryGroupHeader
                    ? ContinueTimeEntryMode.TimeEntriesGroupContinueButton
                    : ContinueTimeEntryMode.SingleTimeEntryContinueButton;
            }

            return(new ContinueTimeEntryInfo(itemViewModel, continueMode));
        }
Ejemplo n.º 10
0
        public TimeEntryViewData(LogItemViewModel viewModel)
        {
            ViewModel = viewModel;

            var spannableString = new SpannableStringBuilder();

            if (viewModel.HasProject)
            {
                spannableString.Append(viewModel.ProjectName, new ForegroundColorSpan(Color.ParseColor(viewModel.ProjectColor)), SpanTypes.ExclusiveInclusive);

                if (!string.IsNullOrEmpty(viewModel.TaskName))
                {
                    spannableString.Append($": {viewModel.TaskName}");
                }

                if (!string.IsNullOrEmpty(viewModel.ClientName))
                {
                    spannableString.Append($" {viewModel.ClientName}", new ForegroundColorSpan(Color.ParseColor(ClientNameColor)), SpanTypes.ExclusiveExclusive);
                }

                ProjectTaskClientText       = spannableString;
                ProjectTaskClientVisibility = ViewStates.Visible;
            }
            else
            {
                ProjectTaskClientText       = new SpannableString(string.Empty);
                ProjectTaskClientVisibility = ViewStates.Gone;
            }

            DescriptionVisibility         = viewModel.HasDescription.ToVisibility();
            AddDescriptionLabelVisibility = (!viewModel.HasDescription).ToVisibility();
            ContinueImageVisibility       = viewModel.CanContinue.ToVisibility();
            ErrorImageViewVisibility      = (!viewModel.CanContinue).ToVisibility();
            ErrorNeedsSyncVisibility      = viewModel.NeedsSync.ToVisibility();
            ContinueButtonVisibility      = viewModel.CanContinue.ToVisibility();
            BillableIconVisibility        = viewModel.IsBillable.ToVisibility();
            HasTagsIconVisibility         = viewModel.HasTags.ToVisibility();
        }