mirror of
https://github.com/bitwarden/mobile
synced 2025-12-29 22:53:34 +00:00
fab padding and clicked action
This commit is contained in:
12
src/App/Controls/ExtendedListView.cs
Normal file
12
src/App/Controls/ExtendedListView.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class ExtendedListView : ListView
|
||||
{
|
||||
public ExtendedListView() { }
|
||||
|
||||
public ExtendedListView(ListViewCachingStrategy cachingStrategy)
|
||||
: base(cachingStrategy) { }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Xamarin.Forms;
|
||||
using Bit.Core.Enums;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
@@ -8,6 +9,7 @@ namespace Bit.App.Pages
|
||||
|
||||
public AddEditPage(
|
||||
string cipherId = null,
|
||||
CipherType? type = null,
|
||||
string folderId = null,
|
||||
string collectionId = null,
|
||||
string organizationId = null)
|
||||
@@ -18,6 +20,7 @@ namespace Bit.App.Pages
|
||||
_vm.CipherId = cipherId;
|
||||
_vm.FolderId = folderId;
|
||||
_vm.OrganizationId = organizationId;
|
||||
_vm.Type = type;
|
||||
_vm.Init();
|
||||
SetActivityIndicator();
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<pages:GroupingsPageListItemSelector x:Key="listItemDataTemplateSelector"
|
||||
CipherTemplate="{StaticResource cipherTemplate}"
|
||||
GroupTemplate="{StaticResource groupTemplate}" />
|
||||
@@ -68,7 +68,7 @@
|
||||
IsVisible="{Binding ShowAddCipherButton}"></Button>
|
||||
</StackLayout>
|
||||
|
||||
<ListView
|
||||
<controls:ExtendedListView
|
||||
IsVisible="{Binding ShowList}"
|
||||
ItemsSource="{Binding GroupedItems}"
|
||||
VerticalOptions="FillAndExpand"
|
||||
@@ -76,11 +76,14 @@
|
||||
RefreshCommand="{Binding RefreshCommand}"
|
||||
IsPullToRefreshEnabled="true"
|
||||
IsRefreshing="{Binding Refreshing}"
|
||||
CachingStrategy="RecycleElement"
|
||||
ItemTemplate="{StaticResource listItemDataTemplateSelector}"
|
||||
IsGroupingEnabled="True"
|
||||
ItemSelected="RowSelected"
|
||||
StyleClass="list, list-platform">
|
||||
<x:Arguments>
|
||||
<ListViewCachingStrategy>RecycleElement</ListViewCachingStrategy>
|
||||
</x:Arguments>
|
||||
|
||||
<ListView.GroupHeaderTemplate>
|
||||
<DataTemplate x:DataType="pages:GroupingsPageListGroup">
|
||||
<ViewCell>
|
||||
@@ -95,7 +98,7 @@
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.GroupHeaderTemplate>
|
||||
</ListView>
|
||||
</controls:ExtendedListView>
|
||||
</StackLayout>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
using System.Threading.Tasks;
|
||||
@@ -38,6 +39,10 @@ namespace Bit.App.Pages
|
||||
{
|
||||
_absLayout.Children.Remove(_fab);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fab.Clicked = AddButton_Clicked;
|
||||
}
|
||||
}
|
||||
|
||||
protected async override void OnAppearing()
|
||||
@@ -116,5 +121,41 @@ namespace Bit.App.Pages
|
||||
await Navigation.PushModalAsync(new NavigationPage(page), false);
|
||||
}
|
||||
}
|
||||
|
||||
private async void AddButton_Clicked(object sender, System.EventArgs e)
|
||||
{
|
||||
var type = await DisplayActionSheet(AppResources.SelectTypeAdd, AppResources.Cancel, null,
|
||||
AppResources.TypeLogin, AppResources.TypeCard, AppResources.TypeIdentity,
|
||||
AppResources.TypeSecureNote);
|
||||
|
||||
var selectedType = CipherType.SecureNote;
|
||||
if(type == null || type == AppResources.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if(type == AppResources.TypeLogin)
|
||||
{
|
||||
selectedType = CipherType.Login;
|
||||
}
|
||||
else if(type == AppResources.TypeCard)
|
||||
{
|
||||
selectedType = CipherType.Card;
|
||||
}
|
||||
else if(type == AppResources.TypeIdentity)
|
||||
{
|
||||
selectedType = CipherType.Identity;
|
||||
}
|
||||
else if(type == AppResources.TypeSecureNote)
|
||||
{
|
||||
selectedType = CipherType.SecureNote;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var page = new AddEditPage(null, selectedType);
|
||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,10 @@
|
||||
</Style>
|
||||
|
||||
<!-- List -->
|
||||
|
||||
|
||||
<Style TargetType="ListView"
|
||||
Class="list-platform">
|
||||
Class="list-platform"
|
||||
ApplyToDerivedTypes="True">
|
||||
<Setter Property="SeparatorColor"
|
||||
Value="Transparent" />
|
||||
</Style>
|
||||
|
||||
Reference in New Issue
Block a user