private async Task LoadJobsAsync(string offset) { if (MainScrollEvent.IsLoading) return; if (Methods.CheckConnectivity()) { MainScrollEvent.IsLoading = true; // api get job by page int countList = MAdapter.JobList.Count; (int apiStatus, var respond) = await RequestsAsync.Jobs.JobByPage(PageId, "10", offset); if (apiStatus != 200 || !(respond is JobByPageObject result) || result.Data == null) { MainScrollEvent.IsLoading = false; Methods.DisplayReportResult(this, respond); } else { var respondList = result.Data.Count; if (respondList > 0) { foreach (var item in from item in result.Data let check = MAdapter.JobList.FirstOrDefault(a => a.Id == item.Id) where check == null select item) { if (item.Job != null) MAdapter.JobList.Add(WoWonderTools.ListFilterJobs(item.Job.Value.JobInfoClass)); } if (countList > 0) { RunOnUiThread(() => { MAdapter.NotifyItemRangeInserted(countList, MAdapter.JobList.Count - countList); }); } else { RunOnUiThread(() => { MAdapter.NotifyDataSetChanged(); }); } } else { if (MAdapter.JobList.Count > 10 && !MRecycler.CanScrollVertically(1)) Toast.MakeText(this, GetText(Resource.String.Lbl_NoMoreJobs), ToastLength.Short)?.Show(); } } RunOnUiThread(ShowEmptyPage); } else { Inflated = EmptyStateLayout.Inflate(); EmptyStateInflater x = new EmptyStateInflater(); x.InflateLayout(Inflated, EmptyStateInflater.Type.NoConnection); if (!x.EmptyStateButton.HasOnClickListeners) { x.EmptyStateButton.Click += null!; x.EmptyStateButton.Click += EmptyStateButtonOnClick; } Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); MainScrollEvent.IsLoading = false; } }
private void BindJobPost() { try { if (DataInfoObject != null) { DataInfoObject = WoWonderTools.ListFilterJobs(DataInfoObject); TxtTitle.Text = Methods.FunString.DecodeString(DataInfoObject.Title); TxtLocation.Text = DataInfoObject.Location; //Set Description TxtDescription.Text = Methods.FunString.DecodeString(DataInfoObject.Description); TxtMinimum.Text = DataInfoObject.Minimum; TxtMaximum.Text = DataInfoObject.Maximum; //Set Salary Date SalaryDateId = DataInfoObject.SalaryDate; TxtSalaryDate.Text = DataInfoObject.SalaryDate switch { "per_hour" => GetString(Resource.String.Lbl_per_hour), "per_day" => GetString(Resource.String.Lbl_per_day), "per_week" => GetString(Resource.String.Lbl_per_week), "per_month" => GetString(Resource.String.Lbl_per_month), "per_year" => GetString(Resource.String.Lbl_per_year), _ => TxtSalaryDate.Text }; //Set job type JobTypeId = DataInfoObject.JobType; TxtJobType.Text = DataInfoObject.JobType switch { "full_time" => GetString(Resource.String.Lbl_full_time), "part_time" => GetString(Resource.String.Lbl_part_time), "internship" => GetString(Resource.String.Lbl_internship), "volunteer" => GetString(Resource.String.Lbl_volunteer), "contract" => GetString(Resource.String.Lbl_contract), _ => TxtJobType.Text }; CategoryId = DataInfoObject.Category; TxtCategory.Text = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesId == DataInfoObject.Category)?.CategoriesName; } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private async Task LoadJobsAsync(string offset) { switch (MainScrollEvent.IsLoading) { case true: return; } if (Methods.CheckConnectivity()) { MainScrollEvent.IsLoading = true; // api get job by page var countList = MAdapter.JobList.Count; var(apiStatus, respond) = await RequestsAsync.Jobs.JobByPageAsync(PageId, "10", offset); if (apiStatus != 200 || respond is not JobByPageObject result || result.Data == null) { MainScrollEvent.IsLoading = false; Methods.DisplayReportResult(this, respond); } else { var respondList = result.Data.Count; switch (respondList) { case > 0: { foreach (var item in from item in result.Data let check = MAdapter.JobList.FirstOrDefault(a => a.Id == item.Id) where check == null select item) { if (item.Job != null) { MAdapter.JobList.Add(WoWonderTools.ListFilterJobs(item.Job.Value.JobInfoClass)); } } switch (countList) { case > 0: RunOnUiThread(() => { MAdapter.NotifyItemRangeInserted(countList, MAdapter.JobList.Count - countList); }); break; default: RunOnUiThread(() => { MAdapter.NotifyDataSetChanged(); }); break; } break; } default: { switch (MAdapter.JobList.Count) { case > 10 when !MRecycler.CanScrollVertically(1): Toast.MakeText(this, GetText(Resource.String.Lbl_NoMoreJobs), ToastLength.Short)?.Show(); break; } break; } } } RunOnUiThread(ShowEmptyPage); }
private void BindJobPost() { try { if (DataInfoObject != null) { DataInfoObject = WoWonderTools.ListFilterJobs(DataInfoObject); GlideImageLoader.LoadImage(this, DataInfoObject.Page.Avatar, JobAvatar, ImageStyle.RoundedCrop, ImagePlaceholders.Drawable); var image = DataInfoObject.Image.Replace(Client.WebsiteUrl + "/", ""); if (!image.Contains("http")) { DataInfoObject.Image = Client.WebsiteUrl + "/" + image; } else { DataInfoObject.Image = image; } GlideImageLoader.LoadImage(this, DataInfoObject.Image, JobCoverImage, ImageStyle.FitCenter, ImagePlaceholders.Drawable); if (DataInfoObject.IsOwner != null && DataInfoObject.IsOwner.Value) { TxtMore.Visibility = ViewStates.Visible; JobButton.Text = GetString(Resource.String.Lbl_show_applies) + " (" + DataInfoObject.ApplyCount + ")"; JobButton.Tag = "ShowApply"; } //Set Button if its applied if (DataInfoObject.Apply == "true") { JobButton.Text = GetString(Resource.String.Lbl_already_applied); JobButton.Enabled = false; } JobTitle.Text = Methods.FunString.DecodeString(DataInfoObject.Title); if (DataInfoObject.Page != null) { PageName.Text = "@" + Methods.FunString.DecodeString(DataInfoObject.Page.PageName.Replace("@", "")); if (DataInfoObject.Page.IsPageOnwer != null && DataInfoObject.Page.IsPageOnwer.Value) { JobButton.Text = GetString(Resource.String.Lbl_show_applies) + " (" + DataInfoObject.ApplyCount + ")"; } } //Set Description var description = Methods.FunString.DecodeString(DataInfoObject.Description); Description.Text = description; ReadMoreOption.AddReadMoreTo(Description, new String(description)); //Set Salary Date string salaryDate = DataInfoObject.SalaryDate switch { "per_hour" => GetString(Resource.String.Lbl_per_hour), "per_day" => GetString(Resource.String.Lbl_per_day), "per_week" => GetString(Resource.String.Lbl_per_week), "per_month" => GetString(Resource.String.Lbl_per_month), "per_year" => GetString(Resource.String.Lbl_per_year), _ => GetString(Resource.String.Lbl_Unknown) }; MinimumNumber.Text = DataInfoObject.Minimum + " " + salaryDate; MaximumNumber.Text = DataInfoObject.Maximum + " " + salaryDate; //Set job Time var jobInfo = IonIconsFonts.Pin + " " + DataInfoObject.Location + " " + " "; jobInfo += IonIconsFonts.Time + " " + Methods.Time.TimeAgo(Convert.ToInt32(DataInfoObject.Time), false) + " " + " "; //Set job type if (DataInfoObject.JobType == "full_time") { jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_full_time); } else if (DataInfoObject.JobType == "part_time") { jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_part_time); } else if (DataInfoObject.JobType == "internship") { jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_internship); } else if (DataInfoObject.JobType == "volunteer") { jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_volunteer); } else if (DataInfoObject.JobType == "contract") { jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_contract); } else { jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_Unknown); } var categoryName = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesId == DataInfoObject.Category)?.CategoriesName; jobInfo += " " + " " + IonIconsFonts.Pricetag + " " + categoryName; var woTextDecorator = new WoTextDecorator { DecoratedContent = new SpannableString(jobInfo), Content = jobInfo }; woTextDecorator.SetTextColor(IonIconsFonts.Pin, "#ff5722"); woTextDecorator.SetTextColor(IonIconsFonts.Time, "#4caf50"); woTextDecorator.SetTextColor(IonIconsFonts.IosBriefcase, "#2196f3"); woTextDecorator.SetTextColor(IonIconsFonts.Pricetag, "#795548"); woTextDecorator.Build(JobInfo, woTextDecorator.DecoratedContent); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void BindJobPost() { try { if (DataInfoObject != null) { DataInfoObject = WoWonderTools.ListFilterJobs(DataInfoObject); TxtTitle.Text = Methods.FunString.DecodeString(DataInfoObject.Title); TxtLocation.Text = DataInfoObject.Location; //Set Description TxtDescription.Text = Methods.FunString.DecodeString(DataInfoObject.Description); TxtMinimum.Text = DataInfoObject.Minimum; TxtMaximum.Text = DataInfoObject.Maximum; //Set Salary Date SalaryDateId = DataInfoObject.SalaryDate; switch (DataInfoObject.SalaryDate) { case "per_hour": TxtSalaryDate.Text = GetString(Resource.String.Lbl_per_hour); break; case "per_day": TxtSalaryDate.Text = GetString(Resource.String.Lbl_per_day); break; case "per_week": TxtSalaryDate.Text = GetString(Resource.String.Lbl_per_week); break; case "per_month": TxtSalaryDate.Text = GetString(Resource.String.Lbl_per_month); break; case "per_year": TxtSalaryDate.Text = GetString(Resource.String.Lbl_per_year); break; } //Set job type JobTypeId = DataInfoObject.JobType; switch (DataInfoObject.JobType) { case "full_time": TxtJobType.Text = GetString(Resource.String.Lbl_full_time); break; case "part_time": TxtJobType.Text = GetString(Resource.String.Lbl_part_time); break; case "internship": TxtJobType.Text = GetString(Resource.String.Lbl_internship); break; case "volunteer": TxtJobType.Text = GetString(Resource.String.Lbl_volunteer); break; case "contract": TxtJobType.Text = GetString(Resource.String.Lbl_contract); break; } CategoryId = DataInfoObject.Category; TxtCategory.Text = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesId == DataInfoObject.Category)?.CategoriesName; } } catch (Exception e) { Console.WriteLine(e); } }