示例#1
0
        private void InitAttributes(Context context, IAttributeSet attributeSet)
        {
            var attr = context.ObtainStyledAttributes(attributeSet, Resource.Styleable.FloatingActionButton, 0, 0);

            if (attr == null)
            {
                return;
            }

            try
            {
                colorNormal   = attr.GetColor(Resource.Styleable.FloatingActionButton_fab_colorNormal, ContextCompat.GetColor(Application.Context, Resource.Color.fab_material_blue_500));
                colorPressed  = attr.GetColor(Resource.Styleable.FloatingActionButton_fab_colorPressed, DarkenColor(colorNormal));
                colorRipple   = attr.GetColor(Resource.Styleable.FloatingActionButton_fab_colorRipple, LightenColor(colorNormal));
                colorDisabled = attr.GetColor(Resource.Styleable.FloatingActionButton_fab_colorDisabled, ContextCompat.GetColor(Application.Context, Android.Resource.Color.DarkerGray));
                hasShadow     = attr.GetBoolean(Resource.Styleable.FloatingActionButton_fab_shadow, true);
                size          = (FabSize)attr.GetInt(Resource.Styleable.FloatingActionButton_fab_size, 0);
            }
            catch (Exception)
            {
            }
            finally
            {
                attr.Recycle();
            }
        }
示例#2
0
 private void SetFabSize(FabSize size)
 {
     if (size == FabSize.Mini)
     {
         fab.Size              = FabSize.Mini;
         Element.WidthRequest  = FAB_MINI_FRAME_WIDTH_WITH_PADDING;
         Element.HeightRequest = FAB_MINI_FRAME_HEIGHT_WITH_PADDING;
     }
     else
     {
         fab.Size              = FabSize.Normal;
         Element.WidthRequest  = FAB_FRAME_WIDTH_WITH_PADDING;
         Element.HeightRequest = FAB_FRAME_HEIGHT_WITH_PADDING;
     }
 }
        private void Init(Context context, IAttributeSet attributeSet)
        {
            Visible         = true;
            colorNormal     = Resources.GetColor(Resource.Color.fab_material_blue_500);
            colorPressed    = Resources.GetColor(Resource.Color.fab_material_blue_600);
            colorRipple     = Resources.GetColor(Android.Resource.Color.White);
            size            = FabSize.Normal;
            hasShadow       = true;
            scrollThreshold = Resources.GetDimensionPixelOffset(Resource.Dimension.fab_scroll_threshold);
            shadowSize      = Resources.GetDimensionPixelSize(Resource.Dimension.fab_shadow_size);
            if (attributeSet != null)
            {
                InitAttributes(context, attributeSet);
            }

            UpdateBackground();
        }
示例#4
0
        private void Init(Context context, IAttributeSet attributeSet)
        {
            Visible         = true;
            ColorDisabled   = ContextCompat.GetColor(Application.Context, Resource.Color.fab_material_blue_500);
            colorPressed    = DarkenColor(colorNormal);
            colorRipple     = LightenColor(colorNormal);
            ColorDisabled   = ContextCompat.GetColor(Application.Context, Android.Resource.Color.DarkerGray);
            size            = FabSize.Normal;
            hasShadow       = true;
            scrollThreshold = Resources.GetDimensionPixelOffset(Resource.Dimension.fab_scroll_threshold);
            shadowSize      = Resources.GetDimensionPixelSize(Resource.Dimension.fab_shadow_size);
            if (attributeSet != null)
            {
                InitAttributes(context, attributeSet);
            }

            UpdateBackground();
        }
        private void Init(Context context, IAttributeSet attributeSet)
        {
            Visible       = true;
            _colorNormal  = Color.ParseColor("#5677fc");
            colorPressed  = DarkenColor(_colorNormal);
            colorRipple   = LightenColor(_colorNormal);
            colorDisabled = Color.ParseColor("#A9A9A9");
            size          = FabSize.Normal;
            hasShadow     = true;

            //_scrollThreshold = Resources.GetDimensionPixelOffset(Resource.Dimension.fab_scroll_threshold);
            //_shadowSize = Resources.GetDimensionPixelSize(Resource.Dimension.fab_shadow_size);

            if (attributeSet != null)
            {
                InitAttributes(context, attributeSet);
            }

            UpdateBackground();
        }
示例#6
0
 public MyOutlineProvider(Android.Content.Res.Resources res, FabSize size)
 {
     this.res = res;
     fabSize  = size;
 }
 public MyOutlineProvider (Android.Content.Res.Resources res, FabSize size)
 {
   this.res = res;
   this.fabSize = size;
 }
    private void InitAttributes (Context context, IAttributeSet attributeSet)
    {
      var attr = context.ObtainStyledAttributes (attributeSet, Resource.Styleable.FloatingActionButton, 0, 0);
      if (attr == null)
        return;

      try {
       
        colorNormal = attr.GetColor (Resource.Styleable.FloatingActionButton_fab_colorNormal, Resources.GetColor (Resource.Color.fab_material_blue_500));
        colorPressed = attr.GetColor (Resource.Styleable.FloatingActionButton_fab_colorPressed, DarkenColor(colorNormal));
        colorRipple = attr.GetColor (Resource.Styleable.FloatingActionButton_fab_colorRipple, LightenColor(colorNormal));
        colorDisabled = attr.GetColor (Resource.Styleable.FloatingActionButton_fab_colorDisabled, Resources.GetColor (Android.Resource.Color.DarkerGray));
        hasShadow = attr.GetBoolean (Resource.Styleable.FloatingActionButton_fab_shadow, true);
        size = (FabSize)attr.GetInt (Resource.Styleable.FloatingActionButton_fab_size, 0);
      } catch (Exception ex) {
      } finally {
        attr.Recycle ();
      }
    }
    private void Init (Context context, IAttributeSet attributeSet)
    {
      Visible = true;
      colorNormal = Resources.GetColor (Resource.Color.fab_material_blue_500);
      colorPressed = DarkenColor(colorNormal);
      colorRipple = LightenColor (colorNormal);
      colorDisabled = Resources.GetColor (Android.Resource.Color.DarkerGray);
      size = FabSize.Normal;
      hasShadow = true;
      scrollThreshold = Resources.GetDimensionPixelOffset (Resource.Dimension.fab_scroll_threshold);
      shadowSize = Resources.GetDimensionPixelSize (Resource.Dimension.fab_shadow_size);
      if (attributeSet != null)
        InitAttributes (context, attributeSet);

      UpdateBackground ();
    }