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:
24
src/App/Controls/Fab.cs
Normal file
24
src/App/Controls/Fab.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/App/Controls/FabLayout.cs
Normal file
16
src/App/Controls/FabLayout.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user