protected override void OnCreate(Bundle savedInstanceState) { Logger.LogInfo(nameof(About), nameof(OnCreate), " called"); Logger.LogInfo(nameof(About), nameof(OnCreate), " Intent is: " + Intent.ToString()); try { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.About); var tv = FindViewById <TextView>(Resource.Id.info_text); tv.SetText(Constants.AppInfo, TextView.BufferType.Normal); Linkify.AddLinks(tv, MatchOptions.All); _Back = FindViewById <Button>(Resource.Id.GoBack); _Back.RequestFocus(); } catch (Java.Lang.Exception ex) { Logger.LogError(ex); } }
protected override void OnElementChanged(ElementChangedEventArgs <CoreTextArea> e) { base.OnElementChanged(e); if (e.NewElement != null) { parent = e.NewElement; } if (txtView == null) { txtView = new TextView(CrossCurrentActivity.Current.Activity); txtView.Text = e.NewElement.Text; var textColor = Graphics.Color.Black; if (((int)parent.TextColor.R) != -1) { textColor = e.NewElement.TextColor.ToAndroid(); } if (parent.LinksEnabled) { Linkify.AddLinks(txtView, MatchOptions.All); } txtView.SetTextSize(Util.ComplexUnitType.Sp, (float)parent.FontSize); txtView.SetTextColor(textColor); SetNativeControl(txtView); } }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); Control.AutoLinkMask = MatchOptions.WebUrls; Control.SetTextColor(Android.Graphics.Color.Blue); Linkify.AddLinks(Control, MatchOptions.WebUrls); }
private void ClickOnLinks(ElementChangedEventArgs <Label> e) // CakeSoft fixed bug SB-17 { if (e.OldElement == null) { var nativeEditText = (global::Android.Widget.TextView)Control; Linkify.AddLinks(nativeEditText, MatchOptions.WebUrls); } }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.Clear: var progressDialog = ProgressDialog.Show(this, Resources.GetString( Resource.String.ClearSessionProgressTitle), Resources.GetString(Resource.String.ClearSessionProgressText), true); Runner.Instance.ClearSession(() => RunOnUiThread(() => { _results.Clear(); _adapter.NotifyDataSetChanged(); progressDialog.Dismiss(); })); return(true); case Resource.Id.Namespaces: StartActivity(typeof(UpdateNamespacesActivity)); return(true); case Resource.Id.Variables: showVariables(); return(true); case Resource.Id.Settings: StartActivity(typeof(SettingsActivity)); return(true); case Resource.Id.About: var packageInfo = PackageManager.GetPackageInfo(PackageName, 0); var aboutContent = new SpannableString(string.Format(Resources.GetString(Resource.String.AboutContent), packageInfo.VersionName)); Linkify.AddLinks(aboutContent, MatchOptions.All); var dialog = new AlertDialog.Builder(this) .SetTitle(Resource.String.AboutTitle) .SetMessage(aboutContent) .SetPositiveButton(Resource.String.AboutOkButton, delegate { }) .Show(); ((TextView)dialog.FindViewById(AndroidCore.Resource.Id.Message)).MovementMethod = LinkMovementMethod.Instance; return(true); } return(base.OnOptionsItemSelected(item)); }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); var element = Element as LinkLabel; Linkify.AddLinks(this.Control, MatchOptions.WebUrls); this.Control.SetLinkTextColor(element.LinkTextColor.ToAndroid()); }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); if (e.OldElement == null) { var nativeEditText = Control; Linkify.AddLinks(nativeEditText, MatchOptions.WebUrls); } }
/// <summary> /// Called when [element changed]. /// </summary> /// <param name="e">The e.</param> protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); if (e.OldElement == null) { var nativeEditText = (global::Android.Widget.TextView)Control; Linkify.AddLinks(nativeEditText, MatchOptions.All); } }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); var text = Control.Text; string partOne = "", partTwo = "", linkText = "", linkUrl = ""; var isLinkPresent = false; if (text.Contains("$$")) { if (text.EndsWith("$$")) { text += "."; } var splits = text.Split(new string[1] { "$$" }, StringSplitOptions.None); if (splits.Length == 3) { partOne = splits[0]; var linkSplit = splits[1].Split('|'); if (linkSplit.Length == 2) { linkText = linkSplit[0]; linkUrl = linkSplit[1]; isLinkPresent = true; } partTwo = splits[2]; } } //var url = App.CurrentNews.LinkUrl; //var link = App.CurrentNews.LinkText; //partOne = App.CurrentNews.NewsDetailsPartOne; //partTwo = App.CurrentNews.NewsDetailsPartTwo; if (isLinkPresent) { var finalText = String.Format("<a href=\"{0}\">{1}</a>", linkUrl, linkText); var finalString = String.Concat(partOne, finalText, partTwo); Control.Text = finalString; var text1 = Html.FromHtml(finalString); //Control.AutoLinkMask = MatchOptions.All; Control.LinksClickable = true; Control.SetText(text1, TextView.BufferType.Spannable); Control.MovementMethod = LinkMovementMethod.Instance; //var converted = Linkify.AddLinks(Control, MatchOptions.WebUrls); } else { var converted = Linkify.AddLinks(Control, MatchOptions.WebUrls); } }
public void showPLaceInfo(int position) { if (_leyendaShowed) { showLeyenda(); } header.RemoveView(_leyendaMap); _mainLayout.AddView(scrollPlaces); titulo_header.Text = _currentPlaces [position].titulo; scrollPlaces.SetBackgroundColor(Color.White); placeInfoOpen = true; placesInfoLayout.RemoveAllViews(); int space = Configuration.getWidth(15); var extraInfo = _placesData [position].placeExtraInfo; for (int i = 0; i < extraInfo.Count; i++) { bool flagSpace = false; String url = extraInfo [i].url; if (extraInfo [i].detalle != null) { TextView detalle = new TextView(context); detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32)); detalle.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf"); detalle.Text = extraInfo [i].detalle; Linkify.AddLinks(detalle, MatchOptions.All); //HUILLCA placesInfoLayout.AddView(detalle); flagSpace = true; } if (url != null) { ImageView image = new ImageView(context); Picasso.With(context).Load(url).Placeholder(context.Resources.GetDrawable(Resource.Drawable.progress_animation)).Resize(Configuration.getWidth(640), Configuration.getHeight(640)).CenterInside().Into(image); placesInfoLayout.AddView(image); if (flagSpace) { image.SetPadding(0, space, 0, space); } } } placesInfoLayout.SetBackgroundColor(Color.White); }
public void ShowAboutInfo(string message) { var spannable = new SpannableString(message); Linkify.AddLinks(spannable, MatchOptions.All); var alertBox = new AlertDialog.Builder(this) .SetNeutralButton("Ok", (x, y) => { }) .SetMessage(spannable) .SetTitle("About Mono Stock Portfolio") .Create(); alertBox.Show(); ((TextView)alertBox.FindViewById(Android.Resource.Id.Message)).MovementMethod = LinkMovementMethod.Instance; }
private void SetText() { if (Element is HyperlinkLabel hyperlinkLabelElement && hyperlinkLabelElement != null) { string text = hyperlinkLabelElement.GetText(out List <HyperlinkLabelLink> links); Control.Text = text; if (text != null) { foreach (var item in links) { var pattern = Pattern.Compile(item.Text); Linkify.AddLinks(Control, pattern, "", new CustomMatchFilter(item.Start), new CustomTransformFilter(item.Link)); Control.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; } } } }
public void ShowNewVersionDialog(Android.Support.V7.App.AppCompatActivity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.SetTitle(" New Version Available "); var version = activity.PackageManager.GetPackageInfo(activity.PackageName, Android.Content.PM.PackageInfoFlags.MetaData); SpannableString s = new SpannableString(String.Format("Please download the new version of this app from")); Linkify.AddLinks(s, MatchOptions.WebUrls); //builder.SetMessage(s); builder.SetCancelable(false); builder.SetPositiveButton("Download", delegate { builder.Dispose(); DownloadFile(activity); }); builder.Show(); }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); Linkify.AddLinks(Control, MatchOptions.All); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.welcome_page_five); View rootView = Window.DecorView.RootView; rootView.LayoutDirection = LayoutUtils.GetLayoutDirection(); LinearLayout headerLayout = FindViewById <LinearLayout>(Resource.Id.consent_header); TextView header = headerLayout.FindViewById <TextView>(Resource.Id.welcome_page_five_title); header.Text = ConsentViewModel.WELCOME_PAGE_CONSENT_TITLE; Button previousButton = FindViewById <Button>(Resource.Id.welcome_page_five_prev_button); previousButton.Click += new SingleClick(PreviousButtonPressed, 500).Run; previousButton.Text = WelcomeViewModel.PREVIOUS_PAGE_BUTTON_TEXT; Button nextButton = FindViewById <Button>(Resource.Id.welcome_page_five_button_next); nextButton.Click += new SingleClick(NextButtonPressed, 500).Run; nextButton.Text = WelcomeViewModel.NEXT_PAGE_BUTTON_TEXT; _switchCustom = FindViewById <SwitchCompat>(Resource.Id.welcome_page_five_switch); _switchCustom.CheckedChange += OnCheckedChange; _switchCustom.ContentDescription = ConsentViewModel.SWITCH_ACCESSIBILITY_CONSENT_SWITCH_DESCRIPTOR; _consentWarning = FindViewById <LinearLayout>(Resource.Id.welcome_page_five_consent_warning); SetConsentWarningShown(false); _consentWarningTextView = FindViewById <TextView>(Resource.Id.welcome_page_five_consent_warning_text); _consentWarningTextView.Text = ConsentViewModel.CONSENT_REQUIRED; TextView consentTextView = FindViewById <TextView>(Resource.Id.welcome_page_five_switch_text); consentTextView.Text = ConsentViewModel.GIVE_CONSENT_TEXT; consentTextView.LabelFor = _switchCustom.Id; //ABOUT _aboutHeader = FindViewById <TextView>(Resource.Id.consent1_about_header); _aboutHeader.Text = ConsentViewModel.CONSENT_ONE_TITLE; _aboutText1 = FindViewById <TextView>(Resource.Id.consent1_about_text_section1); _aboutText1.Text = ConsentViewModel.CONSENT_ONE_PARAGRAPH_SECTION_ONE; _aboutText2 = FindViewById <TextView>(Resource.Id.consent1_about_text_section2); _aboutText2.Text = ConsentViewModel.CONSENT_ONE_PARAGRAPH_SECTION_TWO; //HOW IT WORKS _howItWorksHeader = FindViewById <TextView>(Resource.Id.consent1_howitworks_header); _howItWorksHeader.Text = ConsentViewModel.CONSENT_TWO_TITLE; _howItWorksText1 = FindViewById <TextView>(Resource.Id.consent1_howitworks_text_section1); _howItWorksText1.Text = ConsentViewModel.CONSENT_TWO_PARAGRAPH_SECTION_ONE; _howItWorksText2 = FindViewById <TextView>(Resource.Id.consent1_howitworks_text_section2); _howItWorksText2.Text = ConsentViewModel.CONSENT_TWO_PARAGRAPH_SECTION_TWO; _howItWorksText3 = FindViewById <TextView>(Resource.Id.consent1_howitworks_text_section3); _howItWorksText3.Text = ConsentViewModel.CONSENT_TWO_PARAGRAPH_SECTION_THREE; //SAMTYKKE _samtykkeText1 = FindViewById <TextView>(Resource.Id.consent1_samtykke_text_section1); _samtykkeText1.Text = ConsentViewModel.CONSENT_THREE_PARAGRAPH_SECTION_ONE; _samtykkeText2 = FindViewById <TextView>(Resource.Id.consent1_samtykke_text_section2); _samtykkeText2.Text = ConsentViewModel.CONSENT_THREE_PARAGRAPH_SECTION_TWO; //BEHANDLING AF PERSONOPLYSNINGWER _processingofpersonaldataText1 = FindViewById <TextView>(Resource.Id.consent1_processingofpersonaldata_text_section1); _processingofpersonaldataText1.Text = ConsentViewModel.CONSENT_FIVE_PARAGRAPH_SECTION_ONE; _processingofpersonaldataText2 = FindViewById <TextView>(Resource.Id.consent1_processingofpersonaldata_text_section2); _processingofpersonaldataText2.Text = ConsentViewModel.CONSENT_FIVE_PARAGRAPH_SECTION_TWO; Linkify.AddLinks(_processingofpersonaldataText2, MatchOptions.EmailAddresses); _processingofpersonaldataText3 = FindViewById <TextView>(Resource.Id.consent1_processingofpersonaldata_text_section3); _processingofpersonaldataText3.Text = ConsentViewModel.CONSENT_FIVE_PARAGRAPH_SECTION_THREE; //PERSONVERNERKLÆRINGEN LINK _policyLinkText = 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 = FindViewById <TextView>(Resource.Id.consent1_samtykkebottom_header); _samtykkebottomHeader.Text = ConsentViewModel.CONSENT_SIX_TITLE; _samtykkebottomText = FindViewById <TextView>(Resource.Id.consent1_samtykkebottom_text); _samtykkebottomText.Text = ConsentViewModel.CONSENT_SIX_PARAGRAPH; RelativeLayout RelativeLayout4 = 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); // 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(); HeadingAccessibilityDelegate headingAccessibilityDelegate = AccessibilityUtils.GetHeadingAccessibilityDelegate(); header.SetAccessibilityDelegate(headingAccessibilityDelegate); _aboutHeader.SetAccessibilityDelegate(headingAccessibilityDelegate); _howItWorksHeader.SetAccessibilityDelegate(headingAccessibilityDelegate); _samtykkebottomHeader.SetAccessibilityDelegate(headingAccessibilityDelegate); }
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 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); if (indexCurso == 0) //Para que solo afecte a las Rutas { linearUnidad.SetPadding(Configuration.getWidth(100), Configuration.getWidth(25), 0, Configuration.getWidth(-25)); } 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); //Huillca if (indexCurso == 1 && indexUnidad != 6) //Para que no afecte a las Rutas ni a los precios //Linkify.AddLinks(descriptionUnidad,Patterns.Phone,"tel:"); //(084) 21-1122 --------modelo de telefono //984-820715 ----modelo celular { Linkify.AddLinks(descriptionUnidad, Java.Util.Regex.Pattern.Compile("\\W\\d+\\W\\s\\d+\\W\\d+"), "tel:"); Linkify.AddLinks(descriptionUnidad, Java.Util.Regex.Pattern.Compile("\\d+\\W\\d+"), "tel:"); Linkify.AddLinks(descriptionUnidad, Patterns.EmailAddress, "email:"); Linkify.AddLinks(descriptionUnidad, Patterns.WebUrl, "http://"); } //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 == 0) { 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); if (indexUnidad == 2 && i > 1) { } else { LinearLayout test = new LinearLayout(context); //test.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); test.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(100)); test.SetGravity(Android.Views.GravityFlags.Center); test.Tag = i; test.SetX(Configuration.getWidth(0)); test.SetY(Configuration.getWidth(-40)); //test.SetPadding (Configuration.getWidth(30), Configuration.getWidth (25), Configuration.getWidth(30), Configuration.getWidth (25)); test.SetGravity(GravityFlags.Left | GravityFlags.Center); TextView verMapa = new TextView(context); verMapa.Text = Resources.GetText(Resource.String.See_maps_and_photos); verMapa.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf"); verMapa.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(35)); verMapa.SetTextColor(Color.ParseColor(Configuration.ListaColores [i % 6])); test.AddView(verMapa); linearUnidad.AddView(test); _listIconVerMap.Add(test); } } 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; _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 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); }
// @BindingAdapter("sessionTimeRange") // public static void setSessionTimeRange(TextView textView, @NonNull Session session) { // String timeRange = textView.getContext().getString(R.string.session_time_range, // DateUtil.getHourMinute(session.stime), // DateUtil.getHourMinute(session.etime), // DateUtil.getMinutes(session.stime, session.etime)); // textView.setText(timeRange); // } // // @BindingAdapter("sessionDetailTimeRange") // public static void setSessionDetailTimeRange(TextView textView, @NonNull Session session) { // String timeRange = textView.getContext().getString(R.string.session_time_range, // DateUtil.getLongFormatDate(session.stime, textView.getContext()), // DateUtil.getHourMinute(session.etime), // DateUtil.getMinutes(session.stime, session.etime)); // textView.setText(timeRange); // } // //@BindingAdapter("sessionDescription") public static void SetSessionDescription(this TextView textView, Session session) { textView.Text = session.description; Linkify.AddLinks(textView, MatchOptions.All); }
private void ParseAndDisplay(JsonValue json) { var notFound = "not found"; //TextView logo = FindViewById<TextView>(Resource.Id.logoText); //ImageView logo = FindViewById<ImageView>(Resource.Id.logoImageView); WebView logo = FindViewById <WebView>(Resource.Id.logoWebView); TextView website = FindViewById <TextView>(Resource.Id.websiteText); TextView organizationName = FindViewById <TextView>(Resource.Id.nameText); TextView onLine = FindViewById <TextView>(Resource.Id.onLineText); TextView numEmploy = FindViewById <TextView>(Resource.Id.numEmpText); TextView founded = FindViewById <TextView>(Resource.Id.foundedText); TextView overview = FindViewById <TextView>(Resource.Id.overviewText); TextView email1Label = FindViewById <TextView>(Resource.Id.email1Label); TextView email2Label = FindViewById <TextView>(Resource.Id.email2Label); TextView email1 = FindViewById <TextView>(Resource.Id.email1Text); TextView email2 = FindViewById <TextView>(Resource.Id.email2Text); TextView phone1 = FindViewById <TextView>(Resource.Id.phone1Text); TextView phone2 = FindViewById <TextView>(Resource.Id.phone2Text); TextView phone1Label = FindViewById <TextView>(Resource.Id.phone1Label); TextView phone2Label = FindViewById <TextView>(Resource.Id.phone2Label); TextView organazation = FindViewById <TextView>(Resource.Id.nameText); // TextView address1Line1 = FindViewById<TextView>(Resource.Id.addressText); TextView link1 = FindViewById <TextView>(Resource.Id.link1Text); TextView link2 = FindViewById <TextView>(Resource.Id.link2Text); TextView social1 = FindViewById <TextView>(Resource.Id.social1Text); TextView social2 = FindViewById <TextView>(Resource.Id.social2Text); JsonValue company = json; if (company.ContainsKey("logo")) { //loadImage(logo, company["logo"]); //web.LoadDataWithBaseURL(null, "<html><head></head><body><table style=\"width:100%; height:100%;\"><tr><td style=\"vertical-align:middle;\"><img src=\"" + company["logo"] + "\"></td></tr></table></body></html>", "html/css", "utf-8", null); logo.LoadUrl(company["logo"]); Color transparent = new Color(0x00000000); logo.SetBackgroundColor(transparent); logo.Visibility = ViewStates.Visible; } if (company.ContainsKey("website")) { website.Text = company["website"].ToString().Replace("\"", string.Empty); Linkify.AddLinks(website, MatchOptions.WebUrls); } else { website.Text = notFound; } onLine.Text = company.ContainsKey("onlineSince") ? company["onlineSince"].ToString().Replace("\"", string.Empty) : notFound; JsonValue organization = company.ContainsKey("organization") ? company["organization"] : null; if (organazation != null) { organizationName.Text = organization.ContainsKey("name") ? organization["name"].ToString().Replace("\"", string.Empty).Replace("\"", string.Empty) : notFound; numEmploy.Text = organization.ContainsKey("approxEmployees") ? organization["approxEmployees"].ToString().Replace("\"", string.Empty) : notFound; founded.Text = organization.ContainsKey("founded") ? organization["founded"].ToString().Replace("\"", string.Empty) : notFound; overview.Text = organization.ContainsKey("overview") ? organization["overview"].ToString().Replace("\"", string.Empty) : notFound; JsonValue contactInfo = organization["contactInfo"]; if (contactInfo.ContainsKey("emailAddresses")) { JsonValue emailAddress = contactInfo["emailAddresses"]; email1.Text = emailAddress[0].ContainsKey("value") ? emailAddress[0]["value"].ToString().Replace("\"", string.Empty) : notFound; email2.Text = emailAddress.Count > 1 && emailAddress[1].ContainsKey("value") ? emailAddress[0]["value"].ToString().Replace("\"", string.Empty): notFound; } if (contactInfo.ContainsKey("phoneNumbers")) { JsonValue phone = contactInfo["phoneNumbers"]; phone1.Text = phone[0].ContainsKey("number") ? phone[0]["number"].ToString().Replace("\"", string.Empty) : notFound; phone2.Text = phone.Count > 1 && phone[1].ContainsKey("number") ? phone[1]["number"].ToString().Replace("\"", string.Empty) : notFound; } if (organization.ContainsKey("links")) { JsonValue link = organization["links"]; if (link[0].ContainsKey("url")) { link1.Text = link[0]["url"].ToString().Replace("\"", string.Empty); Linkify.AddLinks(link1, MatchOptions.WebUrls); } else { link1.Text = notFound; } if (link.Count > 1 && link[1].ContainsKey("url")) { link2.Text = link[1]["url"].ToString().Replace("\"", string.Empty); Linkify.AddLinks(link2, MatchOptions.WebUrls); } else { link2.Text = notFound; } } if (company.ContainsKey("socialProfiles")) { JsonValue socialProfile = company["socialProfiles"]; { if (socialProfile[0].ContainsKey("url")) { social1.Text = socialProfile[0]["typeName"].ToString().Replace("\"", string.Empty) + ": " + socialProfile[0]["url"].ToString().Replace("\"", string.Empty); Linkify.AddLinks(social1, MatchOptions.WebUrls); } else { social1.Text = notFound; } if (socialProfile.Count > 1 && socialProfile[1].ContainsKey("url")) { social2.Text = socialProfile[1]["typeName"].ToString().Replace("\"", string.Empty) + ": " + socialProfile[1]["url"].ToString().Replace("\"", string.Empty); Linkify.AddLinks(social2, MatchOptions.WebUrls); } else { social2.Text = notFound; } } } //TODO: addresses if (contactInfo.ContainsKey("addresses")) { } } else { linearLayout.Visibility = ViewStates.Gone; noResults.Visibility = ViewStates.Visible; } }
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); } }