示例#1
0
            void Render(Marker marker, View view)
            {
                TextView titleUi       = view.FindViewById <TextView>(Resource.Id.title);
                TextView latitudText   = view.FindViewById <TextView>(Resource.Id.LatitudMarker);
                TextView longitudText  = view.FindViewById <TextView>(Resource.Id.LongitudMarker);
                TextView velocidadText = view.FindViewById <TextView>(Resource.Id.velocidadMarker);
                TextView tiempoText    = view.FindViewById <TextView>(Resource.Id.tiempoMarker);
                TextView direccionText = view.FindViewById <TextView>(Resource.Id.direccionMarker);
                string   title         = marker.Title;

                if (title != null)
                {
                    // Spannable string allows us to edit the formatting of the text.
                    SpannableString titleText = new SpannableString(title);
                    SpanTypes       st        = (SpanTypes)0;
                    titleText.SetSpan(new ForegroundColorSpan(Color.Red), 0, titleText.Length(), st);
                    titleUi.TextFormatted = (titleText);
                }
                else
                {
                    titleUi.Text = ("");
                }

                string snippet = marker.Snippet;

                string[] texto = snippet.Split('*');

                tiempoText.Text    = texto[0];
                latitudText.Text   = texto[1];
                longitudText.Text  = texto[2];
                velocidadText.Text = texto[3];
                direccionText.Text = texto[4];
            }
示例#2
0
            private void Render(Marker marker, View view)
            {
                String   title   = marker.Title;
                TextView titleUi = ((TextView)view.FindViewById(Resource.Id.title));

                if (title != null)
                {
                    // Spannable string allows us to edit the formatting of the text.
                    SpannableString titleText = new SpannableString(title);
                    SpanTypes       st        = (SpanTypes)0;
                    titleText.SetSpan(new ForegroundColorSpan(parent.Resources.GetColor(Resource.Color.colorAccent)), 0, titleText.Length(), st);
                    titleUi.TextFormatted = (titleText);
                }
                else
                {
                    titleUi.Text = ("");
                }

                String   snippet   = marker.Snippet;
                TextView snippetUi = ((TextView)view.FindViewById(Resource.Id.snippet));

                if (snippet != null)
                {
                    SpannableString snippetText = new SpannableString(snippet);
                    snippetUi.TextFormatted = (snippetText);
                }
                else
                {
                    snippetUi.Text = ("");
                }
            }
示例#3
0
        private void MakeLinkClickable(ISpannable strBuilder, URLSpan span)
        {
            var       start     = strBuilder.GetSpanStart(span);
            var       end       = strBuilder.GetSpanEnd(span);
            SpanTypes flags     = strBuilder.GetSpanFlags(span);
            var       clickable = new HtmlLabelClickableSpan((HtmlLabel)Element, span);

            strBuilder.SetSpan(clickable, start, end, flags);
            strBuilder.RemoveSpan(span);
        }
示例#4
0
        void SpansAppend(SpannableStringBuilder builder, string text, SpanTypes flags,
                         params Java.Lang.Object[] spans)
        {
            int start = builder.Length();

            builder.Append(text);
            int length = builder.Length();

            foreach (var span in spans)
            {
                builder.SetSpan(span, start, length, flags);
            }
        }
            void SetSpan()
            {
                var start = _builder.Length();

                _builder.Append(_text);
                var end = _builder.Length();

                if (_clickSpan != null)
                {
                    _builder.SetSpan(_clickSpan, start, end, _flag);
                    _clickSpan = null;
                }
                _flag = SpanTypes.ExclusiveExclusive;
            }
            private void Render(Marker marker, View view)
            {
                int badge;

                // Use the equals() method on a Marker to check for equals.  Do not use ==.
                if (marker.Equals(parent.mBrisbane))
                {
                    badge = Resource.Drawable.badge_qld;
                }
                else if (marker.Equals(parent.mAdelaide))
                {
                    badge = Resource.Drawable.badge_sa;
                }
                else if (marker.Equals(parent.mSydney))
                {
                    badge = Resource.Drawable.badge_nsw;
                }
                else if (marker.Equals(parent.mMelbourne))
                {
                    badge = Resource.Drawable.badge_victoria;
                }
                else if (marker.Equals(parent.mPerth))
                {
                    badge = Resource.Drawable.badge_wa;
                }
                else
                {
                    // Passing 0 to setImageResource will clear the image view.
                    badge = 0;
                }
                ((ImageView)view.FindViewById(Resource.Id.badge)).SetImageResource(badge);

                String   title   = marker.Title;
                TextView titleUi = ((TextView)view.FindViewById(Resource.Id.title));

                if (title != null)
                {
                    // Spannable string allows us to edit the formatting of the text.
                    SpannableString titleText = new SpannableString(title);
                    SpanTypes       st        = (SpanTypes)0;
                    // FIXME: this somehow rejects to compile
                    //titleText.SetSpan (new ForegroundColorSpan(Color.Red), 0, titleText.Length, st);
                    titleUi.TextFormatted = (titleText);
                }
                else
                {
                    titleUi.Text = ("");
                }

                String   snippet   = marker.Snippet;
                TextView snippetUi = ((TextView)view.FindViewById(Resource.Id.snippet));

                if (snippet != null)
                {
                    SpannableString snippetText = new SpannableString(snippet);
                    snippetText.SetSpan(new ForegroundColorSpan(Color.Magenta), 0, 10, 0);
                    snippetText.SetSpan(new ForegroundColorSpan(Color.Blue), 12, 21, 0);
                    snippetUi.TextFormatted = (snippetText);
                }
                else
                {
                    snippetUi.Text = ("");
                }
            }
示例#7
0
 public void SetFlag(SpanTypes flag)
 {
     this.flag = flag;
 }
 public Builder(string text)
 {
     _text    = text;
     _flag    = SpanTypes.ExclusiveExclusive;
     _builder = new SpannableStringBuilder();
 }
示例#9
0
        public static void Appand(SpannableStringBuilder ssb, string text, Java.Lang.Object what, SpanTypes flags)
        {
            var start = ssb.Length();

            ssb.Append(text);
            ssb.SetSpan(what, start, ssb.Length(), flags);
        }