コード例 #1
0
 private void CreateBorder(BorderView element)
 {
     NativeView.Layer.MasksToBounds = true;
     NativeView.Layer.CornerRadius  = element.CornerRadius;
     NativeView.Layer.BorderColor   = element.BorderColor.ToCGColor();
     NativeView.Layer.BorderWidth   = element.BorderWidth;
 }
コード例 #2
0
ファイル: DialogView.designer.cs プロジェクト: obaby/iSign-1
        void ReleaseDesignerOutlets()
        {
            if (BorderView != null)
            {
                BorderView.Dispose();
                BorderView = null;
            }

            if (CancelBtn != null)
            {
                CancelBtn.Dispose();
                CancelBtn = null;
            }

            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }

            if (InputTxt != null)
            {
                InputTxt.Dispose();
                InputTxt = null;
            }

            if (OkBtn != null)
            {
                OkBtn.Dispose();
                OkBtn = null;
            }
        }
コード例 #3
0
ファイル: Quote.cs プロジェクト: J3057/MobileApp
                public override void RemoveFromView(object obj)
                {
                    BorderView.RemoveAsSubview(obj);
                    QuoteLabel.RemoveAsSubview(obj);
                    Citation.RemoveAsSubview(obj);
                    UrlGlyph.RemoveAsSubview(obj);

                    TryRemoveDebugLayer(obj);
                }
コード例 #4
0
ファイル: Quote.cs プロジェクト: J3057/MobileApp
                public override void AddToView(object obj)
                {
                    BorderView.AddAsSubview(obj);
                    QuoteLabel.AddAsSubview(obj);
                    Citation.AddAsSubview(obj);
                    UrlGlyph.AddAsSubview(obj);

                    TryAddDebugLayer(obj);
                }
コード例 #5
0
ファイル: StackPanel.cs プロジェクト: J3057/MobileApp
                public override void RemoveFromView(object obj)
                {
                    BorderView.RemoveAsSubview(obj);

                    // let each child do the same thing
                    foreach (IUIControl control in ChildControls)
                    {
                        control.RemoveFromView(obj);
                    }

                    TryRemoveDebugLayer(obj);
                }
コード例 #6
0
ファイル: StackPanel.cs プロジェクト: J3057/MobileApp
                public override void AddToView(object obj)
                {
                    BorderView.AddAsSubview(obj);

                    // let each child do the same thing
                    foreach (IUIControl control in ChildControls)
                    {
                        control.AddToView(obj);
                    }

                    TryAddDebugLayer(obj);
                }
コード例 #7
0
        public static void UpdateBackground(BorderView touchView, global::Android.Views.View view)
        {
            var borderWidth = touchView.BorderWidth;
            var context     = view.Context;

            GradientDrawable strokeDrawable = null;

            if (0 < borderWidth)
            {
                strokeDrawable = new GradientDrawable();
                strokeDrawable.SetColor(touchView.BackgroundColor.ToAndroid());

                strokeDrawable.SetStroke((int)context.ToPixels(borderWidth), touchView.BorderColor.ToAndroid());
                strokeDrawable.SetCornerRadius(context.ToPixels(touchView.CornerRadius));
            }

            var backgroundDrawable = new GradientDrawable();

            backgroundDrawable.SetColor(touchView.BackgroundColor.ToAndroid());
            backgroundDrawable.SetCornerRadius(context.ToPixels(touchView.CornerRadius));

            if (null != strokeDrawable)
            {
                var ld = new LayerDrawable(new Drawable[]
                {
                    strokeDrawable,
                    backgroundDrawable
                });

                ld.SetLayerInset(
                    1,
                    (int)context.ToPixels(borderWidth),
                    (int)context.ToPixels(borderWidth),
                    (int)context.ToPixels(borderWidth),
                    (int)context.ToPixels(borderWidth)
                    );

                //view.SetBackgroundDrawable(ld);
                view.Background = ld;
            }
            else
            {
                //view.SetBackgroundDrawable(backgroundDrawable);
                view.Background = backgroundDrawable;
            }

            view.SetPadding(
                (int)context.ToPixels(borderWidth + touchView.Padding.Left),
                (int)context.ToPixels(borderWidth + touchView.Padding.Top),
                (int)context.ToPixels(borderWidth + touchView.Padding.Right),
                (int)context.ToPixels(borderWidth + touchView.Padding.Bottom)
                );
        }
コード例 #8
0
        public override void Draw(CGRect rect)
        {
            BorderView bv = (BorderView)this.Element;
            /* This is really just an elaborate cast to float. */
            var thickness = new CGRect(
                (float)bv.Thickness.Left,
                (float)bv.Thickness.Top,
                (float)(bv.Thickness.Right - bv.Thickness.Left),
                (float)(bv.Thickness.Bottom - bv.Thickness.Top)
                );

            using (var context = UIGraphics.GetCurrentContext())
            {
                context.SetFillColor(bv.BorderColor.ToCGColor());
                context.AddRects(new CGRect[] {
                    new CGRect(0, 0, thickness.Left, Bounds.Height),
                    new CGRect(Bounds.Width - thickness.Right, 0, thickness.Right, Bounds.Height),
                    new CGRect(0, 0, Bounds.Width, thickness.Top),
                    new CGRect(0, Bounds.Height - thickness.Bottom, Bounds.Width, thickness.Bottom)
                });
                context.DrawPath(CGPathDrawingMode.Fill);
            }
        }
コード例 #9
0
        void UpdateBookmarks()
        {
            try {
                int height = 150;
                Bookmarks.HeightRequest = height;
                List <string> keys = App.GetKeys <string>(App.BOOKMARK_DATA);
                List <string> data = new List <string>();
                bookmarkPosters = new List <BookmarkPoster>();
                Bookmarks.Children.Clear();
                int  index   = 0;
                bool allDone = false;
                for (int i = 0; i < keys.Count; i++)
                {
                    string __key = App.ConvertToObject <string>(keys[i], "");
                    if (__key == "")
                    {
                        continue;
                    }
                    string name      = FindHTML(__key, "Name=", "|||");
                    string posterUrl = FindHTML(__key, "PosterUrl=", "|||");
                    posterUrl = ConvertIMDbImagesToHD(posterUrl, 182, 268);

                    string id = FindHTML(__key, "Id=", "|||");
                    if (name != "" && posterUrl != "" && id != "")
                    {
                        if (CheckIfURLIsValid(posterUrl))
                        {
                            string posterURL = ConvertIMDbImagesToHD(posterUrl, 76, 113, 1.75); //.Replace(",76,113_AL", "," + pwidth + "," + pheight + "_AL").Replace("UY113", "UY" + pheight).Replace("UX76", "UX" + pwidth);
                            if (CheckIfURLIsValid(posterURL))
                            {
                                Grid stackLayout = new Grid()
                                {
                                    VerticalOptions = LayoutOptions.Start
                                };
                                Button imageButton = new Button()
                                {
                                    HeightRequest = RecPosterHeight, WidthRequest = RecPosterWith, BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.Start
                                };
                                var ff = new FFImageLoading.Forms.CachedImage {
                                    Source          = posterURL,
                                    HeightRequest   = RecPosterHeight,
                                    WidthRequest    = RecPosterWith,
                                    BackgroundColor = Color.Transparent,
                                    VerticalOptions = LayoutOptions.Start,
                                    Transformations =
                                    {
                                        //  new FFImageLoading.Transformations.RoundedTransformation(10,1,1.5,10,"#303F9F")
                                        new FFImageLoading.Transformations.RoundedTransformation(10, 1, 1.5, 0, "#303F9F")
                                    },
                                    InputTransparent = true,
                                };

                                // ================================================================ RECOMMENDATIONS CLICKED ================================================================
                                // stackLayout.SetValue(XamEffects.BorderView.CornerRadiusProperty, 20);

                                var brView = new BorderView()
                                {
                                    VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, CornerRadius = 5
                                };

                                brView.SetValue(XamEffects.TouchEffect.ColorProperty, Color.White);
                                Commands.SetTap(brView, new Command((o) => {
                                    var z = (BookmarkPoster)o;
                                    PushPageFromUrlAndName(z.id, z.name);
                                }));
                                var _b = new BookmarkPoster()
                                {
                                    id = id, name = name, posterUrl = posterUrl
                                };
                                Commands.SetTapParameter(brView, _b);


                                bookmarkPosters.Add(_b);

                                // var _color = Settings.BlackColor + 5;

                                BoxView boxView = new BoxView()
                                {
                                    BackgroundColor  = Settings.ItemBackGroundColor,// Color.FromRgb(_color, _color, _color),
                                    InputTransparent = true,
                                    CornerRadius     = 10,
                                    HeightRequest    = RecPosterHeight + bookmarkLabelTransY,
                                    TranslationY     = 0,
                                    WidthRequest     = RecPosterWith,
                                };
                                stackLayout.Children.Add(boxView);
                                stackLayout.Children.Add(ff);
                                stackLayout.Children.Add(imageButton);
                                stackLayout.Children.Add(new Label()
                                {
                                    Text = name, VerticalOptions = LayoutOptions.Start, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, Padding = 1, TextColor = Color.White, MaxLines = 2, ClassId = "OUTLINE", TranslationY = RecPosterHeight
                                });
                                stackLayout.Children.Add(brView);
                                stackLayout.Opacity = 0;

                                async void WaitUntillComplete()
                                {
                                    stackLayout.Opacity = 0;
                                    while (!allDone)
                                    {
                                        await Task.Delay(50);
                                    }
                                    await stackLayout.FadeTo(1, (uint)(200 + index * 50), Easing.Linear);
                                }

                                WaitUntillComplete();

                                index++;
                                Bookmarks.Children.Add(stackLayout);

                                /*
                                 * Grid stackLayout = new Grid();
                                 *
                                 *
                                 * var ff = new FFImageLoading.Forms.CachedImage {
                                 *  Source = posterUrl,
                                 *  HeightRequest = height,
                                 *  WidthRequest = 87,
                                 *  BackgroundColor = Color.Transparent,
                                 *  VerticalOptions = LayoutOptions.Start,
                                 *  Transformations = {
                                 *  new FFImageLoading.Transformations.RoundedTransformation(1,1,1.5,0,"#303F9F")
                                 * },
                                 *  InputTransparent = true,
                                 * };
                                 *
                                 * //Source = p.posterUrl
                                 *
                                 * stackLayout.Children.Add(ff);
                                 * // stackLayout.Children.Add(imageButton);
                                 * bookmarkPosters.Add(new BookmarkPoster() { id = id, name = name, posterUrl = posterUrl });
                                 * Grid.SetColumn(stackLayout, Bookmarks.Children.Count);
                                 * Bookmarks.Children.Add(stackLayout);
                                 *
                                 * // --- RECOMMENDATIONS CLICKED -----
                                 * stackLayout.SetValue(XamEffects.TouchEffect.ColorProperty, Color.White);
                                 * Commands.SetTap(stackLayout, new Command((o) => {
                                 *  int z = (int)o;
                                 *  PushPageFromUrlAndName(bookmarkPosters[z].id, bookmarkPosters[z].name);
                                 * }));
                                 * Commands.SetTapParameter(stackLayout, i);*/
                            }
                        }
                        // data.Add(App.GetKey("BookmarkData"))
                    }
                    //await Task.Delay(100);

                    //MScroll.HeightRequest = keys.Count > 0 ? 130 : 0;
                }
                allDone      = true;
                hasBookmarks = bookmarkPosters.Count > 0;

                UpdateNoBookmarks();

                /*if (ImdbTypePicker.SelectedIndex == -1) {
                 *  ImdbTypePicker.SelectedIndex = bookmarkPosters.Count > 0 ? 0 : 2; // SET TO POPULAR BY DEAFULT
                 * }*/
                SetRecs();
            }
            catch (Exception _ex) {
                error(_ex);
            }
            ChangeSizeOfTabs();
        }