예제 #1
0
        protected override UICollectionViewCell GetOrCreateCellFor(UICollectionView collectionView, NSIndexPath indexPath, object item)
        {
            var cell = (GenreCollectionCell)base.GetOrCreateCellFor(collectionView, indexPath, item);

            if (cell is IMvxDataConsumer dataConsumer)
            {
                var dataItem = (Genre)item;
                dataConsumer.DataContext = dataItem;
                if (dataItem.IsSelected)
                {
                    cell.BackgroundColor = UIColorUtils.GetAppThemeColor();
                    cell.UpdateLabelColor(UIColor.White);
                    cell.Selected            = true;
                    cell.Layer.BorderWidth   = 0f;
                    cell.Layer.ShadowColor   = UIColorUtils.GetAppThemeColor().CGColor;
                    cell.Layer.ShadowOffset  = new CGSize(1.0, 2.0);
                    cell.Layer.ShadowRadius  = 1.5f;
                    cell.Layer.ShadowOpacity = 1.0f;
                    cell.Layer.MasksToBounds = false;
                }
                else
                {
                    cell.BackgroundColor = UIColorUtils.GetBorderColor();
                    cell.UpdateLabelColor(UIColorUtils.GetAppTextLightColor());
                    cell.Layer.ShadowOffset  = new CGSize(0.0, 0.0);
                    cell.Layer.ShadowRadius  = 0.0f;
                    cell.Layer.ShadowOpacity = 0.0f;
                }
            }
            return(cell);
        }
예제 #2
0
 private void UpdateFavoriteStatus()
 {
     if (ViewModel.MovieDetails.IsFavorite)
     {
         favoriteImageView.Image     = UIImage.FromBundle("favorite-filled").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
         favoriteImageView.TintColor = UIColor.Red;
     }
     else
     {
         favoriteImageView.Image     = UIImage.FromBundle("favorite-gray").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
         favoriteImageView.TintColor = UIColorUtils.GetAppTextLightColor();
     }
 }
        protected override UICollectionViewCell GetOrCreateCellFor(UICollectionView collectionView, NSIndexPath indexPath, object item)
        {
            var cell = (GenreCollectionCell)base.GetOrCreateCellFor(collectionView, indexPath, item);

            if (cell is IMvxDataConsumer dataConsumer)
            {
                var dataItem = (string)item;
                dataConsumer.DataContext = dataItem;
                cell.BackgroundColor     = UIColorUtils.GetBorderColor();
                cell.UpdateLabelColor(UIColorUtils.GetAppTextLightColor());
            }
            return(cell);
        }
예제 #4
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);
        }