bool SearchView.IOnQueryTextListener.OnQueryTextSubmit(string query)
{
((ISearchBarController)Element).OnSearchButtonPressed();
- Control.ClearFocus();
+ ClearFocus(Control);
return true;
}
_inputType = InputTypes.ClassText | InputTypes.TextFlagAutoComplete | InputTypes.TextFlagNoSuggestions;
}
- searchView.ClearFocus();
+ ClearFocus(searchView);
UpdatePlaceholder();
UpdateText();
UpdateEnabled();
internal override void OnNativeFocusChanged(bool hasFocus)
{
if (hasFocus && !Element.IsEnabled)
- Control.ClearFocus();
+ ClearFocus(Control);
}
void UpdateAlignment()
SearchView control = Control;
if (!model.IsEnabled)
{
- control.ClearFocus();
+ ClearFocus(control);
// removes cursor in SearchView
control.SetInputType(InputTypes.Null);
}
control.SetInputType(_inputType);
}
+ void ClearFocus(SearchView view)
+ {
+ try
+ {
+ view.ClearFocus();
+ }
+ catch (Java.Lang.UnsupportedOperationException)
+ {
+ // silently catch these as they happen in the previewer due to some bugs in upstread android
+ }
+ }
+
void UpdateFont()
{
_editText = _editText ?? Control.GetChildrenOfType<EditText>().FirstOrDefault();