void GetData() { var apiTask = new ServiceApi().GetSportProfile(SportId); apiTask.HandleError(); apiTask.OnSucess(response => { profile = response.Result; //aboutController.SetView(profile); //rankingsController.SetView(profile); lblName.Text = response.Result.Name; lblTitle.Text = response.Result.Name; lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); Views.SetFollowed(btnFollow, response.Result.IsFollowing); if (!string.IsNullOrEmpty(response.Result.IconPublicUrl)) { ImageService.Instance.LoadUrl(response.Result.IconPublicUrl).Retry(3, 300).Into(imgProfile); } }); }
public void SetData(GlobalSearchItem item, UINavigationController navigationController) { this.navigationController = navigationController; model = item; if (IsNew) { btnFollow.TouchUpInside += (sender, e) => { Shared.Follower.ToggleFollow(btnFollow, model, model.Id, model.Type); }; imgProfile.UserInteractionEnabled = true; imgProfile.AddGestureRecognizer(new UITapGestureRecognizer((obj) => GoToProfile())); lblTitle.UserInteractionEnabled = true; lblTitle.AddGestureRecognizer(new UITapGestureRecognizer((obj) => GoToProfile())); IsNew = false; } lblTitle.Text = item.Title; lblSubtitle.Text = item.Subtitle; lblSubtitle.Hidden = string.IsNullOrEmpty(item.Subtitle); lblFollowers.Text = LargeValueHelper.GetString(item.Followers) + " followers"; Views.SetFollowed(btnFollow, item.IsFollowing); imageTask?.Cancel(item.ProfileUrl); if (!string.IsNullOrEmpty(item.ProfileUrl)) { imageTask = new ImageLoaderHelper(item.ProfileUrl, imgProfile, "DefaultProfile", null, new CircleTransformation()); } }
public void SetData(TeamProfile profile) { this.profile = profile; if (profile == null || lblName == null) { return; } lblName.Text = profile.SchoolName; lblPosts.Text = LargeValueHelper.GetString(profile.Posts); lblSport.Text = profile.SportName; lblRecord.Text = profile.Wins + "W " + profile.Loss + "L " + profile.Ties + "T"; lblRanking.Text = profile.Ranking; lblPosts.Text = LargeValueHelper.GetString(profile.Posts); lblFollowers.Text = LargeValueHelper.GetString(profile.Followers); if (profile.IsProfileAdmin) { btnAdmin.Text = "You are an admin of this profile"; } isFollowing = profile.IsFollowing; Views.SetFollowed(btnFollow, isFollowing); if (!string.IsNullOrEmpty(profile.ProfileUrl)) { ImageService.Instance.LoadUrl(profile.ProfileUrl).Transform(new CircleTransformation()).Retry(3, 300).Into(imgProfile); } }
public void SetData(SchoolProfile profile) { this.profile = profile; lblName.Text = profile.Name; lblPosts.Text = LargeValueHelper.GetString(profile.Posts); lblPosts.Text = LargeValueHelper.GetString(profile.Posts); lblFollowers.Text = LargeValueHelper.GetString(profile.Followers); isFollowing = profile.IsFollowing; if (profile.IsProfileAdmin) { btnAdmin.Text = "You are an admin of this profile"; } Views.SetFollowed(btnFollow, isFollowing); if (!string.IsNullOrEmpty(profile.ProfileUrl)) { ImageService.Instance.LoadUrl(profile.ProfileUrl).Transform(new CircleTransformation()).Retry(3, 300) .Into(imgProfile); } //btnAdmin.Click += (sender, args) => //{ // if (profile == null) // return; // Intent intent = new Intent(Activity, typeof(AdminInfoActivity)); // intent.PutExtra("Id", SchoolId); // intent.PutExtra("Type", (int)FeedType.School); // intent.PutExtra("IsAdmin", profile.IsProfileAdmin); // StartActivity(intent); //}; }
void GetData() { var apiTask = new ServiceApi().GetSchoolProfile(SchoolId); apiTask.HandleError(); apiTask.OnSucess(response => { profile = response.Result; aboutController.SetView(profile); //rankingsController.SetView(profile); lblName.Text = response.Result.Name; lblTitle.Text = response.Result.Name; var color = ColorHelper.GetColor(profile.PrimaryColor, btnBack.Superview.BackgroundColor); btnBack.Superview.BackgroundColor = color; btnProfile.Superview.Superview.BackgroundColor = color; lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); //btnAdmin.SetTitle("Become an Admin of this profile", UIControlState.Normal); Views.SetFollowed(btnFollow, response.Result.IsFollowing); if (!string.IsNullOrEmpty(response.Result.ProfileUrl)) { ImageService.Instance.LoadUrl(response.Result.ProfileUrl).Retry(3, 300).Into(imgProfile); } if (profile.IsProfileAdmin) { btnAdmin.SetTitle("You are an admin of this profile", UIControlState.Normal); } }); }
void GetProfileData() { var apiTask = new ServiceApi().GetMyProfileDetails(); apiTask.HandleError(this); apiTask.OnSucess(this, (response) => { lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); lblFollowing.Text = LargeValueHelper.GetString(response.Result.Following); }); }
public override void OnResume() { base.OnResume(); var apiTask = new ServiceApi().GetMyProfileDetails(); apiTask.HandleError(ActivityProgresDialog); apiTask.OnSucess(ActivityProgresDialog, (response) => { lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); lblFollowing.Text = LargeValueHelper.GetString(response.Result.Following); }); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); var apiTask = new ServiceApi().GetMyProfileDetails(); apiTask.HandleError(); apiTask.OnSucess((response) => { lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); lblFollowing.Text = LargeValueHelper.GetString(response.Result.Following); }); }
public void SetData(SportProfile profile) { this.profile = profile; lblName.Text = profile.Name; lblPosts.Text = LargeValueHelper.GetString(profile.Posts); lblPosts.Text = LargeValueHelper.GetString(profile.Posts); lblFollowers.Text = LargeValueHelper.GetString(profile.Followers); isFollowing = profile.IsFollowing; Views.SetFollowed(btnFollow, isFollowing); if (!string.IsNullOrEmpty(profile.IconPublicUrl)) { ImageService.Instance.LoadUrl(profile.IconPublicUrl).Transform(new CircleTransformation()).Retry(3, 300).Into(imgProfile); } }
void GetData() { var apiTask = new ServiceApi().GetContentSourceProfile(ContentSourceId); apiTask.HandleError(ActivityProgresDialog); apiTask.OnSucess(ActivityProgresDialog, response => { profile = response.Result; btnActionButton.Text = profile.ActionButtonText; if (!string.IsNullOrEmpty(response.Result.PrimaryColor)) { try { btnActionButton.SetTextColor(Color.ParseColor(response.Result.PrimaryColor)); } catch { } } (Activity as ContentSourceActivity)?.DataFectched(response.Result); lblName.Text = response.Result.Name; lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); try { if (!response.Result.WebsiteLink.StartsWith("http://") && !response.Result.WebsiteLink.StartsWith("https://")) { response.Result.WebsiteLink = "http://" + response.Result.WebsiteLink; } lblUrl.Text = new Uri(response.Result.WebsiteLink).Host; } catch (Exception e) { } lblDescription.Text = response.Result.Description; isFollowing = response.Result.IsFollowing; Views.SetFollowed(btnFollow, isFollowing); if (!string.IsNullOrEmpty(response.Result.ProfileUrl)) { ImageService.Instance.LoadUrl(response.Result.ProfileUrl).Transform(new CircleTransformation()).Retry(3, 300).Into(imgProfile); } }); }
void GetData() { var apiTask = new ServiceApi().GetUserProfile(UserId); apiTask.HandleError(LoadingScreen); apiTask.OnSucess(response => { profile = response.Result; lblTitle.Text = response.Result.Name; lblName.Text = response.Result.Name; lblAthlete.Superview.Hidden = true; lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); isFollowing = response.Result.IsFollowing; Views.SetFollowed(btnFollow, profile.IsFollowing); if (!string.IsNullOrEmpty(response.Result.ProfileUrl)) { ImageService.Instance.LoadUrl(response.Result.ProfileUrl).Transform(new CircleTransformation()).Retry(3, 300).Into(imgProfile); } var apiTask2 = new ServiceApi().GetUser(UserId); apiTask2.HandleError(LoadingScreen); apiTask2.OnSucess(response2 => { if (!response2.Result.AthleteVerified) { lblAthlete.Text = ""; lblAthlete.Superview.Hidden = true; } else { lblAthlete.Text = response.Result.Athlete; lblAthlete.Superview.Hidden = false; if (string.IsNullOrEmpty(lblAthlete.Text)) { lblAthlete.Superview.Hidden = true; } } }); }); }
void GetData() { var apiTask = new ServiceApi().GetContentSourceProfile(ContentSourceId); apiTask.HandleError(); apiTask.OnSucess(response => { profile = response.Result; btnSignUp.SetTitle(profile.ActionButtonText, UIControlState.Normal); var color = ColorHelper.GetColor(profile.PrimaryColor, btnBack.Superview.BackgroundColor); btnSignUp.SetTitleColor(color, UIControlState.Normal); btnBack.Superview.BackgroundColor = color; btnProfile.Superview.Superview.BackgroundColor = color; aboutController.SetView(profile); lblName.Text = response.Result.Name; lblTitle.Text = response.Result.Name; lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); try { if (!response.Result.WebsiteLink.StartsWith("http://") && !response.Result.WebsiteLink.StartsWith("https://")) { response.Result.WebsiteLink = "http://" + response.Result.WebsiteLink; } lblUrl.Text = new Uri(response.Result.WebsiteLink).Host; } catch (Exception e) { } lblDescription.Text = response.Result.Description; Views.SetFollowed(btnFollow, response.Result.IsFollowing); if (!string.IsNullOrEmpty(response.Result.ProfileUrl)) { ImageService.Instance.LoadUrl(response.Result.ProfileUrl).Transform(new CircleTransformation()).Retry(3, 300).Into(imgProfile); } }); }
void GetData() { var apiTask = new ServiceApi().GetTeamProfile(TeamId); apiTask.HandleError(); apiTask.OnSucess(response => { profile = response.Result; aboutController.SetView(profile); rankingsController.SetView(profile); lblTitle.UserInteractionEnabled = true; lblName.Text = response.Result.SchoolName; lblTitle.Text = response.Result.SchoolName; lblSport.Text = response.Result.SportName; lblBottomSport.Text = response.Result.SportName; lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); lblRecord.Text = $"{profile.Wins}W {profile.Loss}L {profile.Ties}T"; lblRanking.Text = profile.Ranking; var color = ColorHelper.GetColor(profile.PrimaryColor, btnBack.Superview.BackgroundColor); btnBack.Superview.BackgroundColor = color; btnProfile.Superview.Superview.BackgroundColor = color; //btnAdmin.SetTitle("Become an Admin of this profile", UIControlState.Normal); Views.SetFollowed(btnFollow, response.Result.IsFollowing); if (!string.IsNullOrEmpty(response.Result.ProfileUrl)) { ImageService.Instance.LoadUrl(response.Result.ProfileUrl).Retry(3, 300).Into(imgProfile); } if (profile.IsProfileAdmin) { btnAdmin.SetTitle("You are an admin of this profile", UIControlState.Normal); } }); }
void GetData() { var apiTask = new ServiceApi().GetUserProfile(userId); apiTask.HandleError(this); apiTask.OnSucess(this, response => { this.profile = response.Result; lblTitle.Text = response.Result.Name; lblName.Text = response.Result.Name; lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers); lblAthlete.Text = response.Result.Athlete; isFollowing = response.Result.IsFollowing; Views.SetFollowed(btnFollow, isFollowing); if (string.IsNullOrEmpty(lblAthlete.Text)) { lblAthlete.Visibility = ViewStates.Gone; } if (!string.IsNullOrEmpty(response.Result.ProfileUrl)) { ImageService.Instance.LoadUrl(response.Result.ProfileUrl).Transform(new CircleTransformation()).Retry(3, 300).Into(imgProfile); } var apiTask2 = new ServiceApi().GetUser(userId); apiTask2.HandleError(this); apiTask2.OnSucess(this, response2 => { if (!response2.Result.AthleteVerified) { lblAthlete.Text = ""; lblAthlete.Visibility = ViewStates.Gone; } }); }); }
void GetData() { DateTime eventDate = DateTime.Now; var apiTask = new ServiceApi().GetEventProfile(EventId); apiTask.HandleError(this); apiTask.OnSucess(this, response => { this.profile = response.Result; lblTitle.Text = response.Result.Name; lblSport.Text = response.Result.SportName; lblLocation.Text = response.Result.Location; eventDate = ConvertToUTC(response.Result.DateOfEventUtc, response.Result.TimezoneId); if (response.Result.IsTbd) { lblTime.Text = "TBD"; } else { string lang = CultureInfo.CurrentCulture.Name; var abbreviations = TZNames.GetAbbreviationsForTimeZone(response.Result.TimezoneId, lang); lblTime.Text = eventDate.ToString("h:mm tt") + " " + abbreviations.Standard; } lblDate.Text = eventDate.ToString("D"); lblName.Text = response.Result.Name; lblEventName.Text = profile.Name; if (!string.IsNullOrEmpty(profile.Team1Url)) { ImageService.Instance.LoadUrl(profile.Team1Url).Retry(3, 300).Into(imgTeam1); } if (!string.IsNullOrEmpty(profile.Team2Url)) { ImageService.Instance.LoadUrl(profile.Team2Url).Retry(3, 300).Into(imgTeam2); } lblTeam1Name.Text = profile.Team1Name; lblTeam2Name.Text = profile.Team2Name; imgRight.Enabled = true; if (string.IsNullOrEmpty(profile.TicketUrl)) { imgRight.Visibility = ViewStates.Invisible; } if (profile.DateOfEventUtc <= DateTime.UtcNow) { if (profile.TeamCount == 2) { imgRight.Visibility = ViewStates.Gone; } else { imgRight.Visibility = ViewStates.Visible; } imgRight.SetImageBitmap(null); if (!string.IsNullOrEmpty(profile.WinningTeamUrl)) { ImageService.Instance.LoadUrl(profile.WinningTeamUrl).Retry(3, 300).Into(imgRight); } imgRight.Enabled = false; } var span = new SpannableString("Show all " + profile.TeamCount + " teams"); span.SetSpan(new FanwordTypefaceSpan(CustomTypefaces.RobotoBold), 9, profile.TeamCount.ToString().Length + 15, SpanTypes.ExclusiveExclusive); btnShowTeams.TextFormatted = span; if (profile.TeamCount == 2) { llTwoTeams.Visibility = ViewStates.Visible; llManyTeams.Visibility = ViewStates.Gone; } else { llTwoTeams.Visibility = ViewStates.Gone; llManyTeams.Visibility = ViewStates.Visible; } lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblTeam1Score.Text = response.Result.Team1Score; lblTeam2Score.Text = response.Result.Team2Score; }); }
void GetData() { DateTime eventDate = DateTime.Now; var apiTask = new ServiceApi().GetEventProfile(EventId); apiTask.HandleError(); apiTask.OnSucess(response => { this.profile = response.Result; lblTitle.Text = response.Result.Name; lblSport.Text = response.Result.SportName; lblLocation.Text = response.Result.Location; eventDate = ConvertToUTC(response.Result.DateOfEventUtc, response.Result.TimezoneId); lblDate.Text = eventDate.ToString("D"); if (response.Result.IsTbd) { lblTime.Text = "TBD"; } else { string lang = CultureInfo.CurrentCulture.Name; var abbreviations = TZNames.GetAbbreviationsForTimeZone(response.Result.TimezoneId, lang); lblTime.Text = eventDate.ToString("h:mm tt") + " " + abbreviations.Standard; } lblName.Text = response.Result.Name; lblEventName.Text = profile.Name; if (!string.IsNullOrEmpty(profile.Team1Url)) { ImageService.Instance.LoadUrl(profile.Team1Url).Retry(3, 300).Into(imgTeam1); } if (!string.IsNullOrEmpty(profile.Team2Url)) { ImageService.Instance.LoadUrl(profile.Team2Url).Retry(3, 300).Into(imgTeam2); } lblTeam1Name.Text = profile.Team1Name; lblTeam2Name.Text = profile.Team2Name; imgRight.UserInteractionEnabled = true; if (string.IsNullOrEmpty(profile.TicketUrl)) { imgRight.Hidden = true; } if (profile.DateOfEventUtc <= DateTime.UtcNow) { if (profile.TeamCount == 2) { lcRightWidth.Constant = 0; } else { imgRight.Hidden = false; } imgRight.Image = null; if (!string.IsNullOrEmpty(profile.WinningTeamUrl)) { ImageService.Instance.LoadUrl(profile.WinningTeamUrl).Retry(3, 300).Into(imgRight); } imgRight.UserInteractionEnabled = false; } var boldAttributes = new UIStringAttributes(); boldAttributes.Font = UIFont.BoldSystemFontOfSize(btnShowTeams.Font.PointSize); boldAttributes.ForegroundColor = UIColor.FromRGB(144, 144, 144); var regularAttributes = new UIStringAttributes(); regularAttributes.Font = UIFont.SystemFontOfSize(btnShowTeams.Font.PointSize); regularAttributes.ForegroundColor = UIColor.FromRGB(144, 144, 144); NSMutableAttributedString attributedString = new NSMutableAttributedString("Show me all ", regularAttributes); attributedString.Append(new NSMutableAttributedString(profile.TeamCount.ToString() + " teams", boldAttributes)); btnShowTeams.SetAttributedTitle(attributedString, UIControlState.Normal); if (profile.TeamCount == 2) { vwTwoTeams.Hidden = false; vwManyTeams.Hidden = true; } else { vwTwoTeams.Hidden = true; vwManyTeams.Hidden = false; } lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts); lblTeam1Score.Text = response.Result.Team1Score; lblTeam2Score.Text = response.Result.Team2Score; }); }
View GetView(GlobalSearchItem item, int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { if (GetType(item, position) == 0) { view = LayoutInflater.Inflate(Resource.Layout.SearchHeaderItem, null); } else { view = LayoutInflater.Inflate(Resource.Layout.SearchItem, null); view.FindViewById <Button>(Resource.Id.btnFollow).Click += (sender, args) => { var model = adapter.Items[(int)view.Tag]; Fanword.Android.Shared.Follower.FollowToggle(this, sender as Button, model, model.Id, model.Type); }; view.FindViewById <TextView>(Resource.Id.lblTitle).Click += (sender, args) => { var model = adapter.Items[(int)view.Tag]; GoToProfile(model); }; view.FindViewById <ImageViewAsync>(Resource.Id.imgProfile).Click += (sender, args) => { var model = adapter.Items[(int)view.Tag]; GoToProfile(model); }; } } view.Tag = position; if (GetType(item, position) == 0) { if (!string.IsNullOrEmpty(item.Title)) { view.FindViewById <TextView>(Resource.Id.lblTitle).Text = item.Title; } else { var str = string.Concat(item.Type.ToString().Select(x => Char.IsUpper(x) ? " " + x : x.ToString())).TrimStart(' '); // Add spaces view.FindViewById <TextView>(Resource.Id.lblTitle).Text = str + "s"; } } else { view.FindViewById <TextView>(Resource.Id.lblTitle).Text = item.Title; view.FindViewById <TextView>(Resource.Id.lblSubtitle).Text = item.Subtitle; view.FindViewById <TextView>(Resource.Id.lblSubtitle).Visibility = string.IsNullOrEmpty(item.Subtitle) ? ViewStates.Gone : ViewStates.Visible; view.FindViewById <TextView>(Resource.Id.lblFollowers).Text = LargeValueHelper.GetString(item.Followers) + " followers"; var profileImageView = view.FindViewById <ImageViewAsync>(Resource.Id.imgProfile); Picasso.With(this).Load(item.ProfileUrl).Resize(100, 100).CenterCrop().OnlyScaleDown().Placeholder(Resource.Drawable.DefProfPic).Transform(new PiccasoCircleTransformation()).Into(profileImageView); /* * * profileImageView.Tag?.CancelPendingTask(item.ProfileUrl); * var task = ImageService.Instance.LoadUrl(item.ProfileUrl) * .Retry(3, 300) * .LoadingPlaceholder(Resource.Drawable.DefProfPic.ToString(), ImageSource.CompiledResource) * .DownSample(100) * .Transform(new CircleTransformation()) * .Into(profileImageView); * * profileImageView.Tag = new ImageLoaderHelper(task);*/ Views.SetFollowed(view.FindViewById <Button>(Resource.Id.btnFollow), item.IsFollowing); } return(view); }