From 7060ee838c086ffddf3c7b8a9238b819d99f79f8 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 30 Jul 2016 00:16:40 -0400 Subject: [PATCH] Adjusted some spacing on about and settings --- src/App/Pages/Settings/SettingsAboutPage.cs | 3 +- src/App/Pages/Settings/SettingsPage.cs | 83 ++++++++++++--------- 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/App/Pages/Settings/SettingsAboutPage.cs b/src/App/Pages/Settings/SettingsAboutPage.cs index dc1ebb6bc..094e0b494 100644 --- a/src/App/Pages/Settings/SettingsAboutPage.cs +++ b/src/App/Pages/Settings/SettingsAboutPage.cs @@ -35,7 +35,7 @@ namespace Bit.App.Pages { Children = { logo, versionLabel }, Spacing = 20, - Padding = new Thickness(0, 40) + Padding = new Thickness(0, 40, 0, 0) }; var creditsCell = new ExtendedTextCell @@ -49,7 +49,6 @@ namespace Bit.App.Pages { VerticalOptions = LayoutOptions.Start, EnableScrolling = false, - NoHeader = true, Intent = TableIntent.Settings, HasUnevenRows = true, Root = new TableRoot diff --git a/src/App/Pages/Settings/SettingsPage.cs b/src/App/Pages/Settings/SettingsPage.cs index ac2271add..ea10623e3 100644 --- a/src/App/Pages/Settings/SettingsPage.cs +++ b/src/App/Pages/Settings/SettingsPage.cs @@ -123,13 +123,18 @@ namespace Bit.App.Pages }; helpCell.Tapped += HelpCell_Tapped; - var rateCell = new ExtendedTextCell - { - Text = "Rate the App", - ShowDisclousure = true - }; + var rateCell = new LongDetailViewCell("Rate the App", null); rateCell.Tapped += RateCell_Tapped; + if(Device.OS == TargetPlatform.iOS) + { + rateCell.Detail.Text = "App Store ratings are reset with every new version of bitwarden. Please consider helping us out with a good review!"; + } + else + { + rateCell.Detail.Text = "Please consider helping us out with a good review!"; + } + Table = new CustomTable { Root = new TableRoot @@ -165,36 +170,8 @@ namespace Bit.App.Pages } }; - var rateLabel = new Label - { - LineBreakMode = LineBreakMode.WordWrap, - FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), - Style = (Style)Application.Current.Resources["text-muted"], - Margin = new Thickness(15, 0, 15, 25) - }; - - if(Device.OS == TargetPlatform.iOS) - { - rateLabel.Text = "App Store ratings are reset with every new version of bitwarden. Please consider helping us out with a good review!"; - } - else - { - rateLabel.Text = "Please consider helping us out with a good review!"; - } - - var stackLayout = new StackLayout - { - Children = { Table, rateLabel }, - Spacing = 0 - }; - - stackLayout.LayoutChanged += (sender, args) => - { - rateLabel.WidthRequest = stackLayout.Bounds.Width - rateLabel.Bounds.Left * 2; - }; - Title = AppResources.Settings; - Content = new ScrollView { Content = stackLayout }; + Content = Table; } private async void TwoStepCell_Tapped(object sender, EventArgs e) @@ -406,8 +383,6 @@ namespace Bit.App.Pages { public CustomTable() { - VerticalOptions = LayoutOptions.Start; - EnableScrolling = false; Intent = TableIntent.Settings; HasUnevenRows = true; @@ -418,5 +393,41 @@ namespace Bit.App.Pages } } } + + private class LongDetailViewCell : ExtendedViewCell + { + public LongDetailViewCell(string labelText, string detailText) + { + Label = new Label + { + VerticalOptions = LayoutOptions.CenterAndExpand, + LineBreakMode = LineBreakMode.TailTruncation, + Text = labelText + }; + + Detail = new Label + { + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), + LineBreakMode = LineBreakMode.WordWrap, + VerticalOptions = LayoutOptions.End, + Style = (Style)Application.Current.Resources["text-muted"], + Text = detailText + }; + + var labelDetailStackLayout = new StackLayout + { + HorizontalOptions = LayoutOptions.StartAndExpand, + VerticalOptions = LayoutOptions.FillAndExpand, + Children = { Label, Detail }, + Padding = new Thickness(15) + }; + + ShowDisclousure = true; + View = labelDetailStackLayout; + } + + public Label Label { get; set; } + public Label Detail { get; set; } + } } }