public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var v = inflater.Inflate(Resource.Layout.settings_contactus_fragment, container, false); var tvPhone = v.FindViewById <TextView>(Resource.Id.tvPhone); var tvTelSupportTime = v.FindViewById <TextView>(Resource.Id.tvTelSupportTime); var tvInternationalCall = v.FindViewById <TextView>(Resource.Id.tvInternationalCall); var tvFax = v.FindViewById <TextView>(Resource.Id.tvFax); var tvEmail = v.FindViewById <TextView>(Resource.Id.tvEmail); var tvLNCustomerRelations = v.FindViewById <TextView>(Resource.Id.tvLNCustomerRelations); var tvPost = v.FindViewById <TextView>(Resource.Id.tvPost); var tvPostToUsTitle = v.FindViewById <TextView>(Resource.Id.tvPostToUsTitle); var tvPostDx = v.FindViewById <TextView>(Resource.Id.tvPostDx); var tvSendByDXTitle = v.FindViewById <TextView>(Resource.Id.tvSendByDXTitle); var contactUs = GlobalAccess.Instance.CurrentUserInfo.Country.ContactUs; tvPhone.Text = contactUs.Phone; tvTelSupportTime.Text = contactUs.WorkingHours; tvInternationalCall.Text = contactUs.InternationalCallers; tvFax.Text = contactUs.Fax; tvEmail.Text = contactUs.Email; if (contactUs.PostToUs == null || string.IsNullOrEmpty(contactUs.PostToUs.Content)) { tvPost.Visibility = ViewStates.Gone; tvPostToUsTitle.Visibility = ViewStates.Gone; } else { if (string.IsNullOrEmpty(contactUs.PostToUs.Title)) { tvLNCustomerRelations.Visibility = ViewStates.Gone; } else { tvLNCustomerRelations.Text = contactUs.PostToUs.Title; } tvPost.Text = contactUs.PostToUs.Content; } if (string.IsNullOrEmpty(contactUs.SendByDX)) { tvPostDx.Visibility = ViewStates.Gone; tvSendByDXTitle.Visibility = ViewStates.Gone; } else { tvPostDx.Text = contactUs.SendByDX; } var ssb = new SpannableStringBuilder(tvEmail.Text); tvEmail.MovementMethod = LinkMovementMethod.Instance; Linkify.AddLinks(ssb, MatchOptions.WebUrls | MatchOptions.EmailAddresses); FixedTextUtils.RemoveLinkUnderline(ssb); tvEmail.TextFormatted = ssb; return(v); }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); Linkify.AddLinks(Control, MatchOptions.All); }
public void initUnidades(int indexCurso, int indexUnidad) { var textFormat = Android.Util.ComplexUnitType.Px; _spaceUnidades.RemoveAllViews(); _listLinearUnidades.Clear(); _listIconMap.Clear(); _listIconVerMap.Clear(); int numUnidades = _listUnidades.Count; _mainSpace.SetY(Configuration.getHeight(0)); if (isNotas) { _mainSpace.RemoveAllViews(); taskListView = new ListView(context); taskListView.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(850)); addTaskButton = new Button(context); addTaskButton.Text = "Añadir Nota"; addTaskButton.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); _mainSpace.SetY(Configuration.getHeight(20)); //addTaskButton.SetY (Configuration.getHeight (130)); //_mainLayout.AddView(addTaskButton); _mainSpace.AddView(addTaskButton); _mainSpace.AddView(taskListView); if (addTaskButton != null) { addTaskButton.Click += (sender, e) => { //layoutSave.Visibility = Android.Views.ViewStates.Visible; context.StartActivity(typeof(NotasItemScreen)); }; } // wire up task click handler if (taskListView != null) { taskListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { var taskDetails = new Intent(context, typeof(NotasItemScreen)); taskDetails.PutExtra("TaskID", tasks[e.Position].ID); context.StartActivity(taskDetails); }; } return; } for (int i = 0; i < numUnidades; i++) { LinearLayoutLO linearUnidad = new LinearLayoutLO(context); linearUnidad.content = _listUnidades[i]; linearUnidad.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearUnidad.Orientation = Orientation.Vertical; linearUnidad.SetGravity(Android.Views.GravityFlags.CenterVertical); //linearUnidad.SetBackgroundColor (Color.Blue); linearUnidad.index = i; linearUnidad.SetPadding(Configuration.getWidth(100), Configuration.getWidth(25), 0, Configuration.getWidth(25)); //linearUnidad.SetX (100); TextView titleUnidad = new TextView(context); titleUnidad.SetTextSize(textFormat, Configuration.getHeight(42)); titleUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2); /*if (indexCurso == 2) { * if (indexUnidad == 3) { * linearUnidad.Orientation = Orientation.Horizontal; * ImageIconMap icon = new ImageIconMap (context); * icon.index = i; * icon.SetImageBitmap(iconPlay); * icon.SetX (Configuration.getWidth (60)); * linearUnidad.AddView (icon); * _listIconMap.Add (icon); * } * } */ if (indexCurso == 3) { titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55)); } RelativeLayout linearContenido = new RelativeLayout(context); linearContenido.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearContenido.SetGravity(Android.Views.GravityFlags.Center); //TextView titleUnidad = new TextView(context); //titleUnidad.Text = _listUnidades [i].Title; titleUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Title); titleUnidad.SetTextColor(Color.ParseColor(Configuration.ListaColores [i % 6])); titleUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf"); TextView descriptionUnidad = new TextView(context); descriptionUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2); //descriptionUnidad.Text = _listUnidades [i].Description; descriptionUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Description); //descriptionUnidad.Text = _listUnidades [i].Description; descriptionUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf"); descriptionUnidad.SetTextSize(textFormat, Configuration.getHeight(28)); Linkify.AddLinks(descriptionUnidad, MatchOptions.All); //descriptionUnidad.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; //descriptionUnidad.LinksClickable = true; //descriptionUnidad.SetTextIsSelectable (true); LinearLayout linearContenidoIn = new LinearLayout(context); linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearContenidoIn.Orientation = Orientation.Vertical; //linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center); linearContenidoIn.AddView(titleUnidad); linearContenidoIn.AddView(descriptionUnidad); linearContenido.AddView(linearContenidoIn); /*if (indexCurso == 2) { * linearContenidoIn.RemoveView (descriptionUnidad); * ImageView imgUnidad = new ImageView (context); * Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(440),Configuration.getHeight(440)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad); * linearContenidoIn.AddView (imgUnidad); * linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center); * linearUnidad.SetPadding (0, Configuration.getWidth (25),0, Configuration.getWidth (25)); * * } */ linearUnidad.AddView(linearContenido); if (indexCurso == 3) { if (indexUnidad != 3) { ImageView info = new ImageView(context); info.Tag = i; info.SetImageBitmap(iconInfo); info.SetX(Configuration.getWidth(450)); info.SetY(Configuration.getHeight(10)); ImageView favorit_ = new ImageView(context); favorit_.Tag = i; favorit_.SetX(Configuration.getWidth(450)); favorit_.SetY(Configuration.getHeight(150)); favorit_.Click += delegate { funcFavoritos(favorit_); }; //Colocando icono de Favoritos if (!isFavoritos) { int id_auto = 0; if (isListFavorites(_listUnidades[i].Id) != -1) { favorit_.SetImageBitmap(iconFavorito); } else { favorit_.SetImageBitmap(iconFavorito_BN); } linearContenido.AddView(favorit_); } bool removido = true; if (isFavoritos) { /*_mainSpace.RemoveView(_contentScrollView_S2); * _mainSpace.RemoveView (_fondo2);*/ _mainSpace.RemoveAllViews(); favorit_.SetImageBitmap(iconFavorito); linearContenido.AddView(favorit_); _mainSpace.AddView(_spaceUnidades); removido = false; } if (removido) { try{ _mainSpace.RemoveAllViews(); _mainSpace.AddView(_fondo2); _mainSpace.AddView(_contentScrollView_S2); _mainSpace.AddView(_spaceUnidades); }catch (Exception e) { //ya existe esos hijos } } linearContenido.AddView(info); } else { titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55)); } } if (indexCurso == 1 && indexUnidad == 7) { linearContenidoIn.RemoveView(titleUnidad); linearContenidoIn.RemoveView(descriptionUnidad); //linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-2, -2); linearContenidoIn.SetX(Configuration.getWidth(0)); ImageView imgUnidad = new ImageView(context); Picasso.With(context).Load(_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(640), Configuration.getHeight(2362)).Placeholder(context.Resources.GetDrawable(Resource.Drawable.progress_animation)).CenterInside().Into(imgUnidad); linearContenidoIn.AddView(imgUnidad); linearUnidad.SetPadding(0, 0, 0, 0); linearUnidad.SetX(Configuration.getWidth(0)); } _listLinearUnidades.Add(linearUnidad); LinearLayout separationLinear = new LinearLayout(context); separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5); separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8")); separationLinear.Orientation = Orientation.Horizontal; //linearUnidad.AddView (separationLinear); _spaceUnidades.AddView(linearUnidad); _spaceUnidades.AddView(separationLinear); } }
public void initUnidades(int indexCurso, int indexUnidad) { var textFormat = Android.Util.ComplexUnitType.Px; _spaceUnidades.RemoveAllViews(); _listLinearUnidades.Clear(); _listIconMap.Clear(); _listIconVerMap.Clear(); int numUnidades = _listUnidades.Count; for (int i = 0; i < numUnidades; i++) { LinearLayoutLO linearUnidad = new LinearLayoutLO(context); linearUnidad.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearUnidad.Orientation = Orientation.Vertical; linearUnidad.SetGravity(Android.Views.GravityFlags.CenterVertical); linearUnidad.index = i; linearUnidad.SetPadding(Configuration.getWidth(100), Configuration.getWidth(25), 0, Configuration.getWidth(25)); //linearUnidad.SetX (100); TextView titleUnidad = new TextView(context); titleUnidad.SetTextSize(textFormat, Configuration.getHeight(42)); titleUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2); /*if (indexCurso == 2) { * if (indexUnidad == 3) { * linearUnidad.Orientation = Orientation.Horizontal; * ImageIconMap icon = new ImageIconMap (context); * icon.index = i; * icon.SetImageBitmap(iconPlay); * icon.SetX (Configuration.getWidth (60)); * linearUnidad.AddView (icon); * _listIconMap.Add (icon); * } * } */ if (indexCurso == 0) //3 { titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55)); } RelativeLayout linearContenido = new RelativeLayout(context); linearContenido.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearContenido.SetGravity(Android.Views.GravityFlags.Center); //TextView titleUnidad = new TextView(context); //titleUnidad.Text = _listUnidades [i].Title; titleUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Title); titleUnidad.SetTextColor(Color.ParseColor(Configuration.ListaColores [i % 6])); titleUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf"); TextView descriptionUnidad = new TextView(context); descriptionUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2); //descriptionUnidad.Text = _listUnidades [i].Description; descriptionUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Description); //descriptionUnidad.Text = _listUnidades [i].Description; descriptionUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf"); descriptionUnidad.SetTextSize(textFormat, Configuration.getHeight(28)); Linkify.AddLinks(descriptionUnidad, MatchOptions.All); //descriptionUnidad.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; //descriptionUnidad.LinksClickable = true; //descriptionUnidad.SetTextIsSelectable (true); LinearLayout linearContenidoIn = new LinearLayout(context); linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearContenidoIn.Orientation = Orientation.Vertical; //linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center); linearContenidoIn.AddView(titleUnidad); linearContenidoIn.AddView(descriptionUnidad); linearContenido.AddView(linearContenidoIn); /*if (indexCurso == 2) { * linearContenidoIn.RemoveView (descriptionUnidad); * ImageView imgUnidad = new ImageView (context); * Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(440),Configuration.getHeight(440)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad); * linearContenidoIn.AddView (imgUnidad); * linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center); * linearUnidad.SetPadding (0, Configuration.getWidth (25),0, Configuration.getWidth (25)); * * } */ linearUnidad.AddView(linearContenido); if (indexCurso == 3) { if (indexUnidad != 3) { ImageView info = new ImageView(context); info.Tag = i; info.SetImageBitmap(iconInfo); info.SetX(Configuration.getWidth(450)); info.SetY(Configuration.getHeight(10)); linearContenido.AddView(info); } else { titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55)); } } if (indexCurso == 1 && indexUnidad == 7) { linearContenidoIn.RemoveView(titleUnidad); linearContenidoIn.RemoveView(descriptionUnidad); //linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-2, -2); linearContenidoIn.SetX(Configuration.getWidth(0)); ImageView imgUnidad = new ImageView(context); Picasso.With(context).Load(_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(640), Configuration.getHeight(2362)).Placeholder(context.Resources.GetDrawable(Resource.Drawable.progress_animation)).CenterInside().Into(imgUnidad); linearContenidoIn.AddView(imgUnidad); linearUnidad.SetPadding(0, 0, 0, 0); linearUnidad.SetX(Configuration.getWidth(0)); } _listLinearUnidades.Add(linearUnidad); LinearLayout separationLinear = new LinearLayout(context); separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5); separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8")); separationLinear.Orientation = Orientation.Horizontal; //linearUnidad.AddView (separationLinear); _spaceUnidades.AddView(linearUnidad); _spaceUnidades.AddView(separationLinear); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.consent_settings_page_body, container, false); RelativeLayout RelativeLayout4 = view.FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_hvordan_accepterer); TextView contactInformation = RelativeLayout4.FindViewById <TextView>(Resource.Id.consent_page_text); contactInformation.TextAlignment = TextAlignment.ViewStart; contactInformation.TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_FOUR_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy); Linkify.AddLinks(contactInformation, MatchOptions.EmailAddresses | MatchOptions.PhoneNumbers); //ABOUT _aboutHeader = view.FindViewById <TextView>(Resource.Id.consent1_about_header); _aboutHeader.Text = ConsentViewModel.CONSENT_ONE_TITLE; _aboutText1 = view.FindViewById <TextView>(Resource.Id.consent1_about_text_section1); _aboutText1.Text = ConsentViewModel.CONSENT_ONE_PARAGRAPH_SECTION_ONE; _aboutText2 = view.FindViewById <TextView>(Resource.Id.consent1_about_text_section2); _aboutText2.Text = ConsentViewModel.CONSENT_ONE_PARAGRAPH_SECTION_TWO; //HOW IT WORKS _howitworksHeader = view.FindViewById <TextView>(Resource.Id.consent1_howitworks_header); _howitworksHeader.Text = ConsentViewModel.CONSENT_TWO_TITLE; _howitworksText1 = view.FindViewById <TextView>(Resource.Id.consent1_howitworks_text_section1); _howitworksText1.Text = ConsentViewModel.CONSENT_TWO_PARAGRAPH_SECTION_ONE; _howitworksText2 = view.FindViewById <TextView>(Resource.Id.consent1_howitworks_text_section2); _howitworksText2.Text = ConsentViewModel.CONSENT_TWO_PARAGRAPH_SECTION_TWO; _howitworksText3 = view.FindViewById <TextView>(Resource.Id.consent1_howitworks_text_section3); _howitworksText3.Text = ConsentViewModel.CONSENT_TWO_PARAGRAPH_SECTION_THREE; //SAMTYKKE _samtykkeText1 = view.FindViewById <TextView>(Resource.Id.consent1_samtykke_text_section1); _samtykkeText1.Text = ConsentViewModel.CONSENT_THREE_PARAGRAPH_SECTION_ONE; _samtykkeText2 = view.FindViewById <TextView>(Resource.Id.consent1_samtykke_text_section2); _samtykkeText2.Text = ConsentViewModel.CONSENT_THREE_PARAGRAPH_SECTION_TWO; //BEHANDLING AF PERSONOPLYSNINGWER _processingofpersonaldataText1 = view.FindViewById <TextView>(Resource.Id.consent1_processingofpersonaldata_text_section1); _processingofpersonaldataText1.Text = ConsentViewModel.CONSENT_FIVE_PARAGRAPH_SECTION_ONE; _processingofpersonaldataText2 = view.FindViewById <TextView>(Resource.Id.consent1_processingofpersonaldata_text_section2); _processingofpersonaldataText2.Text = ConsentViewModel.CONSENT_FIVE_PARAGRAPH_SECTION_TWO; Linkify.AddLinks(_processingofpersonaldataText2, MatchOptions.EmailAddresses); _processingofpersonaldataText3 = view.FindViewById <TextView>(Resource.Id.consent1_processingofpersonaldata_text_section3); _processingofpersonaldataText3.Text = ConsentViewModel.CONSENT_FIVE_PARAGRAPH_SECTION_THREE; //PERSONVERNERKLÆRINGEN LINK _policyLinkText = view.FindViewById <TextView>(Resource.Id.consent_paragraph_policy_link); _policyLinkText.TextFormatted = HtmlCompat.FromHtml($"<a href=\"{ConsentViewModel.CONSENT_SEVEN_LINK_URL}\">{ConsentViewModel.CONSENT_SEVEN_LINK_TEXT}</a>", HtmlCompat.FromHtmlModeLegacy); _policyLinkText.MovementMethod = new Android.Text.Method.LinkMovementMethod(); //SAMTYKKE, BOTTOM _samtykkebottomHeader = view.FindViewById <TextView>(Resource.Id.consent1_samtykkebottom_header); _samtykkebottomHeader.Text = ConsentViewModel.CONSENT_SIX_TITLE; _samtykkebottomText = view.FindViewById <TextView>(Resource.Id.consent1_samtykkebottom_text); _samtykkebottomText.Text = ConsentViewModel.CONSENT_SIX_PARAGRAPH; // CONTENT DESCRIPTIONS OF HEADER _aboutHeader.ContentDescription = ConsentViewModel.CONSENT_ONE_TITLE.ToLower(); _howitworksHeader.ContentDescription = ConsentViewModel.CONSENT_TWO_TITLE.ToLower(); _samtykkebottomHeader.ContentDescription = ConsentViewModel.CONSENT_SIX_TITLE.ToLower(); _aboutHeader.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate()); _howitworksHeader.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate()); _samtykkebottomHeader.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate()); return(view); }
public override View GetView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) // no view to re-use, create new { view = context.LayoutInflater.Inflate(Resource.Layout.PeopleListItem, null); } if (PeopleActivity.v [position].picture == null) //if perosn has no image display default image { view.FindViewById <ImageView> (Resource.Id.personPic).SetImageResource(Resource.Drawable.blank_person); view.FindViewById <ImageView> (Resource.Id.personPic).SetAdjustViewBounds(true); } else //displays person's image { view.FindViewById <ImageView> (Resource.Id.personPic).SetImageBitmap(PeopleActivity.v [position].picture); view.FindViewById <ImageView> (Resource.Id.personPic).SetAdjustViewBounds(true); } string homepage = PeopleActivity.v [position].homepage; if (homepage != "no homepage") //if person has a homepage make button that links to their homepage { view.FindViewById <Button> (Resource.Id.homePageButton).Enabled = true; view.FindViewById <Button> (Resource.Id.homePageButton).Visibility = ViewStates.Visible; Button b = (Button)view.FindViewById(Resource.Id.homePageButton); if (b != null) { b.Click += (Sender, e) => { var main = Android.Content.Intent.ParseUri(homepage, IntentUriType.None); context.StartActivity(main); }; } } else { view.FindViewById <Button> (Resource.Id.homePageButton).Enabled = false; view.FindViewById <Button> (Resource.Id.homePageButton).Visibility = ViewStates.Gone; } Linkify.AddLinks(view.FindViewById <TextView> (Resource.Id.phoneNo), MatchOptions.PhoneNumbers); Linkify.AddLinks(view.FindViewById <TextView> (Resource.Id.email), MatchOptions.EmailAddresses); view.FindViewById <TextView> (Resource.Id.phoneNo).Text = PeopleActivity.v [position].phoneno; view.FindViewById <TextView> (Resource.Id.email).Text = PeopleActivity.v [position].email; view.FindViewById <TextView> (Resource.Id.fullName).Text = PeopleActivity.v [position].fullname; //persons name return(view); }
public void OnGlobalLayout() { var tag = tv.Tag as ExpandableTextViewTag; if (tag == null) { throw new InvalidOperationException("Unable to handle a TextView without Tag."); } ViewTreeObserver obs = tv.ViewTreeObserver; obs.RemoveOnGlobalLayoutListener(this); if (tag.LineCount < 0) { tag.LineCount = tv.LineCount; if (tag.FormattedText == null) { var spanned = tv.TextFormatted as ISpannable; if (spanned != null) { tag.FormattedText = spanned; } if (tag.AutoLinkOptions != null) { SpannableStringBuilder ssb = tag.FormattedText == null ? new SpannableStringBuilder(tv.Text) : new SpannableStringBuilder(tag.FormattedText); Linkify.AddLinks(ssb, tag.AutoLinkOptions.AutoLinkMask); if (!tag.AutoLinkOptions.IsLinkUnderline) { FixedTextUtils.RemoveLinkUnderline(ssb); } tag.FormattedText = ssb; } } } if (tag.IsPartial) { if (tv.LineCount > tag.MaxLines) { int lineStartIndex = tv.Layout.GetLineStart(tag.MaxLines - 1); int lineEndIndex = tv.Layout.GetLineEnd(tag.MaxLines - 1); int remainLineWidth; if (tag.ViewMoreLessOptions == null) { Rect apostropheRect = new Rect(); tv.Paint.GetTextBounds(Apostrophe, 0, Apostrophe.Length, apostropheRect); remainLineWidth = tv.Width - (apostropheRect.Width() * 5 / 3) - tv.TotalPaddingLeft - tv.TotalPaddingRight; } else { Rect viewMoreRect = new Rect(); tv.Paint.GetTextBounds(tag.ViewMoreLessOptions.ViewMore, 0, tag.ViewMoreLessOptions.ViewMore.Length, viewMoreRect); Rect apostropheRect = new Rect(); tv.Paint.GetTextBounds(Apostrophe, 0, Apostrophe.Length, apostropheRect); remainLineWidth = tv.Width - (int)Math.Round(viewMoreRect.Width() * (1.0f + 3.0f / (float)(tag.ViewMoreLessOptions.ViewMore.Length)) * ViewMoreLessProportion) - apostropheRect.Width() - tv.TotalPaddingLeft - tv.TotalPaddingRight; } String test = tv.Text.Substring(lineStartIndex, lineEndIndex - lineStartIndex); int returnIndex = test.IndexOf('\r'); if (returnIndex < 0) { returnIndex = test.IndexOf('\n'); } if (returnIndex >= 0) { test = test.Substring(0, returnIndex); } Rect testRect = new Rect(); while (test.Length > 0) { tv.Paint.GetTextBounds(test, 0, test.Length, testRect); if (testRect.Width() < remainLineWidth) { break; } test = test.Substring(0, test.Length - 1); } if (tag.ViewMoreLessOptions == null) { if (tag.FormattedText == null) { tv.Text = tv.Text.Substring(0, lineStartIndex + test.Length) + Apostrophe; } else { var ssbPartial = new SpannableStringBuilder( tag.FormattedText.SubSequenceFormatted(0, lineStartIndex + test.Length)); ssbPartial.Append(Apostrophe); tv.TextFormatted = ssbPartial; } } else { if (tag.FormattedText == null) { String text = tv.Text.Substring(0, lineStartIndex + test.Length) + Apostrophe + " "; var ssb = new SpannableStringBuilder(text); ssb.Append(StyleViewMoreLess(tag)); tv.TextFormatted = ssb; } else { var ssbPartial = new SpannableStringBuilder( tag.FormattedText.SubSequenceFormatted(0, lineStartIndex + test.Length)); ssbPartial.Append(Apostrophe + " "); ssbPartial.Append(StyleViewMoreLess(tag)); tv.TextFormatted = ssbPartial; } } tv.ScrollTo(0, 0); if (tag.ClickSwitch) { tv.SetOnClickListener(this); } } else if (tag.AutoLinkOptions != null) { tv.TextFormatted = tag.FormattedText; } } else { if (tag.ViewMoreLessOptions == null) { if (tag.FormattedText == null) { tv.Text = tag.Text; } else { tv.TextFormatted = tag.FormattedText; } } else { if (tag.FormattedText == null) { String text = tag.Text + " "; var ssb = new SpannableStringBuilder(text); ssb.Append(StyleViewMoreLess(tag)); tv.TextFormatted = ssb; } else { var ssb = new SpannableStringBuilder(tag.FormattedText); ssb.Append(" "); ssb.Append(StyleViewMoreLess(tag)); tv.TextFormatted = ssb; } } tv.ScrollTo(0, 0); } if (tag.Listerner != null) { tag.Listerner.LineCountDetected(tv); } }