mirror of
https://github.com/bitwarden/mobile
synced 2026-01-08 11:33:31 +00:00
add toolbar icons
This commit is contained in:
@@ -2,38 +2,95 @@
|
||||
<pages:BaseContentPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Bit.App.Pages.Authenticator.AuthenticatorPage"
|
||||
x:Class="Bit.App.Pages.AuthenticatorPage"
|
||||
xmlns:u="clr-namespace:Bit.App.Utilities"
|
||||
xmlns:effects="clr-namespace:Bit.App.Effects"
|
||||
xmlns:pages="clr-namespace:Bit.App.Pages"
|
||||
xmlns:authenticator="clr-namespace:Bit.App.Pages.Authenticator"
|
||||
xmlns:controls="clr-namespace:Bit.App.Controls"
|
||||
x:DataType="authenticator:AuthenticatorPageViewModel"
|
||||
x:DataType="pages:AuthenticatorPageViewModel"
|
||||
Title="{Binding PageTitle}">
|
||||
|
||||
<StackLayout>
|
||||
<RefreshView
|
||||
IsVisible="{Binding ShowList}"
|
||||
IsRefreshing="{Binding Refreshing}"
|
||||
Command="{Binding RefreshCommand}">
|
||||
<controls:ExtendedCollectionView
|
||||
ItemsSource="{Binding Items}"
|
||||
VerticalOptions="FillAndExpand"
|
||||
SelectionMode="Single"
|
||||
SelectionChanged="RowSelected"
|
||||
StyleClass="list, list-platform">
|
||||
<controls:ExtendedCollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:AuthenticatorViewCell />
|
||||
</DataTemplate>
|
||||
</controls:ExtendedCollectionView.ItemTemplate>
|
||||
<ContentPage.BindingContext>
|
||||
<pages:AuthenticatorPageViewModel />
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Icon="search.png" Clicked="Search_Clicked"
|
||||
AutomationProperties.IsInAccessibleTree="True"
|
||||
AutomationProperties.Name="{u:I18n Search}" />
|
||||
</ContentPage.ToolbarItems>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||
|
||||
<ToolbarItem x:Name="_aboutIconItem" x:Key="aboutIconItem" Icon="info.png"
|
||||
Clicked="About_Clicked" Order="Primary" Priority="-1"
|
||||
AutomationProperties.IsInAccessibleTree="True"
|
||||
AutomationProperties.Name="{u:I18n AboutSend}" />
|
||||
<ToolbarItem x:Name="_syncItem" x:Key="syncItem" Text="{u:I18n Sync}"
|
||||
Clicked="Sync_Clicked" Order="Secondary" />
|
||||
<ToolbarItem x:Name="_lockItem" x:Key="lockItem" Text="{u:I18n Lock}"
|
||||
Clicked="Lock_Clicked" Order="Secondary" />
|
||||
<ToolbarItem x:Name="_aboutTextItem" x:Key="aboutTextItem" Text="{u:I18n AboutSend}"
|
||||
Clicked="About_Clicked" Order="Secondary" />
|
||||
<ToolbarItem x:Name="_addItem" x:Key="addItem" Icon="plus.png"
|
||||
Clicked="AddButton_Clicked" Order="Primary"
|
||||
AutomationProperties.IsInAccessibleTree="True"
|
||||
AutomationProperties.Name="{u:I18n AddItem}" />
|
||||
|
||||
<DataTemplate x:Key="authenticatorTemplate"
|
||||
x:DataType="pages:SendGroupingsPageListItem">
|
||||
<controls:AuthenticatorViewCell />
|
||||
</DataTemplate>
|
||||
|
||||
<StackLayout x:Key="mainLayout" x:Name="_mainLayout">
|
||||
<RefreshView
|
||||
IsVisible="{Binding ShowList}"
|
||||
IsRefreshing="{Binding Refreshing}"
|
||||
Command="{Binding RefreshCommand}">
|
||||
<controls:ExtendedCollectionView
|
||||
ItemsSource="{Binding Items}"
|
||||
ItemTemplate="{StaticResource authenticatorTemplate}"
|
||||
VerticalOptions="FillAndExpand"
|
||||
SelectionMode="Single"
|
||||
SelectionChanged="RowSelected"
|
||||
StyleClass="list, list-platform">
|
||||
|
||||
|
||||
</controls:ExtendedCollectionView>
|
||||
</RefreshView>
|
||||
</controls:ExtendedCollectionView>
|
||||
</RefreshView>
|
||||
|
||||
<StackLayout
|
||||
IsVisible="{Binding ShowList}">
|
||||
<StackLayout
|
||||
IsVisible="{Binding ShowList}">
|
||||
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
|
||||
<AbsoluteLayout
|
||||
x:Name="_absLayout"
|
||||
VerticalOptions="FillAndExpand"
|
||||
HorizontalOptions="FillAndExpand">
|
||||
<ContentView
|
||||
x:Name="_mainContent"
|
||||
AbsoluteLayout.LayoutFlags="All"
|
||||
AbsoluteLayout.LayoutBounds="0, 0, 1, 1" />
|
||||
<Button
|
||||
x:Name="_fab"
|
||||
Image="plus.png"
|
||||
Clicked="AddButton_Clicked"
|
||||
Style="{StaticResource btn-fab}"
|
||||
AbsoluteLayout.LayoutFlags="PositionProportional"
|
||||
AbsoluteLayout.LayoutBounds="1, 1, AutoSize, AutoSize"
|
||||
AutomationProperties.IsInAccessibleTree="True"
|
||||
AutomationProperties.Name="{u:I18n AddItem}">
|
||||
<Button.Effects>
|
||||
<effects:FabShadowEffect />
|
||||
</Button.Effects>
|
||||
</Button>
|
||||
</AbsoluteLayout>
|
||||
|
||||
</pages:BaseContentPage>
|
||||
|
||||
@@ -7,7 +7,7 @@ using Xamarin.Forms;
|
||||
using Xamarin.Forms.PlatformConfiguration;
|
||||
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
|
||||
|
||||
namespace Bit.App.Pages.Authenticator
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
public partial class AuthenticatorPage : BaseContentPage
|
||||
{
|
||||
@@ -30,30 +30,19 @@ namespace Bit.App.Pages.Authenticator
|
||||
//_vm.Page = this;
|
||||
//_fromTabPage = fromTabPage;
|
||||
//_selectAction = selectAction;
|
||||
//var isIos = Device.RuntimePlatform == Device.iOS;
|
||||
//if (selectAction != null)
|
||||
//{
|
||||
// if (isIos)
|
||||
// {
|
||||
// ToolbarItems.Add(_closeItem);
|
||||
// }
|
||||
// ToolbarItems.Add(_selectItem);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (isIos)
|
||||
// {
|
||||
// ToolbarItems.Add(_moreItem);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ToolbarItems.Add(_historyItem);
|
||||
// }
|
||||
//}
|
||||
//if (isIos)
|
||||
//{
|
||||
// _typePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
|
||||
//}
|
||||
|
||||
if (Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
_absLayout.Children.Remove(_fab);
|
||||
ToolbarItems.Add(_aboutIconItem);
|
||||
ToolbarItems.Add(_addItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolbarItems.Add(_syncItem);
|
||||
ToolbarItems.Add(_lockItem);
|
||||
ToolbarItems.Add(_aboutTextItem);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task InitAsync()
|
||||
@@ -80,26 +69,44 @@ namespace Bit.App.Pages.Authenticator
|
||||
//});
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
|
||||
private async void Search_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
base.OnDisappearing();
|
||||
//_broadcasterService.Unsubscribe(nameof(GeneratorPage));
|
||||
if (DoOnce())
|
||||
{
|
||||
// var page = new SendsPage(_vm.Filter, _vm.Type != null);
|
||||
// await Navigation.PushModalAsync(new NavigationPage(page));
|
||||
}
|
||||
}
|
||||
|
||||
private async void Sync_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
// await _vm.SyncAsync();
|
||||
}
|
||||
|
||||
private async void Lock_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
// await _vaultTimeoutService.LockAsync(true, true);
|
||||
}
|
||||
|
||||
private void About_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
// _vm.ShowAbout();
|
||||
}
|
||||
|
||||
private async void AddButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
if (DoOnce())
|
||||
{
|
||||
// var page = new SendAddEditPage(null, null, _vm.Type);
|
||||
// await Navigation.PushModalAsync(new NavigationPage(page));
|
||||
}
|
||||
}
|
||||
|
||||
private async void RowSelected(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
if (Device.RuntimePlatform == Device.Android && _tabsPage != null)
|
||||
{
|
||||
_tabsPage.ResetToVaultPage();
|
||||
return true;
|
||||
}
|
||||
return base.OnBackButtonPressed();
|
||||
}
|
||||
|
||||
private async void Copy_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
//await _vm.CopyAsync();
|
||||
@@ -120,20 +127,11 @@ namespace Bit.App.Pages.Authenticator
|
||||
//}
|
||||
}
|
||||
|
||||
private void Select_Clicked(object sender, EventArgs e)
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
//_selectAction?.Invoke(_vm.Password);
|
||||
base.OnDisappearing();
|
||||
//_broadcasterService.Unsubscribe(nameof(GeneratorPage));
|
||||
}
|
||||
|
||||
|
||||
private async void Close_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
if (DoOnce())
|
||||
{
|
||||
await Navigation.PopModalAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Utilities;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Pages.Authenticator
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
public class AuthenticatorPageViewModel : BaseViewModel
|
||||
{
|
||||
@@ -24,6 +25,8 @@ namespace Bit.App.Pages.Authenticator
|
||||
{
|
||||
_userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
|
||||
|
||||
PageTitle = AppResources.Authenticator;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Bit.App.Pages
|
||||
|
||||
Children.Add(_groupingsPage);
|
||||
|
||||
_authenticatorPage = new NavigationPage(new Authenticator.AuthenticatorPage(true, null, this))
|
||||
_authenticatorPage = new NavigationPage(new AuthenticatorPage(true, null, this))
|
||||
{
|
||||
Title = AppResources.Authenticator,
|
||||
IconImageSource = "info.png"
|
||||
|
||||
Reference in New Issue
Block a user