示例#1
0
 public static void UpdateStrokeThickness(this ShapeableImageView platformButton, IButtonStroke buttonStroke)
 {
     if (buttonStroke.StrokeThickness >= 0)
     {
         platformButton.StrokeWidth = (int)platformButton.Context.ToPixels(buttonStroke.StrokeThickness);
     }
 }
示例#2
0
 public static void UpdateStrokeColor(this ShapeableImageView platformButton, IButtonStroke buttonStroke)
 {
     if (buttonStroke.StrokeColor is Color stroke)
     {
         platformButton.StrokeColor = ColorStateListExtensions.CreateButton(stroke.ToPlatform());
     }
 }
示例#3
0
        internal static void SetContentPadding(this ShapeableImageView platformButton, IImageButton imageButton)
        {
            var padding = imageButton.Padding;

            platformButton.SetContentPadding(
                (int)platformButton.Context.ToPixels(padding.Left),
                (int)platformButton.Context.ToPixels(padding.Top),
                (int)platformButton.Context.ToPixels(padding.Right),
                (int)platformButton.Context.ToPixels(padding.Bottom)
                );
        }
示例#4
0
        public static void UpdatePadding(this ShapeableImageView platformButton, IImageButton imageButton)
        {
            platformButton.SetContentPadding(imageButton);

            // NOTE(jpr): post on handler to get around an Android Framework bug.
            // see: https://github.com/material-components/material-components-android/issues/2063
            platformButton.Post(() =>
            {
                platformButton.SetContentPadding(imageButton);
            });
        }
 public static void UpdateCornerRadius(this ShapeableImageView platformButton, IButtonStroke buttonStroke)
 {
     platformButton.ShapeAppearanceModel =
         platformButton.ShapeAppearanceModel
         .ToBuilder()
         .SetTopLeftCorner(CornerFamily.Rounded, buttonStroke.CornerRadius)
         .SetTopRightCorner(CornerFamily.Rounded, buttonStroke.CornerRadius)
         .SetBottomLeftCorner(CornerFamily.Rounded, buttonStroke.CornerRadius)
         .SetBottomRightCorner(CornerFamily.Rounded, buttonStroke.CornerRadius)
         .Build();
 }
示例#6
0
        public AwarenessAdapterViewHolder(View itemView, Action <AwarenessAdapterClickEventArgs> clickListener,
                                          Action <AwarenessAdapterClickEventArgs> longClickListener, Action <AwarenessAdapterClickEventArgs> deleteClickListener) : base(itemView)
        {
            //TextView = v;
            Dates              = itemView.FindViewById <MaterialTextView>(Resource.Id.txtDates);
            AwarenessMsg       = itemView.FindViewById <MaterialTextView>(Resource.Id.txtAwareessmessage);
            Sender             = itemView.FindViewById <MaterialTextView>(Resource.Id.txtAwarenessSender);
            BtnDeleteAwareness = itemView.FindViewById <MaterialButton>(Resource.Id.BtnDeleteAwareness);
            ImgAwareness       = itemView.FindViewById <ShapeableImageView>(Resource.Id.awareness_img);


            itemView.Click += (sender, e) => clickListener(new AwarenessAdapterClickEventArgs {
                View = itemView, Position = AbsoluteAdapterPosition
            });
            itemView.LongClick += (sender, e) => longClickListener(new AwarenessAdapterClickEventArgs {
                View = itemView, Position = AbsoluteAdapterPosition
            });
            BtnDeleteAwareness.Click += (sender, e) => deleteClickListener(new AwarenessAdapterClickEventArgs {
                View = itemView, Position = AbsoluteAdapterPosition
            });
        }
示例#7
0
        // TODO: NET7 should this be public?
        internal static void UpdateBackground(this ShapeableImageView platformButton, IImageButton imageButton)
        {
            Paint?paint = imageButton.Background;

            platformButton.Background = paint?.ToDrawable(platformButton.Context);
        }