1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-06 02:23:57 +00:00

icons in vault listing

This commit is contained in:
Kyle Spearrin
2017-10-20 15:24:40 -04:00
parent 5cb3e15201
commit 37974c7ec8
37 changed files with 347 additions and 189 deletions

View File

@@ -1,4 +1,5 @@
using FFImageLoading.Forms;
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
@@ -7,6 +8,17 @@ namespace Bit.App.Controls
{
public LabeledDetailCell()
{
Icon = new CachedImage
{
WidthRequest = 20,
HeightRequest = 20,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
ErrorPlaceholder = "login.png",
CacheDuration = TimeSpan.FromDays(30),
BitmapOptimizations = true
};
Label = new Label
{
LineBreakMode = LineBreakMode.TailTruncation,
@@ -45,21 +57,24 @@ namespace Bit.App.Controls
{
ColumnSpacing = 0,
RowSpacing = 0,
Padding = new Thickness(15, 3, 0, 3)
Padding = new Thickness(3, 3, 0, 3)
};
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(40, GridUnitType.Absolute) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(60, GridUnitType.Absolute) });
grid.Children.Add(Label, 0, 0);
grid.Children.Add(Detail, 0, 1);
grid.Children.Add(LabelIcon, 1, 0);
grid.Children.Add(LabelIcon2, 2, 0);
grid.Children.Add(Button, 3, 0);
Grid.SetColumnSpan(Detail, 3);
grid.Children.Add(Icon, 0, 0);
grid.Children.Add(Label, 1, 0);
grid.Children.Add(Detail, 1, 1);
grid.Children.Add(LabelIcon, 2, 0);
grid.Children.Add(LabelIcon2, 3, 0);
grid.Children.Add(Button, 4, 0);
Grid.SetRowSpan(Icon, 2);
Grid.SetRowSpan(Button, 2);
Grid.SetColumnSpan(Detail, 3);
if(Device.RuntimePlatform == Device.Android)
{
@@ -69,6 +84,7 @@ namespace Bit.App.Controls
View = grid;
}
public CachedImage Icon { get; private set; }
public Label Label { get; private set; }
public Label Detail { get; private set; }
public CachedImage LabelIcon { get; private set; }

View File

@@ -1,4 +1,5 @@
using Bit.App.Models.Page;
using FFImageLoading.Forms;
using System;
using Xamarin.Forms;
@@ -12,6 +13,8 @@ namespace Bit.App.Controls
public VaultListViewCell(Action<VaultListPageModel.Cipher> moreClickedAction)
{
SetBinding(LoginParameterProperty, new Binding("."));
Icon.SetBinding(CachedImage.SourceProperty, nameof(VaultListPageModel.Cipher.Icon));
Icon.SetBinding(CachedImage.LoadingPlaceholderProperty, nameof(VaultListPageModel.Cipher.Icon));
Label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Cipher.Name));
Detail.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Cipher.Subtitle));
LabelIcon.SetBinding(VisualElement.IsVisibleProperty, nameof(VaultListPageModel.Cipher.Shared));