Ejemplo n.º 1
0
        public override void LoadView ()
        {
            View = new UIView ().Apply (Style.Screen);

            Add (new SeparatorView ().Apply (Style.Settings.Separator));
            Add (askProjectView = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.Settings.RowBackground).Apply (BindAskProjectView));
            askProjectView.Label.Apply (Style.Settings.SettingLabel);
            askProjectView.Label.Text = "SettingsAskProject".Tr ();
            askProjectView.Switch.ValueChanged += OnAskProjectViewValueChanged;

            Add (new SeparatorView ().Apply (Style.Settings.Separator));
            Add (new UILabel () {
                Text = "SettingsAskProjectDesc".Tr (),
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.Settings.DescriptionLabel));

            Add (new SeparatorView ().Apply (Style.Settings.Separator));
            Add (mobileTagView = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.Settings.RowBackground).Apply (BindMobileTagView));
            mobileTagView.Label.Apply (Style.Settings.SettingLabel);
            mobileTagView.Label.Text = "SettingsMobileTag".Tr ();
            mobileTagView.Switch.ValueChanged += OnMobileTagViewValueChanged;

            Add (new SeparatorView ().Apply (Style.Settings.Separator));
            Add (new UILabel () {
                Text = "SettingsMobileTagDesc".Tr (),
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.Settings.DescriptionLabel));

            View.AddConstraints (MakeConstraints (View));
        }
Ejemplo n.º 2
0
 private void BindMobileTagView (LabelSwitchView v)
 {
     v.Switch.On = SettingsStore.UseDefaultTag;
 }
Ejemplo n.º 3
0
 private void BindAskProjectView (LabelSwitchView v)
 {
     v.Switch.On = SettingsStore.ChooseProjectForNew;
 }
        public override void LoadView ()
        {
            durationButton = new UIButton ().Apply (Style.NavTimer.DurationButton);
            durationButton.SetTitle (DefaultDurationText, UIControlState.Normal); // Dummy content to use for sizing of the label
            durationButton.SizeToFit ();
            durationButton.TouchUpInside += OnDurationButtonTouchUpInside;
            NavigationItem.TitleView = durationButton;

            var scrollView = new UIScrollView ().Apply (Style.Screen);

            scrollView.Add (wrapper = new UIView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });

            wrapper.Add (startStopView = new StartStopView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                StartTime = ViewModel.StartDate,
                StopTime = ViewModel.StopDate,
            });
            startStopView.SelectedChanged += OnStartStopViewSelectedChanged;

            wrapper.Add (datePicker = new UIDatePicker {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = DatePickerHidden,
                Alpha = 0,
            } .Apply (Style.EditTimeEntry.DatePicker));
            datePicker.ValueChanged += OnDatePickerValueChanged;

            wrapper.Add (projectButton = new ProjectClientTaskButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });
            projectButton.TouchUpInside += OnProjectButtonTouchUpInside;

            wrapper.Add (descriptionTextField = new TextField {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString (
                    "EditEntryDesciptionTimerHint".Tr (),
                    foregroundColor: Color.Gray
                ),
                ShouldReturn = tf => tf.ResignFirstResponder (),
            } .Apply (Style.EditTimeEntry.DescriptionField));

            descriptionTextField.ShouldBeginEditing += (s) => {
                ForceDimissDatePicker();
                return true;
            };
            descriptionTextField.ShouldEndEditing += s => {
                return true;
            };

            wrapper.Add (tagsButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            } .Apply (Style.EditTimeEntry.TagsButton));
            tagsButton.TouchUpInside += OnTagsButtonTouchUpInside;

            wrapper.Add (billableSwitch = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "EditEntryBillable".Tr (),
            } .Apply (Style.EditTimeEntry.BillableContainer));
            billableSwitch.Label.Apply (Style.EditTimeEntry.BillableLabel);

            wrapper.Add (deleteButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            } .Apply (Style.EditTimeEntry.DeleteButton));
            deleteButton.SetTitle ("EditEntryDelete".Tr (), UIControlState.Normal);
            deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside;

            ResetWrapperConstraints ();
            scrollView.AddConstraints (
                wrapper.AtTopOf (scrollView),
                wrapper.AtBottomOf (scrollView),
                wrapper.AtLeftOf (scrollView),
                wrapper.AtRightOf (scrollView),
                wrapper.WithSameWidth (scrollView),
                wrapper.Height ().GreaterThanOrEqualTo ().HeightOf (scrollView).Minus (64f),
                null
            );

            View = scrollView;
        }
        public override void LoadView ()
        {
            var scrollView = new UIScrollView ().Apply (Style.Screen);

            scrollView.Add (wrapper = new UIView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });

            wrapper.Add (startStopView = new StartStopView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                StartTime = model.StartTime,
                StopTime = model.StopTime,
            }.Apply (BindStartStopView));
            startStopView.SelectedChanged += OnStartStopViewSelectedChanged;

            wrapper.Add (datePicker = new UIDatePicker () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = DatePickerHidden,
                Alpha = 0,
            }.Apply (Style.EditTimeEntry.DatePicker).Apply (BindDatePicker));
            datePicker.ValueChanged += OnDatePickerValueChanged;

            wrapper.Add (projectButton = new ProjectClientTaskButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (BindProjectButton));
            projectButton.TouchUpInside += OnProjectButtonTouchUpInside;

            wrapper.Add (descriptionTextField = new TextField () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString (
                    "EditEntryDesciptionTimerHint".Tr (),
                    foregroundColor: Color.Gray
                ),
                ShouldReturn = (tf) => tf.ResignFirstResponder (),
            }.Apply (Style.EditTimeEntry.DescriptionField).Apply (BindDescriptionField));
            descriptionTextField.EditingChanged += OnDescriptionFieldEditingChanged;
            descriptionTextField.EditingDidEnd += (s, e) => CommitDescriptionChanges ();

            wrapper.Add (tagsButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.EditTimeEntry.TagsButton).Apply (BindTagsButton));
            tagsButton.TouchUpInside += OnTagsButtonTouchUpInside;

            wrapper.Add (billableSwitch = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "EditEntryBillable".Tr (),
            }.Apply (Style.EditTimeEntry.BillableContainer).Apply (BindBillableSwitch));
            billableSwitch.Label.Apply (Style.EditTimeEntry.BillableLabel);
            billableSwitch.Switch.ValueChanged += OnBillableSwitchValueChanged;

            wrapper.Add (deleteButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.EditTimeEntry.DeleteButton));
            deleteButton.SetTitle ("EditEntryDelete".Tr (), UIControlState.Normal);
            deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside;

            wrapper.AddConstraints (VerticalLinearLayout (wrapper));
            scrollView.AddConstraints (
                wrapper.AtTopOf (scrollView),
                wrapper.AtBottomOf (scrollView),
                wrapper.AtLeftOf (scrollView),
                wrapper.AtRightOf (scrollView),
                wrapper.WithSameWidth (scrollView),
                wrapper.Height ().GreaterThanOrEqualTo ().HeightOf (scrollView).Minus (64f),
                null
            );

            View = scrollView;
        }
 private void BindBillableSwitch (LabelSwitchView v)
 {
     v.Hidden = model.Workspace == null || !model.Workspace.IsPremium;
     v.Switch.On = model.IsBillable;
 }
Ejemplo n.º 7
0
 private void BindGroupedView (LabelSwitchView v)
 {
     v.Switch.On = SettingsStore.GroupedTimeEntries;
 }