1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-06-25 10:26:02 +02:00

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 System.Threading.Tasks;
using Plugin.Settings.Abstractions;
using Bit.App.Controls;
namespace Bit.App
{
@ -30,6 +31,8 @@ namespace Bit.App
_fingerprint = fingerprint;
_settings = settings;
SetStyles();
if(authService.IsAuthenticated)
{
MainPage = new MainPage();
@ -133,5 +136,74 @@ namespace Bit.App
// 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 ExtendedTextCell()
{
TextColor = Color.FromHex("333333");
DetailColor = Color.FromHex("777777");
}
public static readonly BindableProperty BackgroundColorProperty =
BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White);

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@ namespace Bit.App.Pages
Text = "Use Fingerprint to Unlock",
Command = new Command(async () => await CheckFingerprintAsync()),
VerticalOptions = LayoutOptions.EndAndExpand,
TextColor = Color.FromHex("333333")
Style = (Style)Application.Current.Resources["btn-default"]
};
var logoutButton = new Button
@ -46,7 +46,7 @@ namespace Bit.App.Pages
Text = AppResources.LogOut,
Command = new Command(async () => await LogoutAsync()),
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 };

View File

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

View File

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

View File

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