diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index c7b6ccf0e..80e469bfb 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -299,6 +299,21 @@ + + + + + + + + + + + + + + + diff --git a/src/Android/Controls/ExtendedTextCellRenderer.cs b/src/Android/Controls/ExtendedTextCellRenderer.cs index 06bb30c73..8e68fa4a5 100644 --- a/src/Android/Controls/ExtendedTextCellRenderer.cs +++ b/src/Android/Controls/ExtendedTextCellRenderer.cs @@ -33,9 +33,9 @@ namespace Bit.Android.Controls resourceId = context.Resources.GetIdentifier(fileName, "drawable", context.PackageName); } - var image = new ImageView(context); + var image = new DisclosureImage(context, extendedCell); image.SetImageResource(resourceId); - image.SetPadding(0, 0, 30, 0); + image.SetPadding(10, 10, 30, 10); View.SetAccessoryView(image); } } @@ -43,6 +43,30 @@ namespace Bit.Android.Controls return View; } + private class DisclosureImage : ImageView + { + private ExtendedTextCell _cell; + + public DisclosureImage(Context context, ExtendedTextCell cell) : base(context) + { + _cell = cell; + } + + public override bool OnTouchEvent(MotionEvent e) + { + switch(e.Action) + { + case MotionEventActions.Up: + _cell.OnDisclousureTapped(); + break; + default: + break; + } + + return true; + } + } + protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args) { base.OnCellPropertyChanged(sender, args); diff --git a/src/Android/Resources/Resource.Designer.cs b/src/Android/Resources/Resource.Designer.cs index 11e763df3..0e1761d02 100644 --- a/src/Android/Resources/Resource.Designer.cs +++ b/src/Android/Resources/Resource.Designer.cs @@ -2274,58 +2274,61 @@ namespace Bit.Android public const int ion_plus = 2130837656; // aapt resource value: 0x7f020099 - public const int mr_dialog_material_background_dark = 2130837657; + public const int more = 2130837657; // aapt resource value: 0x7f02009a - public const int mr_dialog_material_background_light = 2130837658; + public const int mr_dialog_material_background_dark = 2130837658; // aapt resource value: 0x7f02009b - public const int mr_ic_audiotrack_light = 2130837659; + public const int mr_dialog_material_background_light = 2130837659; // aapt resource value: 0x7f02009c - public const int mr_ic_cast_dark = 2130837660; + public const int mr_ic_audiotrack_light = 2130837660; // aapt resource value: 0x7f02009d - public const int mr_ic_cast_light = 2130837661; + public const int mr_ic_cast_dark = 2130837661; // aapt resource value: 0x7f02009e - public const int mr_ic_close_dark = 2130837662; + public const int mr_ic_cast_light = 2130837662; // aapt resource value: 0x7f02009f - public const int mr_ic_close_light = 2130837663; + public const int mr_ic_close_dark = 2130837663; // aapt resource value: 0x7f0200a0 - public const int mr_ic_media_route_connecting_mono_dark = 2130837664; + public const int mr_ic_close_light = 2130837664; // aapt resource value: 0x7f0200a1 - public const int mr_ic_media_route_connecting_mono_light = 2130837665; + public const int mr_ic_media_route_connecting_mono_dark = 2130837665; // aapt resource value: 0x7f0200a2 - public const int mr_ic_media_route_mono_dark = 2130837666; + public const int mr_ic_media_route_connecting_mono_light = 2130837666; // aapt resource value: 0x7f0200a3 - public const int mr_ic_media_route_mono_light = 2130837667; + public const int mr_ic_media_route_mono_dark = 2130837667; // aapt resource value: 0x7f0200a4 - public const int mr_ic_pause_dark = 2130837668; + public const int mr_ic_media_route_mono_light = 2130837668; // aapt resource value: 0x7f0200a5 - public const int mr_ic_pause_light = 2130837669; + public const int mr_ic_pause_dark = 2130837669; // aapt resource value: 0x7f0200a6 - public const int mr_ic_play_dark = 2130837670; + public const int mr_ic_pause_light = 2130837670; // aapt resource value: 0x7f0200a7 - public const int mr_ic_play_light = 2130837671; - - // aapt resource value: 0x7f0200aa - public const int notification_template_icon_bg = 2130837674; + public const int mr_ic_play_dark = 2130837671; // aapt resource value: 0x7f0200a8 - public const int roundedbg = 2130837672; + public const int mr_ic_play_light = 2130837672; + + // aapt resource value: 0x7f0200ab + public const int notification_template_icon_bg = 2130837675; // aapt resource value: 0x7f0200a9 - public const int roundedbgdark = 2130837673; + public const int roundedbg = 2130837673; + + // aapt resource value: 0x7f0200aa + public const int roundedbgdark = 2130837674; static Drawable() { diff --git a/src/Android/Resources/drawable-hdpi/more.png b/src/Android/Resources/drawable-hdpi/more.png new file mode 100644 index 000000000..f7968b5da Binary files /dev/null and b/src/Android/Resources/drawable-hdpi/more.png differ diff --git a/src/Android/Resources/drawable-mdpi/more.png b/src/Android/Resources/drawable-mdpi/more.png new file mode 100644 index 000000000..f7968b5da Binary files /dev/null and b/src/Android/Resources/drawable-mdpi/more.png differ diff --git a/src/Android/Resources/drawable-xhdpi/more.png b/src/Android/Resources/drawable-xhdpi/more.png new file mode 100644 index 000000000..f7968b5da Binary files /dev/null and b/src/Android/Resources/drawable-xhdpi/more.png differ diff --git a/src/Android/Resources/drawable-xxhdpi/more.png b/src/Android/Resources/drawable-xxhdpi/more.png new file mode 100644 index 000000000..f7968b5da Binary files /dev/null and b/src/Android/Resources/drawable-xxhdpi/more.png differ diff --git a/src/Android/Resources/drawable/more.png b/src/Android/Resources/drawable/more.png new file mode 100644 index 000000000..f7968b5da Binary files /dev/null and b/src/Android/Resources/drawable/more.png differ diff --git a/src/App/Controls/ExtendedTextCell.cs b/src/App/Controls/ExtendedTextCell.cs index 83baf743a..a9d176edc 100644 --- a/src/App/Controls/ExtendedTextCell.cs +++ b/src/App/Controls/ExtendedTextCell.cs @@ -1,4 +1,5 @@ -using Xamarin.Forms; +using System; +using Xamarin.Forms; namespace Bit.App.Controls { @@ -30,5 +31,12 @@ namespace Bit.App.Controls get { return (string)GetValue(DisclousureImageProperty); } set { SetValue(DisclousureImageProperty, value); } } + + public event EventHandler DisclousureTapped; + + public void OnDisclousureTapped() + { + DisclousureTapped?.Invoke(this, EventArgs.Empty); + } } } diff --git a/src/App/Pages/VaultListSitesPage.cs b/src/App/Pages/VaultListSitesPage.cs index 1afcbe88f..2d0d46ef1 100644 --- a/src/App/Pages/VaultListSitesPage.cs +++ b/src/App/Pages/VaultListSitesPage.cs @@ -10,6 +10,7 @@ using Bit.App.Resources; using Xamarin.Forms; using XLabs.Ioc; using Bit.App.Utilities; +using System.Diagnostics; namespace Bit.App.Pages { @@ -83,8 +84,8 @@ namespace Bit.App.Pages private async void MoreClickedAsync(object sender, EventArgs e) { - var mi = sender as MenuItem; - var site = mi.CommandParameter as VaultListPageModel.Site; + var cell = sender as VaultListViewCell; + var site = cell.CommandParameter as VaultListPageModel.Site; var selection = await DisplayActionSheet(AppResources.MoreOptions, AppResources.Cancel, null, AppResources.View, AppResources.Edit, AppResources.CopyPassword, AppResources.CopyUsername, AppResources.GoToWebsite); @@ -163,23 +164,32 @@ namespace Bit.App.Pages private class VaultListViewCell : ExtendedTextCell { + private VaultListSitesPage _page; + public VaultListViewCell(VaultListSitesPage page) { - var moreAction = new MenuItem { Text = AppResources.More }; - moreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); - moreAction.Clicked += page.MoreClickedAsync; + _page = page; var deleteAction = new MenuItem { Text = AppResources.Delete, IsDestructive = true }; deleteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); deleteAction.Clicked += page.DeleteClickedAsync; + SetBinding(CommandParameterProperty, new Binding(".")); this.SetBinding(TextProperty, s => s.Name); this.SetBinding(DetailProperty, s => s.Username); - ContextActions.Add(moreAction); ContextActions.Add(deleteAction); TextColor = Color.FromHex("333333"); DetailColor = Color.FromHex("777777"); + + DisclousureTapped += VaultListViewCell_DisclousureTapped; + ShowDisclousure = true; + DisclousureImage = "more"; + } + + private void VaultListViewCell_DisclousureTapped(object sender, EventArgs e) + { + _page.MoreClickedAsync(sender, e); } } diff --git a/src/iOS/Controls/ExtendedTextCellRenderer.cs b/src/iOS/Controls/ExtendedTextCellRenderer.cs index 57102c379..db41f7157 100644 --- a/src/iOS/Controls/ExtendedTextCellRenderer.cs +++ b/src/iOS/Controls/ExtendedTextCellRenderer.cs @@ -25,14 +25,20 @@ namespace Bit.iOS.Controls { var detailDisclosureButton = UIButton.FromType(UIButtonType.Custom); detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Normal); - detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected); - detailDisclosureButton.Frame = new CGRect(0f, 0f, 30f, 30f); + try + { + detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage + "_selected"), UIControlState.Selected); + } + catch + { + detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected); + } + + detailDisclosureButton.Frame = new CGRect(0f, 0f, 30f, 40f); detailDisclosureButton.TouchUpInside += (sender, e) => { - var index = tv.IndexPathForCell(cell); - tv.SelectRow(index, true, UITableViewScrollPosition.None); - tv.Source.AccessoryButtonTapped(tv, index); + extendedCell.OnDisclousureTapped(); }; cell.AccessoryView = detailDisclosureButton; } diff --git a/src/iOS/Resources/more.png b/src/iOS/Resources/more.png new file mode 100644 index 000000000..f7968b5da Binary files /dev/null and b/src/iOS/Resources/more.png differ diff --git a/src/iOS/Resources/more@2x.png b/src/iOS/Resources/more@2x.png new file mode 100644 index 000000000..39a930b49 Binary files /dev/null and b/src/iOS/Resources/more@2x.png differ diff --git a/src/iOS/Resources/more@3x.png b/src/iOS/Resources/more@3x.png new file mode 100644 index 000000000..6906eac17 Binary files /dev/null and b/src/iOS/Resources/more@3x.png differ diff --git a/src/iOS/Resources/more_selected.png b/src/iOS/Resources/more_selected.png new file mode 100644 index 000000000..c3d6f8cf7 Binary files /dev/null and b/src/iOS/Resources/more_selected.png differ diff --git a/src/iOS/Resources/more_selected@2x.png b/src/iOS/Resources/more_selected@2x.png new file mode 100644 index 000000000..685c25d5c Binary files /dev/null and b/src/iOS/Resources/more_selected@2x.png differ diff --git a/src/iOS/Resources/more_selected@3x.png b/src/iOS/Resources/more_selected@3x.png new file mode 100644 index 000000000..414ef723f Binary files /dev/null and b/src/iOS/Resources/more_selected@3x.png differ diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index d6deab4d7..d159e8b75 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -375,6 +375,24 @@ + + + + + + + + + + + + + + + + + +