1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-02 00:23:15 +00:00

Added stepper cell to password generator settings page. Conditionally show sync indicator on pages.

This commit is contained in:
Kyle Spearrin
2016-07-12 18:59:09 -04:00
parent f2893e788d
commit 822a14e56c
9 changed files with 87 additions and 35 deletions

View File

@@ -9,22 +9,26 @@ namespace Bit.App.Controls
{
private ISyncService _syncService;
public ExtendedContentPage()
public ExtendedContentPage(bool syncIndicator = true)
{
_syncService = Resolver.Resolve<ISyncService>();
BackgroundColor = Color.FromHex("efeff4");
IsBusy = _syncService.SyncInProgress;
MessagingCenter.Subscribe<Application, bool>(Application.Current, "SyncCompleted", (sender, success) =>
if(syncIndicator)
{
IsBusy = _syncService.SyncInProgress;
});
MessagingCenter.Subscribe<Application>(Application.Current, "SyncStarted", (sender) =>
{
IsBusy = _syncService.SyncInProgress;
});
MessagingCenter.Subscribe<Application, bool>(Application.Current, "SyncCompleted", (sender, success) =>
{
IsBusy = _syncService.SyncInProgress;
});
MessagingCenter.Subscribe<Application>(Application.Current, "SyncStarted", (sender) =>
{
IsBusy = _syncService.SyncInProgress;
});
}
}
}
}

View File

@@ -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; }
}
}