This commit is contained in:
Kyle Spearrin 2019-05-08 08:33:17 -04:00
parent 0b73317dd0
commit 2a5739dfdc
20 changed files with 2675 additions and 381 deletions

View File

@ -442,5 +442,35 @@
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\notification_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\pencil.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\plus.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\pencil.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\plus.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\pencil.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\plus.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\pencil.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\plus.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\plus.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\pencil.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>

View File

@ -39,6 +39,7 @@ namespace Bit.Droid
private void RegisterLocalServices()
{
Refractored.FabControl.Droid.FloatingActionButtonViewRenderer.Init();
// Note: This might cause a race condition. Investigate more.
Task.Run(() => FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true));

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

View File

@ -12,8 +12,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Refractored.FloatingActionButtonForms" Version="2.1.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.5.909-pre" />
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.9.961" />
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
</ItemGroup>

View File

@ -23,24 +23,40 @@ namespace Bit.App.Pages
return true;
}
protected void SetActivityIndicator()
protected void SetActivityIndicator(ContentView targetView = null)
{
Content = new ActivityIndicator
var indicator = new ActivityIndicator
{
IsRunning = true,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center
};
if(targetView != null)
{
targetView.Content = indicator;
}
else
{
Content = indicator;
}
}
protected async Task LoadOnAppearedAsync(View viewToSet, bool fromModal, Func<Task> workFunction)
protected async Task LoadOnAppearedAsync(View sourceView, bool fromModal, Func<Task> workFunction,
ContentView targetView = null)
{
async Task DoWorkAsync()
{
await workFunction.Invoke();
if(viewToSet != null)
if(sourceView != null)
{
Content = viewToSet;
if(targetView != null)
{
targetView.Content = sourceView;
}
else
{
Content = sourceView;
}
}
}
if(Device.RuntimePlatform == Device.iOS)

View File

@ -5,6 +5,7 @@
xmlns:pages="clr-namespace:Bit.App.Pages"
xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:controls="clr-namespace:Bit.App.Controls"
xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl"
x:DataType="pages:GroupingsPageViewModel"
Title="{Binding PageTitle}"
x:Name="_page">
@ -51,45 +52,69 @@
<pages:GroupingsPageListItemSelector x:Key="listItemDataTemplateSelector"
CipherTemplate="{StaticResource cipherTemplate}"
GroupTemplate="{StaticResource groupTemplate}" />
<StackLayout x:Key="mainLayout" x:Name="_mainLayout">
<StackLayout
VerticalOptions="CenterAndExpand"
Padding="20, 0"
Spacing="20"
IsVisible="{Binding ShowNoData}">
<Label
Text="{Binding NoDataText}"
HorizontalTextAlignment="Center"></Label>
<Button
Text="{u:I18n AddAnItem}"
Command="{Binding AddCipherCommand}"
IsVisible="{Binding ShowAddCipherButton}"></Button>
</StackLayout>
<ListView
IsVisible="{Binding ShowList}"
ItemsSource="{Binding GroupedItems}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
RefreshCommand="{Binding RefreshCommand}"
IsPullToRefreshEnabled="true"
IsRefreshing="{Binding Refreshing}"
CachingStrategy="RecycleElement"
ItemTemplate="{StaticResource listItemDataTemplateSelector}"
IsGroupingEnabled="True"
ItemSelected="RowSelected"
StyleClass="list, list-platform">
<ListView.GroupHeaderTemplate>
<DataTemplate x:DataType="pages:GroupingsPageListGroup">
<ViewCell>
<StackLayout StyleClass="list-row-header">
<Label
Text="{Binding Name}"
StyleClass="list-header, list-header-platform" />
<Label
Text="{Binding ItemCount}"
StyleClass="list-header-sub" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
</ListView>
</StackLayout>
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout x:Name="_mainLayout">
<StackLayout VerticalOptions="CenterAndExpand"
Padding="20, 0"
Spacing="20"
IsVisible="{Binding ShowNoData}">
<Label Text="{Binding NoDataText}"
HorizontalTextAlignment="Center"></Label>
<Button Text="{u:I18n AddAnItem}"
Command="{Binding AddCipherCommand}"
IsVisible="{Binding ShowAddCipherButton}"></Button>
</StackLayout>
<ListView x:Name="ItemsListView"
IsVisible="{Binding ShowList}"
ItemsSource="{Binding GroupedItems}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
RefreshCommand="{Binding RefreshCommand}"
IsPullToRefreshEnabled="true"
IsRefreshing="{Binding Refreshing}"
CachingStrategy="RecycleElement"
ItemTemplate="{StaticResource listItemDataTemplateSelector}"
IsGroupingEnabled="True"
ItemSelected="RowSelected"
StyleClass="list, list-platform">
<ListView.GroupHeaderTemplate>
<DataTemplate x:DataType="pages:GroupingsPageListGroup">
<ViewCell>
<StackLayout StyleClass="list-row-header">
<Label Text="{Binding Name}"
StyleClass="list-header, list-header-platform" />
<Label Text="{Binding ItemCount}"
StyleClass="list-header-sub" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
</ListView>
</StackLayout>
<AbsoluteLayout
x:Name="_absLayout"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand">
<ContentView
x:Name="_mainContent"
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
</ContentView>
<fab:FloatingActionButtonView
x:Name="_fab"
ImageName="plus.png"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds="1, 1, AutoSize, AutoSize">
</fab:FloatingActionButtonView>
</AbsoluteLayout>
</pages:BaseContentPage>

View File

@ -20,7 +20,7 @@ namespace Bit.App.Pages
string collectionId = null, string pageTitle = null)
{
InitializeComponent();
SetActivityIndicator();
SetActivityIndicator(_mainContent);
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
_syncService = ServiceContainer.Resolve<ISyncService>("syncService");
_vm = BindingContext as GroupingsPageViewModel;
@ -33,6 +33,11 @@ namespace Bit.App.Pages
{
_vm.PageTitle = pageTitle;
}
if(Device.RuntimePlatform == Device.iOS)
{
_absLayout.Children.Remove(_fab);
}
}
protected async override void OnAppearing()
@ -62,7 +67,7 @@ namespace Bit.App.Pages
await _vm.LoadAsync();
}
}
});
}, _mainContent);
}
protected override void OnDisappearing()

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Styles.Base">
x:Class="Bit.App.Styles.Base"
xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl">
<!-- General -->
<Style TargetType="Label"
@ -68,6 +69,14 @@
<Setter Property="TextColor"
Value="{StaticResource DisabledIconColor}" />
</Style>
<Style TargetType="fab:FloatingActionButtonView">
<Setter Property="ColorNormal"
Value="{StaticResource FabColor}" />
<Setter Property="ColorPressed"
Value="{StaticResource FabPressedColor}" />
<Setter Property="ColorRipple"
Value="{StaticResource FabPressedColor}" />
</Style>
<!-- Title -->
<Style TargetType="Button"

View File

@ -24,4 +24,7 @@
<Color x:Key="ListItemBorderColor">#f0f0f0</Color>
<Color x:Key="ListHeaderTextColor">#3c8dbc</Color>
<Color x:Key="FabColor">#3c8dbc</Color>
<Color x:Key="FabPressedColor">#3883af</Color>
</ResourceDictionary>

View File

@ -24,4 +24,7 @@
<Color x:Key="ListItemBorderColor">#f0f0f0</Color>
<Color x:Key="ListHeaderTextColor">#3c8dbc</Color>
<Color x:Key="FabColor">#3c8dbc</Color>
<Color x:Key="FabPressedColor">#3883af</Color>
</ResourceDictionary>