1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-27 03:52:57 +02:00

Added back more context menu to list view of vault

This commit is contained in:
Kyle Spearrin 2016-06-16 00:09:46 -04:00
parent ecc15363b5
commit 7c6a4c8fb1
3 changed files with 20 additions and 19 deletions

View File

@ -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<VaultListPageModel.Site>(TextProperty, s => s.Name);
this.SetBinding<VaultListPageModel.Site>(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);
}
}

View File

@ -295,15 +295,6 @@ namespace Bit.App.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to More Options.
/// </summary>
internal static string MoreOptions {
get {
return ResourceManager.GetString("MoreOptions", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to My Vault.
/// </summary>

View File

@ -220,10 +220,6 @@
<value>More</value>
<comment>Text to define that there are more options things to see.</comment>
</data>
<data name="MoreOptions" xml:space="preserve">
<value>More Options</value>
<comment>The text title that defines more options for a site.</comment>
</data>
<data name="MyVault" xml:space="preserve">
<value>My Vault</value>
<comment>The title for the vault page.</comment>