public void LoadSeries(Series series, Piece piece) { if(piece != null) { if(AppGlobal.CollectionsViewInListMode) { AppGlobal.CollectionsViewInListMode = false; } } ResolveSeriesViewController(series); if(_vc.NavigationItem.TitleView != null) { _vc.NavigationItem.TitleView.Dispose(); _vc.NavigationItem.TitleView = null; } var label = new UILabel(); label.Font = UIFont.BoldSystemFontOfSize(14.0f); label.BackgroundColor = UIColor.Clear; label.TextColor = UIColor.White; label.Text = series.Title; label.SizeToFit(); _vc.NavigationItem.TitleView = label; this.NavigationController.PushViewController(_vc, true); if(piece != null) { _vc.GoToPiece(series, piece); } }
public PieceViewController(Piece piece, RectangleF frame, SeriesViewController parent, GalleryImageView galleryImageView) { _piece = piece; _frame = frame; _parent = parent; _galleryImageView = galleryImageView; }
public static GalleryImageView BuildGalleryPage(Piece piece, int index, int total, out RectangleF canvasFrame) { float width; float height; float gutter; GetGalleryArea(out width, out height, out gutter); // Background width is 1280 var backgroundImage = BuildGalleryBackground(Util.IsLandscape()); UIImage background = GetSeamlessBackgroundSlice(index, backgroundImage); var imageView = new GalleryImageView(background); // UIImageView background.Dispose(); backgroundImage.Dispose(); // Add canvas UIImage canvas = ImageCache.Get(GetImageKey(piece, width * 2, height * 2), ()=> GenerateGalleryPiece(piece, width * 2, height * 2)); var canvasView = new UIImageView(canvas); canvasView.Center = new PointF(width / 2, (height / 2) - gutter); canvasView.Layer.MasksToBounds = false; var canvasViewFrame = canvasView.Frame; canvasFrame = canvasViewFrame; // Add reflection float reflectionY = GetReflectionY(); var reflection = GetOrGenerateReflection(piece, canvasViewFrame, canvas, reflectionY); canvas.Dispose(); var reflectionFrame = new RectangleF(canvasViewFrame.X, reflectionY, reflection.Size.Width, reflection.Size.Height); var reflectionView = new UIImageView(reflection); reflectionView.Frame = reflectionFrame; reflectionView.Layer.Opacity = 0.30f; reflection.Dispose(); // Add shadow var shadowY = canvasViewFrame.Y + canvasViewFrame.Height - 10; var shadowView = new UIImageView(_shadowMask); shadowView.Frame = new RectangleF(canvasViewFrame.X, shadowY, canvasViewFrame.Width, _shadowMask.Size.Height); var shadowLeftView = new UIImageView(_shadowLeft); shadowLeftView.Frame = new RectangleF(canvasViewFrame.X - 3, canvasViewFrame.Y, 3, canvasViewFrame.Height); var shadowRightView = new UIImageView(_shadowRight); shadowRightView.Frame = new RectangleF(canvasViewFrame.X + canvasViewFrame.Width, canvasViewFrame.Y, 3, canvasViewFrame.Height); var shadowTopView = new UIImageView(_shadowTop); shadowTopView.Frame = new RectangleF(canvasViewFrame.X, canvasViewFrame.Y, canvasViewFrame.Width, _shadowTop.Size.Height); // Add image layers together imageView.AddSubview(shadowView); imageView.AddSubview(shadowLeftView); imageView.AddSubview(shadowRightView); imageView.AddSubview(canvasView); imageView.AddSubview(shadowTopView); imageView.AddSubview(reflectionView); var lighting = BuildLighting(); var lightingView = new LightImageView(lighting); lighting.Dispose(); imageView.AddSubview(lightingView); imageView.Lights = lightingView; return imageView; }
public void GoToPiece(Series series, Piece piece) { int page = 0; for(var i = 0; i < series.Pieces.Count; i++) { if(series.Pieces[i] == piece) { page = i; } } _listView.GoToPage(page, false /* flip */); }
public PieceDetailViewController(Piece piece, SeriesViewController parent) { _piece = piece; _parent = parent; // Required to push the full view on to the parent stack }
public static UIImage GenerateGalleryPiece(Piece piece, float width, float height) { if(Util.IsPad()) { if(Util.IsLandscape()) { // iPad Landscape width = 720; height = 515; } else { // iPad Portrait width = 440; height = 605; } } else { if(Util.IsLandscape()) { // iPhone Landscape width = 300; height = 190; } else { // iPhone Portrait width = 200; height = 275; } } var image = UIImageEx.FromFile(piece.Source); var final = ImageHelper.ImageToFitSize(image, new SizeF(width, height)); image.Dispose(); return final; }
public static UIImage GeneratePieceThumbnail(Piece piece, float w, float h) { return GeneratePieceThumbnail(piece.Source, w, h, true, true); }
private static UIImage GetOrGenerateReflection(Piece piece, RectangleF canvasFrame, UIImage canvas, float reflectionY) { // Doesn't work when saved to disk return GenerateReflection(canvasFrame, canvas, reflectionY); }
public static UIImage LoadRoundedThumbnail(Piece piece) { var s = DimensionSet.ListThumbnailSquare; return ImageCache.Get(GetImageKey(piece, s, s), () => GeneratePieceThumbnail(piece, s, s)); }
public static UIImage LoadMapThumbnail(Piece piece) { return ImageCache.Get(GetImageKey(piece, 27, 28), () => GeneratePieceThumbnail(piece, 27, 28)); }
public static string GetImageKey(Piece piece, float width, float height) { return string.Concat(piece.Title.ToLower(), "_", piece.Year, "_", width, "x", height, DimensionSet.IsRetinaDisplay ? "@2x" : "", Util.IsPad() ? "_ipad" : "_iphone"); }
public PieceFullViewController(Piece piece, SeriesViewController parent) { _piece = piece; _parent = parent; _orientation = UIApplication.SharedApplication.StatusBarOrientation; }