mirror of
https://github.com/bitwarden/android.git
synced 2024-12-20 00:02:58 +03:00
adjusting cells for vault list view
This commit is contained in:
parent
2e9410846e
commit
84836fe89b
6 changed files with 23 additions and 13 deletions
|
@ -17,7 +17,7 @@ namespace Bit.Android.Controls
|
||||||
|
|
||||||
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
|
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
|
||||||
{
|
{
|
||||||
var View = (BaseCellView)base.GetCellCore(item, convertView, parent, context);
|
var View = base.GetCellCore(item, convertView, parent, context);
|
||||||
var extendedCell = (ExtendedViewCell)item;
|
var extendedCell = (ExtendedViewCell)item;
|
||||||
|
|
||||||
if(View != null)
|
if(View != null)
|
||||||
|
@ -37,7 +37,7 @@ namespace Bit.Android.Controls
|
||||||
var image = new DisclosureImage(context, extendedCell);
|
var image = new DisclosureImage(context, extendedCell);
|
||||||
image.SetImageResource(resourceId);
|
image.SetImageResource(resourceId);
|
||||||
image.SetPadding(10, 10, 30, 10);
|
image.SetPadding(10, 10, 30, 10);
|
||||||
View.SetAccessoryView(image);
|
//View.SetAccessoryView(image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Bit.App.Controls
|
||||||
|
|
||||||
var stackLayout = new StackLayout
|
var stackLayout = new StackLayout
|
||||||
{
|
{
|
||||||
Padding = new Thickness(15, 5),
|
Padding = new Thickness(20, 5),
|
||||||
HorizontalOptions = LayoutOptions.FillAndExpand,
|
HorizontalOptions = LayoutOptions.FillAndExpand,
|
||||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
VerticalOptions = LayoutOptions.FillAndExpand,
|
||||||
Children = { Label, Detail },
|
Children = { Label, Detail },
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Bit.App.Models.Page
|
||||||
Id = site.Id;
|
Id = site.Id;
|
||||||
FolderId = folderId;
|
FolderId = folderId;
|
||||||
Name = site.Name?.Decrypt();
|
Name = site.Name?.Decrypt();
|
||||||
Username = site.Username?.Decrypt();
|
Username = site.Username?.Decrypt() ?? " ";
|
||||||
Password = site.Password?.Decrypt();
|
Password = site.Password?.Decrypt();
|
||||||
Uri = site.Uri?.Decrypt();
|
Uri = site.Uri?.Decrypt();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ using XLabs.Ioc;
|
||||||
using Bit.App.Utilities;
|
using Bit.App.Utilities;
|
||||||
using PushNotification.Plugin.Abstractions;
|
using PushNotification.Plugin.Abstractions;
|
||||||
using Plugin.Settings.Abstractions;
|
using Plugin.Settings.Abstractions;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
|
@ -55,10 +56,13 @@ namespace Bit.App.Pages
|
||||||
GroupHeaderTemplate = new DataTemplate(() => new VaultListHeaderViewCell(this)),
|
GroupHeaderTemplate = new DataTemplate(() => new VaultListHeaderViewCell(this)),
|
||||||
ItemTemplate = new DataTemplate(() => new VaultListViewCell(this))
|
ItemTemplate = new DataTemplate(() => new VaultListViewCell(this))
|
||||||
};
|
};
|
||||||
|
|
||||||
if(Device.OS == TargetPlatform.iOS)
|
if(Device.OS == TargetPlatform.iOS)
|
||||||
{
|
{
|
||||||
listView.Margin = new Thickness(0, 0, -15, 0);
|
listView.Margin = new Thickness(0, 0, -15, 0);
|
||||||
|
listView.RowHeight = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
listView.ItemSelected += SiteSelected;
|
listView.ItemSelected += SiteSelected;
|
||||||
|
|
||||||
Title = _favorites ? AppResources.Favorites : AppResources.MyVault;
|
Title = _favorites ? AppResources.Favorites : AppResources.MyVault;
|
||||||
|
@ -183,6 +187,9 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
private VaultListSitesPage _page;
|
private VaultListSitesPage _page;
|
||||||
|
|
||||||
|
public static readonly BindableProperty SiteParameterProperty = BindableProperty.Create(nameof(SiteParameter),
|
||||||
|
typeof(VaultListPageModel.Site), typeof(VaultListViewCell), null);
|
||||||
|
|
||||||
public VaultListViewCell(VaultListSitesPage page)
|
public VaultListViewCell(VaultListSitesPage page)
|
||||||
{
|
{
|
||||||
_page = page;
|
_page = page;
|
||||||
|
@ -196,7 +203,7 @@ namespace Bit.App.Pages
|
||||||
moreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
|
moreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
|
||||||
moreAction.Clicked += MoreAction_Clicked;
|
moreAction.Clicked += MoreAction_Clicked;
|
||||||
|
|
||||||
//SetBinding(CommandParameterProperty, new Binding("."));
|
SetBinding(SiteParameterProperty, new Binding("."));
|
||||||
Label.SetBinding<VaultListPageModel.Site>(Label.TextProperty, s => s.Name);
|
Label.SetBinding<VaultListPageModel.Site>(Label.TextProperty, s => s.Name);
|
||||||
Detail.SetBinding<VaultListPageModel.Site>(Label.TextProperty, s => s.Username);
|
Detail.SetBinding<VaultListPageModel.Site>(Label.TextProperty, s => s.Username);
|
||||||
|
|
||||||
|
@ -208,6 +215,12 @@ namespace Bit.App.Pages
|
||||||
DisclousureImage = "more";
|
DisclousureImage = "more";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VaultListPageModel.Site SiteParameter
|
||||||
|
{
|
||||||
|
get { return GetValue(SiteParameterProperty) as VaultListPageModel.Site; }
|
||||||
|
set { SetValue(SiteParameterProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
private void MoreAction_Clicked(object sender, EventArgs e)
|
private void MoreAction_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var menuItem = sender as MenuItem;
|
var menuItem = sender as MenuItem;
|
||||||
|
@ -218,8 +231,7 @@ namespace Bit.App.Pages
|
||||||
private void VaultListViewCell_DisclousureTapped(object sender, EventArgs e)
|
private void VaultListViewCell_DisclousureTapped(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var cell = sender as VaultListViewCell;
|
var cell = sender as VaultListViewCell;
|
||||||
//var site = cell.CommandParameter as VaultListPageModel.Site;
|
_page.MoreClickedAsync(cell.SiteParameter);
|
||||||
// _page.MoreClickedAsync(site);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +242,6 @@ namespace Bit.App.Pages
|
||||||
var image = new Image
|
var image = new Image
|
||||||
{
|
{
|
||||||
Source = "fa_folder_open.png",
|
Source = "fa_folder_open.png",
|
||||||
Margin = new Thickness(16, 0, 0, 0),
|
|
||||||
VerticalOptions = LayoutOptions.CenterAndExpand
|
VerticalOptions = LayoutOptions.CenterAndExpand
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -238,7 +249,6 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
VerticalTextAlignment = TextAlignment.Center,
|
VerticalTextAlignment = TextAlignment.Center,
|
||||||
VerticalOptions = LayoutOptions.CenterAndExpand,
|
VerticalOptions = LayoutOptions.CenterAndExpand,
|
||||||
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
|
||||||
Style = (Style)Application.Current.Resources["text-muted"]
|
Style = (Style)Application.Current.Resources["text-muted"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -249,11 +259,11 @@ namespace Bit.App.Pages
|
||||||
Orientation = StackOrientation.Horizontal,
|
Orientation = StackOrientation.Horizontal,
|
||||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
VerticalOptions = LayoutOptions.FillAndExpand,
|
||||||
Children = { image, label },
|
Children = { image, label },
|
||||||
BackgroundColor = Color.FromHex("efeff4")
|
BackgroundColor = Color.FromHex("efeff4"),
|
||||||
|
Padding = new Thickness(16, 0, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
View = stackLayout;
|
View = stackLayout;
|
||||||
Height = 30;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Bit.iOS.Controls
|
||||||
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected);
|
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
detailDisclosureButton.Frame = new CGRect(0f, 0f, 50f, 40f);
|
detailDisclosureButton.Frame = new CGRect(0f, 0f, 50f, 100f);
|
||||||
detailDisclosureButton.TouchUpInside += (sender, e) =>
|
detailDisclosureButton.TouchUpInside += (sender, e) =>
|
||||||
{
|
{
|
||||||
extendedCell.OnDisclousureTapped();
|
extendedCell.OnDisclousureTapped();
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Bit.iOS.Controls
|
||||||
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected);
|
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
detailDisclosureButton.Frame = new CGRect(0f, 0f, 50f, 40f);
|
detailDisclosureButton.Frame = new CGRect(0f, 0f, 50f, 100f);
|
||||||
detailDisclosureButton.TouchUpInside += (sender, e) =>
|
detailDisclosureButton.TouchUpInside += (sender, e) =>
|
||||||
{
|
{
|
||||||
extendedCell.OnDisclousureTapped();
|
extendedCell.OnDisclousureTapped();
|
||||||
|
|
Loading…
Reference in a new issue