mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
border for sections
This commit is contained in:
parent
defac4e2d5
commit
dcf412d94d
4 changed files with 29 additions and 17 deletions
|
@ -82,17 +82,19 @@ namespace Bit.App.Pages
|
|||
var groupedItems = new List<GroupingsPageListGroup>();
|
||||
var ciphers = await _cipherService.GetAllDecryptedByUrlAsync(Uri, null);
|
||||
var matching = ciphers.Item1?.Select(c => new GroupingsPageListItem { Cipher = c }).ToList();
|
||||
var hasMatching = matching?.Any() ?? false;
|
||||
if(matching?.Any() ?? false)
|
||||
{
|
||||
groupedItems.Add(
|
||||
new GroupingsPageListGroup(matching, AppResources.MatchingItems, matching.Count, false));
|
||||
new GroupingsPageListGroup(matching, AppResources.MatchingItems, matching.Count, false, true));
|
||||
}
|
||||
var fuzzy = ciphers.Item2?.Select(c =>
|
||||
new GroupingsPageListItem { Cipher = c, FuzzyAutofill = true }).ToList();
|
||||
if(fuzzy?.Any() ?? false)
|
||||
{
|
||||
groupedItems.Add(
|
||||
new GroupingsPageListGroup(fuzzy, AppResources.PossibleMatchingItems, fuzzy.Count, false));
|
||||
new GroupingsPageListGroup(fuzzy, AppResources.PossibleMatchingItems, fuzzy.Count, false,
|
||||
!hasMatching));
|
||||
}
|
||||
GroupedItems.ResetWithRange(groupedItems);
|
||||
ShowList = groupedItems.Any();
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||
|
||||
<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}"
|
||||
|
@ -95,6 +97,9 @@
|
|||
<ListView.GroupHeaderTemplate>
|
||||
<DataTemplate x:DataType="pages:GroupingsPageListGroup">
|
||||
<ViewCell>
|
||||
<StackLayout Spacing="0" Padding="0">
|
||||
<BoxView StyleClass="box-row-separator"
|
||||
IsVisible="{Binding First, Converter={StaticResource inverseBool}}" />
|
||||
<StackLayout StyleClass="list-row-header">
|
||||
<Label
|
||||
Text="{Binding Name}"
|
||||
|
@ -103,6 +108,7 @@
|
|||
Text="{Binding ItemCount}"
|
||||
StyleClass="list-header-sub" />
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.GroupHeaderTemplate>
|
||||
|
|
|
@ -4,12 +4,12 @@ namespace Bit.App.Pages
|
|||
{
|
||||
public class GroupingsPageListGroup : List<GroupingsPageListItem>
|
||||
{
|
||||
public GroupingsPageListGroup(string name, int count, bool doUpper = true)
|
||||
: this(new List<GroupingsPageListItem>(), name, count, doUpper)
|
||||
public GroupingsPageListGroup(string name, int count, bool doUpper = true, bool first = false)
|
||||
: this(new List<GroupingsPageListItem>(), name, count, doUpper, first)
|
||||
{ }
|
||||
|
||||
public GroupingsPageListGroup(List<GroupingsPageListItem> groupItems, string name, int count,
|
||||
bool doUpper = true)
|
||||
bool doUpper = true, bool first = false)
|
||||
{
|
||||
AddRange(groupItems);
|
||||
if(string.IsNullOrWhiteSpace(name))
|
||||
|
@ -25,8 +25,10 @@ namespace Bit.App.Pages
|
|||
Name = name;
|
||||
}
|
||||
ItemCount = count.ToString("N0");
|
||||
First = first;
|
||||
}
|
||||
|
||||
public bool First { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string NameShort => string.IsNullOrWhiteSpace(Name) || Name.Length == 0 ? "-" : Name[0].ToString();
|
||||
public string ItemCount { get; set; }
|
||||
|
|
|
@ -150,15 +150,16 @@ namespace Bit.App.Pages
|
|||
_collectionCounts[c.Node.Id] : 0).ToString("N0")
|
||||
}).ToList();
|
||||
|
||||
var hasFavorites = favListItems?.Any() ?? false;
|
||||
if(favListItems?.Any() ?? false)
|
||||
{
|
||||
groupedItems.Add(new GroupingsPageListGroup(favListItems, AppResources.Favorites,
|
||||
favListItems.Count, Device.RuntimePlatform == Device.iOS));
|
||||
favListItems.Count, Device.RuntimePlatform == Device.iOS, true));
|
||||
}
|
||||
if(MainPage)
|
||||
{
|
||||
groupedItems.Add(new GroupingsPageListGroup(
|
||||
AppResources.Types, 4, Device.RuntimePlatform == Device.iOS)
|
||||
AppResources.Types, 4, Device.RuntimePlatform == Device.iOS, !hasFavorites)
|
||||
{
|
||||
new GroupingsPageListItem
|
||||
{
|
||||
|
@ -189,17 +190,18 @@ namespace Bit.App.Pages
|
|||
if(folderListItems?.Any() ?? false)
|
||||
{
|
||||
groupedItems.Add(new GroupingsPageListGroup(folderListItems, AppResources.Folders,
|
||||
folderListItems.Count, Device.RuntimePlatform == Device.iOS));
|
||||
folderListItems.Count, Device.RuntimePlatform == Device.iOS, !MainPage));
|
||||
}
|
||||
if(collectionListItems?.Any() ?? false)
|
||||
{
|
||||
groupedItems.Add(new GroupingsPageListGroup(collectionListItems, AppResources.Collections,
|
||||
collectionListItems.Count, Device.RuntimePlatform == Device.iOS));
|
||||
collectionListItems.Count, Device.RuntimePlatform == Device.iOS, !MainPage));
|
||||
}
|
||||
if(ciphersListItems?.Any() ?? false)
|
||||
{
|
||||
groupedItems.Add(new GroupingsPageListGroup(ciphersListItems, AppResources.Items,
|
||||
ciphersListItems.Count, Device.RuntimePlatform == Device.iOS));
|
||||
ciphersListItems.Count, Device.RuntimePlatform == Device.iOS,
|
||||
!MainPage && !groupedItems.Any()));
|
||||
}
|
||||
GroupedItems.ResetWithRange(groupedItems);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue