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

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

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

            return(textField.AttributedText.GetCharacterSpacing());
        }
Ejemplo 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);
        }
Ejemplo n.º 5
0
        static void UpdateCursorStartPosition(SearchBarHandler searchBarHandler, int position)
        {
            var control  = GetNativeSearchBar(searchBarHandler);
            var editText = control.GetChildrenOfType <EditText>().FirstOrDefault();

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

            return(editText.SelectionStart);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        bool GetNativeIsItalic(SearchBarHandler searchBarHandler)
        {
            var searchView = GetNativeSearchBar(searchBarHandler);
            var editText   = searchView.GetChildrenOfType <EditText>().FirstOrDefault();

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

            return(editText.Typeface.IsItalic);
        }
Ejemplo 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);
        }
Ejemplo n.º 10
0
        double GetNativeUnscaledFontSize(SearchBarHandler searchBarHandler)
        {
            var uiSearchBar = GetNativeSearchBar(searchBarHandler);
            var textField   = uiSearchBar.FindDescendantView <UITextField>();

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

            return(textField.Font.PointSize);
        }
Ejemplo 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);
        }
Ejemplo n.º 12
0
        UITextAlignment GetNativeTextAlignment(SearchBarHandler searchBarHandler)
        {
            var uiSearchBar = GetNativeSearchBar(searchBarHandler);
            var textField   = uiSearchBar.FindDescendantView <UITextField>();

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

            return(textField.TextAlignment);
        }
Ejemplo 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);
        }
Ejemplo n.º 14
0
        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));
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 17
0
        Color GetNativeTextColor(SearchBarHandler searchBarHandler)
        {
            var uiSearchBar = GetNativeSearchBar(searchBarHandler);
            var textField   = uiSearchBar.FindDescendantView <UITextField>();

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

            return(textField.TextColor.ToColor());
        }
Ejemplo 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);
        }
Ejemplo n.º 19
0
 string GetNativePlaceholder(SearchBarHandler searchBarHandler) =>
 GetNativeSearchBar(searchBarHandler).Placeholder;
Ejemplo n.º 20
0
 string GetNativeText(SearchBarHandler searchBarHandler) =>
 GetNativeSearchBar(searchBarHandler).Text;
Ejemplo n.º 21
0
 UISearchBar GetNativeSearchBar(SearchBarHandler searchBarHandler) =>
 (UISearchBar)searchBarHandler.View;
Ejemplo n.º 22
0
 public static void MapText(SearchBarHandler handler, SearchBar searchBar)
 {
     Platform.SearchBarExtensions.UpdateText(handler.PlatformView, searchBar);
 }
Ejemplo n.º 23
0
        static int GetCursorStartPosition(SearchBarHandler searchBarHandler)
        {
            var control = searchBarHandler.QueryEditor;

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