mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +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 groupedItems = new List<GroupingsPageListGroup>();
|
||||||
var ciphers = await _cipherService.GetAllDecryptedByUrlAsync(Uri, null);
|
var ciphers = await _cipherService.GetAllDecryptedByUrlAsync(Uri, null);
|
||||||
var matching = ciphers.Item1?.Select(c => new GroupingsPageListItem { Cipher = c }).ToList();
|
var matching = ciphers.Item1?.Select(c => new GroupingsPageListItem { Cipher = c }).ToList();
|
||||||
|
var hasMatching = matching?.Any() ?? false;
|
||||||
if(matching?.Any() ?? false)
|
if(matching?.Any() ?? false)
|
||||||
{
|
{
|
||||||
groupedItems.Add(
|
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 =>
|
var fuzzy = ciphers.Item2?.Select(c =>
|
||||||
new GroupingsPageListItem { Cipher = c, FuzzyAutofill = true }).ToList();
|
new GroupingsPageListItem { Cipher = c, FuzzyAutofill = true }).ToList();
|
||||||
if(fuzzy?.Any() ?? false)
|
if(fuzzy?.Any() ?? false)
|
||||||
{
|
{
|
||||||
groupedItems.Add(
|
groupedItems.Add(
|
||||||
new GroupingsPageListGroup(fuzzy, AppResources.PossibleMatchingItems, fuzzy.Count, false));
|
new GroupingsPageListGroup(fuzzy, AppResources.PossibleMatchingItems, fuzzy.Count, false,
|
||||||
|
!hasMatching));
|
||||||
}
|
}
|
||||||
GroupedItems.ResetWithRange(groupedItems);
|
GroupedItems.ResetWithRange(groupedItems);
|
||||||
ShowList = groupedItems.Any();
|
ShowList = groupedItems.Any();
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||||
|
|
||||||
<ToolbarItem x:Name="_syncItem" x:Key="syncItem" Text="{u:I18n Sync}"
|
<ToolbarItem x:Name="_syncItem" x:Key="syncItem" Text="{u:I18n Sync}"
|
||||||
Clicked="Sync_Clicked" Order="Secondary" />
|
Clicked="Sync_Clicked" Order="Secondary" />
|
||||||
<ToolbarItem x:Name="_lockItem" x:Key="lockItem" Text="{u:I18n Lock}"
|
<ToolbarItem x:Name="_lockItem" x:Key="lockItem" Text="{u:I18n Lock}"
|
||||||
|
@ -95,13 +97,17 @@
|
||||||
<ListView.GroupHeaderTemplate>
|
<ListView.GroupHeaderTemplate>
|
||||||
<DataTemplate x:DataType="pages:GroupingsPageListGroup">
|
<DataTemplate x:DataType="pages:GroupingsPageListGroup">
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
<StackLayout StyleClass="list-row-header">
|
<StackLayout Spacing="0" Padding="0">
|
||||||
<Label
|
<BoxView StyleClass="box-row-separator"
|
||||||
Text="{Binding Name}"
|
IsVisible="{Binding First, Converter={StaticResource inverseBool}}" />
|
||||||
StyleClass="list-header, list-header-platform" />
|
<StackLayout StyleClass="list-row-header">
|
||||||
<Label
|
<Label
|
||||||
Text="{Binding ItemCount}"
|
Text="{Binding Name}"
|
||||||
StyleClass="list-header-sub" />
|
StyleClass="list-header, list-header-platform" />
|
||||||
|
<Label
|
||||||
|
Text="{Binding ItemCount}"
|
||||||
|
StyleClass="list-header-sub" />
|
||||||
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ViewCell>
|
</ViewCell>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
|
@ -4,12 +4,12 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
public class GroupingsPageListGroup : List<GroupingsPageListItem>
|
public class GroupingsPageListGroup : List<GroupingsPageListItem>
|
||||||
{
|
{
|
||||||
public GroupingsPageListGroup(string name, int count, bool doUpper = true)
|
public GroupingsPageListGroup(string name, int count, bool doUpper = true, bool first = false)
|
||||||
: this(new List<GroupingsPageListItem>(), name, count, doUpper)
|
: this(new List<GroupingsPageListItem>(), name, count, doUpper, first)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public GroupingsPageListGroup(List<GroupingsPageListItem> groupItems, string name, int count,
|
public GroupingsPageListGroup(List<GroupingsPageListItem> groupItems, string name, int count,
|
||||||
bool doUpper = true)
|
bool doUpper = true, bool first = false)
|
||||||
{
|
{
|
||||||
AddRange(groupItems);
|
AddRange(groupItems);
|
||||||
if(string.IsNullOrWhiteSpace(name))
|
if(string.IsNullOrWhiteSpace(name))
|
||||||
|
@ -25,8 +25,10 @@ namespace Bit.App.Pages
|
||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
ItemCount = count.ToString("N0");
|
ItemCount = count.ToString("N0");
|
||||||
|
First = first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool First { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string NameShort => string.IsNullOrWhiteSpace(Name) || Name.Length == 0 ? "-" : Name[0].ToString();
|
public string NameShort => string.IsNullOrWhiteSpace(Name) || Name.Length == 0 ? "-" : Name[0].ToString();
|
||||||
public string ItemCount { get; set; }
|
public string ItemCount { get; set; }
|
||||||
|
|
|
@ -150,15 +150,16 @@ namespace Bit.App.Pages
|
||||||
_collectionCounts[c.Node.Id] : 0).ToString("N0")
|
_collectionCounts[c.Node.Id] : 0).ToString("N0")
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
var hasFavorites = favListItems?.Any() ?? false;
|
||||||
if(favListItems?.Any() ?? false)
|
if(favListItems?.Any() ?? false)
|
||||||
{
|
{
|
||||||
groupedItems.Add(new GroupingsPageListGroup(favListItems, AppResources.Favorites,
|
groupedItems.Add(new GroupingsPageListGroup(favListItems, AppResources.Favorites,
|
||||||
favListItems.Count, Device.RuntimePlatform == Device.iOS));
|
favListItems.Count, Device.RuntimePlatform == Device.iOS, true));
|
||||||
}
|
}
|
||||||
if(MainPage)
|
if(MainPage)
|
||||||
{
|
{
|
||||||
groupedItems.Add(new GroupingsPageListGroup(
|
groupedItems.Add(new GroupingsPageListGroup(
|
||||||
AppResources.Types, 4, Device.RuntimePlatform == Device.iOS)
|
AppResources.Types, 4, Device.RuntimePlatform == Device.iOS, !hasFavorites)
|
||||||
{
|
{
|
||||||
new GroupingsPageListItem
|
new GroupingsPageListItem
|
||||||
{
|
{
|
||||||
|
@ -189,17 +190,18 @@ namespace Bit.App.Pages
|
||||||
if(folderListItems?.Any() ?? false)
|
if(folderListItems?.Any() ?? false)
|
||||||
{
|
{
|
||||||
groupedItems.Add(new GroupingsPageListGroup(folderListItems, AppResources.Folders,
|
groupedItems.Add(new GroupingsPageListGroup(folderListItems, AppResources.Folders,
|
||||||
folderListItems.Count, Device.RuntimePlatform == Device.iOS));
|
folderListItems.Count, Device.RuntimePlatform == Device.iOS, !MainPage));
|
||||||
}
|
}
|
||||||
if(collectionListItems?.Any() ?? false)
|
if(collectionListItems?.Any() ?? false)
|
||||||
{
|
{
|
||||||
groupedItems.Add(new GroupingsPageListGroup(collectionListItems, AppResources.Collections,
|
groupedItems.Add(new GroupingsPageListGroup(collectionListItems, AppResources.Collections,
|
||||||
collectionListItems.Count, Device.RuntimePlatform == Device.iOS));
|
collectionListItems.Count, Device.RuntimePlatform == Device.iOS, !MainPage));
|
||||||
}
|
}
|
||||||
if(ciphersListItems?.Any() ?? false)
|
if(ciphersListItems?.Any() ?? false)
|
||||||
{
|
{
|
||||||
groupedItems.Add(new GroupingsPageListGroup(ciphersListItems, AppResources.Items,
|
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);
|
GroupedItems.ResetWithRange(groupedItems);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue