Ejemplo n.º 1
0
 public XTouchableSpan(SuperTextView view, StTools.XAutoLinkItem item, Color normalTextColor, Color pressedTextColor, bool isUnderLineEnabled = false)
 {
     MoreTextView       = view;
     AutoLinkItem       = item;
     NormalTextColor    = normalTextColor;
     PressedTextColor   = pressedTextColor;
     IsUnderLineEnabled = isUnderLineEnabled;
 }
Ejemplo n.º 2
0
        private List <StTools.XAutoLinkItem> MatchedRanges(ICharSequence text)
        {
            try
            {
                List <StTools.XAutoLinkItem> autoLinkItems = new List <StTools.XAutoLinkItem>();

                if (AutoLinkModes == null)
                {
                    Init(Context);
                    //throw new NullPointerException("Please add at least one mode");
                }

                foreach (StTools.XAutoLinkMode anAutoLinkMode in AutoLinkModes)
                {
                    Console.WriteLine("Run foreach MatchedRanges => 175");
                    string regex = StTools.XUtils.GetRegexByAutoLinkMode(anAutoLinkMode, CustomRegex);

                    if (regex.Length <= 0)
                    {
                        continue;
                    }

                    Pattern pattern = Pattern.Compile(regex);
                    Matcher matcher = pattern.Matcher(text);

                    if (anAutoLinkMode == StTools.XAutoLinkMode.ModePhone)
                    {
                        while (matcher.Find())
                        {
                            Console.WriteLine("Run while MatchedRanges => 186");
                            StTools.XAutoLinkItem ss = new StTools.XAutoLinkItem(matcher.Start(), matcher.End(), matcher.Group(), anAutoLinkMode, UserId);

                            if (matcher.Group().Length > MinPhoneNumberLength)
                            {
                                autoLinkItems.Add(ss);
                            }
                        }
                    }
                    else
                    {
                        while (matcher.Find())
                        {
                            Console.WriteLine("Run while MatchedRanges => 199");
                            autoLinkItems.Add(new StTools.XAutoLinkItem(matcher.Start(), matcher.End(), matcher.Group(), anAutoLinkMode, UserId));
                        }
                    }
                }

                return(autoLinkItems);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
                return(new List <StTools.XAutoLinkItem>());
            }
        }