1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-26 03:42:57 +02:00

vault page layout positioning

This commit is contained in:
Kyle Spearrin 2016-05-16 23:54:24 -04:00
parent 56733e6652
commit e9999adcf2
10 changed files with 51 additions and 43 deletions

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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; }

View File

@ -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; }

View File

@ -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;

View File

@ -56,11 +56,11 @@ namespace Bit.App.Pages
{
new TableSection("Site Information")
{
uriCell,
nameCell,
folderCell,
uriCell,
usernameCell,
passwordCell
passwordCell,
folderCell
},
new TableSection(AppResources.Notes)
{

View File

@ -78,11 +78,11 @@ namespace Bit.App.Pages
{
new TableSection("Site Information")
{
uriCell,
nameCell,
folderCell,
uriCell,
usernameCell,
passwordCell
passwordCell,
folderCell
},
new TableSection(AppResources.Notes)
{

View File

@ -229,7 +229,7 @@ namespace Bit.App.Pages
}
View = borderedStackLayout;
Height = 40;
Height = 35;
}
}
}

View File

@ -45,6 +45,7 @@ namespace Bit.App.Pages
var usernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
usernameCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Username);
usernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
usernameCell.View.SetBinding<VaultViewSitePageModel>(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<VaultViewSitePageModel>(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<VaultViewSitePageModel>(IsVisibleProperty, s => s.ShowUri);
// Notes
var notesCell = new LabeledValueCell();
notesCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Notes);
notesCell.View.SetBinding<VaultViewSitePageModel>(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;
}