summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs20
1 files changed, 4 insertions, 16 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs
index 48bcf576..468710ca 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs
@@ -33,7 +33,7 @@ namespace Xamarin.Forms.Platform.Android
bool SearchView.IOnQueryTextListener.OnQueryTextSubmit(string query)
{
((ISearchBarController)Element).OnSearchButtonPressed();
- ClearFocus(Control);
+ Control.ClearFocus();
return true;
}
@@ -67,7 +67,7 @@ namespace Xamarin.Forms.Platform.Android
_inputType = InputTypes.ClassText | InputTypes.TextFlagAutoComplete | InputTypes.TextFlagNoSuggestions;
}
- ClearFocus(searchView);
+ searchView.ClearFocus();
UpdatePlaceholder();
UpdateText();
UpdateEnabled();
@@ -113,7 +113,7 @@ namespace Xamarin.Forms.Platform.Android
internal override void OnNativeFocusChanged(bool hasFocus)
{
if (hasFocus && !Element.IsEnabled)
- ClearFocus(Control);
+ Control.ClearFocus();
}
void UpdateAlignment()
@@ -148,7 +148,7 @@ namespace Xamarin.Forms.Platform.Android
SearchView control = Control;
if (!model.IsEnabled)
{
- ClearFocus(control);
+ control.ClearFocus();
// removes cursor in SearchView
control.SetInputType(InputTypes.Null);
}
@@ -156,18 +156,6 @@ namespace Xamarin.Forms.Platform.Android
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();