Ejemplo n.º 1
0
        public UISingleDayView()
        {
            _title = new UILabel()
            {
                Font = UIFont.PreferredBody
            };
            this.Add(_title);

            _line = new CAShapeLayer()
            {
                FillColor = UIColor.LightGray.CGColor
            };
            this.Layer.AddSublayer(_line);

            _items = new UITableView()
            {
                SeparatorInset = UIEdgeInsets.Zero
            };
            if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0))
            {
                // Stretch to full width even on iPad
                _items.CellLayoutMarginsFollowReadableWidth = false;
            }
            _scheduleSnapshot = new UIDayScheduleSnapshot();
            _scheduleSnapshot.OnRequestViewClass += new WeakEventHandler <ViewItemClass>(_scheduleSnapshot_OnRequestViewClass).Handler;
            _items.TableFooterView = _scheduleSnapshot;
            this.Add(_items);

            MainScreenViewController.ListenToTabBarHeightChanged(ref _tabBarHeightListener, delegate
            {
                _items.ContentInset = new UIEdgeInsets(0, 0, MainScreenViewController.TAB_BAR_HEIGHT, 0);
            });
        }
        public AboutViewController()
        {
            Title = "About";

            var scrollView = new UIScrollView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            View.Add(scrollView);
            scrollView.StretchWidthAndHeight(View);

            var stackView = new UIStackView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Axis = UILayoutConstraintAxis.Vertical
            };

            scrollView.Add(stackView);
            stackView.ConfigureForVerticalScrolling(scrollView, top: 16, left: 16, right: 16, bottom: 16);

            ConfigureUI(stackView);

            MainScreenViewController.ListenToTabBarHeightChanged(ref _tabBarHeightListener, delegate
            {
                scrollView.ContentInset = new UIEdgeInsets(0, 0, MainScreenViewController.TAB_BAR_HEIGHT, 0);
            });
        }
Ejemplo n.º 3
0
        public UISingleDayView()
        {
            _title = new UILabel()
            {
                Font = UIFont.PreferredBody
            };
            this.Add(_title);

            _buttonExpand = new UIButton(UIButtonType.System);
            _buttonExpand.SetImage(UIImage.FromBundle("ToolbarDown").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal);
            nfloat radians180 = unchecked ((nfloat)Math.PI); // 180 degrees is exactly PI in radians

            _buttonExpand.Transform      = CGAffineTransform.MakeRotation(radians180);
            _buttonExpand.TouchUpInside += _buttonExpand_TouchUpInside;
            this.Add(_buttonExpand);

            _nothingDueText = new UILabel()
            {
                Font          = UIFont.PreferredBody,
                Text          = PowerPlannerResources.GetString("String_NothingDue"),
                TextAlignment = UITextAlignment.Center,
                TextColor     = UIColor.LightGray
            };
            this.Add(_nothingDueText);

            _line = new CAShapeLayer()
            {
                FillColor = UIColor.LightGray.CGColor
            };
            this.Layer.AddSublayer(_line);

            _items = new UITableView()
            {
                SeparatorInset = UIEdgeInsets.Zero
            };
            if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0))
            {
                // Stretch to full width even on iPad
                _items.CellLayoutMarginsFollowReadableWidth = false;
            }
            _scheduleSnapshot = new UIDayScheduleSnapshot();
            _scheduleSnapshot.OnRequestViewClass += new WeakEventHandler <ViewItemClass>(_scheduleSnapshot_OnRequestViewClass).Handler;
            _items.TableFooterView = _scheduleSnapshot;
            this.Add(_items);

            MainScreenViewController.ListenToTabBarHeightChanged(ref _tabBarHeightListener, delegate
            {
                _items.ContentInset = new UIEdgeInsets(0, 0, MainScreenViewController.TAB_BAR_HEIGHT, 0);
            });
        }
Ejemplo n.º 4
0
        public ReminderSettingsViewController()
        {
            Title = "Reminders";

            _tableView = new BareUIStaticGroupedTableView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            View.Add(_tableView);
            _tableView.StretchWidthAndHeight(View);

            MainScreenViewController.ListenToTabBarHeightChanged(ref _tabBarHeightListener, delegate
            {
                _tableView.ContentInset = new UIEdgeInsets(0, 0, MainScreenViewController.TAB_BAR_HEIGHT, 0);
            });
        }
        public SettingsListViewController()
        {
            AutomaticallyAdjustsScrollViewInsets = false;
            Title = "More";

            // Creating a table view programmatically: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/TableView_iPhone/CreateConfigureTableView/CreateConfigureTableView.html#//apple_ref/doc/uid/TP40007451-CH6-SW4
            // Xamarin: https://developer.xamarin.com/guides/ios/user_interface/controls/tables/populating-a-table-with-data/
            _tableView = new BareUIStaticGroupedTableView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            View.Add(_tableView);
            _tableView.StretchWidthAndHeight(View);

            MainScreenViewController.ListenToTabBarHeightChanged(ref _tabBarHeightListener, delegate
            {
                _tableView.ContentInset = new UIEdgeInsets(0, 0, MainScreenViewController.TAB_BAR_HEIGHT, 0);
            });
        }
Ejemplo n.º 6
0
        public ClassTasksOrEventsViewController()
        {
            _tableView = new UITableView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                SeparatorInset = UIEdgeInsets.Zero
            };
            _tableView.TableFooterView = new UIView(); // Eliminate extra separators on bottom of view
            if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0))
            {
                // Stretch to full width even on iPad
                _tableView.CellLayoutMarginsFollowReadableWidth = false;
            }
            View.Add(_tableView);
            _tableView.StretchWidthAndHeight(View);

            MainScreenViewController.ListenToTabBarHeightChanged(ref _tabBarHeightListener, delegate
            {
                _tableView.ContentInset = new UIEdgeInsets(0, 0, MainScreenViewController.TAB_BAR_HEIGHT, 0);
            });
        }
Ejemplo n.º 7
0
        public UIScheduleView(ScheduleViewModel viewModel)
        {
            this.MaximumZoomScale            = 1f;
            this.MinimumZoomScale            = 0.3f;
            this.ViewForZoomingInScrollView += delegate { return(_mainView); };
            this.BackgroundColor             = UIColorCompat.SystemBackgroundColor;

            ViewModel = viewModel;
            ViewModel.PropertyChanged += new WeakEventHandler <PropertyChangedEventArgs>(ViewModel_PropertyChanged).Handler;

            _mainView = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            this.Add(_mainView);
            _mainView.ConfigureForMultiDirectionScrolling(this);

            _timesColumn = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColorCompat.SystemGray4Color
            };
            _mainView.Add(_timesColumn);
            _timesColumn.StretchHeight(_mainView);

            _contentColumn = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            _mainView.Add(_contentColumn);
            _contentColumn.StretchHeight(_mainView);
            _mainView.AddConstraints(NSLayoutConstraint.FromVisualFormat($"H:|[timesColumn][contentColumn]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, new NSDictionary(
                                                                             "timesColumn", _timesColumn,
                                                                             "contentColumn", _contentColumn)));

            // Days row
            _daysRow = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColorCompat.SystemGray4Color
            };
            _contentColumn.Add(_daysRow);
            _daysRow.StretchWidth(_contentColumn);

            // All day items row
            _allDayItemsRow = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            _contentColumn.Add(_allDayItemsRow);
            _allDayItemsRow.StretchWidth(_contentColumn);

            // Schedule row
            _scheduleRow = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            _contentColumn.Add(_scheduleRow);
            _scheduleRow.StretchWidth(_contentColumn);

            //_daysRow.PinToTop(_contentColumn);
            //_scheduleRow.StretchHeight(_contentColumn);
            _contentColumn.AddConstraints(NSLayoutConstraint.FromVisualFormat($"V:|[daysRow][allDayItemsRow][scheduleRow]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, new NSDictionary(
                                                                                  "daysRow", _daysRow,
                                                                                  "allDayItemsRow", _allDayItemsRow,
                                                                                  "scheduleRow", _scheduleRow)));

            // Make scheduleRow be the big one, allDayItemsRow shrink
            _scheduleRow.SetContentCompressionResistancePriority(501, UILayoutConstraintAxis.Vertical);
            _allDayItemsRow.SetContentCompressionResistancePriority(499, UILayoutConstraintAxis.Vertical);

            // Populate days columns
            UIView prevDayLabel       = null;
            UIView prevAllDayItems    = null;
            UIView prevScheduleColumn = null;

            for (int i = 0; i < 7; i++)
            {
                // Day header
                var dayLabel = new UILabel()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    Font  = UIFont.PreferredSubheadline,
                    Lines = 1
                };
                _daysRow.Add(dayLabel);
                if (prevDayLabel == null)
                {
                    dayLabel.PinToLeft(_daysRow, COL_PADDING);
                }
                else
                {
                    dayLabel.SetToRightOf(prevDayLabel, _daysRow, COL_PADDING);
                }
                dayLabel.SetWidth(COL_WIDTH - COL_PADDING);
                dayLabel.StretchHeight(_daysRow, top: 3, bottom: 3);
                _dayLabels[i] = dayLabel;
                prevDayLabel  = dayLabel;

                // All day items
                var allDayItemsStackView = new UIStackView()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    Axis    = UILayoutConstraintAxis.Vertical,
                    Spacing = 1
                };
                {
                    var itemsSource = new BareUIStackViewItemsSourceAdapter(allDayItemsStackView, CreateAllDayItemView);
                    _allDayItemSourceAdapters[i] = itemsSource;
                }
                UIView allDayItemsView = allDayItemsStackView;
                // Have to place the stack view in a view since background doesn't render on stack view itself
                allDayItemsView = new UIView()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    BackgroundColor = UIColorCompat.SecondarySystemBackgroundColor
                };
                allDayItemsView.Add(allDayItemsStackView);
                allDayItemsStackView.StretchWidthAndHeight(allDayItemsView, right: 1);
                if (i % 2 != 0)
                {
                    // Alternate light and dark
                    allDayItemsView.BackgroundColor = UIColorCompat.SecondarySystemBackgroundColor;
                }
                else
                {
                    allDayItemsView.BackgroundColor = UIColorCompat.SystemBackgroundColor;
                }
                _allDayItemsRow.Add(allDayItemsView);
                if (prevAllDayItems == null)
                {
                    allDayItemsView.PinToLeft(_allDayItemsRow);
                }
                else
                {
                    allDayItemsView.SetToRightOf(prevAllDayItems, _allDayItemsRow);
                }
                allDayItemsView.SetWidth(COL_WIDTH);
                allDayItemsView.StretchHeight(_allDayItemsRow);
                prevAllDayItems = allDayItemsView;

                // Schedule column
                var scheduleColumn = new UIControl()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false
                };
                if (i % 2 != 0)
                {
                    // Alternate light and dark
                    scheduleColumn.BackgroundColor = UIColorCompat.SecondarySystemBackgroundColor;
                }
                _scheduleRow.Add(scheduleColumn);
                if (prevScheduleColumn == null)
                {
                    scheduleColumn.PinToLeft(_scheduleRow);
                }
                else
                {
                    scheduleColumn.SetToRightOf(prevScheduleColumn, _scheduleRow);
                }
                scheduleColumn.SetWidth(COL_WIDTH);
                scheduleColumn.StretchHeight(_scheduleRow);
                _scheduleColumns[i] = scheduleColumn;
                prevScheduleColumn  = scheduleColumn;
            }

            ViewModel.InitializeArrangers(HEIGHT_OF_HOUR, UIScheduleViewEventItemCollapsed.SPACING_WITH_NO_ADDITIONAL, UIScheduleViewEventItemCollapsed.SPACING_WITH_ADDITIONAL, UIScheduleViewEventItemCollapsed.WIDTH_OF_COLLAPSED_ITEM);
            ViewModel.OnFullReset           += new WeakEventHandler <EventArgs>(ViewModel_OnFullReset).Handler;
            ViewModel.OnItemsForDateChanged += new WeakEventHandler <DateTime>(ViewModel_OnItemsForDateChanged).Handler;

            MainScreenViewController.ListenToTabBarHeightChanged(ref _tabBarHeightListener, delegate
            {
                // Plus 44 for the toolbar that also appears
                this.ContentInset = new UIEdgeInsets(0, 0, MainScreenViewController.TAB_BAR_HEIGHT + 44, 0);
            });

            UpdateWidth();

            Render();
        }