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> <ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\notification_sm.png" /> <AndroidResource Include="Resources\drawable-xxxhdpi\notification_sm.png" />
</ItemGroup> </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" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project> </Project>

View file

@ -39,6 +39,7 @@ namespace Bit.Droid
private void RegisterLocalServices() private void RegisterLocalServices()
{ {
Refractored.FabControl.Droid.FloatingActionButtonViewRenderer.Init();
// Note: This might cause a race condition. Investigate more. // Note: This might cause a race condition. Investigate more.
Task.Run(() => FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true)); 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> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Refractored.FloatingActionButtonForms" Version="2.1.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.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" /> <PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
</ItemGroup> </ItemGroup>

View file

@ -23,24 +23,40 @@ namespace Bit.App.Pages
return true; return true;
} }
protected void SetActivityIndicator() protected void SetActivityIndicator(ContentView targetView = null)
{ {
Content = new ActivityIndicator var indicator = new ActivityIndicator
{ {
IsRunning = true, IsRunning = true,
VerticalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center 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() async Task DoWorkAsync()
{ {
await workFunction.Invoke(); 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) if(Device.RuntimePlatform == Device.iOS)

View file

@ -5,6 +5,7 @@
xmlns:pages="clr-namespace:Bit.App.Pages" xmlns:pages="clr-namespace:Bit.App.Pages"
xmlns:u="clr-namespace:Bit.App.Utilities" xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:controls="clr-namespace:Bit.App.Controls" xmlns:controls="clr-namespace:Bit.App.Controls"
xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl"
x:DataType="pages:GroupingsPageViewModel" x:DataType="pages:GroupingsPageViewModel"
Title="{Binding PageTitle}" Title="{Binding PageTitle}"
x:Name="_page"> x:Name="_page">
@ -51,45 +52,69 @@
<pages:GroupingsPageListItemSelector x:Key="listItemDataTemplateSelector" <pages:GroupingsPageListItemSelector x:Key="listItemDataTemplateSelector"
CipherTemplate="{StaticResource cipherTemplate}" CipherTemplate="{StaticResource cipherTemplate}"
GroupTemplate="{StaticResource groupTemplate}" /> 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> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<StackLayout x:Name="_mainLayout">
<StackLayout VerticalOptions="CenterAndExpand" <AbsoluteLayout
Padding="20, 0" x:Name="_absLayout"
Spacing="20" VerticalOptions="FillAndExpand"
IsVisible="{Binding ShowNoData}"> HorizontalOptions="FillAndExpand">
<Label Text="{Binding NoDataText}" <ContentView
HorizontalTextAlignment="Center"></Label> x:Name="_mainContent"
<Button Text="{u:I18n AddAnItem}" AbsoluteLayout.LayoutFlags="All"
Command="{Binding AddCipherCommand}" AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
IsVisible="{Binding ShowAddCipherButton}"></Button> </ContentView>
</StackLayout> <fab:FloatingActionButtonView
<ListView x:Name="ItemsListView" x:Name="_fab"
IsVisible="{Binding ShowList}" ImageName="plus.png"
ItemsSource="{Binding GroupedItems}" AbsoluteLayout.LayoutFlags="PositionProportional"
VerticalOptions="FillAndExpand" AbsoluteLayout.LayoutBounds="1, 1, AutoSize, AutoSize">
HasUnevenRows="true" </fab:FloatingActionButtonView>
RefreshCommand="{Binding RefreshCommand}" </AbsoluteLayout>
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>
</pages:BaseContentPage> </pages:BaseContentPage>

View file

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

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms" <ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 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 --> <!-- General -->
<Style TargetType="Label" <Style TargetType="Label"
@ -68,6 +69,14 @@
<Setter Property="TextColor" <Setter Property="TextColor"
Value="{StaticResource DisabledIconColor}" /> Value="{StaticResource DisabledIconColor}" />
</Style> </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 --> <!-- Title -->
<Style TargetType="Button" <Style TargetType="Button"

View file

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

View file

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