mirror of
https://github.com/bitwarden/mobile
synced 2026-01-03 09:03:35 +00:00
Moved add/edit pages to use custom form cells. Moved navigation of vault to modals. Created custom renderer for left modal dismiss button on navigation pages. refresh for edit site UI.
This commit is contained in:
23
src/App/Controls/DismissModalToolBarItem.cs
Normal file
23
src/App/Controls/DismissModalToolBarItem.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class DismissModalToolBarItem : ToolbarItem
|
||||
{
|
||||
private readonly ContentPage _page;
|
||||
|
||||
public DismissModalToolBarItem(ContentPage page, string text = null)
|
||||
{
|
||||
_page = page;
|
||||
Text = text ?? "Close";
|
||||
Clicked += ClickedItem;
|
||||
Priority = -1;
|
||||
}
|
||||
|
||||
private async void ClickedItem(object sender, EventArgs e)
|
||||
{
|
||||
await _page.Navigation.PopModalAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/App/Controls/ExtendedNavigationPage.cs
Normal file
27
src/App/Controls/ExtendedNavigationPage.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class ExtendedNavigationPage : NavigationPage
|
||||
{
|
||||
public ExtendedNavigationPage()
|
||||
: base()
|
||||
{
|
||||
SetDefaults();
|
||||
}
|
||||
|
||||
public ExtendedNavigationPage(Page root)
|
||||
: base(root)
|
||||
{
|
||||
SetDefaults();
|
||||
}
|
||||
|
||||
private void SetDefaults()
|
||||
{
|
||||
// default colors for our app
|
||||
BarBackgroundColor = Color.FromHex("3c8dbc");
|
||||
BarTextColor = Color.FromHex("ffffff");
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/App/Controls/FormEditorCell.cs
Normal file
34
src/App/Controls/FormEditorCell.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class FormEditorCell : ViewCell
|
||||
{
|
||||
public FormEditorCell(Keyboard entryKeyboard = null, double? height = null)
|
||||
{
|
||||
Editor = new ExtendedEditor
|
||||
{
|
||||
Keyboard = entryKeyboard,
|
||||
HasBorder = false
|
||||
};
|
||||
|
||||
if(height.HasValue)
|
||||
{
|
||||
Editor.HeightRequest = height.Value;
|
||||
}
|
||||
|
||||
var stackLayout = new StackLayout
|
||||
{
|
||||
Padding = new Thickness(15, 15, 15, 0),
|
||||
BackgroundColor = Color.White
|
||||
};
|
||||
|
||||
stackLayout.Children.Add(Editor);
|
||||
|
||||
View = stackLayout;
|
||||
}
|
||||
|
||||
public ExtendedEditor Editor { get; private set; }
|
||||
}
|
||||
}
|
||||
38
src/App/Controls/FormEntryCell.cs
Normal file
38
src/App/Controls/FormEntryCell.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class FormEntryCell : ViewCell
|
||||
{
|
||||
public FormEntryCell(string labelText, Keyboard entryKeyboard = null, bool IsPassword = false)
|
||||
{
|
||||
Label = new Label
|
||||
{
|
||||
Text = labelText,
|
||||
FontSize = 14,
|
||||
TextColor = Color.FromHex("777777")
|
||||
};
|
||||
|
||||
Entry = new ExtendedEntry
|
||||
{
|
||||
Keyboard = entryKeyboard,
|
||||
HasBorder = false
|
||||
};
|
||||
|
||||
var stackLayout = new StackLayout
|
||||
{
|
||||
Padding = new Thickness(15, 15, 15, 0),
|
||||
BackgroundColor = Color.White
|
||||
};
|
||||
|
||||
stackLayout.Children.Add(Label);
|
||||
stackLayout.Children.Add(Entry);
|
||||
|
||||
View = stackLayout;
|
||||
}
|
||||
|
||||
public Label Label { get; private set; }
|
||||
public ExtendedEntry Entry { get; private set; }
|
||||
}
|
||||
}
|
||||
44
src/App/Controls/FormPickerCell.cs
Normal file
44
src/App/Controls/FormPickerCell.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Bit.App.Resources;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class FormPickerCell : ViewCell
|
||||
{
|
||||
public FormPickerCell(string labelText, string[] pickerItems)
|
||||
{
|
||||
Label = new Label
|
||||
{
|
||||
Text = labelText,
|
||||
FontSize = 14,
|
||||
TextColor = Color.FromHex("777777")
|
||||
};
|
||||
|
||||
Picker = new ExtendedPicker
|
||||
{
|
||||
HasBorder = false
|
||||
};
|
||||
|
||||
foreach(var item in pickerItems)
|
||||
{
|
||||
Picker.Items.Add(item);
|
||||
}
|
||||
Picker.SelectedIndex = 0;
|
||||
|
||||
var stackLayout = new StackLayout
|
||||
{
|
||||
Padding = new Thickness(15, 15, 15, 0),
|
||||
BackgroundColor = Color.White
|
||||
};
|
||||
|
||||
stackLayout.Children.Add(Label);
|
||||
stackLayout.Children.Add(Picker);
|
||||
|
||||
View = stackLayout;
|
||||
}
|
||||
|
||||
public Label Label { get; private set; }
|
||||
public ExtendedPicker Picker { get; private set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user