Пример #1
0
        public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var item = _items[indexPath.Row];
            SessionsTableViewCell cell = (SessionsTableViewCell)tableView.DequeueReusableCell(_cellIdentifier);
            if (cell == null)
            {
                var cellStyle = UITableViewCellStyle.Subtitle;
                cell = new SessionsTableViewCell(cellStyle, _cellIdentifier);
            }

            cell.ImageView.Alpha = 0.7f;
            if(item.ToUpper().StartsWith("AUDIO"))
                cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_audio");
            else if(item.ToUpper().StartsWith("CLOUD"))
                cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_cloud");
            else if(item.ToUpper().StartsWith("GENERAL"))
                cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_settings");
            else if(item.ToUpper().StartsWith("LIBRARY"))
                cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_library");

            cell.Tag = indexPath.Row;
            cell.TextLabel.Text = item;
            cell.TextLabel.Font = UIFont.FromName("HelveticaNeue-Light", 16);
            cell.Accessory = UITableViewCellAccessory.None;
            cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron");
            cell.ImageChevron.Hidden = false;
            
            return cell;
        }
Пример #2
0
        public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            SessionsTableViewCell cell = (SessionsTableViewCell)tableView.DequeueReusableCell(_cellIdentifier);
            if (cell == null)
            {
                cell = new SessionsTableViewCell(UITableViewCellStyle.Subtitle, _cellIdentifier);
                cell.OnRightButtonTap += HandleOnRightButtonTap;
            }

            cell.Tag = indexPath.Row;
            cell.TextLabel.TextColor = UIColor.Black;
            cell.SelectionStyle = UITableViewCellSelectionStyle.Gray;
            cell.ImageView.Alpha = 0.7f;
            cell.RightButton.Alpha = 0.7f;
            cell.RightButton.Hidden = false;

            if(_items[indexPath.Row].Selection == StateSelectionType.Selected)
                cell.RightButton.SetImage(UIImage.FromBundle("Images/Icons/icon_checkbox_checked"), UIControlState.Normal);
            else if(_items[indexPath.Row].Selection == StateSelectionType.PartlySelected)
                cell.RightButton.SetImage(UIImage.FromBundle("Images/Icons/icon_checkbox_partial"), UIControlState.Normal);
            else
                cell.RightButton.SetImage(UIImage.FromBundle("Images/Icons/icon_checkbox_unchecked"), UIControlState.Normal);

            switch(_items[indexPath.Row].ItemType)
            {
                case SyncMenuItemEntityType.Artist:
                    cell.TextLabel.Text = _items[indexPath.Row].ArtistName;
                    cell.TextLabel.Font = UIFont.FromName("HelveticaNeue", 16);
                    cell.IndexTextLabel.Text = string.Empty;
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_user");
                    break;
                case SyncMenuItemEntityType.Album:
                    cell.TextLabel.Text = _items[indexPath.Row].AlbumTitle;
                    cell.TextLabel.Font = UIFont.FromName("HelveticaNeue-Light", 16);
                    cell.IndexTextLabel.Text = string.Empty;
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_vinyl");
                    break;
                case SyncMenuItemEntityType.Song:
                    cell.TextLabel.Text = _items[indexPath.Row].Song.Title;
                    cell.TextLabel.Font = UIFont.FromName("HelveticaNeue-Light", 14);
                    cell.IndexTextLabel.Text = _items[indexPath.Row].Song.TrackNumber.ToString();
                    cell.ImageView.Image = null;
                    break;
            }

            UIView viewBackgroundSelected = new UIView();
            viewBackgroundSelected.BackgroundColor = GlobalTheme.SecondaryColor;
            cell.SelectedBackgroundView = viewBackgroundSelected;

            return cell;
        }
Пример #3
0
        private void HandleOnRightButtonTap(SessionsTableViewCell cell)
        {
            Console.WriteLine("SyncMenuViewController - HandleOnRightButtonTap");
            int row = cell.Tag;
            OnSelectItems(new List<SyncMenuItemEntity>() { _items[row] });

            tableView.BeginUpdates();
            tableView.ReloadRows(new NSIndexPath[1] { NSIndexPath.FromRowSection(row, 0) }, UITableViewRowAnimation.None);
            tableView.EndUpdates();
        }
Пример #4
0
        public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            SessionsTableViewCell cell = (SessionsTableViewCell)tableView.DequeueReusableCell(_cellIdentifier);
            if (cell == null)
                cell = new SessionsTableViewCell(UITableViewCellStyle.Subtitle, _cellIdentifier);

            cell.Tag = indexPath.Row;
            cell.Accessory = UITableViewCellAccessory.None;
            cell.TextLabel.Font = UIFont.FromName("HelveticaNeue", 14);
            cell.TextLabel.Text = _playlist.Items[indexPath.Row].AudioFile.Title;
            cell.DetailTextLabel.Font = UIFont.FromName("HelveticaNeue-Light", 12);
            cell.DetailTextLabel.Text = _playlist.Items[indexPath.Row].AudioFile.ArtistName;
            cell.ImageView.AutoresizingMask = UIViewAutoresizing.None;
            cell.ImageView.ClipsToBounds = true;
            cell.ImageChevron.Hidden = true;
            cell.IndexTextLabel.Text = (indexPath.Row+1).ToString();

            if (_currentlyPlayingSongId == _playlist.Items[indexPath.Row].AudioFile.Id)
                cell.RightImage.Hidden = false;
            else
                cell.RightImage.Hidden = true;

            return cell;
        }