private void prepareViews() { DurationLabel.Font = DurationLabel.Font.GetMonospacedDigitFont(); centerTextVertically(TagsTextView); TagsTextView.TextContainer.LineFragmentPadding = 0; if (TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Compact) { var bottomSafeAreaInset = UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Bottom; if (bottomSafeAreaInset >= ButtonsContainerBottomConstraint.Constant) { ButtonsContainerBottomConstraint.Constant = 0; } } DescriptionTextView.TintColor = Colors.StartTimeEntry.Cursor.ToNativeColor(); DescriptionTextView.PlaceholderText = Resources.AddDescription; TimeEntryTimes.Hidden = ViewModel.IsEditingGroup; GroupDuration.Hidden = !ViewModel.IsEditingGroup; DurationView.Hidden = ViewModel.IsEditingGroup; StartDateView.Hidden = ViewModel.IsEditingGroup; DescriptionView.InsertSeparator(); SelectProject.InsertSeparator(); TagsContainerView.InsertSeparator(); TimeEntryTimes.InsertSeparator(); DurationView.InsertSeparator(); StartDateView.InsertSeparator(); BillableView.InsertSeparator(); StartTimeView.InsertSeparator(UIRectEdge.Right); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Configure navigation item NavigationItem.TitleView = durationView = new DurationView() { Hint = model != null?model.GetDuration() : TimeSpan.Zero, }.Apply(Style.DurationEdit.DurationView); durationView.DurationChanged += (s, e) => Rebind(); durationView.SizeToFit(); barButtonItem = new UIBarButtonItem( model == null ? "DurationAdd".Tr() : "DurationSet".Tr(), UIBarButtonItemStyle.Plain, OnNavigationBarRightClicked ).Apply(Style.NavLabelButton); Rebind(); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Configure navigation item NavigationItem.TitleView = durationView = new DurationView() { Hint = new Duration(duration.Hours, duration.Minutes), }.Apply(Style.DurationEdit.DurationView); durationView.DurationChanged += (s, e) => Rebind(); durationView.SizeToFit(); barButtonItem = new UIBarButtonItem( "DurationSet".Tr(), UIBarButtonItemStyle.Plain, OnNavigationBarRightClicked ).Apply(Style.NavLabelButton); Rebind(); }
void ReleaseDesignerOutlets() { if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (DurationLabel != null) { DurationLabel.Dispose(); DurationLabel = null; } if (DurationView != null) { DurationView.Dispose(); DurationView = null; } if (EndTimeLabel != null) { EndTimeLabel.Dispose(); EndTimeLabel = null; } if (SaveButton != null) { SaveButton.Dispose(); SaveButton = null; } if (StartTimeLabel != null) { StartTimeLabel.Dispose(); StartTimeLabel = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); projectTaskClientToAttributedString = new ProjectTaskClientToAttributedString( ProjectTaskClientLabel.Font.CapHeight, Colors.EditTimeEntry.ClientText.ToNativeColor()); tagsListToAttributedString = new TagsListToAttributedString(TagsTextView); localizeLabels(); prepareViews(); prepareOnboarding(); contentSizeChangedDisposable = ScrollViewContent.AddObserver(boundsKey, NSKeyValueObservingOptions.New, onContentSizeChanged); DescriptionTextView.Text = ViewModel.Description.Value; ViewModel.Preferences .Select(preferences => preferences.DurationFormat) .Select(format => ViewModel.GroupDuration.ToFormattedString(format)) .Subscribe(GroupDuration.Rx().Text()) .DisposedBy(DisposeBag); CloseButton.Rx().Tap() .Subscribe(ViewModel.CloseWithDefaultResult) .DisposedBy(DisposeBag); ConfirmButton.Rx() .BindAction(ViewModel.Save) .DisposedBy(DisposeBag); DescriptionTextView.TextObservable .Subscribe(ViewModel.Description.Accept) .DisposedBy(DisposeBag); DescriptionTextView.SizeChangedObservable .Subscribe(adjustHeight) .DisposedBy(DisposeBag); ViewModel.SyncErrorMessage .Subscribe(ErrorMessageLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.IsSyncErrorMessageVisible .Subscribe(ErrorView.Rx().IsVisible()) .DisposedBy(DisposeBag); ErrorView.Rx().Tap() .Subscribe(ViewModel.DismissSyncErrorMessage.Inputs) .DisposedBy(DisposeBag); ViewModel.ProjectClientTask .Select(info => projectTaskClientToAttributedString.Convert( info.Project, info.Task, info.Client, new Color(info.ProjectColor).ToNativeColor())) .Subscribe(ProjectTaskClientLabel.Rx().AttributedText()) .DisposedBy(DisposeBag); ViewModel.ProjectClientTask .Select(info => info.HasProject) .Subscribe(ProjectTaskClientLabel.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.ProjectClientTask .Select(info => !info.HasProject) .Subscribe(AddProjectAndTaskView.Rx().IsVisible()) .DisposedBy(DisposeBag); SelectProject.Rx() .BindAction(ViewModel.SelectProject) .DisposedBy(DisposeBag); TagsTextView.Rx() .BindAction(ViewModel.SelectTags) .DisposedBy(DisposeBag); AddTagsView.Rx() .BindAction(ViewModel.SelectTags) .DisposedBy(DisposeBag); var containsTags = ViewModel.Tags .Select(tags => tags.Any()); containsTags .Invert() .Subscribe(AddTagsView.Rx().IsVisible()) .DisposedBy(DisposeBag); containsTags .Subscribe(TagsTextView.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsBillable .Subscribe(BillableSwitch.Rx().CheckedObserver()) .DisposedBy(DisposeBag); BillableSwitch.Rx().Changed() .Subscribe(ViewModel.ToggleBillable.Inputs) .DisposedBy(DisposeBag); ViewModel.IsBillableAvailable .Subscribe(BillableView.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsInaccessible .Subscribe(adjustUIForInaccessibleTimeEntry) .DisposedBy(DisposeBag); ViewModel.StartTime .WithLatestFrom(ViewModel.Preferences, (startTime, preferences) => DateTimeToFormattedString.Convert( startTime, preferences.TimeOfDayFormat.Format)) .Subscribe(StartTimeLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.StartTime .WithLatestFrom(ViewModel.Preferences, (startTime, preferences) => DateTimeToFormattedString.Convert( startTime, preferences.DateFormat.Short)) .Subscribe(StartDateLabel.Rx().Text()) .DisposedBy(DisposeBag); StartTimeView.Rx().Tap() .SelectValue(EditViewTapSource.StartTime) .Subscribe(ViewModel.EditTimes.Inputs) .DisposedBy(DisposeBag); StartDateView.Rx().Tap() .Subscribe(ViewModel.SelectStartDate.Inputs) .DisposedBy(DisposeBag); ViewModel.IsTimeEntryRunning .Subscribe(StopButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsTimeEntryRunning .Select(CommonFunctions.Invert) .Subscribe(EndTimeLabel.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.StopTime .Where(stopTime => stopTime.HasValue) .Select(stopTime => stopTime.Value) .WithLatestFrom(ViewModel.Preferences, (stopTime, preferences) => DateTimeToFormattedString.Convert( stopTime, preferences.TimeOfDayFormat.Format)) .Subscribe(EndTimeLabel.Rx().Text()) .DisposedBy(DisposeBag); EndTimeView.Rx().Tap() .SelectLatestFrom(ViewModel.IsTimeEntryRunning) .Invert() .Where(CommonFunctions.Identity) .SelectValue(EditViewTapSource.StopTime) .Subscribe(ViewModel.EditTimes.Inputs) .DisposedBy(DisposeBag); EndTimeView.Rx().Tap() .Merge(StopButton.Rx().Tap()) .SelectLatestFrom(ViewModel.IsTimeEntryRunning) .Where(CommonFunctions.Identity) .SelectUnit() .Subscribe(ViewModel.StopTimeEntry.Inputs) .DisposedBy(DisposeBag); ViewModel.Duration .WithLatestFrom(ViewModel.Preferences, (duration, preferences) => duration.ToFormattedString(preferences.DurationFormat)) .Subscribe(DurationLabel.Rx().Text()) .DisposedBy(DisposeBag); DurationView.Rx().Tap() .SelectValue(EditViewTapSource.Duration) .Subscribe(ViewModel.EditTimes.Inputs) .DisposedBy(DisposeBag); DeleteButton.Rx() .BindAction(ViewModel.Delete) .DisposedBy(DisposeBag); }
void ReleaseDesignerOutlets() { if (AddProjectAndTaskView != null) { AddProjectAndTaskView.Dispose(); AddProjectAndTaskView = null; } if (AddTagsView != null) { AddTagsView.Dispose(); AddTagsView = null; } if (BillableSwitch != null) { BillableSwitch.Dispose(); BillableSwitch = null; } if (BillableView != null) { BillableView.Dispose(); BillableView = null; } if (CategorizeWithProjectsBubbleView != null) { CategorizeWithProjectsBubbleView.Dispose(); CategorizeWithProjectsBubbleView = null; } if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (ConfirmButton != null) { ConfirmButton.Dispose(); ConfirmButton = null; } if (ConfirmButtonBottomConstraint != null) { ConfirmButtonBottomConstraint.Dispose(); ConfirmButtonBottomConstraint = null; } if (DeleteButton != null) { DeleteButton.Dispose(); DeleteButton = null; } if (DeleteButtonBottomConstraint != null) { DeleteButtonBottomConstraint.Dispose(); DeleteButtonBottomConstraint = null; } if (DescriptionTextView != null) { DescriptionTextView.Dispose(); DescriptionTextView = null; } if (DurationLabel != null) { DurationLabel.Dispose(); DurationLabel = null; } if (DurationView != null) { DurationView.Dispose(); DurationView = null; } if (EndTimeLabel != null) { EndTimeLabel.Dispose(); EndTimeLabel = null; } if (EndTimeView != null) { EndTimeView.Dispose(); EndTimeView = null; } if (ErrorMessageLabel != null) { ErrorMessageLabel.Dispose(); ErrorMessageLabel = null; } if (ErrorView != null) { ErrorView.Dispose(); ErrorView = null; } if (ProjectTaskClientLabel != null) { ProjectTaskClientLabel.Dispose(); ProjectTaskClientLabel = null; } if (RemainingCharacterCount != null) { RemainingCharacterCount.Dispose(); RemainingCharacterCount = null; } if (ScrollView != null) { ScrollView.Dispose(); ScrollView = null; } if (ScrollViewContent != null) { ScrollViewContent.Dispose(); ScrollViewContent = null; } if (StartDateLabel != null) { StartDateLabel.Dispose(); StartDateLabel = null; } if (StartDateView != null) { StartDateView.Dispose(); StartDateView = null; } if (StartTimeLabel != null) { StartTimeLabel.Dispose(); StartTimeLabel = null; } if (StartTimeView != null) { StartTimeView.Dispose(); StartTimeView = null; } if (StopButton != null) { StopButton.Dispose(); StopButton = null; } if (TagsContainerView != null) { TagsContainerView.Dispose(); TagsContainerView = null; } if (TagsSeparator != null) { TagsSeparator.Dispose(); TagsSeparator = null; } if (TagsTextView != null) { TagsTextView.Dispose(); TagsTextView = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } if (BillableLabel != null) { BillableLabel.Dispose(); BillableLabel = null; } if (StartDateDescriptionLabel != null) { StartDateDescriptionLabel.Dispose(); StartDateDescriptionLabel = null; } if (DurationDescriptionLabel != null) { DurationDescriptionLabel.Dispose(); DurationDescriptionLabel = null; } if (StartDescriptionLabel != null) { StartDescriptionLabel.Dispose(); StartDescriptionLabel = null; } if (EndDescriptionLabel != null) { EndDescriptionLabel.Dispose(); EndDescriptionLabel = null; } if (ErrorMessageTitleLabel != null) { ErrorMessageTitleLabel.Dispose(); ErrorMessageTitleLabel = null; } if (AddProjectTaskLabel != null) { AddProjectTaskLabel.Dispose(); AddProjectTaskLabel = null; } if (CategorizeWithProjectsLabel != null) { CategorizeWithProjectsLabel.Dispose(); CategorizeWithProjectsLabel = null; } if (AddTagsLabel != null) { AddTagsLabel.Dispose(); AddTagsLabel = null; } }
void ReleaseDesignerOutlets() { if (AddProjectAndTaskView != null) { AddProjectAndTaskView.Dispose(); AddProjectAndTaskView = null; } if (AddTagsView != null) { AddTagsView.Dispose(); AddTagsView = null; } if (BillableSwitch != null) { BillableSwitch.Dispose(); BillableSwitch = null; } if (BillableView != null) { BillableView.Dispose(); BillableView = null; } if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (ConfirmButton != null) { ConfirmButton.Dispose(); ConfirmButton = null; } if (ConfirmButtonBottomConstraint != null) { ConfirmButtonBottomConstraint.Dispose(); ConfirmButtonBottomConstraint = null; } if (DeleteButton != null) { DeleteButton.Dispose(); DeleteButton = null; } if (DeleteButtonBottomConstraint != null) { DeleteButtonBottomConstraint.Dispose(); DeleteButtonBottomConstraint = null; } if (DescriptionTextView != null) { DescriptionTextView.Dispose(); DescriptionTextView = null; } if (DurationLabel != null) { DurationLabel.Dispose(); DurationLabel = null; } if (DurationView != null) { DurationView.Dispose(); DurationView = null; } if (ProjectTaskClientLabel != null) { ProjectTaskClientLabel.Dispose(); ProjectTaskClientLabel = null; } if (ScrollView != null) { ScrollView.Dispose(); ScrollView = null; } if (ScrollViewContent != null) { ScrollViewContent.Dispose(); ScrollViewContent = null; } if (ErrorMessageLabel != null) { ErrorMessageLabel.Dispose(); ErrorMessageLabel = null; } if (ErrorView != null) { ErrorView.Dispose(); ErrorView = null; } if (StartDateLabel != null) { StartDateLabel.Dispose(); StartDateLabel = null; } if (StartDateView != null) { StartDateView.Dispose(); StartDateView = null; } if (StartTimeLabel != null) { StartTimeLabel.Dispose(); StartTimeLabel = null; } if (StartTimeView != null) { StartTimeView.Dispose(); StartTimeView = null; } if (EndTimeLabel != null) { EndTimeLabel.Dispose(); EndTimeLabel = null; } if (EndTimeView != null) { EndTimeView.Dispose(); EndTimeView = null; } if (StopButton != null) { StopButton.Dispose(); StopButton = null; } if (TagsTextView != null) { TagsTextView.Dispose(); TagsTextView = null; } }
public static void DurationView (DurationView v) { v.Font = UIFont.FromName ("HelveticaNeue-Thin", 32f); v.TextColor = Color.Gray; v.HighlightedTextColor = Color.Black; }