mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
more menu for ios
This commit is contained in:
parent
dcb1102746
commit
325c88018c
11 changed files with 135 additions and 35 deletions
|
@ -15,17 +15,7 @@
|
||||||
</ContentPage.BindingContext>
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
<ContentPage.ToolbarItems>
|
||||||
<ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
|
|
||||||
<ToolbarItem Text="{u:I18n Save}" Clicked="Save_Clicked" Order="Primary" />
|
<ToolbarItem Text="{u:I18n Save}" Clicked="Save_Clicked" Order="Primary" />
|
||||||
<ToolbarItem Text="{u:I18n Attachments}"
|
|
||||||
Clicked="Attachments_Clicked"
|
|
||||||
Order="Secondary"
|
|
||||||
x:Name="_attachmentsItem" />
|
|
||||||
<ToolbarItem Text="{u:I18n Delete}"
|
|
||||||
Clicked="Delete_Clicked"
|
|
||||||
Order="Secondary"
|
|
||||||
IsDestructive="True"
|
|
||||||
x:Name="_deleteItem" />
|
|
||||||
</ContentPage.ToolbarItems>
|
</ContentPage.ToolbarItems>
|
||||||
|
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
|
@ -33,16 +23,31 @@
|
||||||
<u:InverseBoolConverter x:Key="inverseBool" />
|
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||||
<u:StringHasValueConverter x:Key="stringHasValue" />
|
<u:StringHasValueConverter x:Key="stringHasValue" />
|
||||||
<u:IsNotNullConverter x:Key="notNull" />
|
<u:IsNotNullConverter x:Key="notNull" />
|
||||||
|
<ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1"
|
||||||
|
x:Key="closeItem" x:Name="_closeItem" />
|
||||||
<ToolbarItem Text="{u:I18n Collections}"
|
<ToolbarItem Text="{u:I18n Collections}"
|
||||||
x:Key="collectionsItem"
|
x:Key="collectionsItem"
|
||||||
x:Name="_collectionsItem"
|
x:Name="_collectionsItem"
|
||||||
Clicked="Collections_Clicked"
|
Clicked="Collections_Clicked"
|
||||||
Order="Secondary" />
|
Order="Secondary" />
|
||||||
<ToolbarItem Text="{u:I18n Share}"
|
<ToolbarItem Text="{u:I18n Share}"
|
||||||
x:Key="shareItem"
|
x:Key="shareItem"
|
||||||
x:Name="_shareItem"
|
x:Name="_shareItem"
|
||||||
Clicked="Share_Clicked"
|
Clicked="Share_Clicked"
|
||||||
Order="Secondary" />
|
Order="Secondary" />
|
||||||
|
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary" x:Name="_moreItem"
|
||||||
|
x:Key="moreItem" />
|
||||||
|
<ToolbarItem Text="{u:I18n Attachments}"
|
||||||
|
Clicked="Attachments_Clicked"
|
||||||
|
Order="Secondary"
|
||||||
|
x:Name="_attachmentsItem"
|
||||||
|
x:Key="attachmentsItem" />
|
||||||
|
<ToolbarItem Text="{u:I18n Delete}"
|
||||||
|
Clicked="Delete_Clicked"
|
||||||
|
Order="Secondary"
|
||||||
|
IsDestructive="True"
|
||||||
|
x:Name="_deleteItem"
|
||||||
|
x:Key="deleteItem" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,15 @@ namespace Bit.App.Pages
|
||||||
_vm.DefaultUri = uri ?? appOptions?.Uri;
|
_vm.DefaultUri = uri ?? appOptions?.Uri;
|
||||||
_vm.Init();
|
_vm.Init();
|
||||||
SetActivityIndicator();
|
SetActivityIndicator();
|
||||||
if(!_vm.EditMode || Device.RuntimePlatform == Device.iOS)
|
if(_vm.EditMode && Device.RuntimePlatform == Device.Android)
|
||||||
{
|
{
|
||||||
ToolbarItems.Remove(_attachmentsItem);
|
ToolbarItems.Add(_attachmentsItem);
|
||||||
ToolbarItems.Remove(_deleteItem);
|
ToolbarItems.Add(_deleteItem);
|
||||||
}
|
}
|
||||||
if(Device.RuntimePlatform == Device.Android)
|
if(Device.RuntimePlatform == Device.iOS)
|
||||||
{
|
{
|
||||||
ToolbarItems.RemoveAt(0);
|
ToolbarItems.Add(_closeItem);
|
||||||
|
ToolbarItems.Add(_moreItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
_typePicker.ItemDisplayBinding = new Binding("Key");
|
_typePicker.ItemDisplayBinding = new Binding("Key");
|
||||||
|
@ -237,6 +238,43 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void More_Clicked(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
if(!DoOnce())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var options = new List<string> { AppResources.Attachments };
|
||||||
|
if(_vm.EditMode)
|
||||||
|
{
|
||||||
|
options.Add(_vm.Cipher.OrganizationId != null ? AppResources.Share : AppResources.Collections);
|
||||||
|
}
|
||||||
|
var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel,
|
||||||
|
_vm.EditMode ? AppResources.Delete : null, options.ToArray());
|
||||||
|
if(selection == AppResources.Delete)
|
||||||
|
{
|
||||||
|
if(await _vm.DeleteAsync())
|
||||||
|
{
|
||||||
|
await Navigation.PopModalAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(selection == AppResources.Attachments)
|
||||||
|
{
|
||||||
|
var page = new AttachmentsPage(_vm.CipherId);
|
||||||
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
|
}
|
||||||
|
else if(selection == AppResources.Collections)
|
||||||
|
{
|
||||||
|
var page = new CollectionsPage(_vm.CipherId);
|
||||||
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
|
}
|
||||||
|
else if(selection == AppResources.Share)
|
||||||
|
{
|
||||||
|
var page = new SharePage(_vm.CipherId);
|
||||||
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void Close_Clicked(object sender, System.EventArgs e)
|
private async void Close_Clicked(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if(DoOnce())
|
if(DoOnce())
|
||||||
|
|
|
@ -16,13 +16,6 @@
|
||||||
<pages:ViewPageViewModel />
|
<pages:ViewPageViewModel />
|
||||||
</ContentPage.BindingContext>
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
|
||||||
<ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
|
|
||||||
<ToolbarItem Text="{u:I18n Edit}" Clicked="EditToolbarItem_Clicked" Order="Primary" />
|
|
||||||
<ToolbarItem Text="{u:I18n Attachments}" Clicked="Attachments_Clicked" Order="Secondary" />
|
|
||||||
<ToolbarItem Text="{u:I18n Delete}" Clicked="Delete_Clicked" Order="Secondary" IsDestructive="True" />
|
|
||||||
</ContentPage.ToolbarItems>
|
|
||||||
|
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<u:InverseBoolConverter x:Key="inverseBool" />
|
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||||
|
@ -38,6 +31,16 @@
|
||||||
x:Name="_shareItem"
|
x:Name="_shareItem"
|
||||||
Clicked="Share_Clicked"
|
Clicked="Share_Clicked"
|
||||||
Order="Secondary" />
|
Order="Secondary" />
|
||||||
|
<ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1"
|
||||||
|
x:Name="_closeItem" x:Key="closeItem" />
|
||||||
|
<ToolbarItem Text="{u:I18n Edit}" Clicked="EditToolbarItem_Clicked" Order="Primary"
|
||||||
|
x:Name="_editItem" x:Key="editItem" />
|
||||||
|
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary"
|
||||||
|
x:Name="_moreItem" x:Key="moreItem" />
|
||||||
|
<ToolbarItem Text="{u:I18n Attachments}" Clicked="Attachments_Clicked" Order="Secondary"
|
||||||
|
x:Name="_attachmentsItem" x:Key="attachmentsItem" />
|
||||||
|
<ToolbarItem Text="{u:I18n Delete}" Clicked="Delete_Clicked" Order="Secondary" IsDestructive="True"
|
||||||
|
x:Name="_deleteItem" x:Key="deleteItem" />
|
||||||
|
|
||||||
<ScrollView x:Key="scrollView" x:Name="_scrollView">
|
<ScrollView x:Key="scrollView" x:Name="_scrollView">
|
||||||
<StackLayout Spacing="20" x:Name="_mainLayout">
|
<StackLayout Spacing="20" x:Name="_mainLayout">
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Bit.Core.Abstractions;
|
using Bit.App.Resources;
|
||||||
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -25,15 +26,16 @@ namespace Bit.App.Pages
|
||||||
if(Device.RuntimePlatform == Device.iOS)
|
if(Device.RuntimePlatform == Device.iOS)
|
||||||
{
|
{
|
||||||
_absLayout.Children.Remove(_fab);
|
_absLayout.Children.Remove(_fab);
|
||||||
ToolbarItems.RemoveAt(2);
|
ToolbarItems.Add(_closeItem);
|
||||||
ToolbarItems.RemoveAt(2);
|
ToolbarItems.Add(_editItem);
|
||||||
|
ToolbarItems.Add(_moreItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ToolbarItems.RemoveAt(0);
|
|
||||||
ToolbarItems.RemoveAt(0);
|
|
||||||
_fab.Clicked = EditButton_Clicked;
|
_fab.Clicked = EditButton_Clicked;
|
||||||
_mainLayout.Padding = new Thickness(0, 0, 0, 75);
|
_mainLayout.Padding = new Thickness(0, 0, 0, 75);
|
||||||
|
ToolbarItems.Add(_attachmentsItem);
|
||||||
|
ToolbarItems.Add(_deleteItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +147,40 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void More_Clicked(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
if(!DoOnce())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var options = new List<string> { AppResources.Attachments };
|
||||||
|
options.Add(_vm.Cipher.OrganizationId != null ? AppResources.Share : AppResources.Collections);
|
||||||
|
var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel,
|
||||||
|
AppResources.Delete, options.ToArray());
|
||||||
|
if(selection == AppResources.Delete)
|
||||||
|
{
|
||||||
|
if(await _vm.DeleteAsync())
|
||||||
|
{
|
||||||
|
await Navigation.PopModalAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(selection == AppResources.Attachments)
|
||||||
|
{
|
||||||
|
var page = new AttachmentsPage(_vm.CipherId);
|
||||||
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
|
}
|
||||||
|
else if(selection == AppResources.Collections)
|
||||||
|
{
|
||||||
|
var page = new CollectionsPage(_vm.CipherId);
|
||||||
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
|
}
|
||||||
|
else if(selection == AppResources.Share)
|
||||||
|
{
|
||||||
|
var page = new SharePage(_vm.CipherId);
|
||||||
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void Close_Clicked(object sender, System.EventArgs e)
|
private async void Close_Clicked(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if(DoOnce())
|
if(DoOnce())
|
||||||
|
|
BIN
src/iOS/Resources/more.png
Normal file
BIN
src/iOS/Resources/more.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 145 B |
BIN
src/iOS/Resources/more@2x.png
Normal file
BIN
src/iOS/Resources/more@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 348 B |
BIN
src/iOS/Resources/more@3x.png
Normal file
BIN
src/iOS/Resources/more@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 555 B |
BIN
src/iOS/Resources/more_vert.png
Normal file
BIN
src/iOS/Resources/more_vert.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 164 B |
BIN
src/iOS/Resources/more_vert@2x.png
Normal file
BIN
src/iOS/Resources/more_vert@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 242 B |
BIN
src/iOS/Resources/more_vert@3x.png
Normal file
BIN
src/iOS/Resources/more_vert@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 338 B |
|
@ -331,4 +331,22 @@
|
||||||
<Visible>false</Visible>
|
<Visible>false</Visible>
|
||||||
</ImageAsset>
|
</ImageAsset>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BundleResource Include="Resources\more%403x.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BundleResource Include="Resources\more.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BundleResource Include="Resources\more%402x.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BundleResource Include="Resources\more_vert%403x.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BundleResource Include="Resources\more_vert.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BundleResource Include="Resources\more_vert%402x.png" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in a new issue