From 25b75fd6e431fe9c3e75f0641cc644f2c3290497 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 11 Dec 2017 14:29:50 -0500 Subject: [PATCH] make sure PIN doesnt show on screen. adjust focus. --- src/Android/Controls/ExtendedEntryRenderer.cs | 5 +++++ src/App/Controls/ExtendedEntry.cs | 1 + src/App/Controls/PinControl.cs | 8 +++++++- src/App/Pages/Lock/LockPinPage.cs | 3 +-- src/iOS/Controls/ExtendedEntryRenderer.cs | 5 +++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Android/Controls/ExtendedEntryRenderer.cs b/src/Android/Controls/ExtendedEntryRenderer.cs index 3959d210f..c3a70d1d0 100644 --- a/src/Android/Controls/ExtendedEntryRenderer.cs +++ b/src/Android/Controls/ExtendedEntryRenderer.cs @@ -66,6 +66,11 @@ namespace Bit.Android.Controls { Control.Typeface = Typeface.Monospace; } + + if(_view.HideCursor) + { + Control.SetCursorVisible(false); + } } private void ToggleIsPassword(object sender, EventArgs e) diff --git a/src/App/Controls/ExtendedEntry.cs b/src/App/Controls/ExtendedEntry.cs index f855175a7..b9685ee20 100644 --- a/src/App/Controls/ExtendedEntry.cs +++ b/src/App/Controls/ExtendedEntry.cs @@ -56,6 +56,7 @@ namespace Bit.App.Controls public bool? Autocorrect { get; set; } public bool DisableAutocapitalize { get; set; } public bool AllowClear { get; set; } + public bool HideCursor { get; set; } // Need to overwrite default handler because we cant Invoke otherwise public new event EventHandler Completed; diff --git a/src/App/Controls/PinControl.cs b/src/App/Controls/PinControl.cs index 62f2989b6..767b6207a 100644 --- a/src/App/Controls/PinControl.cs +++ b/src/App/Controls/PinControl.cs @@ -21,13 +21,19 @@ namespace Bit.App.Controls { Keyboard = Keyboard.Numeric, MaxLength = 4, - Margin = new Thickness(0, int.MaxValue, 0, 0) + HideCursor = true }; + Entry.BackgroundColor = Entry.TextColor = Color.Transparent; + if(Device.RuntimePlatform == Device.Android) { Label.TextColor = Color.Black; } + else + { + Entry.Margin = new Thickness(0, int.MaxValue, 0, 0); + } } public Label Label { get; set; } diff --git a/src/App/Pages/Lock/LockPinPage.cs b/src/App/Pages/Lock/LockPinPage.cs index bc827e1ca..e425f3af3 100644 --- a/src/App/Pages/Lock/LockPinPage.cs +++ b/src/App/Pages/Lock/LockPinPage.cs @@ -87,6 +87,7 @@ namespace Bit.App.Pages { for(int i = 0; i < 5; i++) { + await Task.Delay(1000); if(!PinControl.Entry.IsFocused) { Device.BeginInvokeOnMainThread(() => PinControl.Entry.Focus()); @@ -95,8 +96,6 @@ namespace Bit.App.Pages { break; } - - await Task.Delay(1000); } }); } diff --git a/src/iOS/Controls/ExtendedEntryRenderer.cs b/src/iOS/Controls/ExtendedEntryRenderer.cs index e9ab06660..fdb2edffb 100644 --- a/src/iOS/Controls/ExtendedEntryRenderer.cs +++ b/src/iOS/Controls/ExtendedEntryRenderer.cs @@ -41,6 +41,11 @@ namespace Bit.iOS.Controls Control.AutocorrectionType = view.Autocorrect.Value ? UITextAutocorrectionType.Yes : UITextAutocorrectionType.No; } + if(view.HideCursor) + { + Control.TintColor = UIColor.Clear; + } + if(view.ReturnType.HasValue) { switch(view.ReturnType.Value)