예제 #1
0
 public override void SetText(Java.Lang.ICharSequence text, TextView.BufferType type)
 {
     base.SetText(text, type);
     if (text != null && text.Length() > 0)
     {
         SetSelection(text.Length());
     }
 }
예제 #2
0
        protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint)
        {
            FilterResults oreturn = new FilterResults();

            if (constraint == null || constraint.Length() == 0)
            {
                oreturn.Values = this.OriginalData;
                oreturn.Count  = this.OriginalData.Length;
            }
            else
            {
                SearchAdapter.SearchItem[] actualResults = new SearchAdapter.SearchItem[this.originalData.Length];
                int i = 0;
                searchList = new List <SearchAdapter.SearchItem>();
                foreach (SearchAdapter.SearchItem str in this.originalData)
                {
                    if (str.Text.ToUpperInvariant().StartsWith(constraint.ToString().ToUpperInvariant()))
                    {
                        searchList.Add(str);
                        //actualResults[i] = str;
                        i++;
                    }
                }
                oreturn.Values = actualResults;
                oreturn.Count  = actualResults.Length;
            }

            return(oreturn);
        }
        public void OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count)
        {
            if (string.IsNullOrEmpty(base.Element.Text) && s.Length() == 0)
            {
                return;
            }
            Validate(s.ToString());

            (base.Element as IElementController).SetValueFromRenderer(FloatingTextEntry.TextProperty, s.ToString());
        }
예제 #4
0
            public bool OnSendTextMessage(Java.Lang.ICharSequence input)
            {
                if (input.Length() == 0)
                {
                    return(false);
                }

                MyMessage message = new MyMessage(input.ToString(), MessageMessageType.SendText.Ordinal())
                {
                    FromUser = new DefaultUser("1", "Ironman", "R.drawable.ironman")
                };

                message.TimeString    = DateTime.Now.ToString("HH:mm");
                message.MessageStatus = CN.Jiguang.Imui.Commons.Models.MessageMessageStatus.SendGoing;
                mAdapter.AddToStart(message, true);
                return(true);
            }
예제 #5
0
        public Java.Lang.ICharSequence TerminateTokenFormatted(Java.Lang.ICharSequence text)
        {
            int i = text.Length();

            while (i > 0 && char.IsWhiteSpace(text.CharAt(i - 1)))
            {
                i--;
            }

            if (i > 0 && char.IsWhiteSpace(text.CharAt(i - 1)))
            {
                return(text);
            }
            else
            {
                return(text);
            }
        }
예제 #6
0
            private void MakeLayout(int width, int maxLines = int.MaxValue)
            {
                if (_textWrapping == TextWrapping.NoWrap)
                {
                    maxLines = 1;
                }

                if (maxLines == 1)
                {
                    _metrics = BoringLayout.IsBoring(_textFormatted, _paint, _metrics);

                    if (_metrics != null)
                    {
                        if (Layout is BoringLayout boring)
                        {
                            Layout = boring.ReplaceOrMake(
                                _textFormatted,
                                _paint,
                                width,
                                _layoutAlignment,
                                1,
                                _addedSpacing = GetSpacingAdd(_paint),
                                _metrics,
                                true,
                                _ellipsize,
                                width
                                );

                            return;
                        }
                        else
                        {
                            Layout = new BoringLayout(
                                _textFormatted,
                                _paint,
                                width,
                                _layoutAlignment,
                                1,
                                _addedSpacing = GetSpacingAdd(_paint),
                                _metrics,
                                true,
                                _ellipsize,
                                width
                                );

                            return;
                        }
                    }
                }

                if ((int)Android.OS.Build.VERSION.SdkInt < 28)
                {
                    Layout = UnoStaticLayoutBuilder.Build(
                        /*source:*/ _textFormatted,
                        /*paint: */ _paint,
                        /*outerwidth: */ width,
                        /*align: */ _layoutAlignment,
                        /*spacingmult:*/ 1,
                        /*spacingadd: */ _addedSpacing = GetSpacingAdd(_paint),
                        /*includepad:*/ true,
                        /*ellipsize: */ _ellipsize,
                        /*ellipsizedWidth: */ width,
                        /*maxLines: */ maxLines
                        );
                }
                else
                {
                    Layout = StaticLayout.Builder.Obtain(_textFormatted, 0, _textFormatted.Length(), _paint, width)
                             .SetLineSpacing(_addedSpacing = GetSpacingAdd(_paint), 1)
                             .SetMaxLines(maxLines)
                             .SetEllipsize(_ellipsize)
                             .SetEllipsizedWidth(width)
                             .SetAlignment(_layoutAlignment)
                             .SetIncludePad(true)
                             .Build();
                }
            }
예제 #7
0
 public int Length()
 {
     return(_source.Length());
 }