public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
 {
     var cell = collectionView.DequeueReusableCell(ToolCell.Key, indexPath) as ToolCell;
     cell.Text = AvailableTools[indexPath.Item].Name;
     cell.SetBorder();
     return cell;
 }
 public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
 {
     var cell = (PictureBigCollectionCell)collectionView.DequeueReusableCell (PictureBigCollectionCell.CellId, indexPath);
     cell.resetScale ();
     AppDelegate.MakeImageFromURL (cell.Image, Items.Images [indexPath.Row]);
     return cell;
 }
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			var cell = (ProductCell)collectionView.DequeueReusableCell (reuseIdentifier, indexPath);
			ConfigureCell (cell, Products [indexPath.Row]);

			return cell;
		}
        public override UICollectionViewCell GetCell(UICollectionView collectionView, Foundation.NSIndexPath indexPath)
        {
            var cell = (ListingImageCell)collectionView.DequeueReusableCell(CellID, indexPath);
            cell.Image = urls[indexPath.Row];

            return cell;
        }
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			SearchCollectionCell cell = (SearchCollectionCell)collectionView.DequeueReusableCell (identifer, indexPath);
			cell.movie = filterData [indexPath.Row];
			cell.UpdateCell ();
			return cell;
		}
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            DBError err;
            PhotoCell cell = (PhotoCell)collectionView.DequeueReusableCell(PhotoCell.Key, indexPath);

            DBPath path = Photos [Photos.Length - indexPath.Row - 1].Path;
            DBFile file = DBFilesystem.SharedFilesystem.OpenFile (path, out err);
            UIImage image = null;

            // This means the file doesn't exist, or it is open with asynchronous operation.
            if (file == null) {
                cell.Content = null;
                return cell;
            }

            if (file.Status.Cached) {
                image = new UIImage (file.ReadData (out err));
                file.Close ();
            } else {
                file.AddObserver (this, () => {
                    DBFileStatus newStatus = file.NewerStatus;

                    if ((newStatus == null && file.Status.Cached) ||
                        (newStatus != null && newStatus.Cached)) {
                        image = new UIImage (file.ReadData (out err));
                        cell.Content = image;
                        file.RemoveObserver(this);
                        file.Close ();
                    }
                });
            }
            cell.Content = image;

            return cell;
        }
 public override UICollectionViewCell GetCell(UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath)
 {
     var tileCell = (TileCellView)collectionView.DequeueReusableCell (tileCellId, indexPath);
     tileCell.Tile = _tileGrid.Grid[indexPath.Row];
     tileCell.Layer.BorderWidth = 0;
     tileCell.Update ();
     return tileCell;
 }
 public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
 {
     var cell = (PreferenceCell)collectionView.DequeueReusableCell (PreferenceCell.CellId, indexPath);
     AppDelegate.MakeImageFromURL (cell.Image, "http://www.sport.net" + AppDelegate.MainCategories.Categories [indexPath.Row].Thumb);
     cell.Category = AppDelegate.MainCategories.Categories[indexPath.Row].Name;
     cell.SetCellState (AppDelegate.MainCategories.Categories [indexPath.Row].Checked);
     return cell;
 }
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			var cell = (PagePreview)collectionView.DequeueReusableCell (cellName, indexPath);

			cell.Page = pages.ElementAt (indexPath.Row);

			return cell;
		}
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = (CVCell)collectionView.DequeueReusableCell (cellId, indexPath);

            cell.Text = indexPath.Row.ToString ();

            return cell;
        }
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			// Get a reusable cell and set it's title from the item
			var cell = collectionView.DequeueReusableCell ("Cell", indexPath) as TextCollectionViewCell;
			cell.Title = Numbers [(int)indexPath.Item].ToString();

			return cell;
		}
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = collectionView.DequeueReusableCell(QuickCurrencyCell.Key, indexPath) as QuickCurrencyCell;

            var rate = CurrentCurrencyList.Currencys[indexPath.Row];

            cell.Setup(rate, CurrentBaseCurrencyAmount);
            return cell;
        }
        public UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            ImageLabelCollectionViewCell cell = (ImageLabelCollectionViewCell)collectionView.DequeueReusableCell(new NSString("ImageLabelCollectionViewCellIdentifier"), indexPath);
            cell.BackgroundColor = UIColor.Clear;
            cell.CollectionCellImageView.Image = UIImage.FromBundle(Speakers[indexPath.Row].SpeakerPhoto);
            cell.CollectionCellLabel.Text = Speakers[indexPath.Row].SpeakerName;

            return cell;
        }
        public override UICollectionViewCell GetCell (UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            var animalCell = (AnimalCell) collectionView.DequeueReusableCell (animalCellId, indexPath);

            var animal = animals [indexPath.Row];
            animalCell.Image = animal.Image;

            return animalCell;
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var item = _items [indexPath.Row];
            var cell = (ExampleCollectionItemCell) collectionView.DequeueReusableCell (CellId, indexPath);

            cell.Title = item.Name;

            return cell;
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            SCAMViewCell cell = (SCAMViewCell)collectionView.DequeueReusableCell (new NSString (Constants.SCAM_CELL_ID), indexPath);

            cell.lblNombre.Text = this.menuNombres [indexPath.Item];
            cell.imageView.Image = new UIImage (this.menuImagenes [indexPath.Item]);

            return cell;
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = collectionView.DequeueReusableCell (FAViewCell.Key, indexPath) as FAViewCell;
            var fa = _searchresult [indexPath.Row];
            var width = _fasize.Size ().Width - 50;
            cell.Init (fa, width);

            return cell;
        }
 public override UICollectionViewCell GetCell(UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath)
 {
     var movieCell = (MyCollectionViewCell)collectionView.DequeueReusableCell (movieCellId, indexPath);
     Movie movie = _content[indexPath.Row];
     movieCell.title.Text = movie.Title;
     movieCell.imageView.Image = UIImage.FromBundle(movie.Image);
     movieCell.subTitle.Text = movie.SubTitle;
     movieCell.count.Text = movie.TotalViews + " Views";
     return movieCell;
 }
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			var cityCell = (CityCollectionViewCell)collectionView.DequeueReusableCell (CardCellId, indexPath);
			var city = Cities [indexPath.Row];

			// Initialize city
			cityCell.City = city;

			return cityCell;
		}
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			// get an ImageCell from the pool. DequeueReusableCell will create one if necessary
			ImageCell imageCell = (ImageCell)collectionView.DequeueReusableCell (cellId, indexPath);

			// update the image for the speaker
			imageCell.UpdateImage (monkeys [indexPath.Row].ImageFile);
                
			return imageCell;
		}
        public override UICollectionViewCell GetCell (UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            var imageCell = (ImageCell)collectionView.DequeueReusableCell (cellId, indexPath);
              
            string imageUrl = imageUrls [indexPath.Row].Replace ("\"", "");

            imageCell.UpdateCell (new Uri (imageUrl));
                
            return imageCell;
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = collectionView.DequeueReusableCell(AppsCollectionViewCell.ReuseId, indexPath) as AppsCollectionViewCell;

            var app = Apps[Convert.ToInt32(indexPath.Item)];

            cell.SetContent(cellSize, app);

            return cell;
        }
		public override UICollectionViewCell GetCell (UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath)
		{
			var itemCell = (ItemCollectionViewCell)collectionView.DequeueReusableCell (ItemCollectionViewCell.Key, indexPath);
			//itemCell.Frame = new System.Drawing.RectangleF (0, 0, 200, 100);
			var item = Items[indexPath.Section][indexPath.Row];
			itemCell.BackgroundColor = item.UseAlterate() ? AlternateItemBackgroundColor : ItemBackgroundColor;
			itemCell.Item = item;

			return itemCell;
		}
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			var cell = (CollectionCell)collectionView.DequeueReusableCell ((NSString)CellID, indexPath);

			string identifier = DataSource.GetIdentifier (indexPath);
			cell.Label.Text = DataSource.GetTitle (identifier);
			cell.ImageView.Image = DataSource.GetThumbnail (identifier);

			return cell;
		}
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			// Dequeue a cell from the reuse pool
			var imageCell = (ImageCell)collectionView.DequeueReusableCell(CellId, indexPath);

			// Reuse the image declared at the class level
			imageCell.ImageView.Image = image;

			return imageCell;
		}
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			var cell = collectionView.DequeueReusableCell (ProjectCollectionViewControllerCell.Key, indexPath) as ProjectCollectionViewControllerCell;
			
			//TODO: populate the cell with the appropriate data based on the indexPath

			cell.CreateView (projectData,indexPath.Item);

			return cell;
		}
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = (IconViewCell)collectionView.DequeueReusableCell(cellId, indexPath);

            var icon = _module.GetIcon(_module.Keys.ToList()[indexPath.Row]);

            cell.Icon = icon;

            return cell;
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var imageCell = (ImageCell)collectionView.DequeueReusableCell (cellId, indexPath);

            imageMgr.RequestImageForAsset ((PHAsset)fetchResults[indexPath.Item], new SizeF (160, 160),
                PHImageContentMode.AspectFill, new PHImageRequestOptions (), (img, info) => {
                imageCell.ImageView.Image = img;
            });

            return imageCell;
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            var cell = (MenuCell)collectionView.DequeueReusableCell (mainCellId, indexPath);

            var item = menuItems[indexPath.Row];

            cell.Image = item.Image;
            cell.Text = item.Name;

            return cell;
        }
		public override UICollectionViewCell GetCell (UICollectionView collectionView, Foundation.NSIndexPath indexPath)
		{
			UserFeedCollectionViewCell cell = (UserFeedCollectionViewCell)collectionView.DequeueReusableCell(UserFeedCollectionViewCell.Identifier, indexPath);
			if (cell == null)
			{
				cell = UserFeedCollectionViewCell.Create ();
			}
			cell.BindDataToCell(Master.CollectionItems[indexPath.Row]);

			return cell;
		}
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = collectionView.DequeueReusableCell(DetermineCellReuseId(), indexPath) as UICollectionViewCell;

            switch (cell)
            {
            case DefaultCell defaultCell:
                UpdateDefaultCell(defaultCell, indexPath);
                break;

            case TemplatedCell templatedCell:
                UpdateTemplatedCell(templatedCell, indexPath);
                break;
            }

            return(cell);
        }
Exemple #32
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = (UICollectionViewCell)collectionView.DequeueReusableCell("controlCell", indexPath);

            cell.BackgroundColor   = UIColor.White;
            cell.Layer.BorderWidth = 0.5f;
            cell.Layer.BorderColor = UIColor.FromRGB(221.0f / 255.0f, 221.0f / 255.0f, 221.0f / 255.0f).CGColor;

            Control item = controls.GetItem <Control>((nuint)indexPath.Row);

            UIImageView imageView = (UIImageView)cell.ViewWithTag(200);

            imageView.Image             = item.image;
            imageView.Layer.BorderColor = UIColor.FromRGB(232.0f / 255.0f, 232.0f / 255.0f, 232.0f / 255.0f).CGColor;                               imageView.Layer.BorderWidth = 0.5f;

            UILabel lblTitle = (UILabel)cell.ViewWithTag(201);

            lblTitle.Text = (item.dispName != "" && item.dispName != null)? item.dispName: item.name;

            UIImageView tag = (UIImageView)cell.ViewWithTag(205);


            if (item.tag == "NEW")
            {
                tag.Image = new UIImage("Controls/Tags/new.png");
            }
            else if (item.tag == "UPDATED")
            {
                tag.Image = new UIImage("Controls/Tags/updated.png");
            }
            else if (item.tag == "PREVIEW")
            {
                tag.Image = new UIImage("Controls/Tags/preview.png");
            }
            else
            {
                tag.Image = null;
            }

            UILabel desc = (UILabel)cell.ViewWithTag(202);

            desc.Text = item.description;

            return(cell);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var tagCell = (LocalTagCollectionViewCell)collectionView.DequeueReusableCell(nameof(LocalTagCollectionViewCell), indexPath);

            if (!tagCell.IsCellActionSet)
            {
                tagCell.CellAction += (ActionType arg1, string arg2) =>
                {
                    if (_isEditMode && LocalTags.Count == 1)
                    {
                        return;
                    }
                    CellAction?.Invoke(arg1, arg2);
                };
            }
            tagCell.RefreshCell(LocalTags[indexPath.Row]);
            return(tagCell);
        }
Exemple #34
0
        public UICollectionViewCell GetCell(UICollectionView collectionView,
                                            NSIndexPath indexPath)
        {
            string cellId;

            if (indexPath.Item % 4 == 0)
            {
                cellId = "cell";
            }
            else
            {
                cellId = "cell2";
            }

            var cell = collectionView.DequeueReusableCell(cellId, indexPath);

            return((UIKit.UICollectionViewCell)cell);
        }
Exemple #35
0
        UICollectionViewCell IUICollectionViewDataSource.GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            Contract.Ensures(Contract.Result <UICollectionViewCell>() != null);
            var cell = collectionView.DequeueReusableCell("sampleCellIdentifier", indexPath) as MyCollectionViewCell;

            UILabel label = new UILabel(frame: new CGRect(0, 100, 100, 100))
            {
                Font          = UIFont.FromName("Arial", 25f),
                TextAlignment = UITextAlignment.Center,
                TextColor     = UIColor.Red,
                Text          = "Text Sample"
            };

            cell.ContentView.AddSubview(label);


            return(cell);
        }
        public UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var _cell = collectionView.DequeueReusableCell("Cell", indexPath);// as ButtonBarViewCell;

            if (!(_cell is ButtonBarViewCell))
            {
                throw new Exception("UICollectionViewCell should be or extend from ButtonBarViewCell");
            }

            var cell            = _cell as ButtonBarViewCell;
            var childController = ViewControllers[indexPath.Item] as IIndicatorInfoProvider;
            var indicatorInfo   = childController.IndicatorInfoForPagerTabStrip(this);

            cell.Label.Text                  = indicatorInfo.Title;
            cell.Label.Font                  = Settings.Style.ButtonBarItemFont;
            cell.Label.TextColor             = Settings.Style.ButtonBarItemTitleColor ?? cell.Label.TextColor;
            cell.ContentView.BackgroundColor = Settings.Style.ButtonBarItemBackgroundColor ?? cell.ContentView.BackgroundColor;
            cell.BackgroundColor             = Settings.Style.ButtonBarItemBackgroundColor ?? cell.BackgroundColor;

            if (indicatorInfo.Image != null)
            {
                cell.ImageView.Image = indicatorInfo.Image;
            }
            if (indicatorInfo.HighlightedImage != null)
            {
                cell.ImageView.HighlightedImage = indicatorInfo.HighlightedImage;
            }

            ConfigureCell(cell, indicatorInfo);

            if (PagerBehaviour.IsProgressiveIndicator)
            {
                ChangeCurrentIndexProgressive?.Invoke(CurrentIndex == indexPath.Item ? null : cell, CurrentIndex == indexPath.Item ? cell : null, 1, true, false);
            }
            else
            {
                ChangeCurrentIndex?.Invoke(CurrentIndex == indexPath.Item ? null : cell, CurrentIndex == indexPath.Item ? cell : null, false);
            }

            cell.IsAccessibilityElement = true;
            cell.AccessibilityLabel     = indicatorInfo.AccessibilityLabel ?? cell.Label.Text;

            return(cell);
        }
Exemple #37
0
        public override UICollectionViewCell GetCell(
            UICollectionView collectionView, NSIndexPath indexPath)
        {
            BlockCell blockCell = (BlockCell)collectionView.DequeueReusableCell(
                blockCellId,
                indexPath
                );

            IBlock block = blocks [indexPath.Row];

            blockCell.blockCell = block;

            blockCell.SetTitle();
            blockCell.SetExample();
            blockCell.SetImage();
            blockCell.SetParentController(introController);

            return(blockCell);
        }
Exemple #38
0
        public UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var length = collectionView.VisibleCells.Length;
            var title  = (Alcoholes)(int)indexPath.Item;


            switch (indexPath.Item)
            {
            case 0:
                var cellProfile = collectionView.DequeueReusableCell(CollectionHomeViewCell.Key, indexPath) as CollectionHomeViewCell;
                cellProfile.btnTitle = "Perfil";

                return(cellProfile);

            case 1:
                var cellOrders = collectionView.DequeueReusableCell(CollectionHomeOrdersViewCell.Key, indexPath) as CollectionHomeOrdersViewCell;

                cellOrders.lblOrders = pedidos.ToString();
                return(cellOrders);

            case 2:
                var cellProx1 = collectionView.DequeueReusableCell(CollectionHomePaqueteViewCell.Key, indexPath) as CollectionHomePaqueteViewCell;
                var img       = UIImage.FromBundle("Brandy");
                cellProx1.BackgroundImage = img;
                cellProx1.btnTitle        = "Promociones (Proximamente)";
                return(cellProx1);

            case 3:
                var cellProx2 = collectionView.DequeueReusableCell(CollectionHomePaqueteViewCell.Key, indexPath) as CollectionHomePaqueteViewCell;
                var img2      = UIImage.FromBundle("Brandy");
                cellProx2.BackgroundImage = img2;
                cellProx2.btnTitle        = "Paquetes (Proximamente)";
                return(cellProx2);

            case 4:
                var cellProx3 = collectionView.DequeueReusableCell(CollectionHomePaqueteViewCell.Key, indexPath) as CollectionHomePaqueteViewCell;
                var img3      = UIImage.FromBundle("Brandy");
                cellProx3.BackgroundImage = img3;
                cellProx3.btnTitle        = "Zonas (Proximamente)";
                return(cellProx3);


            default:
                var cellPackages = collectionView.DequeueReusableCell(CollectionHomePaqueteViewCell.Key, indexPath) as CollectionHomePaqueteViewCell;
                var imgx         = UIImage.FromBundle("Brandy");
                cellPackages.BackgroundImage = imgx;
                cellPackages.btnTitle        = "Packtempedes";
                return(cellPackages);
            }
        }
            public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
            {
                var cell = collectionView.DequeueReusableCell(PostCollectionViewCell1.Key, indexPath) as PostCollectionViewCell1;

                if (cell == null)
                {
                    var arr = NSBundle.MainBundle.LoadNib(PostCollectionViewCell1.Key, null, null);
                    cell = Runtime.GetNSObject <PostCollectionViewCell1>(arr.ValueAt(0));
                }

                cell.Layer.BorderColor  = UIColor.LightGray.CGColor;
                cell.Layer.BorderWidth  = 0.5f;
                cell.Layer.CornerRadius = 10;
                cell.LayoutMargins      = new UIEdgeInsets(5, 5, 5, 5);


                cell.ClipsToBounds = true;
                cell.SetData(items[indexPath.Row]);
                return(cell);
            }
Exemple #40
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = (ShrineCollectionViewCell)collectionView.DequeueReusableCell(cellId, indexPath);

            if (cell == null)
            {
                return(new UICollectionViewCell(CGRect.Empty));
            }

            var itemNum   = indexPath.Row;
            var title     = shrineData.titles[itemNum];
            var imageName = shrineData.imageNames[itemNum];
            var avatar    = shrineData.avatars[itemNum];
            var shopTitle = shrineData.shopTitles[itemNum];
            var price     = shrineData.prices[itemNum];

            cell.PopulateCell(title, imageName, avatar, shopTitle, price);

            return(cell);
        }
            public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
            {
                var cell   = (NavigationCell)collectionView.DequeueReusableCell(new NSString("NavigationCell"), indexPath);
                var target = _menu.Targets.Skip(indexPath.Row).FirstOrDefault();

                if (target != null)
                {
                    cell.Name     = target.Title;
                    cell.Icon     = target.Icon;
                    cell.Selected = () => _menu.SendTargetSelected(target);
                }
                else
                {
                    cell.Selected = null;
                    cell.Icon     = "";
                    cell.Name     = "";
                }

                return(cell);
            }
        /// <summary>
        /// Gets the cell.
        /// </summary>
        /// <returns>The cell.</returns>
        /// <param name="collectionView">Collection view.</param>
        /// <param name="indexPath">Index path.</param>
        public UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            cellId = cellId ?? new NSString(GridViewCell.Key);

            //Get the sections.
            var sections = Element.ItemsSource.OfType <IEnumerable>()
                           .Where(grp => !(grp is string))
                           .ToList();

            object item;

            //If there are any sections.
            if (sections.Any())
            {
                item = sections[(int)indexPath.Section].Cast <object>().ElementAt(indexPath.Row);
            }
            else
            {
                item = Element.ItemsSource.Cast <object>().ElementAt(indexPath.Row);
            }



            var collectionCell = collectionView.DequeueReusableCell(cellId, indexPath) as GridViewCell;

            //collectionCell.SelectedBackgroundView = new UIView()
            //{
            //    BackgroundColor = UIColor.Red,
            //    Hidden = false,


            //};
            //collectionCell.SelectedBackgroundView.Layer.RemoveAllAnimations();

            //var a = NSBundle.MainBundle.LoadNib("statelist_item_background", null, null);
            //collectionCell.SelectedBackgroundView = ObjCRuntime.Runtime.GetNSObject<UIView>(a.ValueAt(0));
            //collectionCell.SelectedBackgroundView.Layer.RemoveAllAnimations();

            collectionCell.RecycleCell(item, Element.ItemTemplate, Element);
            return(collectionCell);
        }
Exemple #43
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = (UICollectionViewCell)collectionView.DequeueReusableCell("UserSearchListCell", indexPath);

            try             //error once on simulator when entering MainActivity, indexPath.row is out of bounds
            {
                UIImageView imageView = (UIImageView)cell.Subviews[0].Subviews[0];
                imageView.Frame = new CGRect(new CGPoint(0, 0), new CGSize(itemWidth, itemWidth));

                Profile item = items[indexPath.Row];

                ImageCache im = new ImageCache(this);
                im.LoadImage(imageView, item.ID.ToString(), item.Pictures[0]);
            }
            catch (Exception ex)
            {
                context.c.ReportErrorSilent(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + " index: " + indexPath.Row);
            }

            return(cell);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var post       = posts[indexPath.Row];
            var postAuthor = userReads.Get(post.UserId);

            var cell = (FeedCollectionViewCell)collectionView.DequeueReusableCell(FeedCollectionViewCell.Key, indexPath);

            cell.UpdateCell(post.Id, userId, postAuthor.Id, postAuthor.ImagePath, postAuthor.UserTag, post.ImagePath, post.Description, post.Likes, post.UsesURL);

            cell.DataContext.DeleteItemAction = () =>
            {
                OnItemChanged?.Invoke(this, EventArgs.Empty);
            };

            cell.DataContext.LikeAction = () =>
            {
                OnItemChanged?.Invoke(this, EventArgs.Empty);
            };

            return(cell);
        }
Exemple #45
0
        public override void ItemHighlighted(UICollectionView collectionView, NSIndexPath indexPath)
        {
            if (!_editmode)
            {
                var cell = (KeyCell)collectionView.DequeueReusableCell(KeyCell.Key, indexPath);
                if (_datasource [indexPath.Row].PersistSelected)                 //turn on/off
                {
                    cell.SwitchKeyOnOff(_datasource [indexPath.Row]);
                }

                //cell.TestSelect ();
                //cell.SetNeedsDisplay ();
                //collectionView.ReloadItems(new NSIndexPath[]{indexPath});
            }

            /*var cell2 = collectionView.CellForItem (indexPath) as KeyCell;
             * cell2.BackgroundColor = UIColor.Purple;
             * collectionView.ReloadItems(new NSIndexPath[]{indexPath});*/

            Console.WriteLine("highlighted");
        }
Exemple #46
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = collectionView.DequeueReusableCell(GotoCollectionViewCell.Key, indexPath) as GotoCollectionViewCell;


            if (indexPath.Row == 9)
            {
                cell.ContentView.BackgroundColor = lineColor;
                cell.titleLabe.Frame             = new CoreGraphics.CGRect(0, 0, 106, 44);
                cell.titleLabe.BackgroundColor   = lineColor;
            }
            if (indexPath.Row == 11)
            {
                cell.ContentView.BackgroundColor = lineColor;
                UIImageView clearImage = new UIImageView(new UIImage("Images/Content/delete.png"));
                clearImage.Frame = new CoreGraphics.CGRect(43, 12, 20, 20);
                cell.titleLabe.AddSubview(clearImage);
            }
            cell.titleLabe.Text = numbersList[indexPath.Row];
            return(cell);
        }
        /// <summary>
        /// Overrides the <see cref="UICollectionViewSource.GetCell"/> method.
        /// Creates and returns a cell for the UICollectionView. Where needed, this method will
        /// optimize the reuse of cells for a better performance.
        /// </summary>
        /// <param name="collectionView">The UICollectionView associated to this source.</param>
        /// <param name="indexPath">The NSIndexPath pointing to the item for which the cell must be returned.</param>
        /// <returns>The created and initialised <see cref="UICollectionViewCell"/>.</returns>
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = (TCell)collectionView.DequeueReusableCell(NsReuseId, indexPath);

            try
            {
                var coll = _dataSource;

                if (coll != null)
                {
                    var item = coll[indexPath.Row];
                    BindCell(cell, item, indexPath);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }

            return(cell);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = collectionView.DequeueReusableCell("photoViewCell", indexPath) as UICollectionViewCell;

            var image = _images.ElementAt(indexPath.Row);

            var imageButton = new UIButton(new CGRect(0, 0, View.Window.Frame.Width / 4 - 10, View.Window.Frame.Width / 4 - 10));

            cell.AddSubview(imageButton);
            imageButton.SetBackgroundImage(image, UIControlState.Normal);

            imageButton.TouchUpInside += (sender, e) =>
            {
                var previewViewController = new UIViewController();

                // TODO: adjust width/heigh based on image
                var imageView = new UIImageView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height))
                {
                    Image = image
                };

                previewViewController.View.AddSubview(imageView);

                var closeButton = new UIButton(new CGRect(View.Frame.Width - 40, 20, 20, 20));
                closeButton.SetTitle("X", UIControlState.Normal);
                closeButton.AccessibilityLabel = "close";
                closeButton.TouchUpInside     += (s, evt) => {
                    previewViewController.DismissViewController(true, null);
                };

                previewViewController.View.AddSubview(closeButton);

                this.ShowViewController(previewViewController, null);
            };

            cell.IsAccessibilityElement = true;
            cell.AccessibilityLabel     = $"image {indexPath.Row}";

            return(cell);
        }
Exemple #49
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var item = _fastListView.ItemsSource.Cast <object>().ElementAt(indexPath.Row);

            var _viewCell = _fastListView.CreateDefault(item);

            if (_viewCell != null)
            {
                _viewCell.BindingContext = item;
                _viewCell.Parent         = _fastListView;

                if (indexPath != null)
                {
                    var collectionCell = collectionView.DequeueReusableCell(new NSString(FastListViewCell.Key), indexPath) as FastListViewCell;

                    if (collectionCell == null)
                    {
                        return(null);
                    }

                    _viewCell.Appearing += (sender, e) => {
                        Console.WriteLine("Cell => Appearing !");
                        _fastListView.SendCellAppearing((Cell)sender);
                    };
                    _viewCell.Disappearing += (sender, e) => {
                        Console.WriteLine("Cell => Disappearing !");
                        _fastListView.SendCellDisappearing((Cell)sender);
                    };
                    collectionCell.UpdateCell(_viewCell);
                    return(collectionCell);
                }
                else
                {
                    return(null);
                }
            }

            return(null);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var headerCell = (ShellSectionHeaderCell)collectionView.DequeueReusableCell(CellId, indexPath);

            var selectedItems = collectionView.GetIndexPathsForSelectedItems();

            var shellContent = ShellSection.Items[indexPath.Row];

            headerCell.Label.Text = shellContent.Title;
            headerCell.Label.SetNeedsDisplay();

            if (selectedItems.Length > 0 && selectedItems[0].Row == indexPath.Row)
            {
                headerCell.Label.TextColor = _selectedColor.ToUIColor();
            }
            else
            {
                headerCell.Label.TextColor = _unselectedColor.ToUIColor();
            }

            return(headerCell);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            if (NohanaImagePickerController == null)
            {
                throw new Exception("failed to dequeueReusableCellWithIdentifier(\"AssetDetailCell\")");
            }

            var cell = collectionView.DequeueReusableCell("AssetDetailCell", CurrentIndexPath) as AssetDetailCell;

            if (cell != null)
            {
                cell.scrollView.ZoomScale = 1;
                cell.Tag = indexPath.Item;

                var imageSize = new CGSize(
                    width: CellSize.Width * UIScreen.MainScreen.Scale,
                    height: CellSize.Width * UIScreen.MainScreen.Scale
                    );
                var asset = PhotoKitAssetList[(int)indexPath.Item];
                cell.Tag = indexPath.Item;

                asset.Image(imageSize, imageData =>
                {
                    InvokeOnMainThread(() =>
                    {
                        if (cell.Tag == indexPath.Item)
                        {
                            cell.imageView.Image = imageData.Image;
                            cell.imageViewHeightConstraint.Constant = this.CellSize.Height;
                            cell.imageViewWidthConstraint.Constant  = this.CellSize.Width;
                        }
                    });
                });

                return((NohanaImagePickerController.PickerDelegate?.NohanaImagePickerList(NohanaImagePickerController, this, cell, indexPath, asset.OriginalAsset)) ?? cell);
            }

            return(base.GetCell(collectionView, indexPath));
        }
Exemple #52
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var commentCell = collectionView.DequeueReusableCell(CommentViewController.commentCellId, indexPath) as CommentCell;

            var imageView = commentCell.GetImageView();

            imageView.Image = UIImage.FromBundle("Profile");

            if (!string.IsNullOrEmpty(comments[indexPath.Row].profilePicture))
            {
                Utils.SetImageFromNSUrlSession(comments[indexPath.Row].profilePicture, imageView, this, PictureType.Profile);
            }

            commentCell.surveyCommentModel = comments[indexPath.Row];

            commentCell.UpdateCell(comments[indexPath.Row].userName, comments[indexPath.Row].text, comments[indexPath.Row].commentDate, commentViewController.NavigationController, comments[indexPath.Row].userId);

            var longPress = new UICommentLongPressGestureRecognizer(commentViewController, new Selector("HandleLongPressSelector:"));

            longPress.Params = new List <object>()
            {
                comments[indexPath.Row]
            };
            commentCell.AddGestureRecognizer(longPress);


            if (comments[indexPath.Row].userLiked == true)
            {
                commentCell.updateLikeButton(false);
            }
            else if (comments[indexPath.Row].userLiked == null || comments[indexPath.Row].userLiked == false)
            {
                commentCell.updateLikeButton(true);
            }

            commentCell.updateLikeCount(comments[indexPath.Row].totalLikes);

            return(commentCell);
        }
Exemple #53
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = (CircleCollectionViewCell)collectionView.DequeueReusableCell(CircleCollectionViewCell.Key,
                                                                                    indexPath);
            var character = Items[indexPath.Row];

            cell.ImageView.Image = UIImage.FromBundle(character.ImageName);

            var scrollPosition = UIDevice.CurrentDevice.Orientation.IsPortrait() ? UICollectionViewScrollPosition.CenteredHorizontally : UICollectionViewScrollPosition.CenteredVertically;

            if (cell.GestureRecognizers != null)
            {
                foreach (var gr in cell.GestureRecognizers)
                {
                    cell.RemoveGestureRecognizer(gr);
                }
            }

            cell.AddGestureRecognizer(new UITapGestureRecognizer(() => ScrollToItem(collectionView, indexPath)));

            return(cell);
        }
Exemple #54
0
        protected override UICollectionViewCell GetOrCreateCellFor(UICollectionView collectionView, NSIndexPath indexPath, object item)
        {
            if (currentViewModel is DiscoverViewModel discoverViewModel)
            {
                if (discoverViewModel.ViewType == ViewType.List)
                {
                    var listCell = (MovieListCell)collectionView.DequeueReusableCell(MovieListCell.Key, indexPath);
                    listCell.favoriteButtonImplementor = this;
                    if (((Movie)item).IsFavorite)
                    {
                        listCell.favoriteImageView.Image     = UIImage.FromBundle("favorite-filled").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                        listCell.favoriteImageView.TintColor = UIColor.Red;
                    }
                    else
                    {
                        listCell.favoriteImageView.Image     = UIImage.FromBundle("favorite-gray").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                        listCell.favoriteImageView.TintColor = UIColorUtils.GetAppTextLightColor();
                    }
                    return(listCell);
                }
            }

            var cell = (MovieCollectionCell)base.GetOrCreateCellFor(collectionView, indexPath, item);

            cell.favoriteButtonImplementor = this;
            var movie = (Movie)item;

            if (movie.IsFavorite)
            {
                cell.favoriteImageView.Image     = UIImage.FromBundle("favorite-filled").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                cell.favoriteImageView.TintColor = UIColor.Red;
            }
            else
            {
                cell.favoriteImageView.Image     = UIImage.FromBundle("favorite-gray").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                cell.favoriteImageView.TintColor = UIColorUtils.GetAppTextLightColor();
            }
            return(cell);
        }
Exemple #55
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var selector = _itemTemplateProvider.CollectionCellTemplateSelector;

            if (selector == null)
            {
                throw new NotSupportedException("The ItemTemplate is null to create UICollectionViewCell use the ItemTemplate with ICollectionCellTemplateSelector value.");
            }
            object item = GetItemAt(indexPath);
            UICollectionViewCell cell;

            if (selector is ICollectionCellTemplateSelectorSupportDequeueReusableCell)
            {
                cell = ((ICollectionCellTemplateSelectorSupportDequeueReusableCell)selector).DequeueReusableCell(collectionView, item, indexPath);
            }
            else
            {
                cell = (UICollectionViewCell)collectionView.DequeueReusableCell(selector.GetIdentifier(item, collectionView), indexPath);
            }

            _lastCreatedCell     = cell;
            _lastCreatedCellPath = indexPath;

            if (Equals(item, _selectedItem) && !cell.Selected)
            {
                collectionView.SelectItem(indexPath, false, UICollectionViewScrollPosition.None);
            }
            cell.Tag |= InitializingStateMask;
            cell.SetDataContext(item);
            if (!HasMask(cell, InitializedStateMask))
            {
                cell.Tag |= InitializedStateMask;
                ParentObserver.GetOrAdd(cell).Parent = collectionView;
                selector.InitializeTemplate(collectionView, cell);
            }
            cell.Tag &= ~InitializingStateMask;
            (cell as IHasDisplayCallback)?.WillDisplay();
            return(cell);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            if (collectionView == null || indexPath == null)
            {
                throw new ArgumentNullException();
            }

            var galleryImageCell =
                (GalleryImageCell)collectionView.DequeueReusableCell(GalleryImageCell.Key, indexPath);

            galleryImageCell.UpdateRow(
                GalleryDataSource.ImageCollection.Values[indexPath.Section].Values[(int)indexPath.Item].Image
                .ToUIImage(),
                GalleryDataSource.ImageCollection.Values[indexPath.Section].Values[(int)indexPath.Item].CreationTime ??
                DateTime.MaxValue, indexPath);

            var imageName = GalleryDataSource.ImageCollection.Values[indexPath.Section].Values[(int)indexPath.Item].Name;

            ConfigureImageCellGeneralAccessibilityAttributes(galleryImageCell.GalleryImageView, imageName);

            return(galleryImageCell);
        }
Exemple #57
0
        void ConfigureDataSource()
        {
            dataSource = new UICollectionViewDiffableDataSource <NSNumber, NSNumber> (collectionView, CellProviderHandler);

            // initial data
            var itemsPerSection = 5;
            var sections        = Enumerable.Range(0, 5).Select(i => NSNumber.FromInt32(i)).ToArray();

            currentSnapshot = new NSDiffableDataSourceSnapshot <NSNumber, NSNumber> ();
            var itemOffset = 0;

            foreach (var section in sections)
            {
                currentSnapshot.AppendSections(new [] { section });
                var items = Enumerable.Range(itemOffset, itemsPerSection).Select(i => NSNumber.FromInt32(i)).ToArray();
                currentSnapshot.AppendItems(items);
                itemOffset += itemsPerSection;
            }

            dataSource.ApplySnapshot(currentSnapshot, false);

            UICollectionViewCell CellProviderHandler(UICollectionView collectionView, NSIndexPath indexPath, NSObject obj)
            {
                var sectionId = currentSnapshot.SectionIdentifiers [indexPath.Section];
                var numberOfItemsInSection = currentSnapshot.GetNumberOfItems(sectionId);
                var isLastCell             = indexPath.Item + 1 == numberOfItemsInSection;

                // Get a cell of the desired kind.
                var cell = collectionView.DequeueReusableCell(ListCell.Key, indexPath) as ListCell;

                // Populate the cell with our item description.
                cell.Label.Text           = $"{indexPath.Section}, {indexPath.Row}";
                cell.SeparatorView.Hidden = isLastCell;

                // Return the cell.
                return(cell);
            }
        }
Exemple #58
0
        void ConfigureDataSource()
        {
            dataSource = new UICollectionViewDiffableDataSource <NSNumber, NSNumber> (collectionView, CellProviderHandler);

            // initial data
            var snapshot        = new NSDiffableDataSourceSnapshot <NSNumber, NSNumber> ();
            var idOffset        = 0;
            var itemsPerSection = 30;
            var sections        = Enumerable.Range(0, 5).Select(i => NSNumber.FromInt32(i)).ToArray();

            foreach (var section in sections)
            {
                snapshot.AppendSections(new [] { section });
                var items = Enumerable.Range(idOffset, itemsPerSection).Select(i => NSNumber.FromInt32(i)).ToArray();
                snapshot.AppendItems(items);
                idOffset += itemsPerSection;
            }

            dataSource.ApplySnapshot(snapshot, false);

            UICollectionViewCell CellProviderHandler(UICollectionView collectionView, NSIndexPath indexPath, NSObject obj)
            {
                // Get a cell of the desired kind.
                var cell = collectionView.DequeueReusableCell(TextCell.Key, indexPath) as TextCell;

                // Populate the cell with our item description.
                cell.Label.Text = $"{indexPath.Section}, {indexPath.Row}";
                cell.ContentView.BackgroundColor    = UIColorExtensions.CornflowerBlue;
                cell.ContentView.Layer.BorderColor  = UIColor.Black.CGColor;
                cell.ContentView.Layer.BorderWidth  = 1;
                cell.ContentView.Layer.CornerRadius = 8;
                cell.Label.TextAlignment            = UITextAlignment.Center;
                cell.Label.Font = UIFont.GetPreferredFontForTextStyle(UIFontTextStyle.Title1);

                // Return the cell.
                return(cell);
            }
        }
        // MARK: Collectionviews
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = (ProductCollectionViewCell)collectionView.DequeueReusableCell(cellId, indexPath);

            if (cell == null)
            {
                return(new UICollectionViewCell(CGRect.Empty));
            }

            var product = products[(int)indexPath.Item];

            cell.SetProduct(product);

            cell.favoriteButton.Tag = indexPath.Item;
            if (!cell.favoriteButton.AllTargets.Contains(this))
            {
                // BUG: Use only Selector as the normal AddTarget does not work. Report a Bug...
                cell.favoriteButton.AddTarget(this, new ObjCRuntime.Selector("onTouchUpInside:"), UIControlEvent.TouchUpInside);
                //cell.favoriteButton.AddTarget(this.OnTouchUpInside, UIControlEvent.TouchUpInside);
            }

            return(cell);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var cell = collectionView.DequeueReusableCell(LightboxCollectionViewCell.ReuseIdentifier, indexPath) as LightboxCollectionViewCell;

            if (cell == null)
            {
                throw new InvalidProgramException("Unable to dequeue a LightboxCollectionViewCell");
            }

            cell.ImageView.Image = null;

            var options = new PHImageRequestOptions {
                Synchronous = true
            };

            var asset = assets [indexPath.Row];

            PHImageManager.DefaultManager.RequestImageForAsset(asset, cell.Bounds.Size, PHImageContentMode.AspectFit, options, (requestedImage, _) => {
                cell.ImageView.Image = requestedImage;
            });

            return(cell);
        }