1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-10 09:49:52 +01:00

entry optimizations on all entry pages

This commit is contained in:
Kyle Spearrin 2016-05-23 23:48:34 -04:00
parent dd9463fca2
commit 6f286ded4f
7 changed files with 37 additions and 41 deletions

View File

@ -5,6 +5,11 @@ namespace Bit.App.Controls
{
public class ExtendedEditor : Editor
{
public ExtendedEditor()
{
TextColor = Color.FromHex("333333");
}
public static readonly BindableProperty HasBorderProperty =
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEditor), true);

View File

@ -6,6 +6,11 @@ namespace Bit.App.Controls
{
public class ExtendedEntry : Entry
{
public ExtendedEntry()
{
TextColor = Color.FromHex("333333");
}
public static readonly BindableProperty HasBorderProperty =
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEntry), true);

View File

@ -5,6 +5,8 @@ namespace Bit.App.Controls
{
public class ExtendedPicker : Picker
{
// TODO: text color
public static readonly BindableProperty HasBorderProperty =
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEntry), true);

View File

@ -29,7 +29,7 @@ namespace Bit.App.Pages
{
var nameCell = new FormEntryCell(AppResources.Name);
var mainTable = new ExtendedTableView
var table = new ExtendedTableView
{
Intent = TableIntent.Settings,
EnableScrolling = false,
@ -46,8 +46,8 @@ namespace Bit.App.Pages
if(Device.OS == TargetPlatform.iOS)
{
mainTable.RowHeight = -1;
mainTable.EstimatedRowHeight = 70;
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
}
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
@ -79,7 +79,7 @@ namespace Bit.App.Pages
}, ToolbarItemOrder.Default, 0);
Title = "Add Folder";
Content = mainTable;
Content = table;
ToolbarItems.Add(saveToolBarItem);
if(Device.OS == TargetPlatform.iOS)
{

View File

@ -47,10 +47,10 @@ namespace Bit.App.Pages
}
var folderCell = new FormPickerCell(AppResources.Folder, folderOptions.ToArray());
var mainTable = new ExtendedTableView
var table = new ExtendedTableView
{
Intent = TableIntent.Settings,
EnableScrolling = false,
EnableScrolling = true,
HasUnevenRows = true,
EnableSelection = false,
Root = new TableRoot
@ -72,16 +72,10 @@ namespace Bit.App.Pages
if(Device.OS == TargetPlatform.iOS)
{
mainTable.RowHeight = -1;
mainTable.EstimatedRowHeight = 70;
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
}
var scrollView = new ScrollView
{
Content = mainTable,
Orientation = ScrollOrientation.Vertical
};
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
{
if(!_connectivity.IsConnected)
@ -126,7 +120,7 @@ namespace Bit.App.Pages
}, ToolbarItemOrder.Default, 0);
Title = AppResources.AddSite;
Content = scrollView;
Content = table;
ToolbarItems.Add(saveToolBarItem);
if(Device.OS == TargetPlatform.iOS)
{

View File

@ -39,14 +39,18 @@ namespace Bit.App.Pages
return;
}
var uriCell = new FormEntryCell(AppResources.URI, Keyboard.Url);
uriCell.Entry.Text = site.Uri?.Decrypt();
var nameCell = new FormEntryCell(AppResources.Name);
nameCell.Entry.Text = site.Name?.Decrypt();
var usernameCell = new FormEntryCell(AppResources.Username);
usernameCell.Entry.Text = site.Username?.Decrypt();
var passwordCell = new FormEntryCell(AppResources.Password, IsPassword: true);
var notesCell = new FormEditorCell(height: 90);
notesCell.Editor.Text = site.Notes?.Decrypt();
var passwordCell = new FormEntryCell(AppResources.Password, IsPassword: true, nextElement: notesCell.Editor);
passwordCell.Entry.Text = site.Password?.Decrypt();
var usernameCell = new FormEntryCell(AppResources.Username, nextElement: passwordCell.Entry);
usernameCell.Entry.Text = site.Username?.Decrypt();
usernameCell.Entry.DisableAutocapitalize = true;
usernameCell.Entry.Autocorrect = false;
var uriCell = new FormEntryCell(AppResources.URI, Keyboard.Url, nextElement: usernameCell.Entry);
uriCell.Entry.Text = site.Uri?.Decrypt();
var nameCell = new FormEntryCell(AppResources.Name, nextElement: uriCell.Entry);
nameCell.Entry.Text = site.Name?.Decrypt();
var folderOptions = new List<string> { AppResources.FolderNone };
var folders = _folderService.GetAllAsync().GetAwaiter().GetResult().OrderBy(f => f.Name?.Decrypt());
@ -65,13 +69,10 @@ namespace Bit.App.Pages
var folderCell = new FormPickerCell(AppResources.Folder, folderOptions.ToArray());
folderCell.Picker.SelectedIndex = selectedIndex;
var notesCell = new FormEditorCell(height: 90);
notesCell.Editor.Text = site.Notes?.Decrypt();
var table = new ExtendedTableView
{
Intent = TableIntent.Settings,
EnableScrolling = false,
EnableScrolling = true,
HasUnevenRows = true,
EnableSelection = false,
Root = new TableRoot
@ -97,12 +98,6 @@ namespace Bit.App.Pages
table.EstimatedRowHeight = 70;
}
var scrollView = new ScrollView
{
Content = table,
Orientation = ScrollOrientation.Vertical
};
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
{
if(!_connectivity.IsConnected)
@ -148,7 +143,7 @@ namespace Bit.App.Pages
}, ToolbarItemOrder.Default, 0);
Title = "Edit Site";
Content = scrollView;
Content = table;
ToolbarItems.Add(saveToolBarItem);
if(Device.OS == TargetPlatform.iOS)
{

View File

@ -64,11 +64,12 @@ namespace Bit.App.Pages
var notesCell = new LabeledValueCell();
notesCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Notes);
notesCell.View.SetBinding<VaultViewSitePageModel>(IsVisibleProperty, s => s.ShowNotes);
notesCell.Value.LineBreakMode = LineBreakMode.WordWrap;
Table = new ExtendedTableView
{
Intent = TableIntent.Settings,
EnableScrolling = false,
EnableScrolling = true,
HasUnevenRows = true,
EnableSelection = false,
Root = new TableRoot
@ -93,14 +94,8 @@ namespace Bit.App.Pages
Table.EstimatedRowHeight = 70;
}
var scrollView = new ScrollView
{
Content = Table,
Orientation = ScrollOrientation.Vertical
};
Title = "View Site";
Content = scrollView;
Content = Table;
BindingContext = Model;
}