Button uppercase styling enforcement

This commit is contained in:
Kyle Spearrin 2016-08-24 00:07:46 -04:00
parent 2262e1c4c2
commit d4f52bce2b
8 changed files with 28 additions and 18 deletions

View File

@ -46,9 +46,16 @@ namespace Bit.Android.Controls
private void SetUppercase()
{
var element = Element as ExtendedButton;
if(element != null && !element.Uppercase)
if(element != null && !string.IsNullOrWhiteSpace(element.Text))
{
Control.TransformationMethod = null;
if(element.Uppercase)
{
element.Text = element.Text.ToUpperInvariant();
}
else
{
Control.TransformationMethod = null;
}
}
}
}

View File

@ -31,7 +31,7 @@ namespace Bit.App.Controls
Spacing = 0
};
Button = new Button
Button = new ExtendedButton
{
HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.CenterAndExpand,

View File

@ -48,7 +48,7 @@ namespace Bit.App.Pages
TextColor = Color.FromHex("333333")
};
var createAccountButton = new Button
var createAccountButton = new ExtendedButton
{
Text = "Create Account",
Command = new Command(async () => await RegisterAsync()),
@ -58,7 +58,7 @@ namespace Bit.App.Pages
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
};
var loginButton = new Button
var loginButton = new ExtendedButton
{
Text = AppResources.LogIn,
Command = new Command(async () => await LoginAsync()),

View File

@ -31,7 +31,7 @@ namespace Bit.App.Pages
public void Init()
{
var fingerprintIcon = new Button
var fingerprintIcon = new ExtendedButton
{
Image = "fingerprint",
BackgroundColor = Color.Transparent,
@ -40,7 +40,7 @@ namespace Bit.App.Pages
Margin = new Thickness(0, 0, 0, 15)
};
var fingerprintButton = new Button
var fingerprintButton = new ExtendedButton
{
Text = "Use Fingerprint to Unlock",
Command = new Command(async () => await CheckFingerprintAsync()),
@ -48,13 +48,14 @@ namespace Bit.App.Pages
Style = (Style)Application.Current.Resources["btn-primary"]
};
var logoutButton = new Button
var logoutButton = new ExtendedButton
{
Text = AppResources.LogOut,
Command = new Command(async () => await LogoutAsync()),
VerticalOptions = LayoutOptions.End,
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
BackgroundColor = Color.Transparent
BackgroundColor = Color.Transparent,
Uppercase = false
};
var stackLayout = new StackLayout

View File

@ -61,13 +61,14 @@ namespace Bit.App.Pages
}
};
var logoutButton = new Button
var logoutButton = new ExtendedButton
{
Text = AppResources.LogOut,
Command = new Command(async () => await LogoutAsync()),
VerticalOptions = LayoutOptions.End,
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
BackgroundColor = Color.Transparent
BackgroundColor = Color.Transparent,
Uppercase = false
};
var stackLayout = new StackLayout

View File

@ -46,13 +46,14 @@ namespace Bit.App.Pages
PinControl.Label.SetBinding<PinPageModel>(Label.TextProperty, s => s.LabelText);
PinControl.Entry.SetBinding<PinPageModel>(Entry.TextProperty, s => s.PIN);
var logoutButton = new Button
var logoutButton = new ExtendedButton
{
Text = AppResources.LogOut,
Command = new Command(async () => await LogoutAsync()),
VerticalOptions = LayoutOptions.End,
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
BackgroundColor = Color.Transparent
BackgroundColor = Color.Transparent,
Uppercase = false
};
var stackLayout = new StackLayout

View File

@ -34,7 +34,7 @@ namespace Bit.App.Pages
public void Init()
{
var syncButton = new Button
var syncButton = new ExtendedButton
{
Text = "Sync Vault Now",
Command = new Command(async () => await SyncAsync()),

View File

@ -59,7 +59,7 @@ namespace Bit.App.Pages
Margin = new Thickness(0, -10, 0, 0)
};
var notStartedButton = new Button
var notStartedButton = new ExtendedButton
{
Text = "Enable App Extension",
Command = new Command(() => ShowExtension("NotStartedEnable")),
@ -108,7 +108,7 @@ namespace Bit.App.Pages
Margin = new Thickness(0, -10, 0, 0)
};
var notActivatedButton = new Button
var notActivatedButton = new ExtendedButton
{
Text = "Enable App Extension",
Command = new Command(() => ShowExtension("NotActivatedEnable")),
@ -158,7 +158,7 @@ namespace Bit.App.Pages
Margin = new Thickness(0, -10, 0, 0)
};
var activatedButton = new Button
var activatedButton = new ExtendedButton
{
Text = "See Supported Apps",
Command = new Command(() =>
@ -171,7 +171,7 @@ namespace Bit.App.Pages
Style = (Style)Application.Current.Resources["btn-primary"]
};
var activatedButtonReenable = new Button
var activatedButtonReenable = new ExtendedButton
{
Text = "Re-enable App Extension",
Command = new Command(() => ShowExtension("Re-enable")),