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

@ -24,6 +24,7 @@ namespace Bit.Android
base.OnCreate(bundle);
Console.WriteLine("A OnCreate");
HockeyApp.Android.CrashManager.Register(this);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App.App(

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.bitwarden.vault" android:versionCode="1" android:versionName="0.0.2" android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.8bit.bitwarden" android:versionCode="1" android:versionName="0.0.2" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.bitwarden.vault.permission.C2D_MESSAGE" />
<uses-permission android:name="com.8bit.bitwarden.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application android:label="bitwarden" android:theme="@style/BitwardenTheme"></application>
</manifest>

View File

@ -15,6 +15,7 @@ using Android.App;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: MetaData("net.hockeyapp.android.appIdentifier", Value = "d3834185b4a643479047b86c65293d42")]
// Version information for an assembly consists of the following four values:
//

View File

@ -1310,32 +1310,32 @@ namespace Bit.Android
public partial class Color
{
// aapt resource value: 0x7f0a0069
public const int abc_background_cache_hint_selector_material_dark = 2131361897;
// aapt resource value: 0x7f0a006a
public const int abc_background_cache_hint_selector_material_light = 2131361898;
public const int abc_background_cache_hint_selector_material_dark = 2131361898;
// aapt resource value: 0x7f0a006b
public const int abc_color_highlight_material = 2131361899;
public const int abc_background_cache_hint_selector_material_light = 2131361899;
// aapt resource value: 0x7f0a006c
public const int abc_color_highlight_material = 2131361900;
// aapt resource value: 0x7f0a0015
public const int abc_input_method_navigation_guard = 2131361813;
// aapt resource value: 0x7f0a006c
public const int abc_primary_text_disable_only_material_dark = 2131361900;
// aapt resource value: 0x7f0a006d
public const int abc_primary_text_disable_only_material_light = 2131361901;
public const int abc_primary_text_disable_only_material_dark = 2131361901;
// aapt resource value: 0x7f0a006e
public const int abc_primary_text_material_dark = 2131361902;
public const int abc_primary_text_disable_only_material_light = 2131361902;
// aapt resource value: 0x7f0a006f
public const int abc_primary_text_material_light = 2131361903;
public const int abc_primary_text_material_dark = 2131361903;
// aapt resource value: 0x7f0a0070
public const int abc_search_url_text = 2131361904;
public const int abc_primary_text_material_light = 2131361904;
// aapt resource value: 0x7f0a0071
public const int abc_search_url_text = 2131361905;
// aapt resource value: 0x7f0a0016
public const int abc_search_url_text_normal = 2131361814;
@ -1346,14 +1346,14 @@ namespace Bit.Android
// aapt resource value: 0x7f0a0018
public const int abc_search_url_text_selected = 2131361816;
// aapt resource value: 0x7f0a0071
public const int abc_secondary_text_material_dark = 2131361905;
// aapt resource value: 0x7f0a0072
public const int abc_secondary_text_material_light = 2131361906;
public const int abc_secondary_text_material_dark = 2131361906;
// aapt resource value: 0x7f0a0068
public const int accent = 2131361896;
// aapt resource value: 0x7f0a0073
public const int abc_secondary_text_material_light = 2131361907;
// aapt resource value: 0x7f0a0069
public const int accent = 2131361897;
// aapt resource value: 0x7f0a0019
public const int accent_material_dark = 2131361817;
@ -1373,6 +1373,9 @@ namespace Bit.Android
// aapt resource value: 0x7f0a001e
public const int background_material_light = 2131361822;
// aapt resource value: 0x7f0a0064
public const int black = 2131361892;
// aapt resource value: 0x7f0a001f
public const int bright_foreground_disabled_material_dark = 2131361823;
@ -1412,8 +1415,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0a0008
public const int common_action_bar_splitter = 2131361800;
// aapt resource value: 0x7f0a0073
public const int common_google_signin_btn_text_dark = 2131361907;
// aapt resource value: 0x7f0a0074
public const int common_google_signin_btn_text_dark = 2131361908;
// aapt resource value: 0x7f0a0009
public const int common_google_signin_btn_text_dark_default = 2131361801;
@ -1427,8 +1430,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0a000a
public const int common_google_signin_btn_text_dark_pressed = 2131361802;
// aapt resource value: 0x7f0a0074
public const int common_google_signin_btn_text_light = 2131361908;
// aapt resource value: 0x7f0a0075
public const int common_google_signin_btn_text_light = 2131361909;
// aapt resource value: 0x7f0a000d
public const int common_google_signin_btn_text_light_default = 2131361805;
@ -1442,8 +1445,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0a000e
public const int common_google_signin_btn_text_light_pressed = 2131361806;
// aapt resource value: 0x7f0a0075
public const int common_plus_signin_btn_text_dark = 2131361909;
// aapt resource value: 0x7f0a0076
public const int common_plus_signin_btn_text_dark = 2131361910;
// aapt resource value: 0x7f0a0000
public const int common_plus_signin_btn_text_dark_default = 2131361792;
@ -1457,8 +1460,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0a0001
public const int common_plus_signin_btn_text_dark_pressed = 2131361793;
// aapt resource value: 0x7f0a0076
public const int common_plus_signin_btn_text_light = 2131361910;
// aapt resource value: 0x7f0a0077
public const int common_plus_signin_btn_text_light = 2131361911;
// aapt resource value: 0x7f0a0004
public const int common_plus_signin_btn_text_light_default = 2131361796;
@ -1472,8 +1475,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0a0005
public const int common_plus_signin_btn_text_light_pressed = 2131361797;
// aapt resource value: 0x7f0a0064
public const int darkgray = 2131361892;
// aapt resource value: 0x7f0a0065
public const int darkgray = 2131361893;
// aapt resource value: 0x7f0a004f
public const int design_fab_shadow_end_color = 2131361871;
@ -1523,8 +1526,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0a002c
public const int foreground_material_light = 2131361836;
// aapt resource value: 0x7f0a0065
public const int gray = 2131361893;
// aapt resource value: 0x7f0a0066
public const int gray = 2131361894;
// aapt resource value: 0x7f0a002d
public const int highlighted_text_material_dark = 2131361837;
@ -1568,8 +1571,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0a0062
public const int hockeyapp_text_white = 2131361890;
// aapt resource value: 0x7f0a0066
public const int lightgray = 2131361894;
// aapt resource value: 0x7f0a0067
public const int lightgray = 2131361895;
// aapt resource value: 0x7f0a0031
public const int material_blue_grey_800 = 2131361841;
@ -1607,8 +1610,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0a003c
public const int material_grey_900 = 2131361852;
// aapt resource value: 0x7f0a0067
public const int primary = 2131361895;
// aapt resource value: 0x7f0a0068
public const int primary = 2131361896;
// aapt resource value: 0x7f0a003d
public const int primary_dark_material_dark = 2131361853;
@ -1658,11 +1661,11 @@ namespace Bit.Android
// aapt resource value: 0x7f0a004c
public const int switch_thumb_disabled_material_light = 2131361868;
// aapt resource value: 0x7f0a0077
public const int switch_thumb_material_dark = 2131361911;
// aapt resource value: 0x7f0a0078
public const int switch_thumb_material_light = 2131361912;
public const int switch_thumb_material_dark = 2131361912;
// aapt resource value: 0x7f0a0079
public const int switch_thumb_material_light = 2131361913;
// aapt resource value: 0x7f0a004d
public const int switch_thumb_normal_material_dark = 2131361869;

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="BitwardenTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:textColorPrimary">@color/darkgray</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:windowBackground">@color/lightgray</item>
</style>
<style name="BitwardenTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:windowBackground">@color/lightgray</item>
</style>
</resources>

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<color name="white">#FFFFFF</color>
<color name="darkgray">#333333</color>
<color name="gray">#738182</color>
<color name="lightgray">#efeff4</color>
<color name="primary">#222d32</color>
<color name="accent">#3c8dbc</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="darkgray">#333333</color>
<color name="gray">#738182</color>
<color name="lightgray">#efeff4</color>
<color name="primary">#222d32</color>
<color name="accent">#3c8dbc</color>
</resources>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="BitwardenTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:textColorPrimary">@color/darkgray</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:windowBackground">@color/lightgray</item>
</style>
<style name="BitwardenTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:windowBackground">@color/lightgray</item>
</style>
</resources>

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,