Пример #1
0
            UITableViewCell GetPrimaryCell(UITableView tableView)
            {
                SeriesPrimaryCell cell = tableView.DequeueReusableCell(SeriesPrimaryCell.Identifier) as SeriesPrimaryCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell        = new SeriesPrimaryCell(UITableViewCellStyle.Default, SeriesCell.Identifier);
                    cell.Parent = this;

                    // take the parent table's width so we inherit its width constraint
                    cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height);

                    // configure the cell colors
                    cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color);
                    cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
                }

                // Banner Image
                cell.Image.Image = Parent.SeriesBillboard;
                cell.Image.SizeToFit( );

                // resize the image to fit the width of the device
                float imageAspect = (float)(cell.Image.Bounds.Height / cell.Image.Bounds.Width);

                cell.Image.Frame = new CGRect(0, 0, cell.Bounds.Width, cell.Bounds.Width * imageAspect);

                // Title
                cell.Title.Text = Series.SeriesName;
                if (Series.SeriesPrivate == true)
                {
                    cell.Title.Text += " (Private)";
                }
                cell.Title.SizeToFit( );

                cell.Desc.Text   = Series.Description;
                cell.Desc.Bounds = new CGRect(0, 0, cell.Frame.Width - 20, float.MaxValue);
                cell.Desc.SizeToFit( );

                cell.Date.Text = Series.DateRanges;
                cell.Date.SizeToFit( );


                // now position the 3 text elements
                // Title
                cell.Title.Frame = new CGRect(10, cell.Image.Frame.Bottom + 5, cell.Frame.Width - 20, cell.Title.Frame.Height);

                // Date
                cell.Date.Frame = new CGRect(10, cell.Title.Frame.Bottom - 9, cell.Frame.Width - 20, cell.Date.Frame.Height + 5);

                // Description
                cell.Desc.Frame = new CGRect(10, cell.Date.Frame.Bottom + 5, cell.Frame.Width - 20, cell.Desc.Frame.Height + 5);

                PendingPrimaryCellHeight = cell.Desc.Frame.Bottom + 5;

                return(cell);
            }
Пример #2
0
            public TableSource(NotesMainUIViewController parent, List <SeriesEntry> series, UIImage imageMainPlaceholder, UIImage imageThumbPlaceholder)
            {
                Parent                = parent;
                SeriesEntries         = series;
                ImageMainPlaceholder  = imageMainPlaceholder;
                ImageThumbPlaceholder = imageThumbPlaceholder;

                // create a dummy cell so we can store the height
                SeriesPrimaryCell cell = new SeriesPrimaryCell(parent.View.Frame, UITableViewCellStyle.Default, SeriesCell.Identifier, ImageMainPlaceholder);

                PendingPrimaryCellHeight = cell.BottomBanner.Frame.Bottom;
            }
            UITableViewCell GetPrimaryCell( UITableView tableView )
            {
                SeriesPrimaryCell cell = tableView.DequeueReusableCell( SeriesPrimaryCell.Identifier ) as SeriesPrimaryCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell = new SeriesPrimaryCell( tableView.Frame, UITableViewCellStyle.Default, SeriesCell.Identifier, ImageMainPlaceholder );
                    cell.Parent = this;

                    // take the parent table's width so we inherit its width constraint
                    cell.Bounds = new CGRect( cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height );

                    // configure the cell colors
                    cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color );
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                }

                // Banner Image
                if ( SeriesEntries.Count > 0 )
                {
                    cell.Image.Image = SeriesEntries[ 0 ].mBillboard != null ? SeriesEntries[ 0 ].mBillboard : ImageMainPlaceholder;

                    // Create the title
                    if ( SeriesEntries[ 0 ].Series.Messages.Count > 0 )
                    {
                        cell.Title.Text = SeriesEntries[ 0 ].Series.Messages[ 0 ].Name;
                        if( SeriesEntries[ 0 ].Series.Private == true || 
                            SeriesEntries[ 0 ].Series.Messages[ 0 ].Private == true )
                        {
                            cell.Title.Text += " (Private)";
                        }
                        cell.Title.SizeToFit( );
                        cell.Title.Frame = new CGRect( 10, cell.Image.Frame.Bottom + 5, cell.Frame.Width - 10, cell.Title.Frame.Height );


                        // Date & Speaker
                        cell.Date.Text = SeriesEntries[ 0 ].Series.Messages[ 0 ].Date;
                        cell.Date.SizeToFit( );
                        cell.Date.Frame = new CGRect( 10, 
                                                      cell.Title.Frame.Bottom - 7, 
                                                      cell.Date.Bounds.Width, 
                                                      cell.Date.Bounds.Height );

                        cell.Speaker.Text = SeriesEntries[ 0 ].Series.Messages[ 0 ].Speaker;
                        cell.Speaker.SizeToFit( );
                        cell.Speaker.Frame = new CGRect( cell.Bounds.Width - cell.Speaker.Bounds.Width - 10, 
                                                         cell.Title.Frame.Bottom - 7, 
                                                         cell.Speaker.Bounds.Width, 
                                                         cell.Speaker.Bounds.Height );


                        // Position the Watch Button and icon
                        cell.WatchButton.Bounds = new CGRect( 0, 0, cell.Bounds.Width / 2 + 6, cell.WatchButton.Bounds.Height + 10 );
                        cell.WatchButton.Layer.Position = new CGPoint( -5, cell.Speaker.Frame.Bottom + 7 );


                        nfloat labelTotalWidth = cell.WatchButtonIcon.Bounds.Width + cell.WatchButtonLabel.Bounds.Width + 5;
                        cell.WatchButtonIcon.Layer.Position = new CGPoint( (cell.WatchButton.Bounds.Width - labelTotalWidth) / 2 + (cell.WatchButtonIcon.Bounds.Width / 2), cell.WatchButton.Bounds.Height / 2 );
                        cell.WatchButtonLabel.Layer.Position = new CGPoint( cell.WatchButtonIcon.Frame.Right + (cell.WatchButtonLabel.Bounds.Width / 2), cell.WatchButton.Bounds.Height / 2 );


                        // Position the Take Notes icon and button
                        cell.TakeNotesButton.Bounds = new CGRect( 0, 0, cell.Bounds.Width / 2 + 5, cell.TakeNotesButton.Bounds.Height + 10 );
                        cell.TakeNotesButton.Layer.Position = new CGPoint( (cell.Bounds.Width + 5) - cell.TakeNotesButton.Bounds.Width, cell.Speaker.Frame.Bottom + 7 );

                        labelTotalWidth = cell.TakeNotesButtonIcon.Bounds.Width + cell.TakeNotesButtonLabel.Bounds.Width + 5;
                        cell.TakeNotesButtonIcon.Layer.Position = new CGPoint( (cell.TakeNotesButton.Bounds.Width - labelTotalWidth) / 2 + (cell.TakeNotesButtonIcon.Bounds.Width / 2), cell.TakeNotesButton.Bounds.Height / 2 );
                        cell.TakeNotesButtonLabel.Layer.Position = new CGPoint( cell.TakeNotesButtonIcon.Frame.Right + (cell.TakeNotesButtonLabel.Bounds.Width / 2), cell.TakeNotesButton.Bounds.Height / 2 );

                        // Position the Bottom Banner
                        cell.BottomBanner.Bounds = new CGRect( 0, 0, cell.Bounds.Width, cell.BottomBanner.Bounds.Height + 10 );
                        cell.BottomBanner.Layer.Position = new CGPoint( 0, cell.TakeNotesButton.Frame.Bottom - 1 );

                        // Watch Button & Labels
                        // disable the button if there's no watch URL
                        if ( string.IsNullOrEmpty( SeriesEntries[ 0 ].Series.Messages[ 0 ].WatchUrl ) )
                        {
                            cell.ToggleWatchButton( false );
                        }
                        else
                        {
                            cell.ToggleWatchButton( true );
                        }


                        // Take Notes Button & Labels
                        // disable the button if there's no note URL
                        if ( string.IsNullOrEmpty( SeriesEntries[ 0 ].Series.Messages[ 0 ].NoteUrl ) )
                        {
                            cell.ToggleTakeNotesButton( false );
                        }
                        else
                        {
                            cell.ToggleTakeNotesButton( true );
                        }
                    }
                    else
                    {
                        cell.ToggleWatchButton( false );
                        cell.ToggleTakeNotesButton( false );
                    }
                }

                PendingPrimaryCellHeight = cell.BottomBanner.Frame.Bottom;
                return cell;
            }
            public TableSource (NotesMainUIViewController parent, List<SeriesEntry> series, UIImage imageMainPlaceholder, UIImage imageThumbPlaceholder )
            {
                Parent = parent;
                SeriesEntries = series;
                ImageMainPlaceholder = imageMainPlaceholder;
                ImageThumbPlaceholder = imageThumbPlaceholder;

                // create a dummy cell so we can store the height
                SeriesPrimaryCell cell = new SeriesPrimaryCell( parent.View.Frame, UITableViewCellStyle.Default, SeriesCell.Identifier, ImageMainPlaceholder );
                PendingPrimaryCellHeight = cell.BottomBanner.Frame.Bottom;
            }
Пример #5
0
            UITableViewCell GetPrimaryCell(UITableView tableView)
            {
                SeriesPrimaryCell cell = tableView.DequeueReusableCell(SeriesPrimaryCell.Identifier) as SeriesPrimaryCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell        = new SeriesPrimaryCell(tableView.Frame, UITableViewCellStyle.Default, SeriesCell.Identifier, ImageMainPlaceholder);
                    cell.Parent = this;

                    // take the parent table's width so we inherit its width constraint
                    cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height);

                    // configure the cell colors
                    cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color);
                    cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
                }

                // Banner Image
                if (SeriesEntries.Count > 0)
                {
                    cell.Image.Image = SeriesEntries[0].mBillboard != null ? SeriesEntries[0].mBillboard : ImageMainPlaceholder;

                    // Create the title
                    Series.Message latestMessage = SeriesEntries[0].Series.GetLatestMessage( );

                    cell.Title.Text = latestMessage.Name;
                    if (SeriesEntries[0].Series.SeriesPrivate == true ||
                        latestMessage.Private == true)
                    {
                        cell.Title.Text += " (Private)";
                    }
                    cell.Title.SizeToFit( );
                    cell.Title.Frame = new CGRect(10, cell.Image.Frame.Bottom + 5, cell.Frame.Width - 10, cell.Title.Frame.Height);


                    // Date & Speaker
                    cell.Date.Text = latestMessage.Date;
                    cell.Date.SizeToFit( );
                    cell.Date.Frame = new CGRect(10,
                                                 cell.Title.Frame.Bottom - 7,
                                                 cell.Date.Bounds.Width,
                                                 Math.Max(22, cell.Date.Bounds.Height));

                    cell.Speaker.Text = latestMessage.Speaker;
                    cell.Speaker.SizeToFit( );
                    cell.Speaker.Frame = new CGRect(cell.Bounds.Width - cell.Speaker.Bounds.Width - 10,
                                                    cell.Title.Frame.Bottom - 7,
                                                    cell.Speaker.Bounds.Width,
                                                    Math.Max(22, cell.Speaker.Bounds.Height));


                    // Position the Watch Button and icon
                    cell.WatchButton.Bounds         = new CGRect(0, 0, cell.Bounds.Width / 2 + 6, cell.WatchButton.Bounds.Height + 10);
                    cell.WatchButton.Layer.Position = new CGPoint(-5, cell.Speaker.Frame.Bottom + 7);


                    nfloat labelTotalWidth = cell.WatchButtonIcon.Bounds.Width + cell.WatchButtonLabel.Bounds.Width + 5;
                    cell.WatchButtonIcon.Layer.Position  = new CGPoint((cell.WatchButton.Bounds.Width - labelTotalWidth) / 2 + (cell.WatchButtonIcon.Bounds.Width / 2), cell.WatchButton.Bounds.Height / 2);
                    cell.WatchButtonLabel.Layer.Position = new CGPoint(cell.WatchButtonIcon.Frame.Right + (cell.WatchButtonLabel.Bounds.Width / 2), cell.WatchButton.Bounds.Height / 2);


                    // Position the Take Notes icon and button
                    cell.TakeNotesButton.Bounds         = new CGRect(0, 0, cell.Bounds.Width / 2 + 5, cell.TakeNotesButton.Bounds.Height + 10);
                    cell.TakeNotesButton.Layer.Position = new CGPoint((cell.Bounds.Width + 5) - cell.TakeNotesButton.Bounds.Width, cell.Speaker.Frame.Bottom + 7);

                    labelTotalWidth = cell.TakeNotesButtonIcon.Bounds.Width + cell.TakeNotesButtonLabel.Bounds.Width + 5;
                    cell.TakeNotesButtonIcon.Layer.Position  = new CGPoint((cell.TakeNotesButton.Bounds.Width - labelTotalWidth) / 2 + (cell.TakeNotesButtonIcon.Bounds.Width / 2), cell.TakeNotesButton.Bounds.Height / 2);
                    cell.TakeNotesButtonLabel.Layer.Position = new CGPoint(cell.TakeNotesButtonIcon.Frame.Right + (cell.TakeNotesButtonLabel.Bounds.Width / 2), cell.TakeNotesButton.Bounds.Height / 2);


                    // Position the Discussion Guide icon and button
                    cell.DiscussionGuideButton.Bounds         = new CGRect(0, 0, cell.Bounds.Width + 6, cell.DiscussionGuideButton.Bounds.Height + 10);
                    cell.DiscussionGuideButton.Layer.Position = new CGPoint(-5, cell.TakeNotesButton.Frame.Bottom);

                    labelTotalWidth = cell.DiscussionGuideButtonIcon.Bounds.Width + cell.DiscussionGuideButtonLabel.Bounds.Width + 5;
                    cell.DiscussionGuideButtonIcon.Layer.Position  = new CGPoint((cell.DiscussionGuideButton.Bounds.Width - labelTotalWidth) / 2 + (cell.DiscussionGuideButtonIcon.Bounds.Width / 2), cell.DiscussionGuideButton.Bounds.Height / 2);
                    cell.DiscussionGuideButtonLabel.Layer.Position = new CGPoint(cell.DiscussionGuideButtonIcon.Frame.Right + (cell.DiscussionGuideButtonLabel.Bounds.Width / 2), cell.DiscussionGuideButton.Bounds.Height / 2);


                    // Position the Bottom Banner
                    cell.BottomBanner.Bounds         = new CGRect(0, 0, cell.Bounds.Width, cell.BottomBanner.Bounds.Height + 10);
                    cell.BottomBanner.Layer.Position = new CGPoint(0, cell.DiscussionGuideButton.Frame.Bottom - 1);

                    // Watch Button & Labels
                    // disable the button if there's no watch URL
                    if (string.IsNullOrWhiteSpace(latestMessage.WatchUrl))
                    {
                        cell.ToggleWatchButton(false);
                    }
                    else
                    {
                        cell.ToggleWatchButton(true);
                    }


                    // Take Notes Button & Labels
                    // disable the button if there's no note URL
                    if (string.IsNullOrWhiteSpace(latestMessage.NoteUrl))
                    {
                        cell.ToggleTakeNotesButton(false);
                    }
                    else
                    {
                        cell.ToggleTakeNotesButton(true);
                    }

                    // DiscussionGuide Button & Labels
                    // disable the button if there's no note URL
                    if (string.IsNullOrWhiteSpace(latestMessage.DiscussionGuideUrl))
                    {
                        cell.ToggleDiscussionGuideButton(false);
                    }
                    else
                    {
                        cell.ToggleDiscussionGuideButton(true);
                    }
                }

                PendingPrimaryCellHeight = cell.BottomBanner.Frame.Bottom;
                return(cell);
            }
            UITableViewCell GetPrimaryCell( UITableView tableView )
            {
                SeriesPrimaryCell cell = tableView.DequeueReusableCell( SeriesPrimaryCell.Identifier ) as SeriesPrimaryCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell = new SeriesPrimaryCell( UITableViewCellStyle.Default, SeriesCell.Identifier );
                    cell.Parent = this;

                    // take the parent table's width so we inherit its width constraint
                    cell.Bounds = new CGRect( cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height );

                    // configure the cell colors
                    cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color );
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                }

                // Banner Image
                cell.Image.Image = Parent.SeriesBillboard;
                cell.Image.SizeToFit( );

                // resize the image to fit the width of the device
                float imageAspect = (float) (cell.Image.Bounds.Height / cell.Image.Bounds.Width);
                cell.Image.Frame = new CGRect( 0, 0, cell.Bounds.Width, cell.Bounds.Width * imageAspect );

                // Title
                cell.Title.Text = Series.Name;
                cell.Title.SizeToFit( );
                cell.Title.Frame = new CGRect( 5, cell.Image.Frame.Bottom + 5, cell.Frame.Width - 10, cell.Title.Frame.Height + 5 );

                // Date
                cell.Date.Text = Series.DateRanges;
                cell.Date.SizeToFit( );
                cell.Date.Frame = new CGRect( 5, cell.Title.Frame.Bottom - 5, cell.Frame.Width - 5, cell.Date.Frame.Height + 5 );

                // Description
                cell.Desc.Text = Series.Description;
                cell.Desc.Bounds = new CGRect( 0, 0, cell.Frame.Width - 10, float.MaxValue );
                cell.Desc.SizeToFit( );
                cell.Desc.Frame = new CGRect( 5, cell.Date.Frame.Bottom, cell.Frame.Width - 10, cell.Desc.Frame.Height + 5 );

                PendingPrimaryCellHeight = cell.Desc.Frame.Bottom + 5;

                return cell;
            }