some style consolidation

This commit is contained in:
Kyle Spearrin 2016-06-17 00:01:25 -04:00
parent 7c6a4c8fb1
commit 0c3bd0b92c
10 changed files with 5947 additions and 104 deletions

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,7 @@ using System.Diagnostics;
using Plugin.Fingerprint.Abstractions; using Plugin.Fingerprint.Abstractions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Plugin.Settings.Abstractions; using Plugin.Settings.Abstractions;
using Bit.App.Controls;
namespace Bit.App namespace Bit.App
{ {
@ -30,6 +31,8 @@ namespace Bit.App
_fingerprint = fingerprint; _fingerprint = fingerprint;
_settings = settings; _settings = settings;
SetStyles();
if(authService.IsAuthenticated) if(authService.IsAuthenticated)
{ {
MainPage = new MainPage(); MainPage = new MainPage();
@ -133,5 +136,74 @@ namespace Bit.App
// Use master password to unlock if no other methods are set // Use master password to unlock if no other methods are set
} }
} }
private void SetStyles()
{
var gray = Color.FromHex("333333");
var grayLight = Color.FromHex("777777");
var grayLighter = Color.FromHex("d2d6de");
var primaryColor = Color.FromHex("3c8dbc");
Resources = new ResourceDictionary();
// Labels
Resources.Add(new Style(typeof(Label))
{
Setters = {
new Setter { Property = Label.TextColorProperty, Value = gray }
}
});
Resources.Add("text-muted", new Style(typeof(Label))
{
Setters = {
new Setter { Property = Label.TextColorProperty, Value = grayLight }
}
});
// Buttons
Resources.Add("btn-default", new Style(typeof(Button))
{
Setters = {
new Setter { Property = Button.TextColorProperty, Value = gray }
}
});
Resources.Add(new Style(typeof(Button))
{
Setters = {
new Setter { Property = Button.TextColorProperty, Value = primaryColor }
}
});
// Editors
Resources.Add(new Style(typeof(Editor))
{
Setters = {
new Setter { Property = Editor.TextColorProperty, Value = gray }
}
});
// Entries
Resources.Add(new Style(typeof(Entry))
{
Setters = {
new Setter { Property = Entry.TextColorProperty, Value = gray }
}
});
// List View
Resources.Add(new Style(typeof(ListView))
{
Setters = {
new Setter { Property = ListView.SeparatorColorProperty, Value = grayLighter }
}
});
}
} }
} }

View file

@ -5,6 +5,12 @@ namespace Bit.App.Controls
{ {
public class ExtendedTextCell : TextCell public class ExtendedTextCell : TextCell
{ {
public ExtendedTextCell()
{
TextColor = Color.FromHex("333333");
DetailColor = Color.FromHex("777777");
}
public static readonly BindableProperty BackgroundColorProperty = public static readonly BindableProperty BackgroundColorProperty =
BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White); BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White);

View file

@ -11,8 +11,8 @@ namespace Bit.App.Controls
{ {
Text = labelText, Text = labelText,
FontSize = 14, FontSize = 14,
TextColor = Color.FromHex("777777"), VerticalOptions = LayoutOptions.Start,
VerticalOptions = LayoutOptions.Start Style = (Style)Application.Current.Resources["text-muted"]
}; };
Entry = new ExtendedEntry Entry = new ExtendedEntry
@ -20,8 +20,7 @@ namespace Bit.App.Controls
Keyboard = entryKeyboard, Keyboard = entryKeyboard,
HasBorder = false, HasBorder = false,
VerticalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand,
IsPassword = IsPassword, IsPassword = IsPassword
TextColor = Color.FromHex("333333")
}; };
if(nextElement != null) if(nextElement != null)

View file

@ -28,7 +28,7 @@ namespace Bit.App.Controls
{ {
Text = labelText, Text = labelText,
FontSize = 14, FontSize = 14,
TextColor = Color.FromHex("777777"), Style = (Style)Application.Current.Resources["text-muted"],
VerticalOptions = LayoutOptions.Start VerticalOptions = LayoutOptions.Start
}; };
@ -39,8 +39,7 @@ namespace Bit.App.Controls
{ {
Text = valueText, Text = valueText,
LineBreakMode = LineBreakMode.TailTruncation, LineBreakMode = LineBreakMode.TailTruncation,
VerticalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand
TextColor = Color.FromHex("333333")
}; };
labelValueStackLayout.Children.Add(Value); labelValueStackLayout.Children.Add(Value);
@ -59,8 +58,7 @@ namespace Bit.App.Controls
Text = button1Text, Text = button1Text,
HorizontalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center,
Margin = new Thickness(0), Margin = new Thickness(0)
TextColor = Color.FromHex("3c8dbc")
}; };
buttonStackLayout.Children.Add(Button1); buttonStackLayout.Children.Add(Button1);
@ -73,8 +71,7 @@ namespace Bit.App.Controls
Text = button2Text, Text = button2Text,
HorizontalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center,
Margin = new Thickness(0), Margin = new Thickness(0)
TextColor = Color.FromHex("3c8dbc")
}; };
buttonStackLayout.Children.Add(Button2); buttonStackLayout.Children.Add(Button2);

View file

@ -13,7 +13,6 @@ namespace Bit.App.Controls
{ {
HorizontalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center,
FontSize = 30, FontSize = 30,
TextColor = Color.FromHex("333333"),
FontFamily = "Courier" FontFamily = "Courier"
}; };

View file

@ -38,7 +38,7 @@ namespace Bit.App.Pages
Text = "Use Fingerprint to Unlock", Text = "Use Fingerprint to Unlock",
Command = new Command(async () => await CheckFingerprintAsync()), Command = new Command(async () => await CheckFingerprintAsync()),
VerticalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.EndAndExpand,
TextColor = Color.FromHex("333333") Style = (Style)Application.Current.Resources["btn-default"]
}; };
var logoutButton = new Button var logoutButton = new Button
@ -46,7 +46,7 @@ namespace Bit.App.Pages
Text = AppResources.LogOut, Text = AppResources.LogOut,
Command = new Command(async () => await LogoutAsync()), Command = new Command(async () => await LogoutAsync()),
VerticalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.End,
TextColor = Color.FromHex("333333") Style = (Style)Application.Current.Resources["btn-default"]
}; };
var stackLayout = new StackLayout { Padding = new Thickness(30, 40), Spacing = 10 }; var stackLayout = new StackLayout { Padding = new Thickness(30, 40), Spacing = 10 };

View file

@ -41,7 +41,7 @@ namespace Bit.App.Pages
Text = AppResources.LogOut, Text = AppResources.LogOut,
Command = new Command(async () => await LogoutAsync()), Command = new Command(async () => await LogoutAsync()),
VerticalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.End,
TextColor = Color.FromHex("333333") Style = (Style)Application.Current.Resources["btn-default"]
}; };
var stackLayout = new StackLayout var stackLayout = new StackLayout

View file

@ -33,8 +33,7 @@ namespace Bit.App.Pages
var listView = new ListView var listView = new ListView
{ {
ItemsSource = Folders, ItemsSource = Folders
SeparatorColor = Color.FromHex("d2d6de")
}; };
listView.ItemSelected += FolderSelected; listView.ItemSelected += FolderSelected;
listView.ItemTemplate = new DataTemplate(() => new SettingsFolderListViewCell(this)); listView.ItemTemplate = new DataTemplate(() => new SettingsFolderListViewCell(this));

View file

@ -48,7 +48,6 @@ namespace Bit.App.Pages
IsGroupingEnabled = true, IsGroupingEnabled = true,
ItemsSource = Folders, ItemsSource = Folders,
HasUnevenRows = true, HasUnevenRows = true,
SeparatorColor = Color.FromHex("d2d6de"),
GroupHeaderTemplate = new DataTemplate(() => new VaultListHeaderViewCell(this)), GroupHeaderTemplate = new DataTemplate(() => new VaultListHeaderViewCell(this)),
ItemTemplate = new DataTemplate(() => new VaultListViewCell(this)) ItemTemplate = new DataTemplate(() => new VaultListViewCell(this))
}; };
@ -185,9 +184,6 @@ namespace Bit.App.Pages
ContextActions.Add(deleteAction); ContextActions.Add(deleteAction);
ContextActions.Add(moreAction); ContextActions.Add(moreAction);
TextColor = Color.FromHex("333333");
DetailColor = Color.FromHex("777777");
DisclousureTapped += VaultListViewCell_DisclousureTapped; DisclousureTapped += VaultListViewCell_DisclousureTapped;
ShowDisclousure = true; ShowDisclousure = true;
DisclousureImage = "more"; DisclousureImage = "more";
@ -221,10 +217,10 @@ namespace Bit.App.Pages
var label = new Label var label = new Label
{ {
TextColor = Color.FromHex("777777"),
VerticalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center,
VerticalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand,
FontSize = 14 FontSize = 14,
Style = (Style)Application.Current.Resources["text-muted"]
}; };
label.SetBinding<VaultListPageModel.Folder>(Label.TextProperty, s => s.Name); label.SetBinding<VaultListPageModel.Folder>(Label.TextProperty, s => s.Name);