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 - - - 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"> - + +