diff --git a/src/App/App.csproj b/src/App/App.csproj index c08fb2a9a..7627feecd 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -27,6 +27,9 @@ GeneratorPage.xaml + + ViewPage.xaml + SettingsPage.xaml @@ -54,6 +57,18 @@ True True + + Light.xaml + + + Dark.xaml + + + iOS.xaml + + + Android.xaml + @@ -61,6 +76,9 @@ AppResources.Designer.cs ResXFileCodeGenerator + + MSBuild:UpdateDesignTimeXaml + diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index 8832b81a3..316f5d844 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -29,7 +29,8 @@ namespace Bit.App InitializeComponent(); SetCulture(); - ThemeManager.SetTheme("light"); + // ThemeManager.SetTheme("light"); + ThemeManager.SetThemeStyle("light"); MainPage = new HomePage(); var mainPageTask = SetMainPageAsync(); diff --git a/src/App/Controls/CipherViewCell/CipherViewCell.xaml b/src/App/Controls/CipherViewCell/CipherViewCell.xaml index ead5e568e..120879404 100644 --- a/src/App/Controls/CipherViewCell/CipherViewCell.xaml +++ b/src/App/Controls/CipherViewCell/CipherViewCell.xaml @@ -6,15 +6,16 @@ + x:DataType="controls:CipherViewCellViewModel" + StyleClass="list-row"> - diff --git a/src/App/Pages/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/GroupingsPage/GroupingsPage.xaml index b2240dc7d..063e96e44 100644 --- a/src/App/Pages/GroupingsPage/GroupingsPage.xaml +++ b/src/App/Pages/GroupingsPage/GroupingsPage.xaml @@ -21,14 +21,17 @@ - + - @@ -36,14 +39,17 @@ - + - @@ -65,11 +71,15 @@ IsRefreshing="{Binding Loading, Mode=OneWay}" CachingStrategy="RecycleElement" ItemTemplate="{StaticResource listItemDataTemplateSelector}" - IsGroupingEnabled="True"> + IsGroupingEnabled="True" + StyleClass="list"> - diff --git a/src/App/Pages/ViewPage.xaml b/src/App/Pages/ViewPage.xaml new file mode 100644 index 000000000..ebb77bd39 --- /dev/null +++ b/src/App/Pages/ViewPage.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/App/Pages/ViewPage.xaml.cs b/src/App/Pages/ViewPage.xaml.cs new file mode 100644 index 000000000..dd4228043 --- /dev/null +++ b/src/App/Pages/ViewPage.xaml.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace Bit.App.Pages +{ + public partial class ViewPage : ContentPage + { + private ViewPageViewModel _vm; + + public ViewPage() + { + InitializeComponent(); + _vm = BindingContext as ViewPageViewModel; + _vm.Page = this; + } + } +} diff --git a/src/App/Pages/ViewPageViewModel.cs b/src/App/Pages/ViewPageViewModel.cs new file mode 100644 index 000000000..8af152eb5 --- /dev/null +++ b/src/App/Pages/ViewPageViewModel.cs @@ -0,0 +1,33 @@ +using Bit.App.Abstractions; +using Bit.App.Resources; +using Bit.Core.Abstractions; +using Bit.Core.Exceptions; +using Bit.Core.Utilities; +using System.Threading.Tasks; +using System.Windows.Input; +using Xamarin.Forms; + +namespace Bit.App.Pages +{ + public class ViewPageViewModel : BaseViewModel + { + private readonly IDeviceActionService _deviceActionService; + private readonly IAuthService _authService; + private readonly ISyncService _syncService; + + public ViewPageViewModel() + { + _deviceActionService = ServiceContainer.Resolve("deviceActionService"); + _authService = ServiceContainer.Resolve("authService"); + _syncService = ServiceContainer.Resolve("syncService"); + + PageTitle = AppResources.Bitwarden; + ShowPasswordCommand = new Command(() => + Page.DisplayAlert("Button 1 Command", "Button 1 message", "Cancel")); + } + + public ICommand ShowPasswordCommand { get; } + public string Email { get; set; } + public string MasterPassword { get; set; } + } +} diff --git a/src/App/Styles/Android.xaml b/src/App/Styles/Android.xaml new file mode 100644 index 000000000..76862af82 --- /dev/null +++ b/src/App/Styles/Android.xaml @@ -0,0 +1,9 @@ + + + + diff --git a/src/App/Styles/Android.xaml.cs b/src/App/Styles/Android.xaml.cs new file mode 100644 index 000000000..166079cef --- /dev/null +++ b/src/App/Styles/Android.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace Bit.App.Styles +{ + public partial class Android : ResourceDictionary + { + public Android() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/App/Styles/Base.xaml b/src/App/Styles/Base.xaml new file mode 100644 index 000000000..c60651157 --- /dev/null +++ b/src/App/Styles/Base.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + diff --git a/src/App/Styles/Base.xaml.cs b/src/App/Styles/Base.xaml.cs new file mode 100644 index 000000000..2e74ee5ea --- /dev/null +++ b/src/App/Styles/Base.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace Bit.App.Styles +{ + public partial class Base : ResourceDictionary + { + public Base() + { + InitializeComponent(); + } + } +} diff --git a/src/App/Styles/Dark.xaml b/src/App/Styles/Dark.xaml new file mode 100644 index 000000000..2f6762b99 --- /dev/null +++ b/src/App/Styles/Dark.xaml @@ -0,0 +1,10 @@ + + + + diff --git a/src/App/Styles/Dark.xaml.cs b/src/App/Styles/Dark.xaml.cs new file mode 100644 index 000000000..d84c47e4f --- /dev/null +++ b/src/App/Styles/Dark.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace Bit.App.Styles +{ + public partial class Dark : ResourceDictionary + { + public Dark() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/App/Styles/Light.xaml b/src/App/Styles/Light.xaml new file mode 100644 index 000000000..cfb9582f7 --- /dev/null +++ b/src/App/Styles/Light.xaml @@ -0,0 +1,10 @@ + + + + diff --git a/src/App/Styles/Light.xaml.cs b/src/App/Styles/Light.xaml.cs new file mode 100644 index 000000000..99a500c97 --- /dev/null +++ b/src/App/Styles/Light.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace Bit.App.Styles +{ + public partial class Light : ResourceDictionary + { + public Light() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/App/Styles/iOS.xaml b/src/App/Styles/iOS.xaml new file mode 100644 index 000000000..721b31b22 --- /dev/null +++ b/src/App/Styles/iOS.xaml @@ -0,0 +1,6 @@ + + + + diff --git a/src/App/Styles/iOS.xaml.cs b/src/App/Styles/iOS.xaml.cs new file mode 100644 index 000000000..72d94ad44 --- /dev/null +++ b/src/App/Styles/iOS.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace Bit.App.Styles +{ + public partial class iOS : ResourceDictionary + { + public iOS() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/App/Utilities/ThemeManager.cs b/src/App/Utilities/ThemeManager.cs index 26bb30242..c8f9548c7 100644 --- a/src/App/Utilities/ThemeManager.cs +++ b/src/App/Utilities/ThemeManager.cs @@ -1,4 +1,6 @@ -using System.Reflection; +using Bit.App.Styles; +using System; +using System.Reflection; using Xamarin.Forms; using Xamarin.Forms.StyleSheets; @@ -21,5 +23,35 @@ namespace Bit.App.Utilities Application.Current.Resources.Add(StyleSheet.FromAssemblyResource(assembly, string.Format(themeFormat, "styles"))); } + + public static void SetThemeStyle(string name) + { + // Reset styles + Application.Current.Resources.Clear(); + Application.Current.Resources.MergedDictionaries.Clear(); + + // Base styles + Application.Current.Resources.MergedDictionaries.Add(new Base()); + + // Platform styles + if(Device.RuntimePlatform == Device.Android) + { + Application.Current.Resources.MergedDictionaries.Add(new Android()); + } + else if(Device.RuntimePlatform == Device.iOS) + { + Application.Current.Resources.MergedDictionaries.Add(new iOS()); + } + + // Theme styles + if(name == "dark") + { + Application.Current.Resources.MergedDictionaries.Add(new Dark()); + } + else + { + Application.Current.Resources.MergedDictionaries.Add(new Light()); + } + } } } diff --git a/src/Core/Models/View/CipherView.cs b/src/Core/Models/View/CipherView.cs index cc6dabafc..d12e68d0e 100644 --- a/src/Core/Models/View/CipherView.cs +++ b/src/Core/Models/View/CipherView.cs @@ -45,7 +45,7 @@ namespace Bit.Core.Models.View public DateTime RevisionDate { get; set; } - public string Subtitle + public string SubTitle { get {