private void Initialize(NearbyShopsAdapterViewHolder holder, NearbyShopsDataObject item) { try { switch (item.Product?.ProductClass?.Images?.Count) { case > 0 when item.Product?.ProductClass != null && item.Product.Value.ProductClass.Images[0].Image.Contains("http"): GlideImageLoader.LoadImage(ActivityContext, item.Product?.ProductClass?.Images?[0]?.Image, holder.Thumbnail, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); break; case > 0: Glide.With(ActivityContext).Load(new File(item.Product?.ProductClass?.Images?[0]?.Image)).Apply(new RequestOptions().CenterCrop().Placeholder(Resource.Drawable.ImagePlacholder).Error(Resource.Drawable.ImagePlacholder)).Into(holder.Thumbnail); break; } GlideImageLoader.LoadImage(ActivityContext, item.Product?.ProductClass?.Seller?.Avatar, holder.Userprofilepic, ImageStyle.CircleCrop, ImagePlaceholders.Color); holder.Title.Text = Methods.FunString.DecodeString(item.Product?.ProductClass?.Name); holder.UserName.Text = WoWonderTools.GetNameFinal(item.Product?.ProductClass?.Seller); holder.Time.Text = item.Product?.ProductClass?.TimeText; var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Product?.ProductClass?.Currency); Console.WriteLine(currency); holder.TxtPrice.Text = item.Product?.ProductClass?.Price + " " + currencyIcon; holder.LocationText.Text = !string.IsNullOrEmpty(item.Product?.ProductClass?.Location) ? item.Product?.ProductClass?.Location : ActivityContext.GetText(Resource.String.Lbl_Unknown); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void InitComponent() { try { ImageUser = FindViewById <ImageView>(Resource.Id.ImageUser); TxtLink = FindViewById <TextView>(Resource.Id.linkText); TxtMyAffiliates = FindViewById <TextView>(Resource.Id.myAffiliatesText); BtnShare = FindViewById <Button>(Resource.Id.cont); GlideImageLoader.LoadImage(this, UserDetails.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); TxtLink.Text = Client.WebsiteUrl + "?ref=" + UserDetails.Username; if (int.Parse(ListUtils.SettingsSiteList?.AmountPercentRef ?? "0") > 0) { TxtMyAffiliates.Text = GetString(Resource.String.Lbl_EarnUpTo) + "%" + ListUtils.SettingsSiteList?.AmountPercentRef + " " + GetString(Resource.String.Lbl_forEachUserYourReferToUs) + " !"; } else if (int.Parse(ListUtils.SettingsSiteList?.AmountRef ?? "0") > 0) { var(currency, currencyIcon) = WoWonderTools.GetCurrency(ListUtils.SettingsSiteList?.AdsCurrency); Console.WriteLine(currency); TxtMyAffiliates.Text = GetString(Resource.String.Lbl_EarnUpTo) + " " + currencyIcon + ListUtils.SettingsSiteList?.AmountRef + " " + GetString(Resource.String.Lbl_forEachUserYourReferToUs) + " !"; } } catch (Exception e) { Console.WriteLine(e); } }
private void Initialize(MarketAdapterViewHolder holder, ProductDataObject item) { try { if (item.Images?.Count > 0) { if (item.Images[0].Image.Contains("http")) { GlideImageLoader.LoadImage(ActivityContext, item.Images?[0]?.Image, holder.Thumbnail, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); } else { Glide.With(ActivityContext).Load(new File(item.Images?[0]?.Image)).Apply(new RequestOptions().CenterCrop().Placeholder(Resource.Drawable.ImagePlacholder).Error(Resource.Drawable.ImagePlacholder)).Into(holder.Thumbnail); } } GlideImageLoader.LoadImage(ActivityContext, item.Seller?.Avatar, holder.Userprofilepic, ImageStyle.CircleCrop, ImagePlaceholders.Color); holder.Title.Text = Methods.FunString.DecodeString(item.Name); holder.UserName.Text = WoWonderTools.GetNameFinal(item.Seller); holder.Time.Text = item.TimeText; var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Currency); Console.WriteLine(currency); holder.TxtPrice.Text = currencyIcon + " " + item.Price; holder.LocationText.Text = !string.IsNullOrEmpty(item.Location) ? item.Location : ActivityContext.GetText(Resource.String.Lbl_Unknown); } catch (Exception e) { Console.WriteLine(e); } }
private void InitComponent() { try { ImageUser = FindViewById <ImageView>(Resource.Id.ImageUser); TxtLink = FindViewById <TextView>(Resource.Id.linkText); TxtMyAffiliates = FindViewById <TextView>(Resource.Id.myAffiliatesText); BtnShare = FindViewById <Button>(Resource.Id.cont); GlideImageLoader.LoadImage(this, UserDetails.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); //https://demo.wowonder.com/register?ref=waelanjo TxtLink.Text = Client.WebsiteUrl + "/register?ref=" + UserDetails.Username; switch (Convert.ToInt32(ListUtils.SettingsSiteList?.AmountPercentRef ?? "0")) { case > 0: TxtMyAffiliates.Text = GetString(Resource.String.Lbl_EarnUpTo) + "%" + ListUtils.SettingsSiteList?.AmountPercentRef + " " + GetString(Resource.String.Lbl_forEachUserYourReferToUs) + " !"; break; default: var(currency, currencyIcon) = WoWonderTools.GetCurrency(ListUtils.SettingsSiteList?.AdsCurrency); Console.WriteLine(currency); TxtMyAffiliates.Text = GetString(Resource.String.Lbl_EarnUpTo) + " " + currencyIcon + ListUtils.SettingsSiteList?.AmountRef + " " + GetString(Resource.String.Lbl_forEachUserYourReferToUs) + " !"; break; } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
// Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { try { if (viewHolder is NearbyBusinessAdapterViewHolder holder) { var item = NearbyBusinessList[position]; if (item.Job?.JobInfoClass != null) { if (item.Job.Value.JobInfoClass.Image.Contains("http")) { GlideImageLoader.LoadImage(ActivityContext, item.Job.Value.JobInfoClass.Image, holder.Image, ImageStyle.FitCenter, ImagePlaceholders.Drawable); } else { File file2 = new File(item.Job.Value.JobInfoClass.Image); var photoUri = FileProvider.GetUriForFile(ActivityContext, ActivityContext.PackageName + ".fileprovider", file2); Glide.With(ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(holder.Image); } holder.Title.Text = Methods.FunString.DecodeString(item.Job.Value.JobInfoClass.Title); var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Job.Value.JobInfoClass.Currency); var categoryName = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesId == item.Job.Value.JobInfoClass.Category)?.CategoriesName; Console.WriteLine(currency); if (string.IsNullOrEmpty(categoryName)) { categoryName = Application.Context.GetText(Resource.String.Lbl_Unknown); } holder.Salary.Text = currencyIcon + " " + item.Job.Value.JobInfoClass.Minimum + " - " + currencyIcon + " " + item.Job.Value.JobInfoClass.Maximum + " . " + categoryName; holder.Description.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.Job.Value.JobInfoClass.Description), 100); if (item.Job.Value.JobInfoClass.IsOwner != null && item.Job.Value.JobInfoClass.IsOwner.Value) { holder.IconMore.Visibility = ViewStates.Visible; holder.Button.Text = ActivityContext.GetString(Resource.String.Lbl_show_applies) + " (" + item.Job.Value.JobInfoClass.ApplyCount + ")"; holder.Button.Tag = "ShowApply"; } else { holder.IconMore.Visibility = ViewStates.Gone; } //Set Button if its applied if (item.Job.Value.JobInfoClass.Apply == "true") { holder.Button.Text = ActivityContext.GetString(Resource.String.Lbl_already_applied); holder.Button.Enabled = false; } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void Get_Data_Product() { try { ProductData = JsonConvert.DeserializeObject <ProductDataObject>(Intent?.GetStringExtra("ProductView")); if (ProductData != null) { var list = ProductData.Images; foreach (var attach in list.Select(productPathImage => new Attachments { Id = Convert.ToInt32(productPathImage.Id), TypeAttachment = "", FileSimple = productPathImage.Image, FileUrl = productPathImage.Image, })) { MAdapter.Add(attach); } TxtTitle.Text = ProductData.Name; var(currency, currencyIcon) = WoWonderTools.GetCurrency(ProductData.Currency); Console.WriteLine(currency); TxtPrice.Text = ProductData.Price; TxtCurrency.Text = currencyIcon; CurrencyId = ProductData.Currency; TxtLocation.Text = ProductData.Location; TxtAbout.Text = ProductData.Description; CategoryId = ProductData.Category; TxtCategory.Text = CategoriesController.ListCategoriesProducts.FirstOrDefault(a => a.CategoriesId == ProductData.Category)?.CategoriesName; switch (ProductData.Type) { // New case "0": RbNew.Checked = true; RbUsed.Checked = false; ProductType = "0"; break; // Used default: RbNew.Checked = false; RbUsed.Checked = true; ProductType = "1"; break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { switch (TypeDialog) { case "Currency": TxtCurrency.Text = itemString.ToString(); var(currency, currencyIcon) = WoWonderTools.GetCurrency(itemId.ToString()); CurrencyId = currency; Console.WriteLine(currencyIcon); break; case "DiscountOffersAdapter": { AddDiscountId = WoWonderTools.GetAddDiscountList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString(); TxtDiscountType.Text = itemString.ToString(); switch (AddDiscountId) { case "free_shipping": MRecycler.Visibility = ViewStates.Gone; MAdapter.DiscountList.Clear(); MAdapter.NotifyDataSetChanged(); break; default: MRecycler.Visibility = ViewStates.Visible; MAdapter.DiscountList.Clear(); MAdapter.DiscountList.Add(new DiscountOffers { DiscountType = AddDiscountId, DiscountFirst = "", DiscountSec = "", DiscountThr = "", }); MAdapter.NotifyDataSetChanged(); break; } break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void PrepareProduct(PostDataObject item) { try { if (item.Product != null && item.Product.Value.ProductClass?.Seller == null) { if (item.Product.Value.ProductClass != null) { item.Product.Value.ProductClass.Seller = item.Publisher; } } if (item.Product?.ProductClass != null) { if (!string.IsNullOrEmpty(item.Product.Value.ProductClass?.Location)) { item.Product.Value.ProductClass.LocationDecodedText = item.Product.Value.ProductClass?.Location; var prepareLocation = Methods.FunString.DecodeString(Methods.FunString.SubStringCutOf(item.Product.Value.ProductClass?.Location, 100)); item.Product.Value.ProductClass.LocationDecodedText = prepareLocation; } if (!string.IsNullOrEmpty(item.Product.Value.ProductClass?.Name)) { var prepareTitle = Methods.FunString.DecodeString(Methods.FunString.SubStringCutOf(item.Product.Value.ProductClass?.Name, 100)); item.Product.Value.ProductClass.Name = prepareTitle; } if (!string.IsNullOrEmpty(item.Product.Value.ProductClass?.Description)) { var prepareDescription = Methods.FunString.DecodeString(Methods.FunString.SubStringCutOf(item.Product.Value.ProductClass?.Description, 100)); item.Product.Value.ProductClass.Description = prepareDescription; } var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Product.Value.ProductClass?.Currency); Console.WriteLine(currency); if (item.Product.Value.ProductClass != null) { item.Product.Value.ProductClass.CurrencyText = currencyIcon + " " + item.Product.Value.ProductClass?.Price; item.Product.Value.ProductClass.TypeDecodedText = MainContext.GetString(item.Product.Value.ProductClass?.Type == "0" ? Resource.String.Radio_New : Resource.String.Radio_Used); //TODO Should be array from API item.Product.Value.ProductClass.StatusDecodedText = item.Product.Value.ProductClass?.Status == "0" ? MainContext.GetString(Resource.String.Lbl_In_Stock) : " "; //TODO Should be array from API } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { if (TypeDialog == "Currency") { TxtCurrency.Text = itemString.ToString(); var(currency, currencyIcon) = WoWonderTools.GetCurrency(itemId.ToString()); CurrencyId = currency; Console.WriteLine(currencyIcon); } else if (TypeDialog == "DiscountOffersAdapter") { AddDiscountId = WoWonderTools.GetAddDiscountList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString(); TxtDiscountType.Text = itemString.ToString(); if (AddDiscountId == "free_shipping") { MRecycler.Visibility = ViewStates.Gone; MAdapter.DiscountList.Clear(); MAdapter.NotifyDataSetChanged(); } else { MRecycler.Visibility = ViewStates.Visible; MAdapter.DiscountList.Clear(); MAdapter.DiscountList.Add(new DiscountOffers() { DiscountType = AddDiscountId, DiscountFirst = "", DiscountSec = "", DiscountThr = "", }); MAdapter.NotifyDataSetChanged(); } } } catch (Exception e) { Console.WriteLine(e); } }
// Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { try { if (viewHolder is UpgradePlansViewHolder holder) { UpgradeGoProClass item = PlansList[position]; if (item != null) { if (AppSettings.SetTabDarkTheme) { holder.MainLayout.SetBackgroundResource(Resource.Drawable.ShadowLinerLayoutDark); holder.RelativeLayout.SetBackgroundResource(Resource.Drawable.price_gopro_item_style_dark); } holder.PlanImg.SetImageResource(item.ImageResource); holder.PlanImg.SetColorFilter(Color.ParseColor(item.HexColor)); var(currency, currencyIcon) = WoWonderTools.GetCurrency(ListUtils.SettingsSiteList?.Currency); Console.WriteLine(currency); if (ListUtils.SettingsSiteList != null) { holder.PriceText.Text = currencyIcon + item.PlanPrice; } else { holder.PriceText.Text = item.PlanPrice; } holder.PlanText.Text = item.PlanText; holder.PerText.Text = item.PlanTime; holder.PlanText.SetTextColor(Color.ParseColor(item.HexColor)); holder.PriceText.SetTextColor(Color.ParseColor(item.HexColor)); holder.UpgradeButton.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor(item.HexColor)); Typeface font = Typeface.CreateFromAsset(Application.Context.Resources?.Assets, "ionicons.ttf"); string name = "go_pro_array_" + item.Id; int? resourceId = ActivityContext.Resources?.GetIdentifier(name, "array", ActivityContext.ApplicationInfo.PackageName); if (resourceId == 0) { return; } string[] planArray = ActivityContext.Resources?.GetStringArray(resourceId.Value); if (planArray != null) { foreach (string options in planArray) { if (!string.IsNullOrEmpty(options)) { AppCompatTextView text = new AppCompatTextView(ActivityContext) { Text = options, TextSize = 13 }; text.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.ParseColor("#444444")); text.Gravity = GravityFlags.CenterHorizontal; text.SetTypeface(font, TypefaceStyle.Normal); WoTextDecorator.Content = options; WoTextDecorator.DecoratedContent = new Android.Text.SpannableString(options); WoTextDecorator.SetTextColor(IonIconsFonts.Checkmark, "#43a735"); WoTextDecorator.SetTextColor(IonIconsFonts.Close, "#e13c4c"); LinearLayout.LayoutParams paramsss = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);//height and width are inpixel paramsss.SetMargins(0, 30, 0, 5); text.LayoutParameters = paramsss; holder.OptionLinerLayout.AddView(text); WoTextDecorator.Build(text, WoTextDecorator.DecoratedContent); } } } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private async void TxtAddOnClick(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { if (string.IsNullOrEmpty(TxtTitle.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_name), ToastLength.Short).Show(); return; } if (string.IsNullOrEmpty(TxtPrice.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_price), ToastLength.Short).Show(); return; } if (string.IsNullOrEmpty(TxtLocation.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_select_Location), ToastLength.Short).Show(); return; } if (string.IsNullOrEmpty(TxtAbout.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_about), ToastLength.Short).Show(); return; } if (string.IsNullOrEmpty(TxtCurrency.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_Currency), ToastLength.Short).Show(); return; } var list = MAdapter.AttachmentList.Where(a => a.TypeAttachment != "Default").ToList(); if (list.Count == 0) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_select_Image), ToastLength.Short).Show(); } else { //Show a progress AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "..."); if (!string.IsNullOrEmpty(DeletedImagesIds)) { DeletedImagesIds = DeletedImagesIds.Remove(DeletedImagesIds.Length - 1, 1); } var(currency, currencyIcon) = WoWonderTools.GetCurrency(ProductData.Currency); Console.WriteLine(currency); var price = TxtPrice.Text.Replace(currencyIcon, "").Replace(" ", ""); var(apiStatus, respond) = await RequestsAsync.Market.Edit_Product(ProductData.Id, TxtTitle.Text, TxtAbout.Text, TxtLocation.Text, price, CurrencyId, CategoryId, ProductType, list, DeletedImagesIds); if (apiStatus == 200) { if (respond is MessageObject result) { Console.WriteLine(result.Message); var listImage = list.Select(productPathImage => new Images { Id = "", ProductId = ProductData.Id, Image = productPathImage.FileSimple, ImageOrg = productPathImage.FileSimple }).ToList(); //Add new item to my Event list var user = ListUtils.MyProfileList?.FirstOrDefault(); if (TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter?.MarketList != null) { var data = TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter.MarketList?.FirstOrDefault(a => a.Id == ProductData.Id); if (data != null) { data.Id = ProductData.Id; data.Name = TxtTitle.Text; data.UserId = UserDetails.UserId; data.Location = TxtLocation.Text; data.Description = TxtAbout.Text; data.Category = CategoryId; data.Images = listImage; data.Price = TxtPrice.Text; data.Type = ProductType; data.Seller = user; TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter?.NotifyItemChanged(TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.MarketList.IndexOf(data)); Intent intent = new Intent(); intent.PutExtra("itemData", JsonConvert.SerializeObject(data)); SetResult(Result.Ok, intent); } } AndHUD.Shared.ShowSuccess(this); Toast.MakeText(this, GetString(Resource.String.Lbl_ProductSuccessfullyEdited), ToastLength.Short).Show(); Finish(); } } else { Methods.DisplayReportResult(this, respond); } AndHUD.Shared.Dismiss(this); } } } catch (Exception exception) { Console.WriteLine(exception); AndHUD.Shared.Dismiss(this); } }
// Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { try { if (viewHolder is JobsAdapterViewHolder holder) { var item = JobList[position]; if (item != null) { if (item.Image.Contains("http")) { var image = item.Image.Replace(Client.WebsiteUrl + "/", ""); if (!image.Contains("http")) { item.Image = Client.WebsiteUrl + "/" + image; } else { item.Image = image; } GlideImageLoader.LoadImage(ActivityContext, item.Image, holder.Image, ImageStyle.FitCenter, ImagePlaceholders.Drawable); } else { File file2 = new File(item.Image); var photoUri = FileProvider.GetUriForFile(ActivityContext, ActivityContext.PackageName + ".fileprovider", file2); Glide.With(ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(holder.Image); } holder.Title.Text = Methods.FunString.DecodeString(item.Title); var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Currency); var categoryName = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesId == item.Category)?.CategoriesName; Console.WriteLine(currency); if (string.IsNullOrEmpty(categoryName)) { categoryName = Application.Context.GetText(Resource.String.Lbl_Unknown); } holder.Salary.Text = currencyIcon + " " + item.Minimum + " - " + currencyIcon + " " + item.Maximum + " . " + categoryName; holder.Description.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.Description), 100); if (item.IsOwner) { holder.IconMore.Visibility = ViewStates.Visible; holder.Button.Text = ActivityContext.GetString(Resource.String.Lbl_show_applies) + " (" + item.ApplyCount + ")"; holder.Button.Tag = "ShowApply"; } else { holder.IconMore.Visibility = ViewStates.Gone; } //Set Button if its applied if (item.Apply == "true") { holder.Button.Text = ActivityContext.GetString(Resource.String.Lbl_already_applied); holder.Button.Enabled = false; } if (!holder.Button.HasOnClickListeners) { holder.Button.Click += (sender, args) => { try { switch (holder.Button.Tag.ToString()) { // Open Apply Job Activity case "ShowApply": { if (item.ApplyCount == "0") { Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String.Lbl_ThereAreNoRequests), ToastLength.Short).Show(); return; } var intent = new Intent(ActivityContext, typeof(ShowApplyJobActivity)); intent.PutExtra("JobsObject", JsonConvert.SerializeObject(item)); ActivityContext.StartActivity(intent); break; } case "Apply": { var intent = new Intent(ActivityContext, typeof(ApplyJobActivity)); intent.PutExtra("JobsObject", JsonConvert.SerializeObject(item)); ActivityContext.StartActivity(intent); break; } } } catch (Exception e) { Console.WriteLine(e); } }; holder.IconMore.Click += (sender, args) => { try { DialogType = "More"; DataInfoObject = item; var arrayAdapter = new List <string>(); var dialogList = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); arrayAdapter.Add(ActivityContext.GetText(Resource.String.Lbl_Edit)); arrayAdapter.Add(ActivityContext.GetText(Resource.String.Lbl_Delete)); dialogList.Title(ActivityContext.GetText(Resource.String.Lbl_More)); dialogList.Items(arrayAdapter); dialogList.NegativeText(ActivityContext.GetText(Resource.String.Lbl_Close)).OnNegative(this); dialogList.AlwaysCallSingleChoiceCallback(); dialogList.ItemsCallback(this).Build().Show(); } catch (Exception e) { Console.WriteLine(e); } }; } } } } catch (Exception exception) { Console.WriteLine(exception); } }
private void Get_Data_Product(ProductDataObject productData) { try { ProductData = productData; PostData = new PostDataObject { PostId = productData.PostId, Product = new ProductUnion { ProductClass = productData, }, ProductId = productData.Id, UserId = productData.UserId, UserData = productData.Seller, Url = productData.Url, PostUrl = productData.Url, }; List <string> listImageUser = new List <string>(); if (productData.Images?.Count > 0) { listImageUser.AddRange(productData.Images.Select(t => t.Image)); } else { listImageUser.Add(productData.Images?[0]?.Image); } if (ViewPagerView.Adapter == null) { ViewPagerView.Adapter = new MultiImagePagerAdapter(this, listImageUser); ViewPagerView.CurrentItem = 0; CircleIndicatorView.SetViewPager(ViewPagerView); } ViewPagerView.Adapter.NotifyDataSetChanged(); GlideImageLoader.LoadImage(this, productData.Seller.Avatar, UserImageAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); var(currency, currencyIcon) = WoWonderTools.GetCurrency(productData.Currency); TxtProductPrice.Text = productData.Price + " " + currencyIcon; Console.WriteLine(currency); var readMoreOption = new StReadMoreOption.Builder() .TextLength(200, StReadMoreOption.TypeCharacter) .MoreLabel(GetText(Resource.String.Lbl_ReadMore)) .LessLabel(GetText(Resource.String.Lbl_ReadLess)) .MoreLabelColor(Color.ParseColor(AppSettings.MainColor)) .LessLabelColor(Color.ParseColor(AppSettings.MainColor)) .LabelUnderLine(true) .Build(); if (Methods.FunString.StringNullRemover(productData.Description) != "Empty") { var description = Methods.FunString.DecodeString(productData.Description); readMoreOption.AddReadMoreTo(TxtProductDescription, new String(description)); } else { TxtProductDescription.Text = GetText(Resource.String.Lbl_Empty); } TxtProductLocation.Text = Methods.FunString.DecodeString(productData.Location); TxtProductCardName.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(productData.Seller), 14); TxtProductTime.Text = productData.TimeText; if (productData.Seller.UserId == UserDetails.UserId) { BtnContact.Visibility = ViewStates.Gone; } //Type == "0" >> New // Type != "0" Used TxtProductNew.Visibility = productData.Type == "0" ? ViewStates.Visible : ViewStates.Gone; // Status InStock TxtProductInStock.Visibility = productData.Status == "0" ? ViewStates.Visible : ViewStates.Gone; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
// Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { try { if (viewHolder is NearbyBusinessAdapterViewHolder holder) { var item = NearbyBusinessList[position]; if (item.Job?.JobInfoClass != null) { if (item.Job.Value.JobInfoClass.Image.Contains("http")) { GlideImageLoader.LoadImage(ActivityContext, item.Job.Value.JobInfoClass.Image, holder.Image, ImageStyle.FitCenter, ImagePlaceholders.Drawable); } else { File file2 = new File(item.Job.Value.JobInfoClass.Image); var photoUri = FileProvider.GetUriForFile(ActivityContext, ActivityContext.PackageName + ".fileprovider", file2); Glide.With(ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(holder.Image); } holder.Title.Text = Methods.FunString.DecodeString(item.Job.Value.JobInfoClass.Title); var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Job.Value.JobInfoClass.Currency); var categoryName = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesId == item.Job.Value.JobInfoClass.Category)?.CategoriesName; Console.WriteLine(currency); if (string.IsNullOrEmpty(categoryName)) { categoryName = Application.Context.GetText(Resource.String.Lbl_Unknown); } holder.Salary.Text = currencyIcon + " " + item.Job.Value.JobInfoClass.Minimum + " - " + currencyIcon + " " + item.Job.Value.JobInfoClass.Maximum + " . " + categoryName; holder.Description.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.Job.Value.JobInfoClass.Description), 100); if (item.Job.Value.JobInfoClass.IsOwner) { holder.IconMore.Visibility = ViewStates.Visible; holder.Button.Text = ActivityContext.GetString(Resource.String.Lbl_show_applies) + " (" + item.Job.Value.JobInfoClass.ApplyCount + ")"; holder.Button.Tag = "ShowApply"; } else { holder.IconMore.Visibility = ViewStates.Gone; } //Set Button if its applied if (item.Job.Value.JobInfoClass.Apply == "true") { holder.Button.Text = ActivityContext.GetString(Resource.String.Lbl_already_applied); holder.Button.Enabled = false; } if (!holder.Button.HasOnClickListeners) { holder.Button.Click += (sender, args) => { try { switch (holder.Button.Tag.ToString()) { // Open Apply Job Activity case "ShowApply": { if (item.Job.Value.JobInfoClass.ApplyCount == "0") { Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String.Lbl_ThereAreNoRequests), ToastLength.Short).Show(); return; } var intent = new Intent(ActivityContext, typeof(ShowApplyJobActivity)); intent.PutExtra("JobsObject", JsonConvert.SerializeObject(item.Job.Value.JobInfoClass)); ActivityContext.StartActivity(intent); break; } case "Apply": { var intent = new Intent(ActivityContext, typeof(ApplyJobActivity)); intent.PutExtra("JobsObject", JsonConvert.SerializeObject(item.Job.Value.JobInfoClass)); ActivityContext.StartActivity(intent); break; } } } catch (Exception e) { Console.WriteLine(e); } }; } } } } catch (Exception exception) { Console.WriteLine(exception); } }