Use tableview on about page for credits selections. Break settings page out into individual table views so we can use footer labels.

This commit is contained in:
Kyle Spearrin 2016-07-25 22:24:40 -04:00
parent 948dc9511f
commit 193ef8c995
2 changed files with 92 additions and 22 deletions

View file

@ -26,31 +26,61 @@ namespace Bit.App.Pages
var versionLabel = new Label var versionLabel = new Label
{ {
Text = $@"Version {_appInfoService.Version} Text = $@"Version {_appInfoService.Version} ({_appInfoService.Build})
© 8bit Solutions LLC 2015-{DateTime.Now.Year}", © 8bit Solutions LLC 2015-{DateTime.Now.Year}",
HorizontalTextAlignment = TextAlignment.Center 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", Text = "Credits",
Style = (Style)Application.Current.Resources["btn-primaryAccent"], ShowDisclousure = true
Margin = new Thickness(15, 0, 15, 25),
Command = new Command(async () => await Navigation.PushAsync(new SettingsCreditsPage())),
HorizontalOptions = LayoutOptions.Center
}; };
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 var stackLayout = new StackLayout
{ {
Children = { logo, versionLabel, creditsButton }, Children = { logoVersionStackLayout, table },
VerticalOptions = LayoutOptions.Center, Spacing = 0
Spacing = 20,
Margin = new Thickness(0, 0, 0, 40)
}; };
Title = "About bitwarden"; Title = "About bitwarden";
Content = new ScrollView { Content = stackLayout }; Content = new ScrollView { Content = stackLayout };
NavigationPage.SetBackButtonTitle(this, "About"); NavigationPage.SetBackButtonTitle(this, "About");
} }
private void RateCell_Tapped(object sender, EventArgs e)
{
Navigation.PushAsync(new SettingsCreditsPage());
}
} }
} }

View file

@ -122,13 +122,8 @@ namespace Bit.App.Pages
}; };
rateCell.Tapped += RateCell_Tapped; 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 Root = new TableRoot
{ {
new TableSection("Security") new TableSection("Security")
@ -136,22 +131,50 @@ namespace Bit.App.Pages
LockOptionsCell, LockOptionsCell,
FingerprintCell, FingerprintCell,
PinCell PinCell
}, }
new TableSection }
};
var table2 = new CustomTable
{
Root = new TableRoot
{
new TableSection("Account")
{ {
changeMasterPasswordCell, changeMasterPasswordCell,
changeEmailCell changeEmailCell
}, }
}
};
var table3 = new CustomTable
{
Root = new TableRoot
{
new TableSection("Manage") new TableSection("Manage")
{ {
foldersCell, foldersCell,
syncCell syncCell
}, }
}
};
var table4 = new CustomTable
{
Root = new TableRoot
{
new TableSection("Current Session") new TableSection("Current Session")
{ {
lockCell, lockCell,
logOutCell logOutCell
}, }
}
};
var table5 = new CustomTable
{
Root = new TableRoot
{
new TableSection("Other") new TableSection("Other")
{ {
aboutCell, aboutCell,
@ -186,10 +209,15 @@ namespace Bit.App.Pages
var stackLayout = new StackLayout var stackLayout = new StackLayout
{ {
Children = { table, rateLabel }, Children = { table, table2, table3, table4, table5, rateLabel },
Spacing = 0 Spacing = 0
}; };
stackLayout.LayoutChanged += (sender, args) =>
{
rateLabel.WidthRequest = stackLayout.Bounds.Width - rateLabel.Bounds.Left * 2;
};
Title = AppResources.Settings; Title = AppResources.Settings;
Content = new ScrollView { Content = stackLayout }; Content = new ScrollView { Content = stackLayout };
} }
@ -383,5 +411,17 @@ namespace Bit.App.Pages
return "Immediately"; return "Immediately";
} }
} }
private class CustomTable : ExtendedTableView
{
public CustomTable()
{
NoFooter = true;
VerticalOptions = LayoutOptions.Start;
EnableScrolling = false;
Intent = TableIntent.Menu;
HasUnevenRows = true;
}
}
} }
} }