mirror of
https://github.com/bitwarden/android.git
synced 2024-12-21 00:31:58 +03:00
vault page layout positioning
This commit is contained in:
parent
56733e6652
commit
e9999adcf2
10 changed files with 51 additions and 43 deletions
|
@ -20,7 +20,7 @@ namespace Bit.App.Controls
|
||||||
|
|
||||||
var stackLayout = new StackLayout
|
var stackLayout = new StackLayout
|
||||||
{
|
{
|
||||||
Padding = new Thickness(15, 15, 15, 0),
|
Padding = new Thickness(15),
|
||||||
BackgroundColor = Color.White
|
BackgroundColor = Color.White
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,21 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
Text = labelText,
|
Text = labelText,
|
||||||
FontSize = 14,
|
FontSize = 14,
|
||||||
TextColor = Color.FromHex("777777")
|
TextColor = Color.FromHex("777777"),
|
||||||
|
VerticalOptions = LayoutOptions.Start
|
||||||
};
|
};
|
||||||
|
|
||||||
Entry = new ExtendedEntry
|
Entry = new ExtendedEntry
|
||||||
{
|
{
|
||||||
Keyboard = entryKeyboard,
|
Keyboard = entryKeyboard,
|
||||||
HasBorder = false
|
HasBorder = false,
|
||||||
|
VerticalOptions = LayoutOptions.CenterAndExpand,
|
||||||
|
Margin = new Thickness(0, 5, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
var stackLayout = new StackLayout
|
var stackLayout = new StackLayout
|
||||||
{
|
{
|
||||||
Padding = new Thickness(15, 15, 15, 0),
|
Padding = new Thickness(15),
|
||||||
BackgroundColor = Color.White
|
BackgroundColor = Color.White
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,15 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
Text = labelText,
|
Text = labelText,
|
||||||
FontSize = 14,
|
FontSize = 14,
|
||||||
TextColor = Color.FromHex("777777")
|
TextColor = Color.FromHex("777777"),
|
||||||
|
VerticalOptions = LayoutOptions.Start
|
||||||
};
|
};
|
||||||
|
|
||||||
Picker = new ExtendedPicker
|
Picker = new ExtendedPicker
|
||||||
{
|
{
|
||||||
HasBorder = false
|
HasBorder = false,
|
||||||
|
VerticalOptions = LayoutOptions.CenterAndExpand,
|
||||||
|
Margin = new Thickness(0, 5, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach(var item in pickerItems)
|
foreach(var item in pickerItems)
|
||||||
|
@ -28,7 +31,7 @@ namespace Bit.App.Controls
|
||||||
|
|
||||||
var stackLayout = new StackLayout
|
var stackLayout = new StackLayout
|
||||||
{
|
{
|
||||||
Padding = new Thickness(15, 15, 15, 0),
|
Padding = new Thickness(15),
|
||||||
BackgroundColor = Color.White
|
BackgroundColor = Color.White
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,17 @@ namespace Bit.App.Controls
|
||||||
string button1Text = null,
|
string button1Text = null,
|
||||||
string button2Text = null)
|
string button2Text = null)
|
||||||
{
|
{
|
||||||
StackLayout = new StackLayout
|
var containerStackLayout = new StackLayout
|
||||||
{
|
{
|
||||||
Padding = new Thickness(15, 15, 15, 0),
|
Padding = new Thickness(15),
|
||||||
BackgroundColor = Color.White
|
BackgroundColor = Color.White,
|
||||||
|
Orientation = StackOrientation.Horizontal
|
||||||
|
};
|
||||||
|
|
||||||
|
var labelValueStackLayout = new StackLayout
|
||||||
|
{
|
||||||
|
HorizontalOptions = LayoutOptions.StartAndExpand,
|
||||||
|
VerticalOptions = LayoutOptions.Center
|
||||||
};
|
};
|
||||||
|
|
||||||
if(labelText != null)
|
if(labelText != null)
|
||||||
|
@ -27,27 +34,30 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
Text = labelText,
|
Text = labelText,
|
||||||
FontSize = 14,
|
FontSize = 14,
|
||||||
TextColor = Color.FromHex("777777")
|
TextColor = Color.FromHex("777777"),
|
||||||
|
VerticalOptions = LayoutOptions.Start
|
||||||
};
|
};
|
||||||
|
|
||||||
StackLayout.Children.Add(Label);
|
labelValueStackLayout.Children.Add(Label);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value = new Label
|
Value = new Label
|
||||||
{
|
{
|
||||||
Text = valueText,
|
Text = valueText,
|
||||||
LineBreakMode = LineBreakMode.TailTruncation,
|
LineBreakMode = LineBreakMode.TailTruncation,
|
||||||
HorizontalOptions = LayoutOptions.StartAndExpand,
|
VerticalOptions = LayoutOptions.CenterAndExpand,
|
||||||
VerticalOptions = LayoutOptions.Center
|
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
|
Orientation = StackOrientation.Horizontal
|
||||||
};
|
};
|
||||||
|
|
||||||
valueStackLayout.Children.Add(Value);
|
|
||||||
|
|
||||||
if(button1Text != null)
|
if(button1Text != null)
|
||||||
{
|
{
|
||||||
Button1 = new Button
|
Button1 = new Button
|
||||||
|
@ -57,7 +67,7 @@ namespace Bit.App.Controls
|
||||||
VerticalOptions = LayoutOptions.Center
|
VerticalOptions = LayoutOptions.Center
|
||||||
};
|
};
|
||||||
|
|
||||||
valueStackLayout.Children.Add(Button1);
|
buttonStackLayout.Children.Add(Button1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(button2Text != null)
|
if(button2Text != null)
|
||||||
|
@ -69,15 +79,14 @@ namespace Bit.App.Controls
|
||||||
VerticalOptions = LayoutOptions.Center
|
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 Label { get; private set; }
|
||||||
public Label Value { get; private set; }
|
public Label Value { get; private set; }
|
||||||
public Button Button1 { get; private set; }
|
public Button Button1 { get; private set; }
|
||||||
|
|
|
@ -24,10 +24,8 @@ namespace Bit.App.Models.Page
|
||||||
{
|
{
|
||||||
_name = value;
|
_name = value;
|
||||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Name)));
|
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Name)));
|
||||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(PageTitle)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string PageTitle => Name ?? AppResources.SiteNoName;
|
|
||||||
public string Username
|
public string Username
|
||||||
{
|
{
|
||||||
get { return _username; }
|
get { return _username; }
|
||||||
|
|
|
@ -35,14 +35,6 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
var stackLayout = new StackLayout { };
|
var stackLayout = new StackLayout { };
|
||||||
stackLayout.Children.Add(syncButton);
|
stackLayout.Children.Add(syncButton);
|
||||||
stackLayout.Children.Add(new ExtendedEntry
|
|
||||||
{
|
|
||||||
BottomBorderColor = Color.Black,
|
|
||||||
HasBorder = true,
|
|
||||||
HasOnlyBottomBorder = true,
|
|
||||||
Placeholder = "Some placeholder",
|
|
||||||
PlaceholderColor = Color.Red
|
|
||||||
});
|
|
||||||
|
|
||||||
Title = "Sync";
|
Title = "Sync";
|
||||||
Content = stackLayout;
|
Content = stackLayout;
|
||||||
|
|
|
@ -56,11 +56,11 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
new TableSection("Site Information")
|
new TableSection("Site Information")
|
||||||
{
|
{
|
||||||
uriCell,
|
|
||||||
nameCell,
|
nameCell,
|
||||||
folderCell,
|
uriCell,
|
||||||
usernameCell,
|
usernameCell,
|
||||||
passwordCell
|
passwordCell,
|
||||||
|
folderCell
|
||||||
},
|
},
|
||||||
new TableSection(AppResources.Notes)
|
new TableSection(AppResources.Notes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,11 +78,11 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
new TableSection("Site Information")
|
new TableSection("Site Information")
|
||||||
{
|
{
|
||||||
uriCell,
|
|
||||||
nameCell,
|
nameCell,
|
||||||
folderCell,
|
uriCell,
|
||||||
usernameCell,
|
usernameCell,
|
||||||
passwordCell
|
passwordCell,
|
||||||
|
folderCell
|
||||||
},
|
},
|
||||||
new TableSection(AppResources.Notes)
|
new TableSection(AppResources.Notes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -229,7 +229,7 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
|
|
||||||
View = borderedStackLayout;
|
View = borderedStackLayout;
|
||||||
Height = 40;
|
Height = 35;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace Bit.App.Pages
|
||||||
var usernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
|
var usernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
|
||||||
usernameCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Username);
|
usernameCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Username);
|
||||||
usernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
|
usernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
|
||||||
|
usernameCell.View.SetBinding<VaultViewSitePageModel>(IsVisibleProperty, s => s.ShowUsername);
|
||||||
|
|
||||||
// Password
|
// Password
|
||||||
var passwordCell = new LabeledValueCell(AppResources.Password, button1Text: AppResources.Show, button2Text: AppResources.Copy);
|
var passwordCell = new LabeledValueCell(AppResources.Password, button1Text: AppResources.Show, button2Text: AppResources.Copy);
|
||||||
|
@ -56,24 +57,26 @@ namespace Bit.App.Pages
|
||||||
// URI
|
// URI
|
||||||
var uriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
|
var uriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
|
||||||
uriCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.UriHost);
|
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
|
// Notes
|
||||||
var notesCell = new LabeledValueCell();
|
var notesCell = new LabeledValueCell();
|
||||||
notesCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Notes);
|
notesCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.Notes);
|
||||||
|
notesCell.View.SetBinding<VaultViewSitePageModel>(IsVisibleProperty, s => s.ShowNotes);
|
||||||
|
|
||||||
Table = new ExtendedTableView
|
Table = new ExtendedTableView
|
||||||
{
|
{
|
||||||
Intent = TableIntent.Settings,
|
Intent = TableIntent.Settings,
|
||||||
EnableScrolling = false,
|
EnableScrolling = false,
|
||||||
HasUnevenRows = true,
|
HasUnevenRows = true,
|
||||||
EnableSelection = true,
|
EnableSelection = false,
|
||||||
Root = new TableRoot
|
Root = new TableRoot
|
||||||
{
|
{
|
||||||
new TableSection("Site Information")
|
new TableSection("Site Information")
|
||||||
{
|
{
|
||||||
uriCell,
|
|
||||||
nameCell,
|
nameCell,
|
||||||
|
uriCell,
|
||||||
usernameCell,
|
usernameCell,
|
||||||
passwordCell
|
passwordCell
|
||||||
},
|
},
|
||||||
|
@ -96,7 +99,7 @@ namespace Bit.App.Pages
|
||||||
Orientation = ScrollOrientation.Vertical
|
Orientation = ScrollOrientation.Vertical
|
||||||
};
|
};
|
||||||
|
|
||||||
SetBinding(Page.TitleProperty, new Binding("PageTitle"));
|
Title = "View Site";
|
||||||
Content = scrollView;
|
Content = scrollView;
|
||||||
BindingContext = Model;
|
BindingContext = Model;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue