1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-26 12:16:07 +01:00

folder icon added to header view. custom bordering. extended text cell for android background color.

This commit is contained in:
Kyle Spearrin 2016-05-16 22:47:36 -04:00
parent 4e906f9370
commit dc9ebbc5a7
15 changed files with 192 additions and 110 deletions

View File

@ -197,6 +197,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\ExtendedEditorRenderer.cs" />
<Compile Include="Controls\ExtendedTextCellRenderer.cs" />
<Compile Include="Controls\ExtendedPickerRenderer.cs" />
<Compile Include="Controls\ExtendedEntryRenderer.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
@ -235,6 +236,21 @@
<ItemGroup>
<AndroidResource Include="Resources\values\colors.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\fa_folder_open.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\fa_folder_open.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-mdpi\fa_folder_open.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\fa_folder_open.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\fa_folder_open.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -0,0 +1,40 @@
using Android.Content;
using System.ComponentModel;
using Android.Views;
using Bit.Android.Controls;
using Bit.App.Controls;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using AView = Android.Views.View;
[assembly: ExportRenderer(typeof(ExtendedTextCell), typeof(ExtendedTextCellRenderer))]
namespace Bit.Android.Controls
{
public class ExtendedTextCellRenderer : TextCellRenderer
{
protected AView View { get; private set; }
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
{
var View = base.GetCellCore(item, convertView, parent, context);
var cell = (ExtendedTextCell)item;
View.SetBackgroundColor(cell.BackgroundColor.ToAndroid());
return View;
}
protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args)
{
base.OnCellPropertyChanged(sender, args);
var cell = (ExtendedTextCell)Cell;
if(args.PropertyName == ExtendedTextCell.BackgroundColorProperty.PropertyName)
{
View.SetBackgroundColor(cell.BackgroundColor.ToAndroid());
}
}
}
}

View File

@ -2042,271 +2042,274 @@ namespace Bit.Android
public const int design_snackbar_background = 2130837580;
// aapt resource value: 0x7f02004d
public const int ic_audiotrack = 2130837581;
public const int fa_folder_open = 2130837581;
// aapt resource value: 0x7f02004e
public const int ic_audiotrack_light = 2130837582;
public const int ic_audiotrack = 2130837582;
// aapt resource value: 0x7f02004f
public const int ic_bluetooth_grey = 2130837583;
public const int ic_audiotrack_light = 2130837583;
// aapt resource value: 0x7f020050
public const int ic_bluetooth_white = 2130837584;
public const int ic_bluetooth_grey = 2130837584;
// aapt resource value: 0x7f020051
public const int ic_cast_dark = 2130837585;
public const int ic_bluetooth_white = 2130837585;
// aapt resource value: 0x7f020052
public const int ic_cast_disabled_light = 2130837586;
public const int ic_cast_dark = 2130837586;
// aapt resource value: 0x7f020053
public const int ic_cast_grey = 2130837587;
public const int ic_cast_disabled_light = 2130837587;
// aapt resource value: 0x7f020054
public const int ic_cast_light = 2130837588;
public const int ic_cast_grey = 2130837588;
// aapt resource value: 0x7f020055
public const int ic_cast_off_light = 2130837589;
public const int ic_cast_light = 2130837589;
// aapt resource value: 0x7f020056
public const int ic_cast_on_0_light = 2130837590;
public const int ic_cast_off_light = 2130837590;
// aapt resource value: 0x7f020057
public const int ic_cast_on_1_light = 2130837591;
public const int ic_cast_on_0_light = 2130837591;
// aapt resource value: 0x7f020058
public const int ic_cast_on_2_light = 2130837592;
public const int ic_cast_on_1_light = 2130837592;
// aapt resource value: 0x7f020059
public const int ic_cast_on_light = 2130837593;
public const int ic_cast_on_2_light = 2130837593;
// aapt resource value: 0x7f02005a
public const int ic_cast_white = 2130837594;
public const int ic_cast_on_light = 2130837594;
// aapt resource value: 0x7f02005b
public const int ic_close_dark = 2130837595;
public const int ic_cast_white = 2130837595;
// aapt resource value: 0x7f02005c
public const int ic_close_light = 2130837596;
public const int ic_close_dark = 2130837596;
// aapt resource value: 0x7f02005d
public const int ic_collapse = 2130837597;
public const int ic_close_light = 2130837597;
// aapt resource value: 0x7f02005e
public const int ic_collapse_00000 = 2130837598;
public const int ic_collapse = 2130837598;
// aapt resource value: 0x7f02005f
public const int ic_collapse_00001 = 2130837599;
public const int ic_collapse_00000 = 2130837599;
// aapt resource value: 0x7f020060
public const int ic_collapse_00002 = 2130837600;
public const int ic_collapse_00001 = 2130837600;
// aapt resource value: 0x7f020061
public const int ic_collapse_00003 = 2130837601;
public const int ic_collapse_00002 = 2130837601;
// aapt resource value: 0x7f020062
public const int ic_collapse_00004 = 2130837602;
public const int ic_collapse_00003 = 2130837602;
// aapt resource value: 0x7f020063
public const int ic_collapse_00005 = 2130837603;
public const int ic_collapse_00004 = 2130837603;
// aapt resource value: 0x7f020064
public const int ic_collapse_00006 = 2130837604;
public const int ic_collapse_00005 = 2130837604;
// aapt resource value: 0x7f020065
public const int ic_collapse_00007 = 2130837605;
public const int ic_collapse_00006 = 2130837605;
// aapt resource value: 0x7f020066
public const int ic_collapse_00008 = 2130837606;
public const int ic_collapse_00007 = 2130837606;
// aapt resource value: 0x7f020067
public const int ic_collapse_00009 = 2130837607;
public const int ic_collapse_00008 = 2130837607;
// aapt resource value: 0x7f020068
public const int ic_collapse_00010 = 2130837608;
public const int ic_collapse_00009 = 2130837608;
// aapt resource value: 0x7f020069
public const int ic_collapse_00011 = 2130837609;
public const int ic_collapse_00010 = 2130837609;
// aapt resource value: 0x7f02006a
public const int ic_collapse_00012 = 2130837610;
public const int ic_collapse_00011 = 2130837610;
// aapt resource value: 0x7f02006b
public const int ic_collapse_00013 = 2130837611;
public const int ic_collapse_00012 = 2130837611;
// aapt resource value: 0x7f02006c
public const int ic_collapse_00014 = 2130837612;
public const int ic_collapse_00013 = 2130837612;
// aapt resource value: 0x7f02006d
public const int ic_collapse_00015 = 2130837613;
public const int ic_collapse_00014 = 2130837613;
// aapt resource value: 0x7f02006e
public const int ic_errorstatus = 2130837614;
public const int ic_collapse_00015 = 2130837614;
// aapt resource value: 0x7f02006f
public const int ic_expand = 2130837615;
public const int ic_errorstatus = 2130837615;
// aapt resource value: 0x7f020070
public const int ic_expand_00000 = 2130837616;
public const int ic_expand = 2130837616;
// aapt resource value: 0x7f020071
public const int ic_expand_00001 = 2130837617;
public const int ic_expand_00000 = 2130837617;
// aapt resource value: 0x7f020072
public const int ic_expand_00002 = 2130837618;
public const int ic_expand_00001 = 2130837618;
// aapt resource value: 0x7f020073
public const int ic_expand_00003 = 2130837619;
public const int ic_expand_00002 = 2130837619;
// aapt resource value: 0x7f020074
public const int ic_expand_00004 = 2130837620;
public const int ic_expand_00003 = 2130837620;
// aapt resource value: 0x7f020075
public const int ic_expand_00005 = 2130837621;
public const int ic_expand_00004 = 2130837621;
// aapt resource value: 0x7f020076
public const int ic_expand_00006 = 2130837622;
public const int ic_expand_00005 = 2130837622;
// aapt resource value: 0x7f020077
public const int ic_expand_00007 = 2130837623;
public const int ic_expand_00006 = 2130837623;
// aapt resource value: 0x7f020078
public const int ic_expand_00008 = 2130837624;
public const int ic_expand_00007 = 2130837624;
// aapt resource value: 0x7f020079
public const int ic_expand_00009 = 2130837625;
public const int ic_expand_00008 = 2130837625;
// aapt resource value: 0x7f02007a
public const int ic_expand_00010 = 2130837626;
public const int ic_expand_00009 = 2130837626;
// aapt resource value: 0x7f02007b
public const int ic_expand_00011 = 2130837627;
public const int ic_expand_00010 = 2130837627;
// aapt resource value: 0x7f02007c
public const int ic_expand_00012 = 2130837628;
public const int ic_expand_00011 = 2130837628;
// aapt resource value: 0x7f02007d
public const int ic_expand_00013 = 2130837629;
public const int ic_expand_00012 = 2130837629;
// aapt resource value: 0x7f02007e
public const int ic_expand_00014 = 2130837630;
public const int ic_expand_00013 = 2130837630;
// aapt resource value: 0x7f02007f
public const int ic_expand_00015 = 2130837631;
public const int ic_expand_00014 = 2130837631;
// aapt resource value: 0x7f020080
public const int ic_media_pause = 2130837632;
public const int ic_expand_00015 = 2130837632;
// aapt resource value: 0x7f020081
public const int ic_media_play = 2130837633;
public const int ic_media_pause = 2130837633;
// aapt resource value: 0x7f020082
public const int ic_media_route_disabled_mono_dark = 2130837634;
public const int ic_media_play = 2130837634;
// aapt resource value: 0x7f020083
public const int ic_media_route_off_mono_dark = 2130837635;
public const int ic_media_route_disabled_mono_dark = 2130837635;
// aapt resource value: 0x7f020084
public const int ic_media_route_on_0_mono_dark = 2130837636;
public const int ic_media_route_off_mono_dark = 2130837636;
// aapt resource value: 0x7f020085
public const int ic_media_route_on_1_mono_dark = 2130837637;
public const int ic_media_route_on_0_mono_dark = 2130837637;
// aapt resource value: 0x7f020086
public const int ic_media_route_on_2_mono_dark = 2130837638;
public const int ic_media_route_on_1_mono_dark = 2130837638;
// aapt resource value: 0x7f020087
public const int ic_media_route_on_mono_dark = 2130837639;
public const int ic_media_route_on_2_mono_dark = 2130837639;
// aapt resource value: 0x7f020088
public const int ic_pause_dark = 2130837640;
public const int ic_media_route_on_mono_dark = 2130837640;
// aapt resource value: 0x7f020089
public const int ic_pause_light = 2130837641;
public const int ic_pause_dark = 2130837641;
// aapt resource value: 0x7f02008a
public const int ic_play_dark = 2130837642;
public const int ic_pause_light = 2130837642;
// aapt resource value: 0x7f02008b
public const int ic_play_light = 2130837643;
public const int ic_play_dark = 2130837643;
// aapt resource value: 0x7f02008c
public const int ic_speaker_dark = 2130837644;
public const int ic_play_light = 2130837644;
// aapt resource value: 0x7f02008d
public const int ic_speaker_group_dark = 2130837645;
public const int ic_speaker_dark = 2130837645;
// aapt resource value: 0x7f02008e
public const int ic_speaker_group_light = 2130837646;
public const int ic_speaker_group_dark = 2130837646;
// aapt resource value: 0x7f02008f
public const int ic_speaker_light = 2130837647;
public const int ic_speaker_group_light = 2130837647;
// aapt resource value: 0x7f020090
public const int ic_successstatus = 2130837648;
public const int ic_speaker_light = 2130837648;
// aapt resource value: 0x7f020091
public const int ic_tv_dark = 2130837649;
public const int ic_successstatus = 2130837649;
// aapt resource value: 0x7f020092
public const int ic_tv_light = 2130837650;
public const int ic_tv_dark = 2130837650;
// aapt resource value: 0x7f020093
public const int icon = 2130837651;
public const int ic_tv_light = 2130837651;
// aapt resource value: 0x7f020094
public const int mr_dialog_material_background_dark = 2130837652;
public const int icon = 2130837652;
// aapt resource value: 0x7f020095
public const int mr_dialog_material_background_light = 2130837653;
public const int mr_dialog_material_background_dark = 2130837653;
// aapt resource value: 0x7f020096
public const int mr_ic_audiotrack_light = 2130837654;
public const int mr_dialog_material_background_light = 2130837654;
// aapt resource value: 0x7f020097
public const int mr_ic_cast_dark = 2130837655;
public const int mr_ic_audiotrack_light = 2130837655;
// aapt resource value: 0x7f020098
public const int mr_ic_cast_light = 2130837656;
public const int mr_ic_cast_dark = 2130837656;
// aapt resource value: 0x7f020099
public const int mr_ic_close_dark = 2130837657;
public const int mr_ic_cast_light = 2130837657;
// aapt resource value: 0x7f02009a
public const int mr_ic_close_light = 2130837658;
public const int mr_ic_close_dark = 2130837658;
// aapt resource value: 0x7f02009b
public const int mr_ic_media_route_connecting_mono_dark = 2130837659;
public const int mr_ic_close_light = 2130837659;
// aapt resource value: 0x7f02009c
public const int mr_ic_media_route_connecting_mono_light = 2130837660;
public const int mr_ic_media_route_connecting_mono_dark = 2130837660;
// aapt resource value: 0x7f02009d
public const int mr_ic_media_route_mono_dark = 2130837661;
public const int mr_ic_media_route_connecting_mono_light = 2130837661;
// aapt resource value: 0x7f02009e
public const int mr_ic_media_route_mono_light = 2130837662;
public const int mr_ic_media_route_mono_dark = 2130837662;
// aapt resource value: 0x7f02009f
public const int mr_ic_pause_dark = 2130837663;
public const int mr_ic_media_route_mono_light = 2130837663;
// aapt resource value: 0x7f0200a0
public const int mr_ic_pause_light = 2130837664;
public const int mr_ic_pause_dark = 2130837664;
// aapt resource value: 0x7f0200a1
public const int mr_ic_play_dark = 2130837665;
public const int mr_ic_pause_light = 2130837665;
// aapt resource value: 0x7f0200a2
public const int mr_ic_play_light = 2130837666;
// aapt resource value: 0x7f0200a5
public const int notification_template_icon_bg = 2130837669;
public const int mr_ic_play_dark = 2130837666;
// aapt resource value: 0x7f0200a3
public const int roundedbg = 2130837667;
public const int mr_ic_play_light = 2130837667;
// aapt resource value: 0x7f0200a6
public const int notification_template_icon_bg = 2130837670;
// aapt resource value: 0x7f0200a4
public const int roundedbgdark = 2130837668;
public const int roundedbg = 2130837668;
// aapt resource value: 0x7f0200a5
public const int roundedbgdark = 2130837669;
static Drawable()
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

View File

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 314 B

View File

Before

Width:  |  Height:  |  Size: 456 B

After

Width:  |  Height:  |  Size: 456 B

View File

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

View File

@ -53,6 +53,7 @@
<Compile Include="Controls\ExtendedEntry.cs" />
<Compile Include="Controls\ExtendedTabbedPage.cs" />
<Compile Include="Controls\FormEditorCell.cs" />
<Compile Include="Controls\ExtendedTextCell.cs" />
<Compile Include="Controls\LabeledValueCell.cs" />
<Compile Include="Controls\FormPickerCell.cs" />
<Compile Include="Controls\FormEntryCell.cs" />

View File

@ -0,0 +1,17 @@
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class ExtendedTextCell : TextCell
{
public static readonly BindableProperty BackgroundColorProperty =
BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.Transparent);
public Color BackgroundColor
{
get { return (Color)GetValue(BackgroundColorProperty); }
set { SetValue(BackgroundColorProperty, value); }
}
}
}

View File

@ -40,7 +40,7 @@ namespace Bit.App.Pages
IsGroupingEnabled = true,
ItemsSource = Folders,
HasUnevenRows = true,
SeparatorColor = Color.FromHex("E0E0E0")
SeparatorColor = Color.FromHex("d2d6de")
};
listView.GroupDisplayBinding = new Binding("Name");
listView.GroupHeaderTemplate = new DataTemplate(() => new VaultListHeaderViewCell(this));
@ -162,7 +162,7 @@ namespace Bit.App.Pages
}
}
private class VaultListViewCell : TextCell
private class VaultListViewCell : ExtendedTextCell
{
public VaultListViewCell(VaultListPage page)
{
@ -181,6 +181,7 @@ namespace Bit.App.Pages
TextColor = Color.FromHex("333333");
DetailColor = Color.FromHex("777777");
BackgroundColor = Color.White;
}
}
@ -190,15 +191,16 @@ namespace Bit.App.Pages
{
var image = new Image
{
Source = ImageSource.FromFile("fa-folder-open.png"),
Margin = new Thickness(16, 8, 0, 8)
Source = "fa_folder_open.png",
Margin = new Thickness(16, 0, 0, 0),
VerticalOptions = LayoutOptions.CenterAndExpand
};
var label = new Label
{
FontSize = 14,
TextColor = Color.FromHex("777777"),
VerticalTextAlignment = TextAlignment.Center
VerticalTextAlignment = TextAlignment.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
};
label.SetBinding<VaultListPageModel.Folder>(Label.TextProperty, s => s.Name);
@ -206,25 +208,28 @@ namespace Bit.App.Pages
var stackLayout = new StackLayout
{
Orientation = StackOrientation.Horizontal,
BackgroundColor = Color.FromHex("ecf0f5")
VerticalOptions = LayoutOptions.CenterAndExpand
};
stackLayout.Children.Add(image);
stackLayout.Children.Add(label);
var borderStackLayout = new StackLayout
var borderedStackLayout = new StackLayout
{
Spacing = 0
Spacing = 0,
BackgroundColor = Color.FromHex("ecf0f5"),
HorizontalOptions = LayoutOptions.FillAndExpand
};
var borderBoxTop = new BoxView { BackgroundColor = Color.FromHex("d2d6de"), HeightRequest = 0.5 };
var borderBoxBottom = new BoxView { BackgroundColor = Color.FromHex("d2d6de"), HeightRequest = 0.5 };
borderStackLayout.Children.Add(borderBoxTop);
borderStackLayout.Children.Add(stackLayout);
borderStackLayout.Children.Add(borderBoxBottom);
borderedStackLayout.Children.Add(new BoxView { BackgroundColor = Color.FromHex("d2d6de"), HeightRequest = 0.5, VerticalOptions = LayoutOptions.Start });
borderedStackLayout.Children.Add(stackLayout);
if(Device.OS == TargetPlatform.iOS)
{
borderedStackLayout.Children.Add(new BoxView { BackgroundColor = Color.FromHex("d2d6de"), HeightRequest = 0.5, VerticalOptions = LayoutOptions.End });
}
View = borderStackLayout;
Height = 30;
View = borderedStackLayout;
Height = 40;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

View File

@ -331,13 +331,13 @@
<ITunesArtwork Include="Resources\iTunesArtwork%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\fa-folder-open.png" />
<BundleResource Include="Resources\fa_folder_open.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\fa-folder-open%402x.png" />
<BundleResource Include="Resources\fa_folder_open%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\fa-folder-open%403x.png" />
<BundleResource Include="Resources\fa_folder_open%403x.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">