mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-17 15:27:43 +01:00
fab padding and clicked action
This commit is contained in:
parent
2a5739dfdc
commit
0495c17fc8
@ -82,6 +82,7 @@
|
|||||||
<Compile Include="Renderers\CustomPickerBarRenderer.cs" />
|
<Compile Include="Renderers\CustomPickerBarRenderer.cs" />
|
||||||
<Compile Include="Renderers\CustomEntryBarRenderer.cs" />
|
<Compile Include="Renderers\CustomEntryBarRenderer.cs" />
|
||||||
<Compile Include="Renderers\CustomSearchBarRenderer.cs" />
|
<Compile Include="Renderers\CustomSearchBarRenderer.cs" />
|
||||||
|
<Compile Include="Renderers\ExtendedListViewRenderer.cs" />
|
||||||
<Compile Include="SplashActivity.cs" />
|
<Compile Include="SplashActivity.cs" />
|
||||||
<Compile Include="Renderers\BoxedView\BoxedViewRecyclerAdapter.cs" />
|
<Compile Include="Renderers\BoxedView\BoxedViewRecyclerAdapter.cs" />
|
||||||
<Compile Include="Renderers\BoxedView\BoxedViewRenderer.cs" />
|
<Compile Include="Renderers\BoxedView\BoxedViewRenderer.cs" />
|
||||||
|
29
src/Android/Renderers/ExtendedListViewRenderer.cs
Normal file
29
src/Android/Renderers/ExtendedListViewRenderer.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using Android.Content;
|
||||||
|
using Android.Views;
|
||||||
|
using Bit.App.Controls;
|
||||||
|
using Bit.Droid.Renderers;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Platform.Android;
|
||||||
|
|
||||||
|
[assembly: ExportRenderer(typeof(ExtendedListView), typeof(ExtendedListViewRenderer))]
|
||||||
|
namespace Bit.Droid.Renderers
|
||||||
|
{
|
||||||
|
public class ExtendedListViewRenderer : ListViewRenderer
|
||||||
|
{
|
||||||
|
public ExtendedListViewRenderer(Context context)
|
||||||
|
: base(context)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
|
||||||
|
{
|
||||||
|
base.OnElementChanged(e);
|
||||||
|
if(Control != null && e.NewElement != null && e.NewElement is ExtendedListView listView)
|
||||||
|
{
|
||||||
|
// Pad for FAB
|
||||||
|
Control.SetPadding(0, 0, 0, 170);
|
||||||
|
Control.SetClipToPadding(false);
|
||||||
|
Control.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
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
|
namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
@ -8,6 +9,7 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
public AddEditPage(
|
public AddEditPage(
|
||||||
string cipherId = null,
|
string cipherId = null,
|
||||||
|
CipherType? type = null,
|
||||||
string folderId = null,
|
string folderId = null,
|
||||||
string collectionId = null,
|
string collectionId = null,
|
||||||
string organizationId = null)
|
string organizationId = null)
|
||||||
@ -18,6 +20,7 @@ namespace Bit.App.Pages
|
|||||||
_vm.CipherId = cipherId;
|
_vm.CipherId = cipherId;
|
||||||
_vm.FolderId = folderId;
|
_vm.FolderId = folderId;
|
||||||
_vm.OrganizationId = organizationId;
|
_vm.OrganizationId = organizationId;
|
||||||
|
_vm.Type = type;
|
||||||
_vm.Init();
|
_vm.Init();
|
||||||
SetActivityIndicator();
|
SetActivityIndicator();
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
IsVisible="{Binding ShowAddCipherButton}"></Button>
|
IsVisible="{Binding ShowAddCipherButton}"></Button>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
<ListView
|
<controls:ExtendedListView
|
||||||
IsVisible="{Binding ShowList}"
|
IsVisible="{Binding ShowList}"
|
||||||
ItemsSource="{Binding GroupedItems}"
|
ItemsSource="{Binding GroupedItems}"
|
||||||
VerticalOptions="FillAndExpand"
|
VerticalOptions="FillAndExpand"
|
||||||
@ -76,11 +76,14 @@
|
|||||||
RefreshCommand="{Binding RefreshCommand}"
|
RefreshCommand="{Binding RefreshCommand}"
|
||||||
IsPullToRefreshEnabled="true"
|
IsPullToRefreshEnabled="true"
|
||||||
IsRefreshing="{Binding Refreshing}"
|
IsRefreshing="{Binding Refreshing}"
|
||||||
CachingStrategy="RecycleElement"
|
|
||||||
ItemTemplate="{StaticResource listItemDataTemplateSelector}"
|
ItemTemplate="{StaticResource listItemDataTemplateSelector}"
|
||||||
IsGroupingEnabled="True"
|
IsGroupingEnabled="True"
|
||||||
ItemSelected="RowSelected"
|
ItemSelected="RowSelected"
|
||||||
StyleClass="list, list-platform">
|
StyleClass="list, list-platform">
|
||||||
|
<x:Arguments>
|
||||||
|
<ListViewCachingStrategy>RecycleElement</ListViewCachingStrategy>
|
||||||
|
</x:Arguments>
|
||||||
|
|
||||||
<ListView.GroupHeaderTemplate>
|
<ListView.GroupHeaderTemplate>
|
||||||
<DataTemplate x:DataType="pages:GroupingsPageListGroup">
|
<DataTemplate x:DataType="pages:GroupingsPageListGroup">
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
@ -95,7 +98,7 @@
|
|||||||
</ViewCell>
|
</ViewCell>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.GroupHeaderTemplate>
|
</ListView.GroupHeaderTemplate>
|
||||||
</ListView>
|
</controls:ExtendedListView>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</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.Enums;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -38,6 +39,10 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
_absLayout.Children.Remove(_fab);
|
_absLayout.Children.Remove(_fab);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_fab.Clicked = AddButton_Clicked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async override void OnAppearing()
|
protected async override void OnAppearing()
|
||||||
@ -116,5 +121,41 @@ namespace Bit.App.Pages
|
|||||||
await Navigation.PushModalAsync(new NavigationPage(page), false);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,8 @@
|
|||||||
<!-- List -->
|
<!-- List -->
|
||||||
|
|
||||||
<Style TargetType="ListView"
|
<Style TargetType="ListView"
|
||||||
Class="list-platform">
|
Class="list-platform"
|
||||||
|
ApplyToDerivedTypes="True">
|
||||||
<Setter Property="SeparatorColor"
|
<Setter Property="SeparatorColor"
|
||||||
Value="Transparent" />
|
Value="Transparent" />
|
||||||
</Style>
|
</Style>
|
||||||
|
Loading…
Reference in New Issue
Block a user