From 1d4e742d663b767d21af17c444c852068264857c Mon Sep 17 00:00:00 2001
From: Matt Portune <59324545+mportune-bw@users.noreply.github.com>
Date: Thu, 13 May 2021 14:36:20 -0400
Subject: [PATCH] Forms update with CollectionView conversion (#1374)
* Forms update with CollectionView conversion
* updates
* removed unnecessary import
---
src/Android/Android.csproj | 31 +--
.../Renderers/CipherViewCellRenderer.cs | 242 ------------------
src/Android/Renderers/ExtendedGridRenderer.cs | 43 ++++
.../Renderers/ExtendedListViewRenderer.cs | 29 ---
.../Renderers/ExtendedStackLayoutRenderer.cs | 43 ++++
src/Android/Renderers/SendViewCellRenderer.cs | 210 ---------------
.../Resources/drawable/list_item_bg.xml | 7 +
.../Resources/drawable/list_item_bg_dark.xml | 7 +
.../Resources/drawable/list_item_bg_nord.xml | 7 +
.../Resources/layout/CipherViewCell.axml | 86 -------
.../Resources/layout/SendViewCell.axml | 104 --------
src/Android/Resources/values/colors.xml | 1 +
src/App/App.csproj | 6 +-
.../CipherViewCell/CipherViewCell.xaml | 189 +++++++-------
.../CipherViewCell/CipherViewCell.xaml.cs | 160 ++----------
.../CipherViewCell/CipherViewCellViewModel.cs | 19 ++
src/App/Controls/ExtendedCollectionView.cs | 8 +
src/App/Controls/ExtendedGrid.cs | 8 +
src/App/Controls/ExtendedListView.cs | 12 -
src/App/Controls/ExtendedStackLayout.cs | 8 +
.../Controls/SendViewCell/SendViewCell.xaml | 235 +++++++++--------
.../SendViewCell/SendViewCell.xaml.cs | 88 +------
.../SendViewCell/SendViewCellViewModel.cs | 6 +
.../Pages/Generator/GeneratorHistoryPage.xaml | 82 +++---
.../SendGroupingsPage/SendGroupingsPage.xaml | 89 +++----
.../SendGroupingsPage.xaml.cs | 21 +-
.../SendGroupingsPageListGroup.cs | 4 +-
.../SendGroupingsPageViewModel.cs | 6 -
src/App/Pages/Send/SendsPage.xaml | 13 +-
src/App/Pages/Send/SendsPage.xaml.cs | 7 +-
src/App/Pages/Settings/FoldersPage.xaml | 28 +-
src/App/Pages/Settings/FoldersPage.xaml.cs | 8 +-
.../Settings/SettingsPage/SettingsPage.xaml | 73 +++---
.../SettingsPage/SettingsPage.xaml.cs | 8 +-
src/App/Pages/Vault/AutofillCiphersPage.xaml | 45 ++--
.../Pages/Vault/AutofillCiphersPage.xaml.cs | 8 +-
src/App/Pages/Vault/CiphersPage.xaml | 13 +-
src/App/Pages/Vault/CiphersPage.xaml.cs | 7 +-
.../Vault/GroupingsPage/GroupingsPage.xaml | 100 ++++----
.../Vault/GroupingsPage/GroupingsPage.xaml.cs | 11 +-
.../GroupingsPage/GroupingsPageListItem.cs | 14 +-
src/App/Pages/Vault/PasswordHistoryPage.xaml | 82 +++---
src/App/Resources/AppResources.Designer.cs | 8 +-
src/App/Resources/AppResources.resx | 4 +
src/App/Styles/Android.xaml | 12 +-
src/App/Styles/Base.xaml | 18 +-
src/App/Styles/iOS.xaml | 23 +-
src/App/Utilities/IconGlyphConverter.cs | 64 +++++
src/App/Utilities/IconImageConverter.cs | 79 ++++++
src/App/Utilities/SendIconGlyphConverter.cs | 36 +++
src/iOS.Core/Services/DeviceActionService.cs | 7 +-
src/iOS.Core/Views/Toast.cs | 2 +-
src/iOS/iOS.csproj | 2 +-
53 files changed, 940 insertions(+), 1483 deletions(-)
delete mode 100644 src/Android/Renderers/CipherViewCellRenderer.cs
create mode 100644 src/Android/Renderers/ExtendedGridRenderer.cs
delete mode 100644 src/Android/Renderers/ExtendedListViewRenderer.cs
create mode 100644 src/Android/Renderers/ExtendedStackLayoutRenderer.cs
delete mode 100644 src/Android/Renderers/SendViewCellRenderer.cs
create mode 100644 src/Android/Resources/drawable/list_item_bg.xml
create mode 100644 src/Android/Resources/drawable/list_item_bg_dark.xml
create mode 100644 src/Android/Resources/drawable/list_item_bg_nord.xml
delete mode 100644 src/Android/Resources/layout/CipherViewCell.axml
delete mode 100644 src/Android/Resources/layout/SendViewCell.axml
create mode 100644 src/App/Controls/ExtendedCollectionView.cs
create mode 100644 src/App/Controls/ExtendedGrid.cs
delete mode 100644 src/App/Controls/ExtendedListView.cs
create mode 100644 src/App/Controls/ExtendedStackLayout.cs
create mode 100644 src/App/Utilities/IconGlyphConverter.cs
create mode 100644 src/App/Utilities/IconImageConverter.cs
create mode 100644 src/App/Utilities/SendIconGlyphConverter.cs
diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj
index e2b80aa9d..3ea651dfb 100644
--- a/src/Android/Android.csproj
+++ b/src/Android/Android.csproj
@@ -77,19 +77,19 @@
1.8.10
-
+
- 1.5.3.2
+ 1.6.1
121.0.1
-
-
-
-
-
-
+
+
+
+
+
+
117.0.0
@@ -120,18 +120,17 @@
-
+
+
-
-
@@ -173,6 +172,9 @@
+
+
+
@@ -185,7 +187,6 @@
-
@@ -262,12 +263,6 @@
Designer
-
-
- MSBuild:UpdateGeneratedFiles
- Designer
-
-
MSBuild:UpdateGeneratedFiles
diff --git a/src/Android/Renderers/CipherViewCellRenderer.cs b/src/Android/Renderers/CipherViewCellRenderer.cs
deleted file mode 100644
index 971bb091b..000000000
--- a/src/Android/Renderers/CipherViewCellRenderer.cs
+++ /dev/null
@@ -1,242 +0,0 @@
-using Android.App;
-using Android.Content;
-using Android.Graphics;
-using Android.Runtime;
-using Android.Util;
-using Android.Views;
-using Android.Views.InputMethods;
-using Android.Widget;
-using Bit.App.Controls;
-using Bit.App.Utilities;
-using Bit.Droid.Renderers;
-using FFImageLoading;
-using FFImageLoading.Views;
-using FFImageLoading.Work;
-using System;
-using System.ComponentModel;
-using Xamarin.Forms;
-using Xamarin.Forms.Platform.Android;
-
-[assembly: ExportRenderer(typeof(CipherViewCell), typeof(CipherViewCellRenderer))]
-namespace Bit.Droid.Renderers
-{
- public class CipherViewCellRenderer : ViewCellRenderer
- {
- private static Typeface _faTypeface;
- private static Typeface _miTypeface;
- private static Android.Graphics.Color _textColor;
- private static Android.Graphics.Color _mutedColor;
- private static Android.Graphics.Color _disabledIconColor;
- private static bool _usingLightTheme;
-
- private AndroidCipherCell _cell;
-
- protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView,
- ViewGroup parent, Context context)
- {
- // TODO expand beyond light/dark detection once we support custom theme switching without app restart
- var themeChanged = _usingLightTheme != ThemeManager.UsingLightTheme;
- if (_faTypeface == null)
- {
- _faTypeface = Typeface.CreateFromAsset(context.Assets, "FontAwesome.ttf");
- }
- if (_miTypeface == null)
- {
- _miTypeface = Typeface.CreateFromAsset(context.Assets, "MaterialIcons_Regular.ttf");
- }
- if (_textColor == default(Android.Graphics.Color) || themeChanged)
- {
- _textColor = ThemeManager.GetResourceColor("TextColor").ToAndroid();
- }
- if (_mutedColor == default(Android.Graphics.Color) || themeChanged)
- {
- _mutedColor = ThemeManager.GetResourceColor("MutedColor").ToAndroid();
- }
- if (_disabledIconColor == default(Android.Graphics.Color) || themeChanged)
- {
- _disabledIconColor = ThemeManager.GetResourceColor("DisabledIconColor").ToAndroid();
- }
- _usingLightTheme = ThemeManager.UsingLightTheme;
-
- var cipherCell = item as CipherViewCell;
- _cell = convertView as AndroidCipherCell;
- if (_cell == null)
- {
- _cell = new AndroidCipherCell(context, cipherCell, _faTypeface, _miTypeface);
- }
- else
- {
- _cell.CipherViewCell.PropertyChanged -= CellPropertyChanged;
- }
- cipherCell.PropertyChanged += CellPropertyChanged;
- _cell.UpdateCell(cipherCell);
- _cell.UpdateColors(_textColor, _mutedColor, _disabledIconColor);
- return _cell;
- }
-
- public void CellPropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- var cipherCell = sender as CipherViewCell;
- _cell.CipherViewCell = cipherCell;
- if (e.PropertyName == CipherViewCell.CipherProperty.PropertyName)
- {
- _cell.UpdateCell(cipherCell);
- }
- else if (e.PropertyName == CipherViewCell.WebsiteIconsEnabledProperty.PropertyName)
- {
- _cell.UpdateIconImage(cipherCell);
- }
- }
- }
-
- public class AndroidCipherCell : LinearLayout, INativeElementView
- {
- private readonly Typeface _faTypeface;
- private readonly Typeface _miTypeface;
-
- private IScheduledWork _currentTask;
-
- public AndroidCipherCell(Context context, CipherViewCell cipherView, Typeface faTypeface, Typeface miTypeface)
- : base(context)
- {
- CipherViewCell = cipherView;
- _faTypeface = faTypeface;
- _miTypeface = miTypeface;
-
- var view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.CipherViewCell, null);
- IconImage = view.FindViewById(Resource.Id.CipherCellIconImage);
- Icon = view.FindViewById(Resource.Id.CipherCellIcon);
- Name = view.FindViewById(Resource.Id.CipherCellName);
- SubTitle = view.FindViewById(Resource.Id.CipherCellSubTitle);
- SharedIcon = view.FindViewById(Resource.Id.CipherCellSharedIcon);
- AttachmentsIcon = view.FindViewById(Resource.Id.CipherCellAttachmentsIcon);
- MoreButton = view.FindViewById(Resource.Id.CipherCellButton);
- MoreButton.Click += MoreButton_Click;
-
- Icon.Typeface = _faTypeface;
- SharedIcon.Typeface = _faTypeface;
- AttachmentsIcon.Typeface = _faTypeface;
- MoreButton.Typeface = _miTypeface;
-
- var small = (float)Device.GetNamedSize(NamedSize.Small, typeof(Label));
- Icon.SetTextSize(ComplexUnitType.Pt, 10);
- Name.SetTextSize(ComplexUnitType.Sp, (float)Device.GetNamedSize(NamedSize.Medium, typeof(Label)));
- SubTitle.SetTextSize(ComplexUnitType.Sp, small);
- SharedIcon.SetTextSize(ComplexUnitType.Sp, small);
- AttachmentsIcon.SetTextSize(ComplexUnitType.Sp, small);
- MoreButton.SetTextSize(ComplexUnitType.Sp, 25);
-
- AddView(view);
- }
-
- public CipherViewCell CipherViewCell { get; set; }
- public Element Element => CipherViewCell;
-
- public IconImageView IconImage { get; set; }
- public TextView Icon { get; set; }
- public TextView Name { get; set; }
- public TextView SubTitle { get; set; }
- public TextView SharedIcon { get; set; }
- public TextView AttachmentsIcon { get; set; }
- public Android.Widget.Button MoreButton { get; set; }
-
- public void UpdateCell(CipherViewCell cipherCell)
- {
- UpdateIconImage(cipherCell);
-
- var cipher = cipherCell.Cipher;
- Name.Text = cipher.Name;
- if (!string.IsNullOrWhiteSpace(cipher.SubTitle))
- {
- SubTitle.Text = cipher.SubTitle;
- SubTitle.Visibility = ViewStates.Visible;
- }
- else
- {
- SubTitle.Visibility = ViewStates.Invisible;
- }
- SharedIcon.Visibility = cipher.Shared ? ViewStates.Visible : ViewStates.Gone;
- AttachmentsIcon.Visibility = cipher.HasAttachments ? ViewStates.Visible : ViewStates.Gone;
- }
-
- public void UpdateIconImage(CipherViewCell cipherCell)
- {
- if (_currentTask != null && !_currentTask.IsCancelled && !_currentTask.IsCompleted)
- {
- _currentTask.Cancel();
- }
-
- var cipher = cipherCell.Cipher;
-
- var iconImage = cipherCell.GetIconImage(cipher);
- if (iconImage.Item2 != null)
- {
- IconImage.SetImageResource(Resource.Drawable.login);
- IconImage.Visibility = ViewStates.Visible;
- Icon.Visibility = ViewStates.Gone;
- _currentTask = ImageService.Instance.LoadUrl(iconImage.Item2).DownSample(64).Into(IconImage);
- IconImage.Key = iconImage.Item2;
- }
- else
- {
- IconImage.Visibility = ViewStates.Gone;
- Icon.Visibility = ViewStates.Visible;
- Icon.Text = iconImage.Item1;
- }
- }
-
- public void UpdateColors(Android.Graphics.Color textColor, Android.Graphics.Color mutedColor,
- Android.Graphics.Color iconDisabledColor)
- {
- Name.SetTextColor(textColor);
- SubTitle.SetTextColor(mutedColor);
- Icon.SetTextColor(mutedColor);
- SharedIcon.SetTextColor(mutedColor);
- AttachmentsIcon.SetTextColor(mutedColor);
- MoreButton.SetTextColor(iconDisabledColor);
- }
-
- private void MoreButton_Click(object sender, EventArgs e)
- {
- if (CipherViewCell.ButtonCommand?.CanExecute(CipherViewCell.Cipher) ?? false)
- {
- CipherViewCell.ButtonCommand.Execute(CipherViewCell.Cipher);
- }
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- MoreButton.Click -= MoreButton_Click;
- }
- base.Dispose(disposing);
- }
- }
-
- [Android.Runtime.Preserve(AllMembers = true)]
- [Register("bit.droid.renderers.IconImageView")]
- public class IconImageView : ImageViewAsync
- {
- public IconImageView(Context context) : base(context)
- { }
-
- public IconImageView(IntPtr javaReference, JniHandleOwnership transfer)
- : base(javaReference, transfer)
- { }
-
- public IconImageView(Context context, IAttributeSet attrs)
- : base(context, attrs)
- { }
-
- public string Key { get; set; }
-
- protected override void JavaFinalize()
- {
- SetImageDrawable(null);
- SetImageBitmap(null);
- ImageService.Instance.InvalidateCacheEntryAsync(Key, FFImageLoading.Cache.CacheType.Memory);
- base.JavaFinalize();
- }
- }
-}
diff --git a/src/Android/Renderers/ExtendedGridRenderer.cs b/src/Android/Renderers/ExtendedGridRenderer.cs
new file mode 100644
index 000000000..050e0f011
--- /dev/null
+++ b/src/Android/Renderers/ExtendedGridRenderer.cs
@@ -0,0 +1,43 @@
+using Android.Content;
+using Bit.App.Controls;
+using Bit.App.Utilities;
+using Bit.Droid.Renderers;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Android;
+
+[assembly: ExportRenderer(typeof(ExtendedGrid), typeof(ExtendedGridRenderer))]
+namespace Bit.Droid.Renderers
+{
+ public class ExtendedGridRenderer : ViewRenderer
+ {
+ private static int? _bgResId;
+
+ public ExtendedGridRenderer(Context context) : base(context) { }
+
+ protected override void OnElementChanged(ElementChangedEventArgs elementChangedEvent)
+ {
+ base.OnElementChanged(elementChangedEvent);
+ if (elementChangedEvent.NewElement != null)
+ {
+ SetBackgroundResource(GetBgResId());
+ }
+ }
+
+ private int GetBgResId()
+ {
+ if (_bgResId == null)
+ {
+ if (ThemeManager.GetTheme(true) == "nord")
+ {
+ _bgResId = Resource.Drawable.list_item_bg_nord;
+ }
+ else
+ {
+ _bgResId ??= ThemeManager.UsingLightTheme ? Resource.Drawable.list_item_bg :
+ Resource.Drawable.list_item_bg_dark;
+ }
+ }
+ return _bgResId.Value;
+ }
+ }
+}
diff --git a/src/Android/Renderers/ExtendedListViewRenderer.cs b/src/Android/Renderers/ExtendedListViewRenderer.cs
deleted file mode 100644
index 963239825..000000000
--- a/src/Android/Renderers/ExtendedListViewRenderer.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using Android.Content;
-using Android.Views;
-using Bit.App.Controls;
-using Bit.Droid.Renderers;
-using Xamarin.Forms;
-using Xamarin.Forms.Platform.Android;
-
-[assembly: ExportRenderer(typeof(ExtendedListView), typeof(ExtendedListViewRenderer))]
-namespace Bit.Droid.Renderers
-{
- public class ExtendedListViewRenderer : ListViewRenderer
- {
- public ExtendedListViewRenderer(Context context)
- : base(context)
- { }
-
- protected override void OnElementChanged(ElementChangedEventArgs e)
- {
- base.OnElementChanged(e);
- if (Control != null && e.NewElement != null && e.NewElement is ExtendedListView listView)
- {
- // Pad for FAB
- Control.SetPadding(0, 0, 0, 170);
- Control.SetClipToPadding(false);
- Control.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
- }
- }
- }
-}
diff --git a/src/Android/Renderers/ExtendedStackLayoutRenderer.cs b/src/Android/Renderers/ExtendedStackLayoutRenderer.cs
new file mode 100644
index 000000000..7242ef825
--- /dev/null
+++ b/src/Android/Renderers/ExtendedStackLayoutRenderer.cs
@@ -0,0 +1,43 @@
+using Android.Content;
+using Bit.App.Controls;
+using Bit.App.Utilities;
+using Bit.Droid.Renderers;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Android;
+
+[assembly: ExportRenderer(typeof(ExtendedStackLayout), typeof(ExtendedStackLayoutRenderer))]
+namespace Bit.Droid.Renderers
+{
+ public class ExtendedStackLayoutRenderer : ViewRenderer
+ {
+ private static int? _bgResId;
+
+ public ExtendedStackLayoutRenderer(Context context) : base(context) { }
+
+ protected override void OnElementChanged(ElementChangedEventArgs elementChangedEvent)
+ {
+ base.OnElementChanged(elementChangedEvent);
+ if (elementChangedEvent.NewElement != null)
+ {
+ SetBackgroundResource(GetBgResId());
+ }
+ }
+
+ private int GetBgResId()
+ {
+ if (_bgResId == null)
+ {
+ if (ThemeManager.GetTheme(true) == "nord")
+ {
+ _bgResId = Resource.Drawable.list_item_bg_nord;
+ }
+ else
+ {
+ _bgResId ??= ThemeManager.UsingLightTheme ? Resource.Drawable.list_item_bg :
+ Resource.Drawable.list_item_bg_dark;
+ }
+ }
+ return _bgResId.Value;
+ }
+ }
+}
diff --git a/src/Android/Renderers/SendViewCellRenderer.cs b/src/Android/Renderers/SendViewCellRenderer.cs
deleted file mode 100644
index 5363bd374..000000000
--- a/src/Android/Renderers/SendViewCellRenderer.cs
+++ /dev/null
@@ -1,210 +0,0 @@
-using System;
-using System.ComponentModel;
-using Android.App;
-using Android.Content;
-using Android.Graphics;
-using Android.Util;
-using Android.Views;
-using Android.Widget;
-using Bit.App.Controls;
-using Bit.App.Utilities;
-using Bit.Droid.Renderers;
-using FFImageLoading.Work;
-using Xamarin.Forms;
-using Xamarin.Forms.Platform.Android;
-using Button = Android.Widget.Button;
-using Color = Android.Graphics.Color;
-using View = Android.Views.View;
-
-[assembly: ExportRenderer(typeof(SendViewCell), typeof(SendViewCellRenderer))]
-namespace Bit.Droid.Renderers
-{
- public class SendViewCellRenderer : ViewCellRenderer
- {
- private static Typeface _faTypeface;
- private static Typeface _miTypeface;
- private static Color _textColor;
- private static Color _mutedColor;
- private static Color _disabledIconColor;
- private static bool _usingLightTheme;
-
- private AndroidSendCell _cell;
-
- protected override View GetCellCore(Cell item, View convertView,
- ViewGroup parent, Context context)
- {
- // TODO expand beyond light/dark detection once we support custom theme switching without app restart
- var themeChanged = _usingLightTheme != ThemeManager.UsingLightTheme;
- if (_faTypeface == null)
- {
- _faTypeface = Typeface.CreateFromAsset(context.Assets, "FontAwesome.ttf");
- }
- if (_miTypeface == null)
- {
- _miTypeface = Typeface.CreateFromAsset(context.Assets, "MaterialIcons_Regular.ttf");
- }
- if (_textColor == default(Color) || themeChanged)
- {
- _textColor = ThemeManager.GetResourceColor("TextColor").ToAndroid();
- }
- if (_mutedColor == default(Color) || themeChanged)
- {
- _mutedColor = ThemeManager.GetResourceColor("MutedColor").ToAndroid();
- }
- if (_disabledIconColor == default(Color) || themeChanged)
- {
- _disabledIconColor = ThemeManager.GetResourceColor("DisabledIconColor").ToAndroid();
- }
- _usingLightTheme = ThemeManager.UsingLightTheme;
-
- var sendCell = item as SendViewCell;
- _cell = convertView as AndroidSendCell;
- if (_cell == null)
- {
- _cell = new AndroidSendCell(context, sendCell, _faTypeface, _miTypeface);
- }
- else
- {
- _cell.SendViewCell.PropertyChanged -= CellPropertyChanged;
- }
- sendCell.PropertyChanged += CellPropertyChanged;
- _cell.UpdateCell(sendCell);
- _cell.UpdateColors(_textColor, _mutedColor, _disabledIconColor);
- return _cell;
- }
-
- public void CellPropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- var sendCell = sender as SendViewCell;
- _cell.SendViewCell = sendCell;
- if (e.PropertyName == SendViewCell.SendProperty.PropertyName)
- {
- _cell.UpdateCell(sendCell);
- }
- }
- }
-
- public class AndroidSendCell : LinearLayout, INativeElementView
- {
- private readonly Typeface _faTypeface;
- private readonly Typeface _miTypeface;
-
- private IScheduledWork _currentTask;
-
- public AndroidSendCell(Context context, SendViewCell sendView, Typeface faTypeface, Typeface miTypeface)
- : base(context)
- {
- SendViewCell = sendView;
- _faTypeface = faTypeface;
- _miTypeface = miTypeface;
-
- var view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.SendViewCell, null);
- Icon = view.FindViewById(Resource.Id.SendCellIcon);
- Name = view.FindViewById(Resource.Id.SendCellName);
- SubTitle = view.FindViewById(Resource.Id.SendCellSubTitle);
- DisabledIcon = view.FindViewById(Resource.Id.SendCellDisabledIcon);
- HasPasswordIcon = view.FindViewById(Resource.Id.SendCellHasPasswordIcon);
- MaxAccessCountReachedIcon = view.FindViewById(Resource.Id.SendCellMaxAccessCountReachedIcon);
- ExpiredIcon = view.FindViewById(Resource.Id.SendCellExpiredIcon);
- PendingDeleteIcon = view.FindViewById(Resource.Id.SendCellPendingDeleteIcon);
- MoreButton = view.FindViewById
-
\ No newline at end of file
+
diff --git a/src/App/Controls/CipherViewCell/CipherViewCell.xaml b/src/App/Controls/CipherViewCell/CipherViewCell.xaml
index 44f6145a7..e49b8aea2 100644
--- a/src/App/Controls/CipherViewCell/CipherViewCell.xaml
+++ b/src/App/Controls/CipherViewCell/CipherViewCell.xaml
@@ -1,114 +1,111 @@
-
+
-
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ AutomationProperties.Name="{u:I18n Shared}" />
+
-
+
+
+
diff --git a/src/App/Controls/CipherViewCell/CipherViewCell.xaml.cs b/src/App/Controls/CipherViewCell/CipherViewCell.xaml.cs
index 85be2f34b..54b87c1e7 100644
--- a/src/App/Controls/CipherViewCell/CipherViewCell.xaml.cs
+++ b/src/App/Controls/CipherViewCell/CipherViewCell.xaml.cs
@@ -1,45 +1,26 @@
-using Bit.App.Pages;
-using Bit.Core;
-using Bit.Core.Abstractions;
-using Bit.Core.Enums;
+using System;
using Bit.Core.Models.View;
-using Bit.Core.Utilities;
-using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
- public partial class CipherViewCell : ViewCell
+ public partial class CipherViewCell : ExtendedGrid
{
public static readonly BindableProperty CipherProperty = BindableProperty.Create(
nameof(Cipher), typeof(CipherView), typeof(CipherViewCell), default(CipherView), BindingMode.OneWay);
public static readonly BindableProperty WebsiteIconsEnabledProperty = BindableProperty.Create(
- nameof(WebsiteIconsEnabled), typeof(bool), typeof(CipherViewCell), true, BindingMode.OneWay);
+ nameof(WebsiteIconsEnabled), typeof(bool?), typeof(CipherViewCell));
public static readonly BindableProperty ButtonCommandProperty = BindableProperty.Create(
nameof(ButtonCommand), typeof(Command), typeof(CipherViewCell));
- private readonly IEnvironmentService _environmentService;
-
- private CipherViewCellViewModel _viewModel;
- private bool _usingNativeCell;
-
public CipherViewCell()
{
- _environmentService = ServiceContainer.Resolve("environmentService");
- if (Device.RuntimePlatform == Device.iOS)
- {
- InitializeComponent();
- _viewModel = _grid.BindingContext as CipherViewCellViewModel;
- }
- else
- {
- _usingNativeCell = true;
- }
+ InitializeComponent();
}
- public bool WebsiteIconsEnabled
+ public bool? WebsiteIconsEnabled
{
get => (bool)GetValue(WebsiteIconsEnabledProperty);
set => SetValue(WebsiteIconsEnabledProperty, value);
@@ -60,130 +41,31 @@ namespace Bit.App.Controls
protected override void OnPropertyChanged(string propertyName = null)
{
base.OnPropertyChanged(propertyName);
- if (_usingNativeCell)
- {
- return;
- }
if (propertyName == CipherProperty.PropertyName)
{
- _viewModel.Cipher = Cipher;
+ if (Cipher == null)
+ {
+ return;
+ }
+ BindingContext = new CipherViewCellViewModel(Cipher, WebsiteIconsEnabled ?? false);
}
- }
-
- protected override void OnBindingContextChanged()
- {
- base.OnBindingContextChanged();
- if (_usingNativeCell)
+ else if (propertyName == WebsiteIconsEnabledProperty.PropertyName)
{
- return;
+ if (Cipher == null)
+ {
+ return;
+ }
+ ((CipherViewCellViewModel)BindingContext).WebsiteIconsEnabled = WebsiteIconsEnabled ?? false;
}
-
- _image.Source = null;
- CipherView cipher = null;
- if (BindingContext is GroupingsPageListItem groupingsPageListItem)
- {
- cipher = groupingsPageListItem.Cipher;
- }
- else if (BindingContext is CipherView cv)
- {
- cipher = cv;
- }
- if (cipher != null)
- {
- var iconImage = GetIconImage(cipher);
- if (iconImage.Item2 != null)
- {
- _image.IsVisible = true;
- _icon.IsVisible = false;
- _image.Source = iconImage.Item2;
- _image.LoadingPlaceholder = "login.png";
- }
- else
- {
- _image.IsVisible = false;
- _icon.IsVisible = true;
- _icon.Text = iconImage.Item1;
- }
- }
- }
-
- public Tuple GetIconImage(CipherView cipher)
- {
- string icon = null;
- string image = null;
- switch (cipher.Type)
- {
- case CipherType.Login:
- var loginIconImage = GetLoginIconImage(cipher);
- icon = loginIconImage.Item1;
- image = loginIconImage.Item2;
- break;
- case CipherType.SecureNote:
- icon = "";
- break;
- case CipherType.Card:
- icon = "";
- break;
- case CipherType.Identity:
- icon = "";
- break;
- default:
- break;
- }
- return new Tuple(icon, image);
- }
-
- private Tuple GetLoginIconImage(CipherView cipher)
- {
- string icon = "";
- string image = null;
- if (cipher.Login.Uri != null)
- {
- var hostnameUri = cipher.Login.Uri;
- var isWebsite = false;
-
- if (hostnameUri.StartsWith(Constants.AndroidAppProtocol))
- {
- icon = "";
- }
- else if (hostnameUri.StartsWith(Constants.iOSAppProtocol))
- {
- icon = "";
- }
- else if (WebsiteIconsEnabled && !hostnameUri.Contains("://") && hostnameUri.Contains("."))
- {
- hostnameUri = string.Concat("http://", hostnameUri);
- isWebsite = true;
- }
- else if (WebsiteIconsEnabled)
- {
- isWebsite = hostnameUri.StartsWith("http") && hostnameUri.Contains(".");
- }
-
- if (WebsiteIconsEnabled && isWebsite)
- {
- var hostname = CoreHelpers.GetHostname(hostnameUri);
- var iconsUrl = _environmentService.IconsUrl;
- if (string.IsNullOrWhiteSpace(iconsUrl))
- {
- if (!string.IsNullOrWhiteSpace(_environmentService.BaseUrl))
- {
- iconsUrl = string.Format("{0}/icons", _environmentService.BaseUrl);
- }
- else
- {
- iconsUrl = "https://icons.bitwarden.net";
- }
- }
- image = string.Format("{0}/{1}/icon.png", iconsUrl, hostname);
- }
- }
- return new Tuple(icon, image);
}
private void MoreButton_Clicked(object sender, EventArgs e)
{
- ButtonCommand?.Execute(Cipher);
+ var cipher = ((sender as MiButton)?.BindingContext as CipherViewCellViewModel)?.Cipher;
+ if (cipher != null)
+ {
+ ButtonCommand?.Execute(cipher);
+ }
}
}
}
diff --git a/src/App/Controls/CipherViewCell/CipherViewCellViewModel.cs b/src/App/Controls/CipherViewCell/CipherViewCellViewModel.cs
index 728b3591c..a3342b6ce 100644
--- a/src/App/Controls/CipherViewCell/CipherViewCellViewModel.cs
+++ b/src/App/Controls/CipherViewCell/CipherViewCellViewModel.cs
@@ -6,11 +6,30 @@ namespace Bit.App.Controls
public class CipherViewCellViewModel : ExtendedViewModel
{
private CipherView _cipher;
+ private bool _websiteIconsEnabled;
+
+ public CipherViewCellViewModel(CipherView cipherView, bool websiteIconsEnabled)
+ {
+ Cipher = cipherView;
+ WebsiteIconsEnabled = websiteIconsEnabled;
+ }
public CipherView Cipher
{
get => _cipher;
set => SetProperty(ref _cipher, value);
}
+
+ public bool WebsiteIconsEnabled
+ {
+ get => _websiteIconsEnabled;
+ set => SetProperty(ref _websiteIconsEnabled, value);
+ }
+
+ public bool ShowIconImage
+ {
+ get => WebsiteIconsEnabled && !string.IsNullOrWhiteSpace(Cipher.Login?.Uri) &&
+ Cipher.Login.Uri.StartsWith("http");
+ }
}
}
diff --git a/src/App/Controls/ExtendedCollectionView.cs b/src/App/Controls/ExtendedCollectionView.cs
new file mode 100644
index 000000000..fa44c31ee
--- /dev/null
+++ b/src/App/Controls/ExtendedCollectionView.cs
@@ -0,0 +1,8 @@
+using Xamarin.Forms;
+
+namespace Bit.App.Controls
+{
+ public class ExtendedCollectionView : CollectionView
+ {
+ }
+}
diff --git a/src/App/Controls/ExtendedGrid.cs b/src/App/Controls/ExtendedGrid.cs
new file mode 100644
index 000000000..77e072aef
--- /dev/null
+++ b/src/App/Controls/ExtendedGrid.cs
@@ -0,0 +1,8 @@
+using Xamarin.Forms;
+
+namespace Bit.App.Controls
+{
+ public class ExtendedGrid : Grid
+ {
+ }
+}
diff --git a/src/App/Controls/ExtendedListView.cs b/src/App/Controls/ExtendedListView.cs
deleted file mode 100644
index 814abae35..000000000
--- a/src/App/Controls/ExtendedListView.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Xamarin.Forms;
-
-namespace Bit.App.Controls
-{
- public class ExtendedListView : ListView
- {
- public ExtendedListView() { }
-
- public ExtendedListView(ListViewCachingStrategy cachingStrategy)
- : base(cachingStrategy) { }
- }
-}
diff --git a/src/App/Controls/ExtendedStackLayout.cs b/src/App/Controls/ExtendedStackLayout.cs
new file mode 100644
index 000000000..3e5c48439
--- /dev/null
+++ b/src/App/Controls/ExtendedStackLayout.cs
@@ -0,0 +1,8 @@
+using Xamarin.Forms;
+
+namespace Bit.App.Controls
+{
+ public class ExtendedStackLayout : StackLayout
+ {
+ }
+}
diff --git a/src/App/Controls/SendViewCell/SendViewCell.xaml b/src/App/Controls/SendViewCell/SendViewCell.xaml
index 1cd4e5f38..9103786fb 100644
--- a/src/App/Controls/SendViewCell/SendViewCell.xaml
+++ b/src/App/Controls/SendViewCell/SendViewCell.xaml
@@ -1,137 +1,132 @@
-
+
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+ AutomationProperties.Name="{u:I18n Disabled}" />
+
+
+
+
-
\ No newline at end of file
+
+
+
diff --git a/src/App/Controls/SendViewCell/SendViewCell.xaml.cs b/src/App/Controls/SendViewCell/SendViewCell.xaml.cs
index b75a32005..afa7c4922 100644
--- a/src/App/Controls/SendViewCell/SendViewCell.xaml.cs
+++ b/src/App/Controls/SendViewCell/SendViewCell.xaml.cs
@@ -1,14 +1,10 @@
using System;
-using Bit.App.Pages;
-using Bit.Core.Abstractions;
-using Bit.Core.Enums;
using Bit.Core.Models.View;
-using Bit.Core.Utilities;
using Xamarin.Forms;
namespace Bit.App.Controls
{
- public partial class SendViewCell : ViewCell
+ public partial class SendViewCell : ExtendedGrid
{
public static readonly BindableProperty SendProperty = BindableProperty.Create(
nameof(Send), typeof(SendView), typeof(SendViewCell), default(SendView), BindingMode.OneWay);
@@ -17,25 +13,11 @@ namespace Bit.App.Controls
nameof(ButtonCommand), typeof(Command), typeof(SendViewCell));
public static readonly BindableProperty ShowOptionsProperty = BindableProperty.Create(
- nameof(ShowOptions), typeof(bool), typeof(SendViewCell));
-
- private readonly IEnvironmentService _environmentService;
-
- private SendViewCellViewModel _viewModel;
- private bool _usingNativeCell;
+ nameof(ShowOptions), typeof(bool), typeof(SendViewCell), true, BindingMode.OneWay);
public SendViewCell()
{
- _environmentService = ServiceContainer.Resolve("environmentService");
- if (Device.RuntimePlatform == Device.iOS)
- {
- InitializeComponent();
- _viewModel = _grid.BindingContext as SendViewCellViewModel;
- }
- else
- {
- _usingNativeCell = true;
- }
+ InitializeComponent();
}
public SendView Send
@@ -52,72 +34,30 @@ namespace Bit.App.Controls
public bool ShowOptions
{
- get => GetValue(ShowOptionsProperty) is bool && (bool)GetValue(ShowOptionsProperty);
+ get => (bool)GetValue(ShowOptionsProperty);
set => SetValue(ShowOptionsProperty, value);
}
protected override void OnPropertyChanged(string propertyName = null)
{
base.OnPropertyChanged(propertyName);
- if (_usingNativeCell)
- {
- return;
- }
if (propertyName == SendProperty.PropertyName)
{
- _viewModel.Send = Send;
+ if (Send == null)
+ {
+ return;
+ }
+ BindingContext = new SendViewCellViewModel(Send, ShowOptions);
}
- else if (propertyName == ShowOptionsProperty.PropertyName)
- {
- _viewModel.ShowOptions = ShowOptions;
- }
- }
-
- protected override void OnBindingContextChanged()
- {
- base.OnBindingContextChanged();
- if (_usingNativeCell)
- {
- return;
- }
-
- SendView send = null;
- if (BindingContext is SendGroupingsPageListItem sendGroupingsPageListItem)
- {
- send = sendGroupingsPageListItem.Send;
- }
- else if (BindingContext is SendView sv)
- {
- send = sv;
- }
- if (send != null)
- {
- var iconImage = GetIconImage(send);
- _icon.IsVisible = true;
- _icon.Text = iconImage;
- }
- }
-
- public string GetIconImage(SendView send)
- {
- string icon = null;
- switch (send.Type)
- {
- case SendType.Text:
- icon = "\uf0f6"; // fa-file-text-o
- break;
- case SendType.File:
- icon = "\uf016"; // fa-file-o
- break;
- default:
- break;
- }
- return icon;
}
private void MoreButton_Clicked(object sender, EventArgs e)
{
- ButtonCommand?.Execute(Send);
+ var send = ((sender as MiButton)?.BindingContext as SendViewCellViewModel)?.Send;
+ if (send != null)
+ {
+ ButtonCommand?.Execute(send);
+ }
}
}
}
diff --git a/src/App/Controls/SendViewCell/SendViewCellViewModel.cs b/src/App/Controls/SendViewCell/SendViewCellViewModel.cs
index 3f10447ce..63f6f3704 100644
--- a/src/App/Controls/SendViewCell/SendViewCellViewModel.cs
+++ b/src/App/Controls/SendViewCell/SendViewCellViewModel.cs
@@ -8,6 +8,12 @@ namespace Bit.App.Controls
private SendView _send;
private bool _showOptions;
+ public SendViewCellViewModel(SendView sendView, bool showOptions)
+ {
+ Send = sendView;
+ ShowOptions = showOptions;
+ }
+
public SendView Send
{
get => _send;
diff --git a/src/App/Pages/Generator/GeneratorHistoryPage.xaml b/src/App/Pages/Generator/GeneratorHistoryPage.xaml
index fb2833ae2..0bf1af963 100644
--- a/src/App/Pages/Generator/GeneratorHistoryPage.xaml
+++ b/src/App/Pages/Generator/GeneratorHistoryPage.xaml
@@ -43,57 +43,53 @@
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
HorizontalTextAlignment="Center">
-
-
+
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
+
+
diff --git a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml
index 2bfbb0e52..0e2f2ca05 100644
--- a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml
+++ b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml
@@ -44,34 +44,32 @@
+ ShowOptions="{Binding BindingContext.SendEnabled, Source={x:Reference _page}}" />
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ Text="{u:I18n AddASend}"
+ Clicked="AddButton_Clicked" />
-
-
- RecycleElement
-
+ Command="{Binding RefreshCommand}">
+
-
-
-
+
+
@@ -146,10 +137,10 @@
-
-
-
-
+
+
+
+
diff --git a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs
index 7430efc49..0f72a8401 100644
--- a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs
+++ b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs
@@ -20,14 +20,13 @@ namespace Bit.App.Pages
private readonly string _pageName;
private AppOptions _appOptions;
- private PreviousPageInfo _previousPage;
public SendGroupingsPage(bool mainPage, SendType? type = null, string pageTitle = null,
- AppOptions appOptions = null, PreviousPageInfo previousPage = null)
+ AppOptions appOptions = null)
{
- _pageName = string.Concat(nameof(GroupingsPage), "_", DateTime.UtcNow.Ticks);
+ _pageName = string.Concat(nameof(SendGroupingsPage), "_", DateTime.UtcNow.Ticks);
InitializeComponent();
- ListView = _listView;
+ SetActivityIndicator(_mainContent);
_broadcasterService = ServiceContainer.Resolve("broadcasterService");
_syncService = ServiceContainer.Resolve("syncService");
_vaultTimeoutService = ServiceContainer.Resolve("vaultTimeoutService");
@@ -37,7 +36,6 @@ namespace Bit.App.Pages
_vm.MainPage = mainPage;
_vm.Type = type;
_appOptions = appOptions;
- _previousPage = previousPage;
if (pageTitle != null)
{
_vm.PageTitle = pageTitle;
@@ -46,7 +44,10 @@ namespace Bit.App.Pages
if (Device.RuntimePlatform == Device.iOS)
{
_absLayout.Children.Remove(_fab);
- ToolbarItems.Add(_aboutIconItem);
+ if (type == null)
+ {
+ ToolbarItems.Add(_aboutIconItem);
+ }
ToolbarItems.Add(_addItem);
}
else
@@ -57,8 +58,6 @@ namespace Bit.App.Pages
}
}
- public ExtendedListView ListView { get; set; }
-
protected override async void OnAppearing()
{
base.OnAppearing();
@@ -136,14 +135,14 @@ namespace Bit.App.Pages
}
}
- private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ private async void RowSelected(object sender, SelectionChangedEventArgs e)
{
- ((ListView)sender).SelectedItem = null;
+ ((ExtendedCollectionView)sender).SelectedItem = null;
if (!DoOnce())
{
return;
}
- if (!(e.SelectedItem is SendGroupingsPageListItem item))
+ if (!(e.CurrentSelection?.FirstOrDefault() is SendGroupingsPageListItem item))
{
return;
}
diff --git a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageListGroup.cs b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageListGroup.cs
index 2724c7fc2..f3d805f35 100644
--- a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageListGroup.cs
+++ b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageListGroup.cs
@@ -7,10 +7,10 @@ namespace Bit.App.Pages
public SendGroupingsPageListGroup(string name, int count, bool doUpper = true, bool first = false)
: this(new List(), name, count, doUpper, first) { }
- public SendGroupingsPageListGroup(List groupItems, string name, int count,
+ public SendGroupingsPageListGroup(List sendGroupItems, string name, int count,
bool doUpper = true, bool first = false)
{
- AddRange(groupItems);
+ AddRange(sendGroupItems);
if (string.IsNullOrWhiteSpace(name))
{
Name = "-";
diff --git a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs
index 3b40132b9..71ca0de10 100644
--- a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs
+++ b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs
@@ -23,7 +23,6 @@ namespace Bit.App.Pages
private bool _doingLoad;
private bool _loading;
private bool _loaded;
- private bool _showAddSendButton;
private bool _showNoData;
private bool _showList;
private bool _syncRefreshing;
@@ -91,11 +90,6 @@ namespace Bit.App.Pages
get => _loaded;
set => SetProperty(ref _loaded, value);
}
- public bool ShowAddSendButton
- {
- get => _showAddSendButton;
- set => SetProperty(ref _showAddSendButton, value);
- }
public bool ShowNoData
{
get => _showNoData;
diff --git a/src/App/Pages/Send/SendsPage.xaml b/src/App/Pages/Send/SendsPage.xaml
index 93146392e..40557f8f4 100644
--- a/src/App/Pages/Send/SendsPage.xaml
+++ b/src/App/Pages/Send/SendsPage.xaml
@@ -60,23 +60,22 @@
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
HorizontalTextAlignment="Center" />
-
-
+
-
-
+
+
\ No newline at end of file
diff --git a/src/App/Pages/Send/SendsPage.xaml.cs b/src/App/Pages/Send/SendsPage.xaml.cs
index 09937ca6f..11096d74b 100644
--- a/src/App/Pages/Send/SendsPage.xaml.cs
+++ b/src/App/Pages/Send/SendsPage.xaml.cs
@@ -1,4 +1,5 @@
using System;
+using Bit.App.Controls;
using Bit.App.Resources;
using Bit.Core.Models.View;
using Xamarin.Forms;
@@ -87,15 +88,15 @@ namespace Bit.App.Pages
Navigation.PopModalAsync(false);
}
- private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ private async void RowSelected(object sender, SelectionChangedEventArgs e)
{
- ((ListView)sender).SelectedItem = null;
+ ((ExtendedCollectionView)sender).SelectedItem = null;
if (!DoOnce())
{
return;
}
- if (e.SelectedItem is SendView send)
+ if (e.CurrentSelection is SendView send)
{
await _vm.SelectSendAsync(send);
}
diff --git a/src/App/Pages/Settings/FoldersPage.xaml b/src/App/Pages/Settings/FoldersPage.xaml
index c4ef5714f..ed05c5fb0 100644
--- a/src/App/Pages/Settings/FoldersPage.xaml
+++ b/src/App/Pages/Settings/FoldersPage.xaml
@@ -32,27 +32,25 @@
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
HorizontalTextAlignment="Center">
-
-
+
-
-
-
-
-
+
+
+
-
-
+
+
diff --git a/src/App/Pages/Settings/FoldersPage.xaml.cs b/src/App/Pages/Settings/FoldersPage.xaml.cs
index 58f948e39..723302cff 100644
--- a/src/App/Pages/Settings/FoldersPage.xaml.cs
+++ b/src/App/Pages/Settings/FoldersPage.xaml.cs
@@ -1,5 +1,7 @@
using Bit.Core.Models.View;
using System;
+using System.Linq;
+using Bit.App.Controls;
using Xamarin.Forms;
namespace Bit.App.Pages
@@ -32,14 +34,14 @@ namespace Bit.App.Pages
}, _mainContent);
}
- private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ private async void RowSelected(object sender, SelectionChangedEventArgs e)
{
- ((ListView)sender).SelectedItem = null;
+ ((ExtendedCollectionView)sender).SelectedItem = null;
if (!DoOnce())
{
return;
}
- if (!(e.SelectedItem is FolderView folder))
+ if (!(e.CurrentSelection?.FirstOrDefault() is FolderView folder))
{
return;
}
diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml
index a49cff04d..d9a969b9b 100644
--- a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml
+++ b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml
@@ -19,23 +19,21 @@
-
-
-
-
-
-
+
+
+
+
-
-
+
-
-
-
-
-
-
-
+
+
+
+
-
+
+
-
-
+
+
diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs
index a6dc34c41..44c1b6774 100644
--- a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs
+++ b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs
@@ -1,7 +1,9 @@
using Bit.App.Abstractions;
using Bit.App.Resources;
using Bit.Core.Utilities;
+using System.Linq;
using System.Threading.Tasks;
+using Bit.App.Controls;
using Xamarin.Forms;
namespace Bit.App.Pages
@@ -41,14 +43,14 @@ namespace Bit.App.Pages
return base.OnBackButtonPressed();
}
- private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ private async void RowSelected(object sender, SelectionChangedEventArgs e)
{
- ((ListView)sender).SelectedItem = null;
+ ((ExtendedCollectionView)sender).SelectedItem = null;
if (!DoOnce())
{
return;
}
- if (!(e.SelectedItem is SettingsPageListItem item))
+ if (!(e.CurrentSelection?.FirstOrDefault() is SettingsPageListItem item))
{
return;
}
diff --git a/src/App/Pages/Vault/AutofillCiphersPage.xaml b/src/App/Pages/Vault/AutofillCiphersPage.xaml
index 6465d89d4..8b9bdeff0 100644
--- a/src/App/Pages/Vault/AutofillCiphersPage.xaml
+++ b/src/App/Pages/Vault/AutofillCiphersPage.xaml
@@ -47,40 +47,35 @@
Clicked="AddButton_Clicked">
-
-
- RecycleElement
-
-
+
-
-
-
-
-
-
-
+
+
+
+
+
-
+
-
-
+
+
diff --git a/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs b/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs
index 4834bbeb8..08350d032 100644
--- a/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs
+++ b/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs
@@ -4,7 +4,9 @@ using Bit.Core.Abstractions;
using Bit.Core.Enums;
using Bit.Core.Utilities;
using System;
+using System.Linq;
using System.Threading.Tasks;
+using Bit.App.Controls;
using Xamarin.Forms;
namespace Bit.App.Pages
@@ -44,14 +46,14 @@ namespace Bit.App.Pages
}, _mainContent);
}
- private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ private async void RowSelected(object sender, SelectionChangedEventArgs e)
{
- ((ListView)sender).SelectedItem = null;
+ ((ExtendedCollectionView)sender).SelectedItem = null;
if (!DoOnce())
{
return;
}
- if (e.SelectedItem is GroupingsPageListItem item && item.Cipher != null)
+ if (e.CurrentSelection?.FirstOrDefault() is GroupingsPageListItem item && item.Cipher != null)
{
await _vm.SelectCipherAsync(item.Cipher, item.FuzzyAutofill);
}
diff --git a/src/App/Pages/Vault/CiphersPage.xaml b/src/App/Pages/Vault/CiphersPage.xaml
index 81b63b2a9..2857385b1 100644
--- a/src/App/Pages/Vault/CiphersPage.xaml
+++ b/src/App/Pages/Vault/CiphersPage.xaml
@@ -60,15 +60,14 @@
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
HorizontalTextAlignment="Center" />
-
-
+
-
-
+
+
diff --git a/src/App/Pages/Vault/CiphersPage.xaml.cs b/src/App/Pages/Vault/CiphersPage.xaml.cs
index c019dd726..ea3357b44 100644
--- a/src/App/Pages/Vault/CiphersPage.xaml.cs
+++ b/src/App/Pages/Vault/CiphersPage.xaml.cs
@@ -3,6 +3,7 @@ using Bit.App.Resources;
using Bit.Core.Models.View;
using Bit.Core.Utilities;
using System;
+using Bit.App.Controls;
using Xamarin.Forms;
namespace Bit.App.Pages
@@ -119,15 +120,15 @@ namespace Bit.App.Pages
}
}
- private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ private async void RowSelected(object sender, SelectionChangedEventArgs e)
{
- ((ListView)sender).SelectedItem = null;
+ ((ExtendedCollectionView)sender).SelectedItem = null;
if (!DoOnce())
{
return;
}
- if (e.SelectedItem is CipherView cipher)
+ if (e.CurrentSelection is CipherView cipher)
{
await _vm.SelectCipherAsync(cipher);
}
diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml
index 353d3f102..19a08c975 100644
--- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml
+++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml
@@ -1,14 +1,14 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Bit.App.Pages.GroupingsPage"
+ xmlns:pages="clr-namespace:Bit.App.Pages"
+ xmlns:u="clr-namespace:Bit.App.Utilities"
+ xmlns:effects="clr-namespace:Bit.App.Effects"
+ xmlns:controls="clr-namespace:Bit.App.Controls"
+ x:DataType="pages:GroupingsPageViewModel"
+ Title="{Binding PageTitle}"
+ x:Name="_page">
@@ -45,29 +45,27 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
- RecycleElement
-
+ Command="{Binding RefreshCommand}">
+
-
-
-
+
+
@@ -126,10 +118,10 @@
-
-
-
-
+
+
+
+
diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs
index 4a9584d03..ba63e395d 100644
--- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs
+++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs
@@ -1,5 +1,4 @@
using Bit.App.Abstractions;
-using Bit.App.Controls;
using Bit.App.Models;
using Bit.App.Resources;
using Bit.Core;
@@ -9,6 +8,7 @@ using Bit.Core.Utilities;
using System;
using System.Linq;
using System.Threading.Tasks;
+using Bit.App.Controls;
using Xamarin.Forms;
namespace Bit.App.Pages
@@ -33,7 +33,6 @@ namespace Bit.App.Pages
{
_pageName = string.Concat(nameof(GroupingsPage), "_", DateTime.UtcNow.Ticks);
InitializeComponent();
- ListView = _listView;
SetActivityIndicator(_mainContent);
_broadcasterService = ServiceContainer.Resolve("broadcasterService");
_syncService = ServiceContainer.Resolve("syncService");
@@ -73,8 +72,6 @@ namespace Bit.App.Pages
}
}
- public ExtendedListView ListView { get; set; }
-
protected async override void OnAppearing()
{
base.OnAppearing();
@@ -197,14 +194,14 @@ namespace Bit.App.Pages
_vm.DisableRefreshing();
}
- private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ private async void RowSelected(object sender, SelectionChangedEventArgs e)
{
- ((ListView)sender).SelectedItem = null;
+ ((ExtendedCollectionView)sender).SelectedItem = null;
if (!DoOnce())
{
return;
}
- if (!(e.SelectedItem is GroupingsPageListItem item))
+ if (!(e.CurrentSelection?.FirstOrDefault() is GroupingsPageListItem item))
{
return;
}
diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPageListItem.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPageListItem.cs
index e72df7fb1..f1c363ae8 100644
--- a/src/App/Pages/Vault/GroupingsPage/GroupingsPageListItem.cs
+++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPageListItem.cs
@@ -75,30 +75,30 @@ namespace Bit.App.Pages
}
else if (Folder != null)
{
- _icon = Folder.Id == null ? "" : "";
+ _icon = Folder.Id == null ? "\uf115" : "\uf07c"; // fa-folder-open-o : fa-folder-open
}
else if (Collection != null)
{
- _icon = "";
+ _icon = "\uf1b2"; // fa-cube
}
else if (Type != null)
{
switch (Type.Value)
{
case CipherType.Login:
- _icon = "";
+ _icon = "\uf0ac"; // fa-globe
break;
case CipherType.SecureNote:
- _icon = "";
+ _icon = "\uf24a"; // fa-sticky-note-o
break;
case CipherType.Card:
- _icon = "";
+ _icon = "\uf09d"; // fa-credit-card
break;
case CipherType.Identity:
- _icon = "";
+ _icon = "\uf2c3"; // fa-id-card-o
break;
default:
- _icon = "";
+ _icon = "\uf0ac"; // fa-globe
break;
}
}
diff --git a/src/App/Pages/Vault/PasswordHistoryPage.xaml b/src/App/Pages/Vault/PasswordHistoryPage.xaml
index 3e7facefa..680261a12 100644
--- a/src/App/Pages/Vault/PasswordHistoryPage.xaml
+++ b/src/App/Pages/Vault/PasswordHistoryPage.xaml
@@ -34,57 +34,53 @@
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
HorizontalTextAlignment="Center">
-
-
+
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
+
+
diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs
index db4e20abb..768226b75 100644
--- a/src/App/Resources/AppResources.Designer.cs
+++ b/src/App/Resources/AppResources.Designer.cs
@@ -1,7 +1,6 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -10,7 +9,6 @@
namespace Bit.App.Resources {
using System;
- using System.Reflection;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
@@ -3371,6 +3369,12 @@ namespace Bit.App.Resources {
}
}
+ public static string AddASend {
+ get {
+ return ResourceManager.GetString("AddASend", resourceCulture);
+ }
+ }
+
public static string CopyLink {
get {
return ResourceManager.GetString("CopyLink", resourceCulture);
diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx
index b683734ac..94c7c1b9e 100644
--- a/src/App/Resources/AppResources.resx
+++ b/src/App/Resources/AppResources.resx
@@ -1904,6 +1904,10 @@
There are no Sends in your account.
'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.
+
+ Add a Send
+ 'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.
+
Copy Link
diff --git a/src/App/Styles/Android.xaml b/src/App/Styles/Android.xaml
index c4930bc45..24a7f691d 100644
--- a/src/App/Styles/Android.xaml
+++ b/src/App/Styles/Android.xaml
@@ -68,10 +68,10 @@
-
+
+
-
+
+
+
diff --git a/src/App/Styles/iOS.xaml b/src/App/Styles/iOS.xaml
index 5b918a137..6b245bfe6 100644
--- a/src/App/Styles/iOS.xaml
+++ b/src/App/Styles/iOS.xaml
@@ -51,11 +51,14 @@
-
+
@@ -127,15 +130,19 @@
Class="list-section-separator-bottom-platform">
-
+
+