mirror of
https://github.com/bitwarden/android.git
synced 2024-12-21 08:42:39 +03:00
entry optimizations on all entry pages
This commit is contained in:
parent
dd9463fca2
commit
6f286ded4f
7 changed files with 37 additions and 41 deletions
|
@ -5,6 +5,11 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
public class ExtendedEditor : Editor
|
public class ExtendedEditor : Editor
|
||||||
{
|
{
|
||||||
|
public ExtendedEditor()
|
||||||
|
{
|
||||||
|
TextColor = Color.FromHex("333333");
|
||||||
|
}
|
||||||
|
|
||||||
public static readonly BindableProperty HasBorderProperty =
|
public static readonly BindableProperty HasBorderProperty =
|
||||||
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEditor), true);
|
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEditor), true);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,11 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
public class ExtendedEntry : Entry
|
public class ExtendedEntry : Entry
|
||||||
{
|
{
|
||||||
|
public ExtendedEntry()
|
||||||
|
{
|
||||||
|
TextColor = Color.FromHex("333333");
|
||||||
|
}
|
||||||
|
|
||||||
public static readonly BindableProperty HasBorderProperty =
|
public static readonly BindableProperty HasBorderProperty =
|
||||||
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEntry), true);
|
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEntry), true);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
public class ExtendedPicker : Picker
|
public class ExtendedPicker : Picker
|
||||||
{
|
{
|
||||||
|
// TODO: text color
|
||||||
|
|
||||||
public static readonly BindableProperty HasBorderProperty =
|
public static readonly BindableProperty HasBorderProperty =
|
||||||
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEntry), true);
|
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEntry), true);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
var nameCell = new FormEntryCell(AppResources.Name);
|
var nameCell = new FormEntryCell(AppResources.Name);
|
||||||
|
|
||||||
var mainTable = new ExtendedTableView
|
var table = new ExtendedTableView
|
||||||
{
|
{
|
||||||
Intent = TableIntent.Settings,
|
Intent = TableIntent.Settings,
|
||||||
EnableScrolling = false,
|
EnableScrolling = false,
|
||||||
|
@ -46,8 +46,8 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
if(Device.OS == TargetPlatform.iOS)
|
if(Device.OS == TargetPlatform.iOS)
|
||||||
{
|
{
|
||||||
mainTable.RowHeight = -1;
|
table.RowHeight = -1;
|
||||||
mainTable.EstimatedRowHeight = 70;
|
table.EstimatedRowHeight = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
||||||
|
@ -79,7 +79,7 @@ namespace Bit.App.Pages
|
||||||
}, ToolbarItemOrder.Default, 0);
|
}, ToolbarItemOrder.Default, 0);
|
||||||
|
|
||||||
Title = "Add Folder";
|
Title = "Add Folder";
|
||||||
Content = mainTable;
|
Content = table;
|
||||||
ToolbarItems.Add(saveToolBarItem);
|
ToolbarItems.Add(saveToolBarItem);
|
||||||
if(Device.OS == TargetPlatform.iOS)
|
if(Device.OS == TargetPlatform.iOS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,10 +47,10 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
var folderCell = new FormPickerCell(AppResources.Folder, folderOptions.ToArray());
|
var folderCell = new FormPickerCell(AppResources.Folder, folderOptions.ToArray());
|
||||||
|
|
||||||
var mainTable = new ExtendedTableView
|
var table = new ExtendedTableView
|
||||||
{
|
{
|
||||||
Intent = TableIntent.Settings,
|
Intent = TableIntent.Settings,
|
||||||
EnableScrolling = false,
|
EnableScrolling = true,
|
||||||
HasUnevenRows = true,
|
HasUnevenRows = true,
|
||||||
EnableSelection = false,
|
EnableSelection = false,
|
||||||
Root = new TableRoot
|
Root = new TableRoot
|
||||||
|
@ -72,16 +72,10 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
if(Device.OS == TargetPlatform.iOS)
|
if(Device.OS == TargetPlatform.iOS)
|
||||||
{
|
{
|
||||||
mainTable.RowHeight = -1;
|
table.RowHeight = -1;
|
||||||
mainTable.EstimatedRowHeight = 70;
|
table.EstimatedRowHeight = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scrollView = new ScrollView
|
|
||||||
{
|
|
||||||
Content = mainTable,
|
|
||||||
Orientation = ScrollOrientation.Vertical
|
|
||||||
};
|
|
||||||
|
|
||||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
||||||
{
|
{
|
||||||
if(!_connectivity.IsConnected)
|
if(!_connectivity.IsConnected)
|
||||||
|
@ -126,7 +120,7 @@ namespace Bit.App.Pages
|
||||||
}, ToolbarItemOrder.Default, 0);
|
}, ToolbarItemOrder.Default, 0);
|
||||||
|
|
||||||
Title = AppResources.AddSite;
|
Title = AppResources.AddSite;
|
||||||
Content = scrollView;
|
Content = table;
|
||||||
ToolbarItems.Add(saveToolBarItem);
|
ToolbarItems.Add(saveToolBarItem);
|
||||||
if(Device.OS == TargetPlatform.iOS)
|
if(Device.OS == TargetPlatform.iOS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,14 +39,18 @@ namespace Bit.App.Pages
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uriCell = new FormEntryCell(AppResources.URI, Keyboard.Url);
|
var notesCell = new FormEditorCell(height: 90);
|
||||||
uriCell.Entry.Text = site.Uri?.Decrypt();
|
notesCell.Editor.Text = site.Notes?.Decrypt();
|
||||||
var nameCell = new FormEntryCell(AppResources.Name);
|
var passwordCell = new FormEntryCell(AppResources.Password, IsPassword: true, nextElement: notesCell.Editor);
|
||||||
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);
|
|
||||||
passwordCell.Entry.Text = site.Password?.Decrypt();
|
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 folderOptions = new List<string> { AppResources.FolderNone };
|
||||||
var folders = _folderService.GetAllAsync().GetAwaiter().GetResult().OrderBy(f => f.Name?.Decrypt());
|
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());
|
var folderCell = new FormPickerCell(AppResources.Folder, folderOptions.ToArray());
|
||||||
folderCell.Picker.SelectedIndex = selectedIndex;
|
folderCell.Picker.SelectedIndex = selectedIndex;
|
||||||
|
|
||||||
var notesCell = new FormEditorCell(height: 90);
|
|
||||||
notesCell.Editor.Text = site.Notes?.Decrypt();
|
|
||||||
|
|
||||||
var table = new ExtendedTableView
|
var table = new ExtendedTableView
|
||||||
{
|
{
|
||||||
Intent = TableIntent.Settings,
|
Intent = TableIntent.Settings,
|
||||||
EnableScrolling = false,
|
EnableScrolling = true,
|
||||||
HasUnevenRows = true,
|
HasUnevenRows = true,
|
||||||
EnableSelection = false,
|
EnableSelection = false,
|
||||||
Root = new TableRoot
|
Root = new TableRoot
|
||||||
|
@ -97,12 +98,6 @@ namespace Bit.App.Pages
|
||||||
table.EstimatedRowHeight = 70;
|
table.EstimatedRowHeight = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scrollView = new ScrollView
|
|
||||||
{
|
|
||||||
Content = table,
|
|
||||||
Orientation = ScrollOrientation.Vertical
|
|
||||||
};
|
|
||||||
|
|
||||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
||||||
{
|
{
|
||||||
if(!_connectivity.IsConnected)
|
if(!_connectivity.IsConnected)
|
||||||
|
@ -148,7 +143,7 @@ namespace Bit.App.Pages
|
||||||
}, ToolbarItemOrder.Default, 0);
|
}, ToolbarItemOrder.Default, 0);
|
||||||
|
|
||||||
Title = "Edit Site";
|
Title = "Edit Site";
|
||||||
Content = scrollView;
|
Content = table;
|
||||||
ToolbarItems.Add(saveToolBarItem);
|
ToolbarItems.Add(saveToolBarItem);
|
||||||
if(Device.OS == TargetPlatform.iOS)
|
if(Device.OS == TargetPlatform.iOS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,11 +64,12 @@ namespace Bit.App.Pages
|
||||||
var notesCell = new LabeledValueCell();
|
var notesCell = new LabeledValueCell();
|
||||||
notesCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Notes);
|
notesCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Notes);
|
||||||
notesCell.View.SetBinding<VaultViewSitePageModel>(IsVisibleProperty, s => s.ShowNotes);
|
notesCell.View.SetBinding<VaultViewSitePageModel>(IsVisibleProperty, s => s.ShowNotes);
|
||||||
|
notesCell.Value.LineBreakMode = LineBreakMode.WordWrap;
|
||||||
|
|
||||||
Table = new ExtendedTableView
|
Table = new ExtendedTableView
|
||||||
{
|
{
|
||||||
Intent = TableIntent.Settings,
|
Intent = TableIntent.Settings,
|
||||||
EnableScrolling = false,
|
EnableScrolling = true,
|
||||||
HasUnevenRows = true,
|
HasUnevenRows = true,
|
||||||
EnableSelection = false,
|
EnableSelection = false,
|
||||||
Root = new TableRoot
|
Root = new TableRoot
|
||||||
|
@ -93,14 +94,8 @@ namespace Bit.App.Pages
|
||||||
Table.EstimatedRowHeight = 70;
|
Table.EstimatedRowHeight = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scrollView = new ScrollView
|
|
||||||
{
|
|
||||||
Content = Table,
|
|
||||||
Orientation = ScrollOrientation.Vertical
|
|
||||||
};
|
|
||||||
|
|
||||||
Title = "View Site";
|
Title = "View Site";
|
||||||
Content = scrollView;
|
Content = Table;
|
||||||
BindingContext = Model;
|
BindingContext = Model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue