diff --git a/src/App/App.csproj b/src/App/App.csproj index ca9d541dd..145ddb693 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -68,6 +68,7 @@ + diff --git a/src/App/Controls/LabeledRightDetailCell.cs b/src/App/Controls/LabeledRightDetailCell.cs new file mode 100644 index 000000000..258137f9f --- /dev/null +++ b/src/App/Controls/LabeledRightDetailCell.cs @@ -0,0 +1,54 @@ +using FFImageLoading.Forms; +using Xamarin.Forms; + +namespace Bit.App.Controls +{ + public class LabeledRightDetailCell : ExtendedViewCell + { + public LabeledRightDetailCell() + { + Label = new Label + { + LineBreakMode = LineBreakMode.TailTruncation, + FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), + HorizontalOptions = LayoutOptions.StartAndExpand, + }; + + Detail = new Label + { + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), + LineBreakMode = LineBreakMode.TailTruncation, + Style = (Style)Application.Current.Resources["text-muted"], + HorizontalOptions = LayoutOptions.End, + VerticalOptions = LayoutOptions.Center + }; + + Icon = new CachedImage + { + WidthRequest = 16, + HeightRequest = 16, + HorizontalOptions = LayoutOptions.End, + VerticalOptions = LayoutOptions.Center, + Margin = new Thickness(5, 0, 0, 0) + }; + + var stackLayout = new StackLayout + { + Orientation = StackOrientation.Horizontal, + Padding = new Thickness(15, 10), + Children = { Label, Detail, Icon } + }; + + if(Device.RuntimePlatform == Device.Android) + { + Label.TextColor = Color.Black; + } + + View = stackLayout; + } + + public Label Label { get; private set; } + public Label Detail { get; private set; } + public CachedImage Icon { get; private set; } + } +} diff --git a/src/App/Pages/Vault/VaultViewLoginPage.cs b/src/App/Pages/Vault/VaultViewLoginPage.cs index bebbbbeb1..ef0d68f0e 100644 --- a/src/App/Pages/Vault/VaultViewLoginPage.cs +++ b/src/App/Pages/Vault/VaultViewLoginPage.cs @@ -261,21 +261,23 @@ namespace Bit.App.Pages } } - public class AttachmentViewCell : ExtendedTextCell + public class AttachmentViewCell : LabeledRightDetailCell { - Action _clicked; + private readonly Action _tapped; - public AttachmentViewCell(VaultViewLoginPageModel.Attachment attachment, Action clickedAction) + public AttachmentViewCell(VaultViewLoginPageModel.Attachment attachment, Action tappedAction) { - _clicked = clickedAction; - Text = attachment.Name; - Tapped += AttachmentViewCell_Tapped; + _tapped = tappedAction; + Label.Text = attachment.Name; + Detail.Text = attachment.Size; + Icon.Source = "user"; // TODO: download icon BackgroundColor = Color.White; + Tapped += AttachmentViewCell_Tapped; } private void AttachmentViewCell_Tapped(object sender, EventArgs e) { - _clicked?.Invoke(); + _tapped?.Invoke(); } } }