1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-25 12:05:59 +01:00

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,10 +46,17 @@ namespace Bit.Android.Controls
private void SetUppercase() private void SetUppercase()
{ {
var element = Element as ExtendedButton; var element = Element as ExtendedButton;
if(element != null && !element.Uppercase) if(element != null && !string.IsNullOrWhiteSpace(element.Text))
{
if(element.Uppercase)
{
element.Text = element.Text.ToUpperInvariant();
}
else
{ {
Control.TransformationMethod = null; Control.TransformationMethod = null;
} }
} }
} }
}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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