From 90a6855e3926c425da9437f550711a079c002e97 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 18 Aug 2016 20:20:18 -0400 Subject: [PATCH] Android style updates --- src/Android/Controls/ExtendedPickerRenderer.cs | 1 + src/Android/Controls/ExtendedSwitchCellRenderer.cs | 12 ++++++++++-- src/App/Controls/FormEditorCell.cs | 6 ++++++ src/App/Controls/FormPickerCell.cs | 1 + src/App/Pages/Settings/SettingsPage.cs | 9 ++++++++- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Android/Controls/ExtendedPickerRenderer.cs b/src/Android/Controls/ExtendedPickerRenderer.cs index 247277fcc..7dab1dfdc 100644 --- a/src/Android/Controls/ExtendedPickerRenderer.cs +++ b/src/Android/Controls/ExtendedPickerRenderer.cs @@ -16,6 +16,7 @@ namespace Bit.Android.Controls var view = (ExtendedPicker)Element; + Control.TextSize = (float)Device.GetNamedSize(NamedSize.Small, typeof(Picker)); SetBorder(view); } diff --git a/src/Android/Controls/ExtendedSwitchCellRenderer.cs b/src/Android/Controls/ExtendedSwitchCellRenderer.cs index e091e5d34..6d36d7726 100644 --- a/src/Android/Controls/ExtendedSwitchCellRenderer.cs +++ b/src/Android/Controls/ExtendedSwitchCellRenderer.cs @@ -12,16 +12,24 @@ namespace Bit.Android.Controls { public class ExtendedSwitchCellRenderer : SwitchCellRenderer { - protected AView View { get; private set; } + protected BaseCellView View { get; private set; } protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context) { - var View = base.GetCellCore(item, convertView, parent, context); + var View = base.GetCellCore(item, convertView, parent, context) as SwitchCellView; var extendedCell = (ExtendedSwitchCell)item; if(View != null) { View.SetBackgroundColor(extendedCell.BackgroundColor.ToAndroid()); + if(item.IsEnabled) + { + View.SetMainTextColor(Color.Black); + } + else + { + View.SetMainTextColor(Color.FromHex("d2d6de")); + } } return View; diff --git a/src/App/Controls/FormEditorCell.cs b/src/App/Controls/FormEditorCell.cs index a7bcac89f..2391a85f2 100644 --- a/src/App/Controls/FormEditorCell.cs +++ b/src/App/Controls/FormEditorCell.cs @@ -27,6 +27,12 @@ namespace Bit.App.Controls Tapped += FormEditorCell_Tapped; + if(Device.OS == TargetPlatform.Android) + { + Editor.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)); + Editor.Margin = new Thickness(-4, -2, -4, -10); + } + View = stackLayout; } diff --git a/src/App/Controls/FormPickerCell.cs b/src/App/Controls/FormPickerCell.cs index c6c720db7..23bacce30 100644 --- a/src/App/Controls/FormPickerCell.cs +++ b/src/App/Controls/FormPickerCell.cs @@ -38,6 +38,7 @@ namespace Bit.App.Controls if(Device.OS == TargetPlatform.Android) { stackLayout.Spacing = 0; + Picker.Margin = new Thickness(-4, -2, -4, -10); } Tapped += FormPickerCell_Tapped; diff --git a/src/App/Pages/Settings/SettingsPage.cs b/src/App/Pages/Settings/SettingsPage.cs index 4d4a170c0..3fe64af0d 100644 --- a/src/App/Pages/Settings/SettingsPage.cs +++ b/src/App/Pages/Settings/SettingsPage.cs @@ -41,9 +41,10 @@ namespace Bit.App.Pages private void Init() { + var fingerprintName = Device.OnPlatform(iOS: "Touch ID", Android: "Fingerprint", WinPhone: "Fingerprint"); FingerprintCell = new ExtendedSwitchCell { - Text = "Unlock with Touch ID" + (!_fingerprint.IsAvailable ? " (Unavilable)" : null), + Text = "Unlock with " + fingerprintName + (!_fingerprint.IsAvailable ? " (Unavilable)" : null), On = _settings.GetValueOrDefault(Constants.SettingFingerprintUnlockOn), IsEnabled = _fingerprint.IsAvailable }; @@ -428,6 +429,12 @@ namespace Bit.App.Pages Padding = new Thickness(15) }; + if(Device.OS == TargetPlatform.Android) + { + labelDetailStackLayout.Spacing = 5; + Label.TextColor = Color.Black; + } + ShowDisclousure = true; View = labelDetailStackLayout; }