diff --git a/src/App/App.csproj b/src/App/App.csproj index 0a55f7a75..d78acfb40 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -55,6 +55,7 @@ + diff --git a/src/App/Controls/ExtendedContentPage.cs b/src/App/Controls/ExtendedContentPage.cs index fd5e0cb1a..cce09fee9 100644 --- a/src/App/Controls/ExtendedContentPage.cs +++ b/src/App/Controls/ExtendedContentPage.cs @@ -9,22 +9,26 @@ namespace Bit.App.Controls { private ISyncService _syncService; - public ExtendedContentPage() + public ExtendedContentPage(bool syncIndicator = true) { _syncService = Resolver.Resolve(); BackgroundColor = Color.FromHex("efeff4"); - IsBusy = _syncService.SyncInProgress; - MessagingCenter.Subscribe(Application.Current, "SyncCompleted", (sender, success) => + if(syncIndicator) { IsBusy = _syncService.SyncInProgress; - }); - MessagingCenter.Subscribe(Application.Current, "SyncStarted", (sender) => - { - IsBusy = _syncService.SyncInProgress; - }); + MessagingCenter.Subscribe(Application.Current, "SyncCompleted", (sender, success) => + { + IsBusy = _syncService.SyncInProgress; + }); + + MessagingCenter.Subscribe(Application.Current, "SyncStarted", (sender) => + { + IsBusy = _syncService.SyncInProgress; + }); + } } } } diff --git a/src/App/Controls/StepperCell.cs b/src/App/Controls/StepperCell.cs new file mode 100644 index 000000000..1f5df0f1e --- /dev/null +++ b/src/App/Controls/StepperCell.cs @@ -0,0 +1,57 @@ +using Xamarin.Forms; + +namespace Bit.App.Controls +{ + public class StepperCell : ExtendedViewCell + { + public StepperCell(string labelText, double value, double min, double max, double increment) + { + Label = new Label + { + Text = labelText, + HorizontalOptions = LayoutOptions.Start, + VerticalOptions = LayoutOptions.CenterAndExpand + }; + + StepperValueLabel = new Label + { + HorizontalOptions = LayoutOptions.FillAndExpand, + VerticalOptions = LayoutOptions.CenterAndExpand, + HorizontalTextAlignment = TextAlignment.Start, + Text = value.ToString(), + Style = (Style)Application.Current.Resources["text-muted"] + }; + + Stepper = new Stepper + { + HorizontalOptions = LayoutOptions.End, + VerticalOptions = LayoutOptions.CenterAndExpand, + Minimum = min, + Maximum = max, + Increment = increment, + Value = value + }; + + Stepper.ValueChanged += Stepper_ValueChanged; + + var stackLayout = new StackLayout + { + Orientation = StackOrientation.Horizontal, + Children = { Label, StepperValueLabel, Stepper }, + Spacing = 15, + Padding = new Thickness(15, 8) + }; + + View = stackLayout; + } + + private void Stepper_ValueChanged(object sender, ValueChangedEventArgs e) + { + StepperValueLabel.Text = e.NewValue.ToString(); + } + + public Label Label { get; private set; } + public Label StepperValueLabel { get; private set; } + public Stepper Stepper { get; private set; } + } +} diff --git a/src/App/Pages/Lock/LockFingerprintPage.cs b/src/App/Pages/Lock/LockFingerprintPage.cs index 1aa71351d..0436d0da8 100644 --- a/src/App/Pages/Lock/LockFingerprintPage.cs +++ b/src/App/Pages/Lock/LockFingerprintPage.cs @@ -20,6 +20,7 @@ namespace Bit.App.Pages private readonly bool _checkFingerprintImmediately; public LockFingerprintPage(bool checkFingerprintImmediately) + : base(false) { _checkFingerprintImmediately = checkFingerprintImmediately; _fingerprint = Resolver.Resolve(); diff --git a/src/App/Pages/Lock/LockPinPage.cs b/src/App/Pages/Lock/LockPinPage.cs index 757c24588..ed438fd82 100644 --- a/src/App/Pages/Lock/LockPinPage.cs +++ b/src/App/Pages/Lock/LockPinPage.cs @@ -18,6 +18,7 @@ namespace Bit.App.Pages private readonly ISettings _settings; public LockPinPage() + : base(false) { _authService = Resolver.Resolve(); _userDialogs = Resolver.Resolve(); diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs index c761e9ee3..6a6862e75 100644 --- a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs +++ b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs @@ -153,6 +153,7 @@ namespace Bit.App.Pages _userDialogs.SuccessToast(string.Format(AppResources.ValueHasBeenCopied, AppResources.Password)); } + // TODO: move to standalone reusable control public class SliderViewCell : ExtendedViewCell { private readonly ToolsPasswordGeneratorPage _page; @@ -200,7 +201,7 @@ namespace Bit.App.Pages Orientation = StackOrientation.Horizontal, Spacing = 15, Children = { label, LengthSlider, Value }, - Padding = new Thickness(15) + Padding = new Thickness(15, 8) }; View = stackLayout; diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorSettingsPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorSettingsPage.cs index e595ae9f7..c31057be2 100644 --- a/src/App/Pages/Tools/ToolsPasswordGeneratorSettingsPage.cs +++ b/src/App/Pages/Tools/ToolsPasswordGeneratorSettingsPage.cs @@ -29,8 +29,8 @@ namespace Bit.App.Pages public ExtendedSwitchCell SpecialCell { get; set; } public ExtendedSwitchCell NumbersCell { get; set; } public ExtendedSwitchCell AvoidAmbiguousCell { get; set; } - public EntryCell SpecialMinCell { get; set; } - public EntryCell NumbersMinCell { get; set; } + public StepperCell SpecialMinCell { get; set; } + public StepperCell NumbersMinCell { get; set; } public void Init() { @@ -69,19 +69,10 @@ namespace Bit.App.Pages }; AvoidAmbiguousCell.OnChanged += AvoidAmbiguousCell_OnChanged; ; - NumbersMinCell = new EntryCell - { - Label = "Minimum Numbers", - Text = _settings.GetValueOrDefault(Constants.PasswordGeneratorMinNumbers, 1).ToString(), - Keyboard = Keyboard.Numeric - }; - - SpecialMinCell = new EntryCell - { - Label = "Minimum Special", - Text = _settings.GetValueOrDefault(Constants.PasswordGeneratorMinSpecial, 1).ToString(), - Keyboard = Keyboard.Numeric - }; + NumbersMinCell = new StepperCell("Minimum Numbers", + _settings.GetValueOrDefault(Constants.PasswordGeneratorMinNumbers, 1), 0, 5, 1); + SpecialMinCell = new StepperCell("Minimum Special", + _settings.GetValueOrDefault(Constants.PasswordGeneratorMinSpecial, 1), 0, 5, 1); var table = new ExtendedTableView { @@ -122,17 +113,11 @@ namespace Bit.App.Pages protected override void OnDisappearing() { - int minNumber; - if(int.TryParse(NumbersMinCell.Text, out minNumber)) - { - _settings.AddOrUpdateValue(Constants.PasswordGeneratorMinNumbers, minNumber); - } + _settings.AddOrUpdateValue(Constants.PasswordGeneratorMinNumbers, + Convert.ToInt32(NumbersMinCell.Stepper.Value)); - int minSpecial; - if(int.TryParse(SpecialMinCell.Text, out minSpecial)) - { - _settings.AddOrUpdateValue(Constants.PasswordGeneratorMinSpecial, minSpecial); - } + _settings.AddOrUpdateValue(Constants.PasswordGeneratorMinSpecial, + Convert.ToInt32(SpecialMinCell.Stepper.Value)); } private void AvoidAmbiguousCell_OnChanged(object sender, ToggledEventArgs e) diff --git a/src/App/Pages/Vault/VaultListSitesPage.cs b/src/App/Pages/Vault/VaultListSitesPage.cs index d65a5648c..422c2d240 100644 --- a/src/App/Pages/Vault/VaultListSitesPage.cs +++ b/src/App/Pages/Vault/VaultListSitesPage.cs @@ -322,7 +322,6 @@ namespace Bit.App.Pages { _page = page; - // Adding whitespace to Delete action to account for the negative margin offset on the listview var deleteAction = new MenuItem { Text = AppResources.Delete, IsDestructive = true }; deleteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); deleteAction.Clicked += page.DeleteClickedAsync; diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 18c3c602a..4735b1892 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -53,10 +53,13 @@ namespace Bit.iOS // Appearance stuff var primaryColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f); + var grayLight = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); UINavigationBar.Appearance.ShadowImage = new UIImage(); UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); UIBarButtonItem.AppearanceWhenContainedIn(new Type[] { typeof(UISearchBar) }).TintColor = primaryColor; + UIStepper.Appearance.TintColor = grayLight; + UISlider.Appearance.TintColor = primaryColor; MessagingCenter.Subscribe(Xamarin.Forms.Application.Current, "ShowAppExtension", (sender, page) => {