Esempio n. 1
0
        Android.Views.GravityFlags GetNativeVerticalTextAlignment(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().First();

            return(editText.Gravity);
        }
Esempio n. 2
0
        Android.Views.TextAlignment GetNativeTextAlignment(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().First();

            return(editText.TextAlignment);
        }
        double GetNativeCharacterSpacing(SearchBarHandler searchBarHandler)
        {
            var searchBar = GetNativeSearchBar(searchBarHandler);
            var textField = searchBar.FindDescendantView <UITextField>();

            return(textField.AttributedText.GetCharacterSpacing());
        }
Esempio n. 4
0
        static void UpdateCursorStartPosition(SearchBarHandler searchBarHandler, int position)
        {
            var control     = searchBarHandler.QueryEditor;
            var endPosition = control.GetPosition(control.BeginningOfDocument, position);

            control.SelectedTextRange = control.GetTextRange(endPosition, endPosition);
        }
Esempio n. 5
0
        static void UpdateCursorStartPosition(SearchBarHandler searchBarHandler, int position)
        {
            var control  = GetNativeSearchBar(searchBarHandler);
            var editText = control.GetChildrenOfType <EditText>().FirstOrDefault();

            editText.SetSelection(position);
        }
Esempio n. 6
0
        static int GetCursorStartPosition(SearchBarHandler searchBarHandler)
        {
            var control  = GetNativeSearchBar(searchBarHandler);
            var editText = control.GetChildrenOfType <EditText>().FirstOrDefault();

            return(editText.SelectionStart);
        }
        double GetNativeUnscaledFontSize(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().FirstOrDefault();

            if (editText == null)
            {
                return(-1);
            }

            return(editText.TextSize / editText.Resources.DisplayMetrics.Density);
        }
        bool GetNativeIsItalic(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().FirstOrDefault();

            if (editText == null)
            {
                return(false);
            }

            return(editText.Typeface.IsItalic);
        }
Esempio n. 9
0
        UIControlContentVerticalAlignment GetNativeVerticalTextAlignment(SearchBarHandler searchBarHandler)
        {
            var uiSearchBar = GetNativeSearchBar(searchBarHandler);
            var textField   = uiSearchBar.FindDescendantView <UITextField>();

            if (textField == null)
            {
                return(UIControlContentVerticalAlignment.Center);
            }

            return(textField.VerticalAlignment);
        }
        double GetNativeUnscaledFontSize(SearchBarHandler searchBarHandler)
        {
            var uiSearchBar = GetNativeSearchBar(searchBarHandler);
            var textField   = uiSearchBar.FindDescendantView <UITextField>();

            if (textField == null)
            {
                return(-1);
            }

            return(textField.Font.PointSize);
        }
Esempio n. 11
0
        double GetNativeCharacterSpacing(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().FirstOrDefault();

            if (editText != null)
            {
                return(editText.LetterSpacing);
            }

            return(-1);
        }
        UITextAlignment GetNativeTextAlignment(SearchBarHandler searchBarHandler)
        {
            var uiSearchBar = GetNativeSearchBar(searchBarHandler);
            var textField   = uiSearchBar.FindDescendantView <UITextField>();

            if (textField == null)
            {
                return(UITextAlignment.Left);
            }

            return(textField.TextAlignment);
        }
Esempio n. 13
0
        Android.Views.TextAlignment GetNativeTextAlignment(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().FirstOrDefault();

            if (editText == null)
            {
                return(Android.Views.TextAlignment.Inherit);
            }

            return(editText.TextAlignment);
        }
        bool GetNativeIsItalic(SearchBarHandler searchBarHandler)
        {
            var uiSearchBar = GetNativeSearchBar(searchBarHandler);
            var textField   = uiSearchBar.FindDescendantView <UITextField>();

            if (textField == null)
            {
                return(false);
            }

            return(textField.Font.FontDescriptor.SymbolicTraits.HasFlag(UIFontDescriptorSymbolicTraits.Italic));
        }
Esempio n. 15
0
        bool GetNativeIsReadOnly(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().First();

            if (editText == null)
            {
                return(false);
            }

            return(!editText.Focusable && !editText.FocusableInTouchMode);
        }
Esempio n. 16
0
        bool GetNativeIsBold(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().FirstOrDefault();

            if (editText == null)
            {
                return(false);
            }

            return(editText.Typeface.GetFontWeight() == FontWeight.Bold);
        }
        Color GetNativeTextColor(SearchBarHandler searchBarHandler)
        {
            var uiSearchBar = GetNativeSearchBar(searchBarHandler);
            var textField   = uiSearchBar.FindDescendantView <UITextField>();

            if (textField == null)
            {
                return(Colors.Transparent);
            }

            return(textField.TextColor.ToColor());
        }
Esempio n. 18
0
        Color GetNativePlaceholderColor(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().FirstOrDefault();

            if (editText != null)
            {
                int    currentHintTextColor     = editText.CurrentHintTextColor;
                AColor currentPlaceholderColorr = new AColor(currentHintTextColor);
                return(currentPlaceholderColorr.ToColor());
            }

            return(Colors.Transparent);
        }
 string GetNativePlaceholder(SearchBarHandler searchBarHandler) =>
 GetNativeSearchBar(searchBarHandler).Placeholder;
 string GetNativeText(SearchBarHandler searchBarHandler) =>
 GetNativeSearchBar(searchBarHandler).Text;
 UISearchBar GetNativeSearchBar(SearchBarHandler searchBarHandler) =>
 (UISearchBar)searchBarHandler.View;
Esempio n. 22
0
 public static void MapText(SearchBarHandler handler, SearchBar searchBar)
 {
     Platform.SearchBarExtensions.UpdateText(handler.PlatformView, searchBar);
 }
Esempio n. 23
0
        static int GetCursorStartPosition(SearchBarHandler searchBarHandler)
        {
            var control = searchBarHandler.QueryEditor;

            return((int)control.GetOffsetFromPosition(control.BeginningOfDocument, control.SelectedTextRange.Start));
        }
 SearchView GetNativeSearchBar(SearchBarHandler searchBarHandler) =>
 (SearchView)searchBarHandler.View;
Esempio n. 25
0
 Task <string> GetPlatformText(SearchBarHandler handler)
 {
     return(InvokeOnMainThreadAsync(() => GetPlatformControl(handler).Text));
 }
Esempio n. 26
0
 static void SetNativeText(SearchBarHandler searchBarHandler, string text) =>
 GetNativeSearchBar(searchBarHandler).SetQuery(text, false);
Esempio n. 27
0
 static SearchView GetNativeSearchBar(SearchBarHandler searchBarHandler) =>
 searchBarHandler.PlatformView;
Esempio n. 28
0
 static SearchView GetNativeSearchBar(SearchBarHandler searchBarHandler) =>
 searchBarHandler.NativeView;
Esempio n. 29
0
 static void SetNativeText(SearchBarHandler searchBarHandler, string text) =>
 GetNativeSearchBar(searchBarHandler).Text = text;
Esempio n. 30
0
 MauiSearchBar GetPlatformControl(SearchBarHandler handler) =>
 handler.PlatformView;