mirror of
https://github.com/bitwarden/mobile
synced 2026-01-05 01:53:17 +00:00
replace launch and clipboard buttons with icons
This commit is contained in:
@@ -129,6 +129,7 @@ namespace Bit.App.Controls
|
||||
{
|
||||
Button.Padding = new Thickness(0);
|
||||
Button.BackgroundColor = Color.Transparent;
|
||||
Button.WidthRequest = 40;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace Bit.App.Controls
|
||||
public LabeledValueCell(
|
||||
string labelText = null,
|
||||
string valueText = null,
|
||||
string button1Text = null,
|
||||
string button2Text = null,
|
||||
string button1Image = null,
|
||||
string button2Image = null,
|
||||
string subText = null)
|
||||
{
|
||||
var containerStackLayout = new StackLayout
|
||||
@@ -69,11 +69,11 @@ namespace Bit.App.Controls
|
||||
buttonStackLayout.Children.Add(Sub);
|
||||
}
|
||||
|
||||
if(button1Text != null)
|
||||
if(button1Image != null)
|
||||
{
|
||||
Button1 = new ExtendedButton
|
||||
{
|
||||
Text = button1Text,
|
||||
Image = button1Image,
|
||||
HorizontalOptions = LayoutOptions.End,
|
||||
VerticalOptions = LayoutOptions.Center,
|
||||
Margin = new Thickness(0)
|
||||
@@ -82,11 +82,11 @@ namespace Bit.App.Controls
|
||||
buttonStackLayout.Children.Add(Button1);
|
||||
}
|
||||
|
||||
if(button2Text != null)
|
||||
if(button2Image != null)
|
||||
{
|
||||
Button2 = new ExtendedButton
|
||||
{
|
||||
Text = button2Text,
|
||||
Image = button2Image,
|
||||
HorizontalOptions = LayoutOptions.End,
|
||||
VerticalOptions = LayoutOptions.Center,
|
||||
Margin = new Thickness(0)
|
||||
@@ -103,11 +103,13 @@ namespace Bit.App.Controls
|
||||
{
|
||||
Button1.Padding = new Thickness(0);
|
||||
Button1.BackgroundColor = Color.Transparent;
|
||||
Button1.WidthRequest = 40;
|
||||
}
|
||||
if(Button2 != null)
|
||||
{
|
||||
Button2.Padding = new Thickness(0);
|
||||
Button2.BackgroundColor = Color.Transparent;
|
||||
Button2.WidthRequest = 40;
|
||||
}
|
||||
|
||||
containerStackLayout.AdjustPaddingForDevice();
|
||||
|
||||
@@ -481,18 +481,6 @@ namespace Bit.App.Pages
|
||||
Table.RowHeight = -1;
|
||||
Table.EstimatedRowHeight = 70;
|
||||
}
|
||||
else if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
if(LoginPasswordCell?.Button != null)
|
||||
{
|
||||
LoginPasswordCell.Button.WidthRequest = 40;
|
||||
}
|
||||
|
||||
if(LoginTotpCell?.Button != null)
|
||||
{
|
||||
LoginTotpCell.Button.WidthRequest = 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitSave()
|
||||
|
||||
@@ -183,20 +183,15 @@ namespace Bit.App.Pages
|
||||
{
|
||||
textFieldCell.Entry.FontFamily = Helpers.OnPlatform(
|
||||
iOS: "Menlo-Regular", Android: "monospace", WinPhone: "Courier");
|
||||
textFieldCell.Button.Image = "eye";
|
||||
textFieldCell.Button.Image = "eye.png";
|
||||
textFieldCell.Button.Command = new Command(() =>
|
||||
{
|
||||
textFieldCell.Entry.InvokeToggleIsPassword();
|
||||
textFieldCell.Button.Image =
|
||||
"eye" + (!textFieldCell.Entry.IsPasswordFromToggled ? "_slash" : string.Empty);
|
||||
"eye" + (!textFieldCell.Entry.IsPasswordFromToggled ? "_slash" : string.Empty) + ".png";
|
||||
});
|
||||
}
|
||||
|
||||
if(Device.RuntimePlatform == Device.Android && textFieldCell.Button != null)
|
||||
{
|
||||
textFieldCell.Button.WidthRequest = 40;
|
||||
}
|
||||
|
||||
textFieldCell.InitEvents();
|
||||
FieldsSection.Add(textFieldCell);
|
||||
break;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Bit.App.Pages
|
||||
useButton: _deviceInfo.HasCamera);
|
||||
if(_deviceInfo.HasCamera)
|
||||
{
|
||||
TotpCell.Button.Image = "camera";
|
||||
TotpCell.Button.Image = "camera.png";
|
||||
}
|
||||
TotpCell.Entry.Text = cipher.Login?.Totp?.Decrypt(cipher.OrganizationId);
|
||||
TotpCell.Entry.DisableAutocapitalize = true;
|
||||
@@ -75,7 +75,7 @@ namespace Bit.App.Pages
|
||||
PasswordCell = new FormEntryCell(AppResources.Password, isPassword: true, nextElement: TotpCell.Entry,
|
||||
useButton: true);
|
||||
PasswordCell.Entry.Text = cipher.Login?.Password?.Decrypt(cipher.OrganizationId);
|
||||
PasswordCell.Button.Image = "eye";
|
||||
PasswordCell.Button.Image = "eye.png";
|
||||
PasswordCell.Entry.DisableAutocapitalize = true;
|
||||
PasswordCell.Entry.Autocorrect = false;
|
||||
PasswordCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", WinPhone: "Courier");
|
||||
@@ -173,15 +173,6 @@ namespace Bit.App.Pages
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 70;
|
||||
}
|
||||
else if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
PasswordCell.Button.WidthRequest = 40;
|
||||
|
||||
if(TotpCell.Button != null)
|
||||
{
|
||||
TotpCell.Button.WidthRequest = 40;
|
||||
}
|
||||
}
|
||||
|
||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
||||
{
|
||||
|
||||
@@ -64,14 +64,14 @@ namespace Bit.App.Pages
|
||||
nameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Name));
|
||||
|
||||
// Username
|
||||
UsernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
|
||||
UsernameCell = new LabeledValueCell(AppResources.Username, button1Image: "clipboard.png");
|
||||
UsernameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Username));
|
||||
UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
|
||||
UsernameCell.Value.LineBreakMode = LineBreakMode.WordWrap;
|
||||
|
||||
// Password
|
||||
PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
|
||||
button2Text: AppResources.Copy);
|
||||
PasswordCell = new LabeledValueCell(AppResources.Password, button1Image: string.Empty,
|
||||
button2Image: "clipboard.png");
|
||||
PasswordCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.MaskedPassword));
|
||||
PasswordCell.Button1.SetBinding(Button.ImageProperty, nameof(VaultViewLoginPageModel.ShowHideImage));
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
@@ -84,7 +84,7 @@ namespace Bit.App.Pages
|
||||
PasswordCell.Value.LineBreakMode = LineBreakMode.WordWrap;
|
||||
|
||||
// URI
|
||||
UriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
|
||||
UriCell = new LabeledValueCell(AppResources.Website, button1Image: "launch.png");
|
||||
UriCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.UriHost));
|
||||
UriCell.Button1.SetBinding(IsVisibleProperty, nameof(VaultViewLoginPageModel.ShowLaunch));
|
||||
UriCell.Button1.Command = new Command(() =>
|
||||
@@ -100,7 +100,7 @@ namespace Bit.App.Pages
|
||||
});
|
||||
|
||||
// Totp
|
||||
TotpCodeCell = new LabeledValueCell(AppResources.VerificationCodeTotp, button1Text: AppResources.Copy, subText: "--");
|
||||
TotpCodeCell = new LabeledValueCell(AppResources.VerificationCodeTotp, button1Image: "clipboard.png", subText: "--");
|
||||
TotpCodeCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.TotpCodeFormatted));
|
||||
TotpCodeCell.Value.SetBinding(Label.TextColorProperty, nameof(VaultViewLoginPageModel.TotpColor));
|
||||
TotpCodeCell.Button1.Command = new Command(() => Copy(Model.TotpCode, AppResources.VerificationCodeTotp));
|
||||
@@ -140,15 +140,6 @@ namespace Bit.App.Pages
|
||||
Table.RowHeight = -1;
|
||||
Table.EstimatedRowHeight = 70;
|
||||
}
|
||||
else if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
// NOTE: This is going to cause problems with i18n strings since various languages have difference string sizes
|
||||
PasswordCell.Button1.WidthRequest = 40;
|
||||
PasswordCell.Button2.WidthRequest = 59;
|
||||
UsernameCell.Button1.WidthRequest = 59;
|
||||
TotpCodeCell.Button1.WidthRequest = 59;
|
||||
UriCell.Button1.WidthRequest = 75;
|
||||
}
|
||||
|
||||
Title = AppResources.ViewItem;
|
||||
Content = Table;
|
||||
@@ -429,13 +420,13 @@ namespace Bit.App.Pages
|
||||
}
|
||||
|
||||
public FieldViewCell(VaultViewCipherPage page, VaultViewLoginPageModel.Field field, bool? a)
|
||||
: base(field.Name, field.Value, AppResources.Copy)
|
||||
: base(field.Name, field.Value, "clipboard.png")
|
||||
{
|
||||
Init(page, field, Button1);
|
||||
}
|
||||
|
||||
public FieldViewCell(VaultViewCipherPage page, VaultViewLoginPageModel.Field field, bool? a, bool? b)
|
||||
: base(field.Name, field.MaskedValue, string.Empty, AppResources.Copy)
|
||||
: base(field.Name, field.MaskedValue, string.Empty, "clipboard.png")
|
||||
{
|
||||
Value.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular",
|
||||
Android: "monospace", WinPhone: "Courier");
|
||||
@@ -443,20 +434,19 @@ namespace Bit.App.Pages
|
||||
{
|
||||
Button1.Margin = new Thickness(10, 0);
|
||||
}
|
||||
|
||||
Button1.WidthRequest = 40;
|
||||
|
||||
Button1.Image = "eye";
|
||||
Button1.Command = new Command(() =>
|
||||
{
|
||||
field.Revealed = !field.Revealed;
|
||||
if(field.Revealed)
|
||||
{
|
||||
Button1.Image = "eye_slash";
|
||||
Button1.Image = "eye_slash.png";
|
||||
Value.Text = field.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Button1.Image = "eye";
|
||||
Button1.Image = "eye.png";
|
||||
Value.Text = field.MaskedValue;
|
||||
}
|
||||
});
|
||||
@@ -470,7 +460,6 @@ namespace Bit.App.Pages
|
||||
if(copyButton != null)
|
||||
{
|
||||
copyButton.Command = new Command(() => page.Copy(field.Value, field.Name));
|
||||
copyButton.WidthRequest = 59;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user