From 193ef8c995f5645d7867baa76fba7980fc4fe49a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 25 Jul 2016 22:24:40 -0400 Subject: [PATCH] Use tableview on about page for credits selections. Break settings page out into individual table views so we can use footer labels. --- src/App/Pages/Settings/SettingsAboutPage.cs | 50 ++++++++++++---- src/App/Pages/Settings/SettingsPage.cs | 64 +++++++++++++++++---- 2 files changed, 92 insertions(+), 22 deletions(-) diff --git a/src/App/Pages/Settings/SettingsAboutPage.cs b/src/App/Pages/Settings/SettingsAboutPage.cs index ea3d015de..8af82d09e 100644 --- a/src/App/Pages/Settings/SettingsAboutPage.cs +++ b/src/App/Pages/Settings/SettingsAboutPage.cs @@ -26,31 +26,61 @@ namespace Bit.App.Pages var versionLabel = new Label { - Text = $@"Version {_appInfoService.Version} + Text = $@"Version {_appInfoService.Version} ({_appInfoService.Build}) © 8bit Solutions LLC 2015-{DateTime.Now.Year}", HorizontalTextAlignment = TextAlignment.Center }; - var creditsButton = new Button + var logoVersionStackLayout = new StackLayout + { + Children = { logo, versionLabel }, + Spacing = 20, + Padding = new Thickness(0, 40) + }; + + var creditsCell = new ExtendedTextCell { Text = "Credits", - Style = (Style)Application.Current.Resources["btn-primaryAccent"], - Margin = new Thickness(15, 0, 15, 25), - Command = new Command(async () => await Navigation.PushAsync(new SettingsCreditsPage())), - HorizontalOptions = LayoutOptions.Center + ShowDisclousure = true }; + creditsCell.Tapped += RateCell_Tapped; + + var table = new ExtendedTableView + { + VerticalOptions = LayoutOptions.Start, + EnableScrolling = false, + NoHeader = true, + Intent = TableIntent.Menu, + HasUnevenRows = true, + Root = new TableRoot + { + new TableSection + { + creditsCell + } + } + }; + + if(Device.OS == TargetPlatform.iOS) + { + table.RowHeight = -1; + table.EstimatedRowHeight = 44; + } var stackLayout = new StackLayout { - Children = { logo, versionLabel, creditsButton }, - VerticalOptions = LayoutOptions.Center, - Spacing = 20, - Margin = new Thickness(0, 0, 0, 40) + Children = { logoVersionStackLayout, table }, + Spacing = 0 }; Title = "About bitwarden"; Content = new ScrollView { Content = stackLayout }; NavigationPage.SetBackButtonTitle(this, "About"); } + + private void RateCell_Tapped(object sender, EventArgs e) + { + Navigation.PushAsync(new SettingsCreditsPage()); + } } } diff --git a/src/App/Pages/Settings/SettingsPage.cs b/src/App/Pages/Settings/SettingsPage.cs index 3e2043551..93b3eb985 100644 --- a/src/App/Pages/Settings/SettingsPage.cs +++ b/src/App/Pages/Settings/SettingsPage.cs @@ -122,13 +122,8 @@ namespace Bit.App.Pages }; rateCell.Tapped += RateCell_Tapped; - var table = new ExtendedTableView + var table = new CustomTable { - NoFooter = true, - VerticalOptions = LayoutOptions.Start, - EnableScrolling = false, - Intent = TableIntent.Menu, - HasUnevenRows = true, Root = new TableRoot { new TableSection("Security") @@ -136,22 +131,50 @@ namespace Bit.App.Pages LockOptionsCell, FingerprintCell, PinCell - }, - new TableSection + } + } + }; + + var table2 = new CustomTable + { + Root = new TableRoot + { + new TableSection("Account") { changeMasterPasswordCell, changeEmailCell - }, + } + } + }; + + var table3 = new CustomTable + { + Root = new TableRoot + { new TableSection("Manage") { foldersCell, syncCell - }, + } + } + }; + + var table4 = new CustomTable + { + Root = new TableRoot + { new TableSection("Current Session") { lockCell, logOutCell - }, + } + } + }; + + var table5 = new CustomTable + { + Root = new TableRoot + { new TableSection("Other") { aboutCell, @@ -186,10 +209,15 @@ namespace Bit.App.Pages var stackLayout = new StackLayout { - Children = { table, rateLabel }, + Children = { table, table2, table3, table4, table5, rateLabel }, Spacing = 0 }; + stackLayout.LayoutChanged += (sender, args) => + { + rateLabel.WidthRequest = stackLayout.Bounds.Width - rateLabel.Bounds.Left * 2; + }; + Title = AppResources.Settings; Content = new ScrollView { Content = stackLayout }; } @@ -383,5 +411,17 @@ namespace Bit.App.Pages return "Immediately"; } } + + private class CustomTable : ExtendedTableView + { + public CustomTable() + { + NoFooter = true; + VerticalOptions = LayoutOptions.Start; + EnableScrolling = false; + Intent = TableIntent.Menu; + HasUnevenRows = true; + } + } } }