1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-29 04:07:37 +02:00
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,20 +52,23 @@
<pages:GroupingsPageListItemSelector x:Key="listItemDataTemplateSelector" <pages:GroupingsPageListItemSelector x:Key="listItemDataTemplateSelector"
CipherTemplate="{StaticResource cipherTemplate}" CipherTemplate="{StaticResource cipherTemplate}"
GroupTemplate="{StaticResource groupTemplate}" /> GroupTemplate="{StaticResource groupTemplate}" />
</ResourceDictionary>
</ContentPage.Resources> <StackLayout x:Key="mainLayout" x:Name="_mainLayout">
<StackLayout x:Name="_mainLayout"> <StackLayout
<StackLayout VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
Padding="20, 0" Padding="20, 0"
Spacing="20" Spacing="20"
IsVisible="{Binding ShowNoData}"> IsVisible="{Binding ShowNoData}">
<Label Text="{Binding NoDataText}" <Label
Text="{Binding NoDataText}"
HorizontalTextAlignment="Center"></Label> HorizontalTextAlignment="Center"></Label>
<Button Text="{u:I18n AddAnItem}" <Button
Text="{u:I18n AddAnItem}"
Command="{Binding AddCipherCommand}" Command="{Binding AddCipherCommand}"
IsVisible="{Binding ShowAddCipherButton}"></Button> IsVisible="{Binding ShowAddCipherButton}"></Button>
</StackLayout> </StackLayout>
<ListView x:Name="ItemsListView"
<ListView
IsVisible="{Binding ShowList}" IsVisible="{Binding ShowList}"
ItemsSource="{Binding GroupedItems}" ItemsSource="{Binding GroupedItems}"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
@ -81,9 +85,11 @@
<DataTemplate x:DataType="pages:GroupingsPageListGroup"> <DataTemplate x:DataType="pages:GroupingsPageListGroup">
<ViewCell> <ViewCell>
<StackLayout StyleClass="list-row-header"> <StackLayout StyleClass="list-row-header">
<Label Text="{Binding Name}" <Label
Text="{Binding Name}"
StyleClass="list-header, list-header-platform" /> StyleClass="list-header, list-header-platform" />
<Label Text="{Binding ItemCount}" <Label
Text="{Binding ItemCount}"
StyleClass="list-header-sub" /> StyleClass="list-header-sub" />
</StackLayout> </StackLayout>
</ViewCell> </ViewCell>
@ -91,5 +97,24 @@
</ListView.GroupHeaderTemplate> </ListView.GroupHeaderTemplate>
</ListView> </ListView>
</StackLayout> </StackLayout>
</ResourceDictionary>
</ContentPage.Resources>
<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> </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>