From e9999adcf2fc6688f1d06676e9b484e4b5583acf Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 16 May 2016 23:54:24 -0400 Subject: [PATCH] vault page layout positioning --- src/App/Controls/FormEditorCell.cs | 2 +- src/App/Controls/FormEntryCell.cs | 9 +++-- src/App/Controls/FormPickerCell.cs | 9 +++-- src/App/Controls/LabeledValueCell.cs | 39 ++++++++++++------- src/App/Models/Page/VaultViewSitePageModel.cs | 2 - src/App/Pages/SyncPage.cs | 8 ---- src/App/Pages/VaultAddSitePage.cs | 6 +-- src/App/Pages/VaultEditSitePage.cs | 6 +-- src/App/Pages/VaultListPage.cs | 2 +- src/App/Pages/VaultViewSitePage.cs | 11 ++++-- 10 files changed, 51 insertions(+), 43 deletions(-) diff --git a/src/App/Controls/FormEditorCell.cs b/src/App/Controls/FormEditorCell.cs index c06e8717d..6f70839ee 100644 --- a/src/App/Controls/FormEditorCell.cs +++ b/src/App/Controls/FormEditorCell.cs @@ -20,7 +20,7 @@ namespace Bit.App.Controls var stackLayout = new StackLayout { - Padding = new Thickness(15, 15, 15, 0), + Padding = new Thickness(15), BackgroundColor = Color.White }; diff --git a/src/App/Controls/FormEntryCell.cs b/src/App/Controls/FormEntryCell.cs index efd95944b..25c81dee8 100644 --- a/src/App/Controls/FormEntryCell.cs +++ b/src/App/Controls/FormEntryCell.cs @@ -11,18 +11,21 @@ namespace Bit.App.Controls { Text = labelText, FontSize = 14, - TextColor = Color.FromHex("777777") + TextColor = Color.FromHex("777777"), + VerticalOptions = LayoutOptions.Start }; Entry = new ExtendedEntry { Keyboard = entryKeyboard, - HasBorder = false + HasBorder = false, + VerticalOptions = LayoutOptions.CenterAndExpand, + Margin = new Thickness(0, 5, 0, 0) }; var stackLayout = new StackLayout { - Padding = new Thickness(15, 15, 15, 0), + Padding = new Thickness(15), BackgroundColor = Color.White }; diff --git a/src/App/Controls/FormPickerCell.cs b/src/App/Controls/FormPickerCell.cs index 953048d5f..6d280883c 100644 --- a/src/App/Controls/FormPickerCell.cs +++ b/src/App/Controls/FormPickerCell.cs @@ -12,12 +12,15 @@ namespace Bit.App.Controls { Text = labelText, FontSize = 14, - TextColor = Color.FromHex("777777") + TextColor = Color.FromHex("777777"), + VerticalOptions = LayoutOptions.Start }; Picker = new ExtendedPicker { - HasBorder = false + HasBorder = false, + VerticalOptions = LayoutOptions.CenterAndExpand, + Margin = new Thickness(0, 5, 0, 0) }; foreach(var item in pickerItems) @@ -28,7 +31,7 @@ namespace Bit.App.Controls var stackLayout = new StackLayout { - Padding = new Thickness(15, 15, 15, 0), + Padding = new Thickness(15), BackgroundColor = Color.White }; diff --git a/src/App/Controls/LabeledValueCell.cs b/src/App/Controls/LabeledValueCell.cs index 8df2ccc76..3af649a8d 100644 --- a/src/App/Controls/LabeledValueCell.cs +++ b/src/App/Controls/LabeledValueCell.cs @@ -15,10 +15,17 @@ namespace Bit.App.Controls string button1Text = null, string button2Text = null) { - StackLayout = new StackLayout + var containerStackLayout = new StackLayout { - Padding = new Thickness(15, 15, 15, 0), - BackgroundColor = Color.White + Padding = new Thickness(15), + BackgroundColor = Color.White, + Orientation = StackOrientation.Horizontal + }; + + var labelValueStackLayout = new StackLayout + { + HorizontalOptions = LayoutOptions.StartAndExpand, + VerticalOptions = LayoutOptions.Center }; if(labelText != null) @@ -27,27 +34,30 @@ namespace Bit.App.Controls { Text = labelText, FontSize = 14, - TextColor = Color.FromHex("777777") + TextColor = Color.FromHex("777777"), + VerticalOptions = LayoutOptions.Start }; - StackLayout.Children.Add(Label); + labelValueStackLayout.Children.Add(Label); } Value = new Label { Text = valueText, LineBreakMode = LineBreakMode.TailTruncation, - HorizontalOptions = LayoutOptions.StartAndExpand, - VerticalOptions = LayoutOptions.Center + VerticalOptions = LayoutOptions.CenterAndExpand, + Margin = new Thickness(0, 5, 0, 0) }; - var valueStackLayout = new StackLayout + labelValueStackLayout.Children.Add(Value); + + containerStackLayout.Children.Add(labelValueStackLayout); + + var buttonStackLayout = new StackLayout { Orientation = StackOrientation.Horizontal }; - valueStackLayout.Children.Add(Value); - if(button1Text != null) { Button1 = new Button @@ -57,7 +67,7 @@ namespace Bit.App.Controls VerticalOptions = LayoutOptions.Center }; - valueStackLayout.Children.Add(Button1); + buttonStackLayout.Children.Add(Button1); } if(button2Text != null) @@ -69,15 +79,14 @@ namespace Bit.App.Controls VerticalOptions = LayoutOptions.Center }; - valueStackLayout.Children.Add(Button2); + buttonStackLayout.Children.Add(Button2); } - StackLayout.Children.Add(valueStackLayout); + containerStackLayout.Children.Add(buttonStackLayout); - View = StackLayout; + View = containerStackLayout; } - public StackLayout StackLayout { get; private set; } public Label Label { get; private set; } public Label Value { get; private set; } public Button Button1 { get; private set; } diff --git a/src/App/Models/Page/VaultViewSitePageModel.cs b/src/App/Models/Page/VaultViewSitePageModel.cs index 2e86414ae..6329f9841 100644 --- a/src/App/Models/Page/VaultViewSitePageModel.cs +++ b/src/App/Models/Page/VaultViewSitePageModel.cs @@ -24,10 +24,8 @@ namespace Bit.App.Models.Page { _name = value; PropertyChanged(this, new PropertyChangedEventArgs(nameof(Name))); - PropertyChanged(this, new PropertyChangedEventArgs(nameof(PageTitle))); } } - public string PageTitle => Name ?? AppResources.SiteNoName; public string Username { get { return _username; } diff --git a/src/App/Pages/SyncPage.cs b/src/App/Pages/SyncPage.cs index c0ff9dd14..0fdfd1b69 100644 --- a/src/App/Pages/SyncPage.cs +++ b/src/App/Pages/SyncPage.cs @@ -35,14 +35,6 @@ namespace Bit.App.Pages var stackLayout = new StackLayout { }; stackLayout.Children.Add(syncButton); - stackLayout.Children.Add(new ExtendedEntry - { - BottomBorderColor = Color.Black, - HasBorder = true, - HasOnlyBottomBorder = true, - Placeholder = "Some placeholder", - PlaceholderColor = Color.Red - }); Title = "Sync"; Content = stackLayout; diff --git a/src/App/Pages/VaultAddSitePage.cs b/src/App/Pages/VaultAddSitePage.cs index 313950e7d..a7f08efb2 100644 --- a/src/App/Pages/VaultAddSitePage.cs +++ b/src/App/Pages/VaultAddSitePage.cs @@ -56,11 +56,11 @@ namespace Bit.App.Pages { new TableSection("Site Information") { - uriCell, nameCell, - folderCell, + uriCell, usernameCell, - passwordCell + passwordCell, + folderCell }, new TableSection(AppResources.Notes) { diff --git a/src/App/Pages/VaultEditSitePage.cs b/src/App/Pages/VaultEditSitePage.cs index 81215e5fb..3eee9c67a 100644 --- a/src/App/Pages/VaultEditSitePage.cs +++ b/src/App/Pages/VaultEditSitePage.cs @@ -78,11 +78,11 @@ namespace Bit.App.Pages { new TableSection("Site Information") { - uriCell, nameCell, - folderCell, + uriCell, usernameCell, - passwordCell + passwordCell, + folderCell }, new TableSection(AppResources.Notes) { diff --git a/src/App/Pages/VaultListPage.cs b/src/App/Pages/VaultListPage.cs index 7b3458a09..f5873e0cb 100644 --- a/src/App/Pages/VaultListPage.cs +++ b/src/App/Pages/VaultListPage.cs @@ -229,7 +229,7 @@ namespace Bit.App.Pages } View = borderedStackLayout; - Height = 40; + Height = 35; } } } diff --git a/src/App/Pages/VaultViewSitePage.cs b/src/App/Pages/VaultViewSitePage.cs index d55c01805..72530698f 100644 --- a/src/App/Pages/VaultViewSitePage.cs +++ b/src/App/Pages/VaultViewSitePage.cs @@ -45,6 +45,7 @@ namespace Bit.App.Pages var usernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy); usernameCell.Value.SetBinding(Label.TextProperty, s => s.Username); usernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username)); + usernameCell.View.SetBinding(IsVisibleProperty, s => s.ShowUsername); // Password var passwordCell = new LabeledValueCell(AppResources.Password, button1Text: AppResources.Show, button2Text: AppResources.Copy); @@ -56,24 +57,26 @@ namespace Bit.App.Pages // URI var uriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch); uriCell.Value.SetBinding(Label.TextProperty, s => s.UriHost); - uriCell.Button1.Command = new Command(() => Device.OpenUri(new Uri(uriCell.Value.Text))); + uriCell.Button1.Command = new Command(() => Device.OpenUri(new Uri(Model.Uri))); + uriCell.View.SetBinding(IsVisibleProperty, s => s.ShowUri); // Notes var notesCell = new LabeledValueCell(); notesCell.Value.SetBinding(Label.TextProperty, s => s.Notes); + notesCell.View.SetBinding(IsVisibleProperty, s => s.ShowNotes); Table = new ExtendedTableView { Intent = TableIntent.Settings, EnableScrolling = false, HasUnevenRows = true, - EnableSelection = true, + EnableSelection = false, Root = new TableRoot { new TableSection("Site Information") { - uriCell, nameCell, + uriCell, usernameCell, passwordCell }, @@ -96,7 +99,7 @@ namespace Bit.App.Pages Orientation = ScrollOrientation.Vertical }; - SetBinding(Page.TitleProperty, new Binding("PageTitle")); + Title = "View Site"; Content = scrollView; BindingContext = Model; }