Android styling for tools page

This commit is contained in:
Kyle Spearrin 2016-08-13 22:07:44 -04:00
parent b4a80751b2
commit d6a66d1eb0

View file

@ -26,13 +26,26 @@ namespace Bit.App.Pages
{ {
var generatorCell = new ToolsViewCell("Password Generator", "Automatically generate strong, unique passwords for your logins.", "refresh"); var generatorCell = new ToolsViewCell("Password Generator", "Automatically generate strong, unique passwords for your logins.", "refresh");
generatorCell.Tapped += GeneratorCell_Tapped; generatorCell.Tapped += GeneratorCell_Tapped;
var extensionCell = new ToolsViewCell("bitwarden App Extension", "Use bitwarden in Safari and other apps to auto-fill your logins.", "upload");
extensionCell.Tapped += ExtensionCell_Tapped;
var webCell = new ToolsViewCell("bitwarden Web Vault", "Manage your logins from any web browser with the bitwarden web vault.", "globe"); var webCell = new ToolsViewCell("bitwarden Web Vault", "Manage your logins from any web browser with the bitwarden web vault.", "globe");
webCell.Tapped += WebCell_Tapped; webCell.Tapped += WebCell_Tapped;
var importCell = new ToolsViewCell("Import Logins", "Quickly bulk import your logins from other password management apps.", "cloudup"); var importCell = new ToolsViewCell("Import Logins", "Quickly bulk import your logins from other password management apps.", "cloudup");
importCell.Tapped += ImportCell_Tapped; importCell.Tapped += ImportCell_Tapped;
var section = new TableSection { generatorCell };
if(Device.OS == TargetPlatform.iOS)
{
var extensionCell = new ToolsViewCell("bitwarden App Extension", "Use bitwarden in Safari and other apps to auto-fill your logins.", "upload");
extensionCell.Tapped += (object sender, EventArgs e) =>
{
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsExtensionPage()));
};
section.Add(extensionCell);
}
section.Add(webCell);
section.Add(importCell);
var table = new ExtendedTableView var table = new ExtendedTableView
{ {
EnableScrolling = true, EnableScrolling = true,
@ -40,13 +53,7 @@ namespace Bit.App.Pages
HasUnevenRows = true, HasUnevenRows = true,
Root = new TableRoot Root = new TableRoot
{ {
new TableSection section
{
generatorCell,
extensionCell,
webCell,
importCell
}
} }
}; };
@ -60,11 +67,6 @@ namespace Bit.App.Pages
Content = table; Content = table;
} }
private void ExtensionCell_Tapped(object sender, EventArgs e)
{
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsExtensionPage()));
}
private void GeneratorCell_Tapped(object sender, EventArgs e) private void GeneratorCell_Tapped(object sender, EventArgs e)
{ {
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsPasswordGeneratorPage())); Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsPasswordGeneratorPage()));
@ -93,7 +95,6 @@ namespace Bit.App.Pages
{ {
var label = new Label var label = new Label
{ {
VerticalOptions = LayoutOptions.CenterAndExpand,
LineBreakMode = LineBreakMode.TailTruncation, LineBreakMode = LineBreakMode.TailTruncation,
Text = labelText Text = labelText
}; };
@ -102,11 +103,16 @@ namespace Bit.App.Pages
{ {
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
LineBreakMode = LineBreakMode.WordWrap, LineBreakMode = LineBreakMode.WordWrap,
VerticalOptions = LayoutOptions.End,
Style = (Style)Application.Current.Resources["text-muted"], Style = (Style)Application.Current.Resources["text-muted"],
Text = detailText Text = detailText
}; };
if(Device.OS == TargetPlatform.Android)
{
detail.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
label.TextColor = Color.Black;
}
var labelDetailStackLayout = new StackLayout var labelDetailStackLayout = new StackLayout
{ {
HorizontalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.StartAndExpand,
@ -127,7 +133,10 @@ namespace Bit.App.Pages
{ {
Orientation = StackOrientation.Horizontal, Orientation = StackOrientation.Horizontal,
Children = { image, labelDetailStackLayout }, Children = { image, labelDetailStackLayout },
Padding = new Thickness(15, 25) Padding = Device.OnPlatform(
iOS: new Thickness(15, 25),
Android: new Thickness(15, 20),
WinPhone: new Thickness(15, 25))
}; };
ShowDisclousure = true; ShowDisclousure = true;