Ejemplo n.º 1
0
            UITableViewCell GetStandardCell(UITableView tableView, int row)
            {
                SeriesCell cell = tableView.DequeueReusableCell(SeriesCell.Identifier) as SeriesCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell        = new SeriesCell(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.BackgroundColor);
                    cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
                }

                // Thumbnail Image
                cell.Image.Image = SeriesEntries[row].mThumbnail != null ? SeriesEntries[row].mThumbnail : ImageThumbPlaceholder;
                cell.Image.SizeToFit( );

                // force the image to be sized according to the height of the cell
                cell.Image.Frame = new CGRect(0,
                                              0,
                                              PrivateNoteConfig.Series_Main_CellWidth,
                                              PrivateNoteConfig.Series_Main_CellHeight);

                nfloat availableTextWidth = cell.Bounds.Width - cell.Chevron.Bounds.Width - cell.Image.Bounds.Width - 10;

                // Chevron
                cell.Chevron.Layer.Position = new CGPoint(cell.Bounds.Width - (cell.Chevron.Bounds.Width / 2) - 5, (PrivateNoteConfig.Series_Main_CellHeight) / 2);

                // Create the title
                cell.Title.Text = SeriesEntries[row].Series.SeriesName;
                if (SeriesEntries[row].Series.SeriesPrivate == true)
                {
                    cell.Title.Text += " (Private)";
                }
                cell.Title.SizeToFit( );

                // Date Range
                cell.Date.Text = SeriesEntries[row].Series.DateRanges;
                cell.Date.SizeToFit( );

                // Position the Title & Date in the center to the right of the image
                nfloat totalTextHeight = cell.Title.Bounds.Height + cell.Date.Bounds.Height - 1;

                cell.Title.Frame = new CGRect(cell.Image.Frame.Right + 10, (PrivateNoteConfig.Series_Main_CellHeight - totalTextHeight) / 2, availableTextWidth - 5, cell.Title.Frame.Height);
                cell.Date.Frame  = new CGRect(cell.Title.Frame.Left, cell.Title.Frame.Bottom - 6, availableTextWidth - 5, cell.Date.Frame.Height + 5);

                // add the seperator to the bottom
                cell.Seperator.Frame = new CGRect(0, cell.Image.Frame.Bottom - 1, cell.Bounds.Width, 1);

                return(cell);
            }
            UITableViewCell GetStandardCell( UITableView tableView, int row )
            {
                SeriesCell cell = tableView.DequeueReusableCell( SeriesCell.Identifier ) as SeriesCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell = new SeriesCell( 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.BackgroundColor );
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                }

                // Thumbnail Image
                cell.Image.Image = SeriesEntries[ row ].mThumbnail != null ? SeriesEntries[ row ].mThumbnail : ImageThumbPlaceholder;
                cell.Image.SizeToFit( );

                // force the image to be sized according to the height of the cell
                cell.Image.Frame = new CGRect( 0, 
                                               0, 
                                               PrivateNoteConfig.Series_Main_CellWidth, 
                                               PrivateNoteConfig.Series_Main_CellHeight );

                nfloat availableTextWidth = cell.Bounds.Width - cell.Chevron.Bounds.Width - cell.Image.Bounds.Width - 10;

                // Chevron
                cell.Chevron.Layer.Position = new CGPoint( cell.Bounds.Width - (cell.Chevron.Bounds.Width / 2) - 5, (PrivateNoteConfig.Series_Main_CellHeight) / 2 );

                // Create the title
                cell.Title.Text = SeriesEntries[ row ].Series.Name;
                if ( SeriesEntries[ row ].Series.Private == true )
                {
                    cell.Title.Text += " (Private)";    
                }
                cell.Title.SizeToFit( );

                // Date Range
                cell.Date.Text = SeriesEntries[ row ].Series.DateRanges;
                cell.Date.SizeToFit( );

                // Position the Title & Date in the center to the right of the image
                nfloat totalTextHeight = cell.Title.Bounds.Height + cell.Date.Bounds.Height - 1;
                cell.Title.Frame = new CGRect( cell.Image.Frame.Right + 10, (PrivateNoteConfig.Series_Main_CellHeight - totalTextHeight) / 2, availableTextWidth - 5, cell.Title.Frame.Height );
                cell.Date.Frame = new CGRect( cell.Title.Frame.Left, cell.Title.Frame.Bottom - 6, availableTextWidth - 5, cell.Date.Frame.Height + 5 );

                // add the seperator to the bottom
                cell.Seperator.Frame = new CGRect( 0, cell.Image.Frame.Bottom - 1, cell.Bounds.Width, 1 );

                return cell;
            }
            UITableViewCell GetStandardCell( UITableView tableView, int row )
            {
                SeriesCell cell = tableView.DequeueReusableCell( SeriesCell.Identifier ) as SeriesCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell = new SeriesCell( 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.BackgroundColor );
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                }

                // Thumbnail Image
                cell.Image.Image = new UIImage( NSBundle.MainBundle.BundlePath + "/" + Parent.LinkEntries[ row ].ImageName );
                cell.Image.SizeToFit( );

                // force the image to be sized according to the height of the cell
                cell.Image.Frame = new CGRect( 0,
                    10,
                    PrivateConnectConfig.MainPage_ThumbnailDimension,
                    PrivateConnectConfig.MainPage_ThumbnailDimension );

                nfloat availableTextWidth = cell.Bounds.Width - cell.Chevron.Bounds.Width - cell.Image.Bounds.Width - 10;

                // Chevron
                cell.Chevron.Layer.Position = new CGPoint( cell.Bounds.Width - (cell.Chevron.Bounds.Width / 2) - 5, (PrivateConnectConfig.MainPage_ThumbnailDimension + 10) / 2 );

                // Create the title
                cell.Title.Text = Parent.LinkEntries[ row ].Title;
                cell.Title.SizeToFit( );

                // Position the Title & Date in the center to the right of the image
                nfloat totalTextHeight = cell.Title.Bounds.Height - 1;
                cell.Title.Frame = new CGRect( cell.Image.Frame.Right + 10, ((PrivateConnectConfig.MainPage_ThumbnailDimension + 10) - totalTextHeight) / 2, availableTextWidth - 5, cell.Title.Frame.Height );

                // add the seperator to the bottom
                cell.Seperator.Frame = new CGRect( 0, cell.Image.Frame.Bottom + 10, cell.Bounds.Width, 1 );

                PendingCellHeight = cell.Seperator.Frame.Bottom;

                return cell;
            }
Ejemplo n.º 4
0
            UITableViewCell GetStandardCell( UITableView tableView, int row )
            {
                SeriesCell cell = tableView.DequeueReusableCell( SeriesCell.Identifier ) as SeriesCell;

                // if there are no cells to reuse, create a new one
                if ( cell == null )
                {
                    cell = new SeriesCell( 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.BackgroundColor );
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                }

                // update the cell's row index so on button taps we know which one was tapped
                cell.RowIndex = row;

                float rowHeight = 100;

                // Buttons
                cell.TakeNotesButton.Frame = new CGRect( cell.Bounds.Width - cell.TakeNotesButton.Bounds.Width,
                                                        (rowHeight - cell.TakeNotesButton.Bounds.Height) / 2,
                                                             cell.TakeNotesButton.Bounds.Width,
                                                             cell.TakeNotesButton.Bounds.Height );

                cell.WatchButton.Frame = new CGRect( cell.TakeNotesButton.Frame.Left - cell.WatchButton.Bounds.Width,
                    (rowHeight - cell.WatchButton.Bounds.Height) / 2,
                                                         cell.WatchButton.Bounds.Width,
                                                         cell.WatchButton.Bounds.Height );

                cell.ListenButton.Frame = new CGRect( cell.WatchButton.Frame.Left - cell.ListenButton.Bounds.Width,
                    (rowHeight - cell.ListenButton.Bounds.Height) / 2,
                    cell.ListenButton.Bounds.Width,
                    cell.ListenButton.Bounds.Height );

                nfloat availableWidth = cell.Bounds.Width - cell.ListenButton.Bounds.Width - cell.WatchButton.Bounds.Width - cell.TakeNotesButton.Bounds.Width;

                // disable the button if there's no listen URL
                if ( string.IsNullOrEmpty( Series.Messages[ row ].AudioUrl ) )
                {
                    cell.ToggleListenButton( false );
                }
                else
                {
                    cell.ToggleListenButton( true );
                }

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

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

                // Create the title
                cell.Title.Text = Series.Messages[ row ].Name;
                cell.Title.SizeToFit( );

                // Date
                cell.Date.Text = Series.Messages[ row ].Date;
                cell.Date.SizeToFit( );

                cell.Speaker.Text = Series.Messages[ row ].Speaker;
                cell.Speaker.SizeToFit( );

                // Position the Title & Date in the center to the right of the image
                nfloat totalTextHeight = cell.Title.Bounds.Height + cell.Date.Bounds.Height + cell.Speaker.Bounds.Height + 15;

                cell.Title.Frame = new CGRect( 5, (rowHeight - totalTextHeight) / 2, availableWidth, cell.Title.Frame.Height + 10);
                cell.Date.Frame = new CGRect( cell.Title.Frame.Left, cell.Title.Frame.Bottom - 5, availableWidth, cell.Date.Frame.Height );
                cell.Speaker.Frame = new CGRect( cell.Title.Frame.Left, cell.Date.Frame.Bottom - 5, availableWidth, cell.Speaker.Frame.Height + 5 );

                // add the seperator to the bottom
                cell.Seperator.Frame = new CGRect( 0, rowHeight - 1, cell.Bounds.Width, 1 );

                PendingCellHeight = rowHeight;

                return cell;
            }
            UITableViewCell GetActivityCell( UITableView tableView, ConnectLink link, bool showSeperator )
            {
                SeriesCell cell = tableView.DequeueReusableCell( SeriesCell.Identifier ) as SeriesCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell = new SeriesCell( 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.BackgroundColor );
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                }

                // Thumbnail Image
                cell.Image.Image = new UIImage( NSBundle.MainBundle.BundlePath + "/" + link.ImageName );
                cell.Image.SizeToFit( );

                nfloat topPadding = 10;

                // force the image to be sized according to the height of the cell
                cell.Image.Frame = new CGRect( 0, 
                    topPadding, 
                    PrivateConnectConfig.MainPage_ThumbnailDimension, 
                    PrivateConnectConfig.MainPage_ThumbnailDimension );

                nfloat availableTextWidth = cell.Bounds.Width - cell.Chevron.Bounds.Width - cell.Image.Bounds.Width - 10;

                // Chevron
                nfloat chevronYPos = cell.Image.Frame.Top + ((PrivateConnectConfig.MainPage_ThumbnailDimension - cell.Chevron.Bounds.Height) / 2);
                cell.Chevron.Layer.Position = new CGPoint( cell.Bounds.Width - cell.Chevron.Bounds.Width - 5, chevronYPos );

                // Create the title
                cell.Title.Text = link.Title.ToUpper( );
                cell.Title.SizeToFit( );

                cell.SubTitle.Text = link.SubTitle;
                cell.SubTitle.SizeToFit( );

                // Position the Title & Date in the center to the right of the image
                nfloat totalTextHeight = cell.Title.Bounds.Height + cell.SubTitle.Bounds.Height - 6;

                cell.Title.Frame = new CGRect( cell.Image.Frame.Right + 10, ((PrivateConnectConfig.MainPage_ThumbnailDimension - totalTextHeight) / 2) + topPadding, availableTextWidth - 5, cell.Title.Frame.Height );
                cell.SubTitle.Frame = new CGRect( cell.Image.Frame.Right + 10, cell.Title.Frame.Bottom - 6, availableTextWidth - 5, cell.Title.Frame.Height );

                // add the seperator to the bottom
                if ( showSeperator )
                {
                    cell.Seperator.Hidden = false;
                    cell.Seperator.Frame = new CGRect( 0, cell.Image.Frame.Bottom + 10, cell.Bounds.Width, 1 );

                    PendingSeriesCellHeight = cell.Seperator.Frame.Bottom;
                }
                else
                {
                    cell.Seperator.Hidden = true;
                    PendingSeriesCellHeight = cell.Image.Frame.Bottom + 10;
                }

                return cell;
            }
            UITableViewCell GetStandardCell( UITableView tableView, int row )
            {
                SeriesCell cell = tableView.DequeueReusableCell( SeriesCell.Identifier ) as SeriesCell;

                // if there are no cells to reuse, create a new one
                if ( cell == null )
                {
                    cell = new SeriesCell( 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.BackgroundColor );
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                }

                if ( row < Series.Messages.Count )
                {
                    cell.HideControls( false );

                    // update the cell's row index so on button taps we know which one was tapped
                    cell.RowIndex = row;


                    // Create the title
                    cell.Title.Text = Series.Messages[ row ].Name;
                    if ( Series.Private == true ||
                         Series.Messages[ row ].Private == true )
                    {
                        cell.Title.Text += " (Private)";
                    }

                    cell.Title.SizeToFit( );

                    // Date
                    cell.Date.Text = Series.Messages[ row ].Date;
                    cell.Date.SizeToFit( );

                    // Speaker
                    cell.Speaker.Text = Series.Messages[ row ].Speaker;
                    cell.Speaker.SizeToFit( );


                    nfloat rowHeight = PrivateNoteConfig.Series_Main_CellHeight;
                    nfloat availableWidth = cell.Bounds.Width - cell.ListenButton.Bounds.Width - cell.WatchButton.Bounds.Width - cell.TakeNotesButton.Bounds.Width;

                    // Position the Title & Date in the center to the right of the image
                    nfloat totalTextHeight = ( cell.Title.Bounds.Height + cell.Date.Bounds.Height + cell.Speaker.Bounds.Height ) - 6;

                    cell.Title.Frame = new CGRect( 10, ( ( rowHeight - totalTextHeight ) / 2 ) - 1, availableWidth, cell.Title.Frame.Height );
                    //cell.Title.BackgroundColor = UIColor.Blue;

                    cell.Date.Frame = new CGRect( cell.Title.Frame.Left, cell.Title.Frame.Bottom - 3, availableWidth, cell.Date.Frame.Height );
                    //cell.Date.BackgroundColor = UIColor.Yellow;

                    cell.Speaker.Frame = new CGRect( cell.Title.Frame.Left, cell.Date.Frame.Bottom - 3, availableWidth, cell.Speaker.Frame.Height );
                    //cell.Speaker.BackgroundColor = UIColor.Green;

                    // add the seperator to the bottom
                    cell.Seperator.Frame = new CGRect( 0, rowHeight - 1, cell.Bounds.Width, 1 );
                    //cell.Seperator.Hidden = true;

                    /*unchecked
                    {
                        cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( (uint)(0xFF0000FF - (row * 100)) );
                    }*/


                    // Buttons
                    cell.TakeNotesButton.Frame = new CGRect( cell.Bounds.Width - cell.TakeNotesButton.Bounds.Width, 
                        ( rowHeight - cell.TakeNotesButton.Bounds.Height ) / 2, 
                        cell.TakeNotesButton.Bounds.Width, 
                        cell.TakeNotesButton.Bounds.Height );

                    cell.WatchButton.Frame = new CGRect( cell.TakeNotesButton.Frame.Left - cell.WatchButton.Bounds.Width, 
                        ( rowHeight - cell.WatchButton.Bounds.Height ) / 2, 
                        cell.WatchButton.Bounds.Width, 
                        cell.WatchButton.Bounds.Height );

                    cell.ListenButton.Frame = new CGRect( cell.WatchButton.Frame.Left - cell.ListenButton.Bounds.Width, 
                        ( rowHeight - cell.ListenButton.Bounds.Height ) / 2, 
                        cell.ListenButton.Bounds.Width, 
                        cell.ListenButton.Bounds.Height );



                    // disable the button if there's no listen URL
                    if ( string.IsNullOrEmpty( Series.Messages[ row ].AudioUrl ) )
                    {
                        cell.ToggleListenButton( false );
                    }
                    else
                    {
                        cell.ToggleListenButton( true );
                    }

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

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

                    //PendingCellHeight = rowHeight;
                }
                else
                {
                    // dummy row for padding.
                    cell.HideControls( true );
                }

                return cell;
            }
Ejemplo n.º 7
0
            UITableViewCell GetStandardCell(UITableView tableView, int row)
            {
                SeriesCell cell = tableView.DequeueReusableCell(SeriesCell.Identifier) as SeriesCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell        = new SeriesCell(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.BackgroundColor);
                    cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
                }

                if (row < Series.Messages.Count)
                {
                    cell.HideControls(false);

                    // update the cell's row index so on button taps we know which one was tapped
                    cell.RowIndex = row;


                    // Create the title
                    cell.Title.Text = Series.Messages[row].Name;
                    if (Series.SeriesPrivate == true ||
                        Series.Messages[row].Private == true)
                    {
                        cell.Title.Text += " (Private)";
                    }

                    cell.Title.SizeToFit( );

                    // Date
                    cell.Date.Text = Series.Messages[row].Date;
                    cell.Date.SizeToFit( );

                    // Speaker
                    cell.Speaker.Text = Series.Messages[row].Speaker;
                    cell.Speaker.SizeToFit( );


                    nfloat rowHeight      = PrivateNoteConfig.Series_Detail_CellHeight;
                    nfloat availableWidth = (cell.Bounds.Width - 20) / 2;

                    cell.Title.Frame = new CGRect(10, 5, availableWidth, cell.Title.Frame.Height);
                    //cell.Title.BackgroundColor = UIColor.Blue;

                    cell.Speaker.Frame = new CGRect(cell.Bounds.Width - Math.Min(cell.Speaker.Frame.Width, availableWidth) - 10, 5, availableWidth, cell.Speaker.Frame.Height);
                    //cell.Speaker.BackgroundColor = UIColor.Green;

                    cell.Date.Frame = new CGRect(cell.Bounds.Width - Math.Min(cell.Date.Frame.Width, availableWidth) - 10, cell.Speaker.Frame.Bottom - 3, availableWidth, cell.Date.Frame.Height);
                    //cell.Date.BackgroundColor = UIColor.Yellow;

                    // add the seperator to the bottom
                    cell.Seperator.Frame = new CGRect(0, rowHeight - 1, cell.Bounds.Width, 1);
                    //cell.Seperator.Hidden = true;

                    /*unchecked
                     * {
                     *  cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( (uint)(0xFF0000FF - (row * 100)) );
                     * }*/


                    // Buttons (lay them out spaced out evenly under the title / speaker / date)

                    /*int numButtons = 4;
                     * int buttonYOffset = 15;
                     *
                     * // first figure out how much space we can put between buttons
                     * nfloat rawButtonWidth = (cell.TakeNotesButton.Bounds.Width +
                     *                         cell.WatchButton.Bounds.Width +
                     *                         cell.ListenButton.Bounds.Width +
                     *                         cell.DiscussionGuideButton.Bounds.Width);
                     *
                     * nfloat buttonSpacing = (cell.Bounds.Width - rawButtonWidth) / numButtons;
                     *
                     * // now get the "total" width the buttons, with padding, will take up in the row
                     * nfloat totalButtonWidth = rawButtonWidth + (buttonSpacing * 3);
                     *
                     * // now figure out where the first button should start by taking half their difference
                     * nfloat startingX = (cell.Bounds.Width - totalButtonWidth) / 2;
                     *
                     * cell.WatchButton.Frame = new CGRect( startingX,
                     *                                   cell.Date.Frame.Bottom - buttonYOffset,
                     *                                   cell.WatchButton.Bounds.Width,
                     *                                   cell.WatchButton.Bounds.Height );
                     *
                     * cell.ListenButton.Frame = new CGRect( cell.WatchButton.Frame.Right + buttonSpacing,
                     *                                    cell.Date.Frame.Bottom - buttonYOffset,
                     *                                    cell.ListenButton.Bounds.Width,
                     *                                    cell.ListenButton.Bounds.Height );
                     *
                     * cell.DiscussionGuideButton.Frame = new CGRect( cell.ListenButton.Frame.Right + buttonSpacing,
                     *                                             cell.Date.Frame.Bottom - buttonYOffset,
                     *                                             cell.DiscussionGuideButton.Bounds.Width,
                     *                                             cell.DiscussionGuideButton.Bounds.Height );
                     *
                     * cell.TakeNotesButton.Frame = new CGRect( cell.DiscussionGuideButton.Frame.Right + buttonSpacing,
                     *                                       cell.Date.Frame.Bottom - buttonYOffset,
                     *                                       cell.TakeNotesButton.Bounds.Width,
                     *                                       cell.TakeNotesButton.Bounds.Height );*/

                    int buttonYOffset = 15;

                    // now figure out where the first button should start by taking half their difference
                    cell.WatchButton.Frame = new CGRect(10,
                                                        cell.Date.Frame.Bottom - buttonYOffset,
                                                        cell.WatchButton.Bounds.Width,
                                                        cell.WatchButton.Bounds.Height);

                    cell.ListenButton.Frame = new CGRect(cell.WatchButton.Frame.Right,
                                                         cell.Date.Frame.Bottom - buttonYOffset,
                                                         cell.ListenButton.Bounds.Width,
                                                         cell.ListenButton.Bounds.Height);

                    cell.DiscussionGuideButton.Frame = new CGRect(cell.ListenButton.Frame.Right,
                                                                  cell.Date.Frame.Bottom - buttonYOffset,
                                                                  cell.DiscussionGuideButton.Bounds.Width,
                                                                  cell.DiscussionGuideButton.Bounds.Height);

                    cell.TakeNotesButton.Frame = new CGRect(cell.DiscussionGuideButton.Frame.Right,
                                                            cell.Date.Frame.Bottom - buttonYOffset,
                                                            cell.TakeNotesButton.Bounds.Width,
                                                            cell.TakeNotesButton.Bounds.Height);


                    // disable the button if there's no listen URL
                    if (string.IsNullOrWhiteSpace(Series.Messages[row].AudioUrl))
                    {
                        cell.ToggleListenButton(false);
                    }
                    else
                    {
                        cell.ToggleListenButton(true);
                    }

                    // disable the button if there's no watch URL
                    if (string.IsNullOrWhiteSpace(Series.Messages[row].WatchUrl))
                    {
                        cell.ToggleWatchButton(false);
                    }
                    else
                    {
                        cell.ToggleWatchButton(true);
                    }

                    // disable the button if there's no note URL
                    if (string.IsNullOrWhiteSpace(Series.Messages[row].NoteUrl))
                    {
                        cell.ToggleTakeNotesButton(false);
                    }
                    else
                    {
                        cell.ToggleTakeNotesButton(true);
                    }

                    // disable the button if there's no discussion guide URL
                    if (string.IsNullOrWhiteSpace(Series.Messages[row].DiscussionGuideUrl))
                    {
                        cell.ToggleDiscussionGuideButton(false);
                    }
                    else
                    {
                        cell.ToggleDiscussionGuideButton(true);
                    }
                }
                else
                {
                    // dummy row for padding.
                    cell.HideControls(true);
                }

                return(cell);
            }
Ejemplo n.º 8
0
            UITableViewCell GetActivityCell(UITableView tableView, ConnectLink link, bool showSeperator)
            {
                SeriesCell cell = tableView.DequeueReusableCell(SeriesCell.Identifier) as SeriesCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell        = new SeriesCell(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.BackgroundColor);
                    cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
                }

                // Thumbnail Image
                cell.Image.Image = new UIImage(NSBundle.MainBundle.BundlePath + "/" + link.ImageName);
                cell.Image.SizeToFit( );

                nfloat topPadding = 10;

                // force the image to be sized according to the height of the cell
                cell.Image.Frame = new CGRect(0,
                                              topPadding,
                                              PrivateConnectConfig.MainPage_ThumbnailDimension,
                                              PrivateConnectConfig.MainPage_ThumbnailDimension);

                nfloat availableTextWidth = cell.Bounds.Width - cell.Chevron.Bounds.Width - cell.Image.Bounds.Width - 10;

                // Chevron
                nfloat chevronYPos = cell.Image.Frame.Top + ((PrivateConnectConfig.MainPage_ThumbnailDimension - cell.Chevron.Bounds.Height) / 2);

                cell.Chevron.Layer.Position = new CGPoint(cell.Bounds.Width - cell.Chevron.Bounds.Width - 5, chevronYPos);

                // Create the title
                cell.Title.Text = link.Title.ToUpper( );
                cell.Title.SizeToFit( );

                cell.SubTitle.Text = link.SubTitle;
                cell.SubTitle.SizeToFit( );

                // Position the Title & Date in the center to the right of the image
                nfloat totalTextHeight = cell.Title.Bounds.Height + cell.SubTitle.Bounds.Height - 6;

                cell.Title.Frame    = new CGRect(cell.Image.Frame.Right + 10, ((PrivateConnectConfig.MainPage_ThumbnailDimension - totalTextHeight) / 2) + topPadding, availableTextWidth - 5, cell.Title.Frame.Height);
                cell.SubTitle.Frame = new CGRect(cell.Image.Frame.Right + 10, cell.Title.Frame.Bottom - 6, availableTextWidth - 5, cell.Title.Frame.Height);

                // add the seperator to the bottom
                if (showSeperator)
                {
                    cell.Seperator.Hidden = false;
                    cell.Seperator.Frame  = new CGRect(0, cell.Image.Frame.Bottom + 10, cell.Bounds.Width, 1);

                    PendingSeriesCellHeight = cell.Seperator.Frame.Bottom;
                }
                else
                {
                    cell.Seperator.Hidden   = true;
                    PendingSeriesCellHeight = cell.Image.Frame.Bottom + 10;
                }

                return(cell);
            }