mirror of
https://github.com/bitwarden/mobile
synced 2026-01-04 17:43:17 +00:00
Extended button and device specific monospace fonts
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
<Compile Include="Controls\DismissModalToolBarItem.cs" />
|
||||
<Compile Include="Controls\EntryLabel.cs" />
|
||||
<Compile Include="Controls\ExtendedEditor.cs" />
|
||||
<Compile Include="Controls\ExtendedButton.cs" />
|
||||
<Compile Include="Controls\ExtendedNavigationPage.cs" />
|
||||
<Compile Include="Controls\ExtendedContentPage.cs" />
|
||||
<Compile Include="Controls\StepperCell.cs" />
|
||||
|
||||
18
src/App/Controls/ExtendedButton.cs
Normal file
18
src/App/Controls/ExtendedButton.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Bit.App.Enums;
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class ExtendedButton : Button
|
||||
{
|
||||
public static readonly BindableProperty PaddingProperty =
|
||||
BindableProperty.Create(nameof(Padding), typeof(Thickness), typeof(ExtendedButton), default(Thickness));
|
||||
|
||||
public Thickness Padding
|
||||
{
|
||||
get { return (Thickness)GetValue(PaddingProperty); }
|
||||
set { SetValue(PaddingProperty, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace Bit.App.Controls
|
||||
|
||||
if(button1Text != null)
|
||||
{
|
||||
Button1 = new Button
|
||||
Button1 = new ExtendedButton
|
||||
{
|
||||
Text = button1Text,
|
||||
HorizontalOptions = LayoutOptions.End,
|
||||
@@ -76,7 +76,7 @@ namespace Bit.App.Controls
|
||||
|
||||
if(button2Text != null)
|
||||
{
|
||||
Button2 = new Button
|
||||
Button2 = new ExtendedButton
|
||||
{
|
||||
Text = button2Text,
|
||||
HorizontalOptions = LayoutOptions.End,
|
||||
@@ -87,6 +87,18 @@ namespace Bit.App.Controls
|
||||
buttonStackLayout.Children.Add(Button2);
|
||||
}
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
{
|
||||
if(Button1 != null)
|
||||
{
|
||||
Button1.Padding = new Thickness(5);
|
||||
}
|
||||
if(Button2 != null)
|
||||
{
|
||||
Button2.Padding = new Thickness(5);
|
||||
}
|
||||
}
|
||||
|
||||
containerStackLayout.Children.Add(buttonStackLayout);
|
||||
|
||||
View = containerStackLayout;
|
||||
@@ -94,7 +106,7 @@ namespace Bit.App.Controls
|
||||
|
||||
public Label Label { get; private set; }
|
||||
public Label Value { get; private set; }
|
||||
public Button Button1 { get; private set; }
|
||||
public Button Button2 { get; private set; }
|
||||
public ExtendedButton Button1 { get; private set; }
|
||||
public ExtendedButton Button2 { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Bit.App.Controls
|
||||
{
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
FontSize = 35,
|
||||
FontFamily = "Courier"
|
||||
};
|
||||
FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier")
|
||||
};
|
||||
|
||||
Entry = new ExtendedEntry
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Bit.App.Pages
|
||||
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
|
||||
Margin = new Thickness(15, 40, 15, 40),
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
FontFamily = "Courier",
|
||||
FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier"),
|
||||
LineBreakMode = LineBreakMode.TailTruncation,
|
||||
VerticalOptions = LayoutOptions.Start
|
||||
};
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace Bit.App.Pages
|
||||
usernameCell.Entry.DisableAutocapitalize = true;
|
||||
usernameCell.Entry.Autocorrect = false;
|
||||
|
||||
usernameCell.Entry.FontFamily = PasswordCell.Entry.FontFamily = "Courier";
|
||||
usernameCell.Entry.FontFamily = PasswordCell.Entry.FontFamily = Device.OnPlatform(
|
||||
iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
|
||||
var uriCell = new FormEntryCell(AppResources.URI, Keyboard.Url, nextElement: usernameCell.Entry);
|
||||
var nameCell = new FormEntryCell(AppResources.Name, nextElement: uriCell.Entry);
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace Bit.App.Pages
|
||||
usernameCell.Entry.DisableAutocapitalize = true;
|
||||
usernameCell.Entry.Autocorrect = false;
|
||||
|
||||
usernameCell.Entry.FontFamily = PasswordCell.Entry.FontFamily = "Courier";
|
||||
usernameCell.Entry.FontFamily = PasswordCell.Entry.FontFamily = Device.OnPlatform(
|
||||
iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
|
||||
var uriCell = new FormEntryCell(AppResources.URI, Keyboard.Url, nextElement: usernameCell.Entry);
|
||||
uriCell.Entry.Text = site.Uri?.Decrypt();
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace Bit.App.Pages
|
||||
UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
|
||||
|
||||
// Password
|
||||
PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty, button2Text: AppResources.Copy);
|
||||
PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
|
||||
button2Text: AppResources.Copy);
|
||||
PasswordCell.Value.SetBinding<VaultViewSitePageModel>(Label.TextProperty, s => s.MaskedPassword);
|
||||
PasswordCell.Button1.SetBinding<VaultViewSitePageModel>(Button.ImageProperty, s => s.ShowHideImage);
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
@@ -62,7 +63,8 @@ namespace Bit.App.Pages
|
||||
PasswordCell.Button1.Command = new Command(() => Model.RevealPassword = !Model.RevealPassword);
|
||||
PasswordCell.Button2.Command = new Command(() => Copy(Model.Password, AppResources.Password));
|
||||
|
||||
UsernameCell.Value.FontFamily = PasswordCell.Value.FontFamily = "Courier";
|
||||
UsernameCell.Value.FontFamily = PasswordCell.Value.FontFamily = Device.OnPlatform(
|
||||
iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
|
||||
// URI
|
||||
UriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
|
||||
|
||||
Reference in New Issue
Block a user