1
0
mirror of https://github.com/bitwarden/mobile synced 2026-02-26 01:13:28 +00:00

Wired up view page functionality. Expanded LabeledValueCell. Created custom group template for vault list page.

This commit is contained in:
Kyle Spearrin
2016-05-14 01:34:42 -04:00
parent d288116b39
commit 4e906f9370
12 changed files with 155 additions and 49 deletions

View File

@@ -11,6 +11,9 @@ namespace Bit.App.Controls
public static readonly BindableProperty EnableSelectionProperty =
BindableProperty.Create(nameof(EnableSelection), typeof(bool), typeof(ExtendedTableView), true);
public static readonly BindableProperty SeparatorColorProperty =
BindableProperty.Create(nameof(SeparatorColor), typeof(Color), typeof(ExtendedTableView), Color.FromHex("d2d6de"));
public bool EnableScrolling
{
get { return (bool)GetValue(EnableScrollingProperty); }
@@ -23,6 +26,12 @@ namespace Bit.App.Controls
set { SetValue(EnableSelectionProperty, value); }
}
public Color SeparatorColor
{
get { return (Color)GetValue(SeparatorColorProperty); }
set { SetValue(SeparatorColorProperty, value); }
}
public int EstimatedRowHeight { get; set; }
}
}

View File

@@ -9,20 +9,13 @@ namespace Bit.App.Controls
{
public class LabeledValueCell : ViewCell
{
private readonly IUserDialogs _userDialogs;
private readonly IClipboardService _clipboardService;
public LabeledValueCell(
string labelText,
string labelText = null,
string valueText = null,
bool copyValue = false,
bool password = false,
bool launch = false)
string button1Text = null,
string button2Text = null)
{
_userDialogs = Resolver.Resolve<IUserDialogs>();
_clipboardService = Resolver.Resolve<IClipboardService>();
var stackLayout = new StackLayout
StackLayout = new StackLayout
{
Padding = new Thickness(15, 15, 15, 0),
BackgroundColor = Color.White
@@ -37,7 +30,7 @@ namespace Bit.App.Controls
TextColor = Color.FromHex("777777")
};
stackLayout.Children.Add(Label);
StackLayout.Children.Add(Label);
}
Value = new Label
@@ -52,46 +45,42 @@ namespace Bit.App.Controls
{
Orientation = StackOrientation.Horizontal
};
valueStackLayout.Children.Add(Value);
if(copyValue)
if(button1Text != null)
{
var copyButton = new Button
Button1 = new Button
{
Text = AppResources.Copy,
Text = button1Text,
HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.Center,
Command = new Command(() => Copy())
VerticalOptions = LayoutOptions.Center
};
valueStackLayout.Children.Add(copyButton);
valueStackLayout.Children.Add(Button1);
}
if(launch)
if(button2Text != null)
{
var launchButton = new Button
Button2 = new Button
{
Text = AppResources.Launch,
Text = button2Text,
HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.Center,
Command = new Command(() => Device.OpenUri(new Uri(Value.Text)))
VerticalOptions = LayoutOptions.Center
};
valueStackLayout.Children.Add(launchButton);
valueStackLayout.Children.Add(Button2);
}
stackLayout.Children.Add(valueStackLayout);
StackLayout.Children.Add(valueStackLayout);
View = stackLayout;
View = StackLayout;
}
public StackLayout StackLayout { get; private set; }
public Label Label { get; private set; }
public Label Value { get; private set; }
private void Copy()
{
_clipboardService.CopyToClipboard(Value.Text);
_userDialogs.SuccessToast(string.Format(AppResources.ValueHasBeenCopied, Label.Text));
}
public Button Button1 { get; private set; }
public Button Button2 { get; private set; }
}
}