From fe52324eea0ee91d92695d1d0e1b5328efb0fef6 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 29 Mar 2019 17:54:03 -0400 Subject: [PATCH] stylesheets --- src/App/App.xaml | 4 +-- src/App/App.xaml.cs | 19 ++++++++++ .../CipherViewCell/CipherViewCell.xaml | 6 ++-- src/App/Controls/FaLabel.cs | 20 +++++++++++ src/App/Css/android.css | 3 ++ src/App/Css/dark.css | 3 ++ src/App/Css/ios.css | 3 ++ src/App/Css/styles.css | 12 +++++++ .../Pages/GroupingsPage/GroupingsPage.xaml | 20 +++++++---- src/App/Pages/SettingsPage.xaml | 36 ++++++++----------- 10 files changed, 92 insertions(+), 34 deletions(-) create mode 100644 src/App/Controls/FaLabel.cs create mode 100644 src/App/Css/android.css create mode 100644 src/App/Css/dark.css create mode 100644 src/App/Css/ios.css create mode 100644 src/App/Css/styles.css diff --git a/src/App/App.xaml b/src/App/App.xaml index 049f80fb4..c21ed3905 100644 --- a/src/App/App.xaml +++ b/src/App/App.xaml @@ -3,6 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Bit.App.App"> - - \ No newline at end of file + + \ No newline at end of file diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index b87e44f34..4ee26492a 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -1,6 +1,8 @@ using Bit.App.Pages; using System; +using System.Reflection; using Xamarin.Forms; +using Xamarin.Forms.StyleSheets; using Xamarin.Forms.Xaml; [assembly: XamlCompilation(XamlCompilationOptions.Compile)] @@ -11,6 +13,23 @@ namespace Bit.App public App() { InitializeComponent(); + + // TODO: Load theme? + if(false) + { +#pragma warning disable CS0162 // Unreachable code detected + Resources.Add( +#pragma warning restore CS0162 // Unreachable code detected + StyleSheet.FromAssemblyResource(IntrospectionExtensions.GetTypeInfo(typeof(App)).Assembly, + "Bit.App.Css.dark.css")); + } + Resources.Add( + StyleSheet.FromAssemblyResource(IntrospectionExtensions.GetTypeInfo(typeof(App)).Assembly, + "Bit.App.Css.styles.css")); + Resources.Add( + StyleSheet.FromAssemblyResource(IntrospectionExtensions.GetTypeInfo(typeof(App)).Assembly, + $"Bit.App.Css.{Device.RuntimePlatform.ToLowerInvariant()}.css")); + MainPage = new TabsPage(); } diff --git a/src/App/Controls/CipherViewCell/CipherViewCell.xaml b/src/App/Controls/CipherViewCell/CipherViewCell.xaml index b560b7862..ead5e568e 100644 --- a/src/App/Controls/CipherViewCell/CipherViewCell.xaml +++ b/src/App/Controls/CipherViewCell/CipherViewCell.xaml @@ -3,12 +3,11 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Bit.App.Controls.CipherViewCell" xmlns:controls="clr-namespace:Bit.App.Controls"> - + - @@ -16,8 +15,7 @@ - + diff --git a/src/App/Controls/FaLabel.cs b/src/App/Controls/FaLabel.cs new file mode 100644 index 000000000..23839fc95 --- /dev/null +++ b/src/App/Controls/FaLabel.cs @@ -0,0 +1,20 @@ +using Xamarin.Forms; + +namespace Bit.App.Controls +{ + public class FaLabel : Label + { + public FaLabel() + { + switch(Device.RuntimePlatform) + { + case Device.iOS: + FontFamily = "FontAwesome"; + break; + case Device.Android: + FontFamily = "FontAwesome.ttf#FontAwesome"; + break; + } + } + } +} diff --git a/src/App/Css/android.css b/src/App/Css/android.css new file mode 100644 index 000000000..a2b2970d9 --- /dev/null +++ b/src/App/Css/android.css @@ -0,0 +1,3 @@ +^Label, ^Entry, ^Editor { + font-size: 16; +} diff --git a/src/App/Css/dark.css b/src/App/Css/dark.css new file mode 100644 index 000000000..f5b591a49 --- /dev/null +++ b/src/App/Css/dark.css @@ -0,0 +1,3 @@ +^contentpage { + background-color: gray; +} diff --git a/src/App/Css/ios.css b/src/App/Css/ios.css new file mode 100644 index 000000000..4a0890cae --- /dev/null +++ b/src/App/Css/ios.css @@ -0,0 +1,3 @@ +^Label, ^Entry, ^Editor { + font-size: 14; +} diff --git a/src/App/Css/styles.css b/src/App/Css/styles.css new file mode 100644 index 000000000..1d2a93485 --- /dev/null +++ b/src/App/Css/styles.css @@ -0,0 +1,12 @@ +^ContentPage { + background-color: white; +} + +StackLayout.list-cell { + padding: 10; + -xf-orientation: horizontal; +} + +StackLayout.list-cell > FaLabel { + font-size: 22; +} diff --git a/src/App/Pages/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/GroupingsPage/GroupingsPage.xaml index 656ea2823..c099a1f22 100644 --- a/src/App/Pages/GroupingsPage/GroupingsPage.xaml +++ b/src/App/Pages/GroupingsPage/GroupingsPage.xaml @@ -21,10 +21,14 @@ - + + @@ -32,10 +36,14 @@ - + + diff --git a/src/App/Pages/SettingsPage.xaml b/src/App/Pages/SettingsPage.xaml index ce357a702..7654d4b81 100644 --- a/src/App/Pages/SettingsPage.xaml +++ b/src/App/Pages/SettingsPage.xaml @@ -1,32 +1,24 @@  - + -