retry focus until it works on pin lock page

This commit is contained in:
Kyle Spearrin 2017-08-29 15:25:16 -04:00
parent 9ae39f3900
commit 66996f491c

View file

@ -5,6 +5,7 @@ using Xamarin.Forms;
using XLabs.Ioc; using XLabs.Ioc;
using Bit.App.Models.Page; using Bit.App.Models.Page;
using Bit.App.Controls; using Bit.App.Controls;
using System.Threading.Tasks;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@ -79,7 +80,29 @@ namespace Bit.App.Pages
_tgr.Tapped += Tgr_Tapped; _tgr.Tapped += Tgr_Tapped;
PinControl.OnPinEntered += PinEntered; PinControl.OnPinEntered += PinEntered;
PinControl.InitEvents(); PinControl.InitEvents();
PinControl.Entry.FocusWithDelay();
if(Device.RuntimePlatform == Device.Android)
{
Task.Run(async () =>
{
for(int i = 0; i < 5; i++)
{
await Task.Delay(1000);
if(!PinControl.Entry.IsFocused)
{
Device.BeginInvokeOnMainThread(() => PinControl.Entry.Focus());
}
else
{
break;
}
}
});
}
else
{
PinControl.Entry.Focus();
}
} }
protected override void OnDisappearing() protected override void OnDisappearing()