mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
more options on generator and history page
This commit is contained in:
parent
09a1c17fb4
commit
5dbea8ca09
6 changed files with 88 additions and 24 deletions
|
@ -19,17 +19,22 @@
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<u:InverseBoolConverter x:Key="inverseBool" />
|
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||||
<u:DateTimeConverter x:Key="dateTime" />
|
<u:DateTimeConverter x:Key="dateTime" />
|
||||||
|
<ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1"
|
||||||
|
x:Name="_closeItem" x:Key="closeItem" />
|
||||||
|
<ToolbarItem Text="{u:I18n Clear}"
|
||||||
|
Clicked="Clear_Clicked"
|
||||||
|
Order="Secondary"
|
||||||
|
x:Name="_clearItem"
|
||||||
|
x:Key="clearItem" />
|
||||||
|
<ToolbarItem Icon="more_vert.png"
|
||||||
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
|
AutomationProperties.Name="{u:I18n Options}"
|
||||||
|
Clicked="More_Clicked"
|
||||||
|
x:Name="_moreItem"
|
||||||
|
x:Key="moreItem" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
|
||||||
<ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
|
|
||||||
<ToolbarItem Text="{u:I18n Clear}"
|
|
||||||
Clicked="Clear_Clicked"
|
|
||||||
Order="Secondary"
|
|
||||||
x:Name="_clearItem" />
|
|
||||||
</ContentPage.ToolbarItems>
|
|
||||||
|
|
||||||
<StackLayout x:Name="_mainLayout">
|
<StackLayout x:Name="_mainLayout">
|
||||||
<Label IsVisible="{Binding ShowNoData}"
|
<Label IsVisible="{Binding ShowNoData}"
|
||||||
Text="{u:I18n NoPasswordsToList}"
|
Text="{u:I18n NoPasswordsToList}"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using System;
|
using Bit.App.Resources;
|
||||||
|
using System;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
|
@ -12,6 +14,15 @@ namespace Bit.App.Pages
|
||||||
SetActivityIndicator();
|
SetActivityIndicator();
|
||||||
_vm = BindingContext as GeneratorHistoryPageViewModel;
|
_vm = BindingContext as GeneratorHistoryPageViewModel;
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
|
if(Device.RuntimePlatform == Device.iOS)
|
||||||
|
{
|
||||||
|
ToolbarItems.Add(_closeItem);
|
||||||
|
ToolbarItems.Add(_moreItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ToolbarItems.Add(_clearItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async void OnAppearing()
|
protected override async void OnAppearing()
|
||||||
|
@ -34,5 +45,19 @@ namespace Bit.App.Pages
|
||||||
await Navigation.PopModalAsync();
|
await Navigation.PopModalAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void More_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(!DoOnce())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel,
|
||||||
|
null, AppResources.Clear);
|
||||||
|
if(selection == AppResources.Clear)
|
||||||
|
{
|
||||||
|
await _vm.ClearAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,19 +12,25 @@
|
||||||
<pages:GeneratorPageViewModel />
|
<pages:GeneratorPageViewModel />
|
||||||
</ContentPage.BindingContext>
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
|
||||||
<ToolbarItem Text="{u:I18n Select}"
|
|
||||||
Clicked="Select_Clicked"
|
|
||||||
Order="Primary"
|
|
||||||
x:Name="_selectItem" />
|
|
||||||
<ToolbarItem Text="{u:I18n PasswordHistory}"
|
|
||||||
Clicked="History_Clicked"
|
|
||||||
Order="Secondary" />
|
|
||||||
</ContentPage.ToolbarItems>
|
|
||||||
|
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<u:InverseBoolConverter x:Key="inverseBool" />
|
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||||
|
<ToolbarItem Text="{u:I18n Select}"
|
||||||
|
Clicked="Select_Clicked"
|
||||||
|
Order="Primary"
|
||||||
|
x:Name="_selectItem"
|
||||||
|
x:Key="selectItem" />
|
||||||
|
<ToolbarItem Text="{u:I18n PasswordHistory}"
|
||||||
|
Clicked="History_Clicked"
|
||||||
|
Order="Secondary"
|
||||||
|
x:Name="_historyItem"
|
||||||
|
x:Key="historyItem" />
|
||||||
|
<ToolbarItem Icon="more_vert.png"
|
||||||
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
|
AutomationProperties.Name="{u:I18n Options}"
|
||||||
|
Clicked="More_Clicked"
|
||||||
|
x:Name="_moreItem"
|
||||||
|
x:Key="moreItem" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Bit.App.Resources;
|
||||||
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
@ -19,9 +20,17 @@ namespace Bit.App.Pages
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
_fromTabPage = fromTabPage;
|
_fromTabPage = fromTabPage;
|
||||||
_selectAction = selectAction;
|
_selectAction = selectAction;
|
||||||
if(selectAction == null)
|
if(selectAction != null)
|
||||||
{
|
{
|
||||||
ToolbarItems.Remove(_selectItem);
|
ToolbarItems.Add(_selectItem);
|
||||||
|
}
|
||||||
|
if(Device.RuntimePlatform == Device.iOS)
|
||||||
|
{
|
||||||
|
ToolbarItems.Add(_moreItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ToolbarItems.Add(_historyItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +68,21 @@ namespace Bit.App.Pages
|
||||||
await _vm.CopyAsync();
|
await _vm.CopyAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void More_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(!DoOnce())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel,
|
||||||
|
null, AppResources.PasswordHistory);
|
||||||
|
if(selection == AppResources.PasswordHistory)
|
||||||
|
{
|
||||||
|
var page = new GeneratorHistoryPage();
|
||||||
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Select_Clicked(object sender, EventArgs e)
|
private void Select_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_selectAction?.Invoke(_vm.Password);
|
_selectAction?.Invoke(_vm.Password);
|
||||||
|
|
|
@ -36,7 +36,9 @@
|
||||||
Clicked="Share_Clicked"
|
Clicked="Share_Clicked"
|
||||||
Order="Secondary" />
|
Order="Secondary" />
|
||||||
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary" x:Name="_moreItem"
|
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary" x:Name="_moreItem"
|
||||||
x:Key="moreItem" />
|
x:Key="moreItem"
|
||||||
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
|
AutomationProperties.Name="{u:I18n Options}" />
|
||||||
<ToolbarItem Text="{u:I18n Attachments}"
|
<ToolbarItem Text="{u:I18n Attachments}"
|
||||||
Clicked="Attachments_Clicked"
|
Clicked="Attachments_Clicked"
|
||||||
Order="Secondary"
|
Order="Secondary"
|
||||||
|
|
|
@ -36,7 +36,9 @@
|
||||||
<ToolbarItem Text="{u:I18n Edit}" Clicked="EditToolbarItem_Clicked" Order="Primary"
|
<ToolbarItem Text="{u:I18n Edit}" Clicked="EditToolbarItem_Clicked" Order="Primary"
|
||||||
x:Name="_editItem" x:Key="editItem" />
|
x:Name="_editItem" x:Key="editItem" />
|
||||||
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary"
|
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary"
|
||||||
x:Name="_moreItem" x:Key="moreItem" />
|
x:Name="_moreItem" x:Key="moreItem"
|
||||||
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
|
AutomationProperties.Name="{u:I18n Options}" />
|
||||||
<ToolbarItem Text="{u:I18n Attachments}" Clicked="Attachments_Clicked" Order="Secondary"
|
<ToolbarItem Text="{u:I18n Attachments}" Clicked="Attachments_Clicked" Order="Secondary"
|
||||||
x:Name="_attachmentsItem" x:Key="attachmentsItem" />
|
x:Name="_attachmentsItem" x:Key="attachmentsItem" />
|
||||||
<ToolbarItem Text="{u:I18n Delete}" Clicked="Delete_Clicked" Order="Secondary" IsDestructive="True"
|
<ToolbarItem Text="{u:I18n Delete}" Clicked="Delete_Clicked" Order="Secondary" IsDestructive="True"
|
||||||
|
|
Loading…
Reference in a new issue