Browse Source

AndroidTestApplication all content type text boxes

Also do not throw when input not configured
pull/5735/head
ili 5 years ago
parent
commit
c378309894
  1. 2
      src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
  2. 6
      src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
  3. 22
      src/Android/Avalonia.AndroidTestApplication/MainActivity.cs

2
src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs

@ -13,7 +13,7 @@ namespace Avalonia.Android
bool _invalidateQueued;
readonly object _lock = new object();
private readonly Handler _handler;
public InvalidationAwareSurfaceView(Context context) : base(context)
{

6
src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs

@ -197,10 +197,8 @@ namespace Avalonia.Android.Platform.SkiaPlatform
public sealed override IInputConnection OnCreateInputConnection(EditorInfo outAttrs)
{
if (_initEditorInfo == null)
throw new InvalidOperationException("Call IInitEditorInfo.InitEditorInfo first");
_initEditorInfo(outAttrs);
if (_initEditorInfo != null)
_initEditorInfo(outAttrs);
return base.OnCreateInputConnection(outAttrs);
}

22
src/Android/Avalonia.AndroidTestApplication/MainActivity.cs

@ -72,13 +72,33 @@ namespace Avalonia.AndroidTestApplication
Height = 40,
Background = Brushes.LightGreen,
Foreground = Brushes.Black
}
},
CreateTextBox(Input.TextInput.TextInputContentType.Normal),
CreateTextBox(Input.TextInput.TextInputContentType.Password),
CreateTextBox(Input.TextInput.TextInputContentType.Email),
CreateTextBox(Input.TextInput.TextInputContentType.Url),
CreateTextBox(Input.TextInput.TextInputContentType.Phone),
CreateTextBox(Input.TextInput.TextInputContentType.Number),
}
}
};
return window;
}
private static TextBox CreateTextBox(Input.TextInput.TextInputContentType contentType)
{
var textBox = new TextBox()
{
Margin = new Thickness(20, 10),
Watermark = contentType.ToString(),
BorderThickness = new Thickness(3),
FontSize = 20
};
textBox.TextInputOptionsQuery += (s, e) => { e.ContentType = contentType; };
return textBox;
}
}
}

Loading…
Cancel
Save