1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-07 19:13:19 +00:00

Android UI improvements. Added hockeyapp for android. Recycle lsitview elements.

This commit is contained in:
Kyle Spearrin
2016-08-13 21:43:15 -04:00
parent 748698b33f
commit b4a80751b2
17 changed files with 134 additions and 75 deletions

View File

@@ -6,6 +6,14 @@ namespace Bit.App.Controls
{
public class ExtendedEntry : Entry
{
public ExtendedEntry()
{
if(Device.OS == TargetPlatform.Android)
{
PlaceholderColor = Color.FromHex("c7c7cd");
}
}
public static readonly BindableProperty HasBorderProperty =
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEntry), true);

View File

@@ -7,6 +7,11 @@ namespace Bit.App.Controls
{
public ExtendedTextCell()
{
if(Device.OS == TargetPlatform.Android)
{
TextColor = Color.Black;
}
DetailColor = Color.FromHex("777777");
}
@@ -41,7 +46,13 @@ namespace Bit.App.Controls
public void OnDisclousureTapped()
{
DisclousureTapped?.Invoke(this, EventArgs.Empty);
if(DisclousureTapped == null)
{
OnTapped();
return;
}
DisclousureTapped.Invoke(this, EventArgs.Empty);
}
}
}

View File

@@ -24,6 +24,11 @@ namespace Bit.App.Controls
Style = (Style)Application.Current.Resources["text-muted"],
HorizontalOptions = LayoutOptions.FillAndExpand
};
if(Device.OS == TargetPlatform.Android)
{
Label.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
}
}
Entry = new ExtendedEntry
@@ -36,6 +41,12 @@ namespace Bit.App.Controls
HorizontalOptions = LayoutOptions.FillAndExpand
};
if(Device.OS == TargetPlatform.Android)
{
Entry.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));
Entry.TextColor = Color.Black;
}
if(useLabelAsPlaceholder)
{
Entry.Placeholder = labelText;

View File

@@ -8,7 +8,6 @@ namespace Bit.App.Controls
{
Label = new Label
{
VerticalOptions = LayoutOptions.CenterAndExpand,
LineBreakMode = LineBreakMode.TailTruncation
};
@@ -16,14 +15,13 @@ namespace Bit.App.Controls
{
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
LineBreakMode = LineBreakMode.TailTruncation,
VerticalOptions = LayoutOptions.End,
Style = (Style)Application.Current.Resources["text-muted"],
Style = (Style)Application.Current.Resources["text-muted"]
};
var labelDetailStackLayout = new StackLayout
{
HorizontalOptions = LayoutOptions.StartAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand,
Children = { Label, Detail },
Padding = new Thickness(15, 5, 5, 5),
Spacing = 0
@@ -32,7 +30,7 @@ namespace Bit.App.Controls
Button = new Button
{
HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand,
WidthRequest = 50
};
@@ -42,6 +40,12 @@ namespace Bit.App.Controls
Children = { labelDetailStackLayout, Button }
};
if(Device.OS == TargetPlatform.Android)
{
Label.TextColor = Color.Black;
Detail.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
}
View = containerStackLayout;
}

View File

@@ -49,7 +49,7 @@ namespace Bit.App.Pages
NoFooter = true,
Root = new TableRoot
{
new TableSection()
new TableSection
{
PasswordCell
}

View File

@@ -48,7 +48,10 @@ namespace Bit.App.Pages
{
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
var padding = new Thickness(15, 20);
var padding = Device.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true,
useLabelAsPlaceholder: true, imageSource: "lock", containerPadding: padding);
@@ -166,11 +169,13 @@ namespace Bit.App.Pages
return;
}
var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, EmailCell.Entry.Text);
var normalizedEmail = EmailCell.Entry.Text.ToLower();
var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, normalizedEmail);
var request = new TokenRequest
{
Email = EmailCell.Entry.Text,
Email = normalizedEmail,
MasterPasswordHash = _cryptoService.HashPasswordBase64(key, PasswordCell.Entry.Text),
Device = new DeviceRequest(_appIdService, _deviceInfo)
};

View File

@@ -38,8 +38,13 @@ namespace Bit.App.Pages
private void Init()
{
var padding = Device.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
CodeCell = new FormEntryCell("Verification Code", useLabelAsPlaceholder: true,
imageSource: "lock", containerPadding: new Thickness(15, 20));
imageSource: "lock", containerPadding: padding);
CodeCell.Entry.Keyboard = Keyboard.Numeric;
CodeCell.Entry.ReturnType = Enums.ReturnType.Go;

View File

@@ -30,8 +30,13 @@ namespace Bit.App.Pages
private void Init()
{
var padding = Device.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
EmailCell = new FormEntryCell(AppResources.EmailAddress, entryKeyboard: Keyboard.Email,
useLabelAsPlaceholder: true, imageSource: "envelope", containerPadding: new Thickness(15, 20));
useLabelAsPlaceholder: true, imageSource: "envelope", containerPadding: padding);
EmailCell.Entry.ReturnType = Enums.ReturnType.Go;
EmailCell.Entry.Completed += Entry_Completed;

View File

@@ -40,7 +40,10 @@ namespace Bit.App.Pages
{
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
var padding = new Thickness(15, 20);
var padding = Device.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
PasswordHintCell = new FormEntryCell("Master Password Hint (optional)", useLabelAsPlaceholder: true,
imageSource: "lightbulb", containerPadding: padding);
@@ -169,10 +172,11 @@ namespace Bit.App.Pages
return;
}
var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, EmailCell.Entry.Text);
var normalizedEmail = EmailCell.Entry.Text.ToLower();
var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, normalizedEmail);
var request = new RegisterRequest
{
Email = EmailCell.Entry.Text,
Email = normalizedEmail,
MasterPasswordHash = _cryptoService.HashPasswordBase64(key, PasswordCell.Entry.Text),
MasterPasswordHint = !string.IsNullOrWhiteSpace(PasswordHintCell.Entry.Text) ? PasswordHintCell.Entry.Text : null
};
@@ -188,7 +192,7 @@ namespace Bit.App.Pages
}
_googleAnalyticsService.TrackAppEvent("Registered");
await _homePage.DismissRegisterAndLoginAsync(EmailCell.Entry.Text);
await _homePage.DismissRegisterAndLoginAsync(normalizedEmail);
}
private class FormTableView : ExtendedTableView

View File

@@ -71,7 +71,7 @@ namespace Bit.App.Pages
ToolbarItems.Add(new AddSiteToolBarItem(this));
}
ListView = new ListView
ListView = new ListView(ListViewCachingStrategy.RecycleElement)
{
IsGroupingEnabled = true,
ItemsSource = PresentationFolders,