1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-27 13:43:32 +00:00

floating action button on android

This commit is contained in:
Kyle Spearrin
2017-12-30 14:05:51 -05:00
parent 2235f1f7af
commit fbe1a6d4c5
15 changed files with 2682 additions and 328 deletions

24
src/App/Controls/Fab.cs Normal file
View File

@@ -0,0 +1,24 @@
using Refractored.FabControl;
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class Fab : FloatingActionButtonView
{
public Fab(FabLayout fabLayout, string icon, Action<object, EventArgs> clickedAction)
{
ImageName = icon;
ColorNormal = Color.FromHex("3c8dbc");
ColorPressed = Color.FromHex("3883af");
ColorRipple = Color.FromHex("3883af");
Clicked = clickedAction;
AbsoluteLayout.SetLayoutFlags(this, AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(this, new Rectangle(1, 1, AbsoluteLayout.AutoSize,
AbsoluteLayout.AutoSize));
fabLayout.Children.Add(this);
}
}
}

View File

@@ -0,0 +1,16 @@
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class FabLayout : AbsoluteLayout
{
public FabLayout(View mainView)
{
VerticalOptions = LayoutOptions.FillAndExpand;
HorizontalOptions = LayoutOptions.FillAndExpand;
SetLayoutFlags(mainView, AbsoluteLayoutFlags.All);
SetLayoutBounds(mainView, new Rectangle(0, 0, 1, 1));
Children.Add(mainView);
}
}
}