public override void LoadView () { base.LoadView (); isUserLogged = UserDefaults.BoolForKey (IsUserLoggedKey); isAppActive = UserDefaults.BoolForKey (AppActiveEntryKey); isAppOnBackground = UserDefaults.BoolForKey (AppBackgroundEntryKey); marginTop = (isUserLogged && isAppActive) ? 10f : 1f; height = (isUserLogged && isAppActive) ? 250f : 62f; // 4 x 60f(cells), var v = new UIView { BackgroundColor = UIColor.Clear, Frame = new CGRect (0,0, UIScreen.MainScreen.Bounds.Width, height), }; v.Add (tableView = new UITableView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.Clear, TableFooterView = new UIView(), ScrollEnabled = false, RowHeight = cellHeight, }); v.Add (openAppView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, Hidden = true, }); UIView bg; openAppView.Add (bg = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.Black, Alpha = 0.1f, }); UILabel textView; openAppView.Add (textView = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName ("Helvetica", 13f), Text = isAppActive ? "NoLoggedUser".Tr() : "NoActiveApp".Tr(), TextColor = UIColor.White, BackgroundColor = UIColor.Clear, }); openAppView.Add (openAppBtn = new StartStopBtn { TranslatesAutoresizingMaskIntoConstraints = false, IsActive = true, }); openAppView.AddConstraints ( bg.AtTopOf (openAppView), bg.AtLeftOf (openAppView), bg.AtRightOf (openAppView), bg.AtBottomOf (openAppView), textView.WithSameCenterY (openAppView), textView.AtLeftOf (openAppView, 50f), textView.WithSameHeight (openAppView), textView.AtRightOf (openAppView), openAppBtn.Width().EqualTo (35f), openAppBtn.Height().EqualTo (35f), openAppBtn.AtRightOf (openAppView, 15f), openAppBtn.WithSameCenterY (openAppView), null ); v.AddConstraints ( tableView.AtTopOf (v), tableView.WithSameWidth (v), tableView.Height().EqualTo (height - marginTop).SetPriority (UILayoutPriority.DefaultLow), tableView.AtBottomOf (v), openAppView.AtTopOf (v), openAppView.WithSameWidth (v), openAppView.Height().EqualTo (cellHeight), null ); View = v; }
public WidgetCell (IntPtr handle) : base (handle) { SelectionStyle = UITableViewCellSelectionStyle.None; textContentView = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false, }; textContentView.Add (projectLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName ("Helvetica", 16f), Text = "Project", TextColor = UIColor.White, }); textContentView.Add (descriptionLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName ("Helvetica", 13f), Text = "Description", TextColor = UIColor.White, }); ContentView.Add (colorBox = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false, }); ContentView.Add (timeLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Text = defaultTimeValue, Font = UIFont.FromName ("Helvetica", 13f), TextAlignment = UITextAlignment.Right, TextColor = UIColor.White, }); ContentView.Add (startBtn = new StartStopBtn { TranslatesAutoresizingMaskIntoConstraints = false, }); ContentView.Add (textContentView); startBtn.TouchUpInside += (sender, e) => { startBtn.IsActive = true; startBtn.IsRunning = !startBtn.IsRunning; if (StartBtnPressed != null) { StartBtnPressed.Invoke (this, e); } }; var maskLayer = new CAGradientLayer { AnchorPoint = CGPoint.Empty, StartPoint = new CGPoint (0.0f, 0.0f), EndPoint = new CGPoint (1.0f, 0.0f), Colors = new [] { UIColor.FromWhiteAlpha (1, 1).CGColor, UIColor.FromWhiteAlpha (1, 1).CGColor, UIColor.FromWhiteAlpha (1, 0).CGColor, }, Locations = new [] { NSNumber.FromFloat (0f), NSNumber.FromFloat (0.9f), NSNumber.FromFloat (1f), }, }; textContentView.Layer.Mask = maskLayer; }
public WidgetCell(IntPtr handle) : base(handle) { SelectionStyle = UITableViewCellSelectionStyle.None; textContentView = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false, }; textContentView.Add(projectLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName("Helvetica", 16f), Text = "Project", TextColor = UIColor.White, }); textContentView.Add(descriptionLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName("Helvetica", 13f), Text = "Description", TextColor = UIColor.White, }); ContentView.Add(colorBox = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false, }); ContentView.Add(timeLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Text = defaultTimeValue, Font = UIFont.FromName("Helvetica", 13f), TextAlignment = UITextAlignment.Right, TextColor = UIColor.White, }); ContentView.Add(startBtn = new StartStopBtn { TranslatesAutoresizingMaskIntoConstraints = false, }); ContentView.Add(textContentView); startBtn.TouchUpInside += (sender, e) => { startBtn.IsActive = true; startBtn.IsRunning = !startBtn.IsRunning; if (StartBtnPressed != null) { StartBtnPressed.Invoke(this, e); } }; var maskLayer = new CAGradientLayer { AnchorPoint = CGPoint.Empty, StartPoint = new CGPoint(0.0f, 0.0f), EndPoint = new CGPoint(1.0f, 0.0f), Colors = new [] { UIColor.FromWhiteAlpha(1, 1).CGColor, UIColor.FromWhiteAlpha(1, 1).CGColor, UIColor.FromWhiteAlpha(1, 0).CGColor, }, Locations = new [] { NSNumber.FromFloat(0f), NSNumber.FromFloat(0.9f), NSNumber.FromFloat(1f), }, }; textContentView.Layer.Mask = maskLayer; }