From 7c6a4c8fb1d447471a69bffa1adc39e4e138137a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 16 Jun 2016 00:09:46 -0400 Subject: [PATCH] Added back more context menu to list view of vault --- src/App/Pages/VaultListSitesPage.cs | 26 +++++++++++++++++----- src/App/Resources/AppResources.Designer.cs | 9 -------- src/App/Resources/AppResources.resx | 4 ---- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/App/Pages/VaultListSitesPage.cs b/src/App/Pages/VaultListSitesPage.cs index 8c7c50a3f..dfc5f2cdc 100644 --- a/src/App/Pages/VaultListSitesPage.cs +++ b/src/App/Pages/VaultListSitesPage.cs @@ -83,11 +83,9 @@ namespace Bit.App.Pages Navigation.PushModalAsync(page); } - private async void MoreClickedAsync(object sender, EventArgs e) + private async void MoreClickedAsync(VaultListPageModel.Site site) { - var cell = sender as VaultListViewCell; - var site = cell.CommandParameter as VaultListPageModel.Site; - var selection = await DisplayActionSheet(AppResources.MoreOptions, AppResources.Cancel, null, + var selection = await DisplayActionSheet(site.Name, AppResources.Cancel, null, AppResources.View, AppResources.Edit, AppResources.CopyPassword, AppResources.CopyUsername, AppResources.GoToWebsite); if(selection == AppResources.View) @@ -171,14 +169,21 @@ namespace Bit.App.Pages { _page = page; - var deleteAction = new MenuItem { Text = AppResources.Delete, IsDestructive = true }; + // Adding whitespace to Delete action to account for the negative margin offset on the listview + var deleteAction = new MenuItem { Text = AppResources.Delete + " ", IsDestructive = true }; deleteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); deleteAction.Clicked += page.DeleteClickedAsync; + var moreAction = new MenuItem { Text = AppResources.More }; + moreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); + moreAction.Clicked += MoreAction_Clicked; + SetBinding(CommandParameterProperty, new Binding(".")); this.SetBinding(TextProperty, s => s.Name); this.SetBinding(DetailProperty, s => s.Username); + ContextActions.Add(deleteAction); + ContextActions.Add(moreAction); TextColor = Color.FromHex("333333"); DetailColor = Color.FromHex("777777"); @@ -188,9 +193,18 @@ namespace Bit.App.Pages DisclousureImage = "more"; } + private void MoreAction_Clicked(object sender, EventArgs e) + { + var menuItem = sender as MenuItem; + var site = menuItem.CommandParameter as VaultListPageModel.Site; + _page.MoreClickedAsync(site); + } + private void VaultListViewCell_DisclousureTapped(object sender, EventArgs e) { - _page.MoreClickedAsync(sender, e); + var cell = sender as VaultListViewCell; + var site = cell.CommandParameter as VaultListPageModel.Site; + _page.MoreClickedAsync(site); } } diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index e0eccd502..0b09955ba 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -295,15 +295,6 @@ namespace Bit.App.Resources { } } - /// - /// Looks up a localized string similar to More Options. - /// - internal static string MoreOptions { - get { - return ResourceManager.GetString("MoreOptions", resourceCulture); - } - } - /// /// Looks up a localized string similar to My Vault. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 8519e6c16..2c8b2b47b 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -220,10 +220,6 @@ More Text to define that there are more options things to see. - - More Options - The text title that defines more options for a site. - My Vault The title for the vault page.