public void RefreshParent() { ServiceWrapper svc = new ServiceWrapper(); //int wineid = Intent.GetIntExtra("WineID", 138); ItemDetailsResponse myData = svc.GetItemDetails(WineBarcode, storeid).Result; var SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; comments = new reviewAdapter(this, SkuRating.Reviews.ToList()); commentsview.Adapter = comments; comments.NotifyDataSetChanged(); }
public void RefreshParent() { Internal_ViewDidLoad(); ErrorDescription.Visibility = ViewStates.Gone; ServiceWrapper svc = new ServiceWrapper(); int wineid = Intent.GetIntExtra("WineID", 138); myData = svc.GetItemDetails(WineBarcode, storeid).Result; AvgRating.Rating = (float)myData.ItemDetails.AverageRating; // var SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; //comments = new reviewAdapter(this, SkuRating.Reviews.ToList()); // commentsview.Adapter = comments; //comments.NotifyDataSetChanged(); }
public void RefreshParent() { ServiceWrapper svc = new ServiceWrapper(); int wineid = Intent.GetIntExtra("WineID", 138); ItemDetailsResponse myData = svc.GetItemDetails(wineid).Result; var SkuRating = svc.GetItemReviewsByWineID(wineid).Result; this.Title = "Wine Details"; var commentsView = FindViewById <ListView>(Resource.Id.listView2); reviewAdapter comments = new reviewAdapter(this, SkuRating.Reviews.ToList()); commentsView.Adapter = comments; comments.NotifyDataSetChanged(); }
public void Internal_ViewDidLoad() { try { WineBarcode = Intent.GetStringExtra("WineBarcode"); storeid = Intent.GetIntExtra("storeid", 1); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); myData = new ItemDetailsResponse(); ItemReviewResponse SkuRating = new ItemReviewResponse(); this.Title = "Wine Details"; try { DownloadAsync(this, System.EventArgs.Empty, WineBarcode); myData = svc.GetItemDetails(WineBarcode, storeid).Result; SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; ReviewArray = SkuRating.Reviews.ToList(); var tempReview = SkuRating.Reviews.ToList().Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId())); if (tempReview != null) { editPopup._editObj.RatingText = tempReview.RatingText; } comments = new reviewAdapter(this, ReviewArray); if (comments.Count == 0) { ErrorDescription.Visibility = ViewStates.Visible; ErrorDescription.Text = SkuRating.ErrorDescription; ErrorDescription.SetTextColor(Android.Graphics.Color.Black); } else { commentsview.Adapter = comments; } setListViewHeightBasedOnChildren1(commentsview); WineName.Text = myData.ItemDetails.Name; WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; Vintage.Text = myData.ItemDetails.Vintage.ToString(); if (Vintage.Text == null || Vintage.Text == "0") { Vintage.Text = ""; } else { Vintage.Text = myData.ItemDetails.Vintage.ToString(); } if (myData.ItemDetails.Producer == null || myData.ItemDetails.Producer == "") { WineProducer.Text = "Not Available"; } else { WineProducer.Text = myData.ItemDetails.Producer; } if (myData.ItemDetails.Description == null || myData.ItemDetails.Description == "") { WineDescription.Text = "Not Available"; } else { WineDescription.Text = myData.ItemDetails.Description; } AvgRating.Rating = (float)myData.ItemDetails.AverageRating; //ReviewPopup editPopup = new ReviewPopup(this, edit); //RatingBar RatingInput = FindViewById<RatingBar>(Resource.Id.ratingInput);//Taking rating stars input //RatingInput.RatingBarChange += editPopup.CreatePopup; var metrics = Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage); BitmapFactory.Options options = new BitmapFactory.Options { InJustDecodeBounds = false, OutHeight = 75, OutWidth = 75 }; ProgressIndicator.Hide(); LoggingClass.LogInfo("Entered into detail view" + WineBarcode, screenid); Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AlertDialog.Builder alert = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); alert.SetTitle("Sorry"); alert.SetMessage("We're under maintainence"); alert.SetNegativeButton("Ok", delegate { }); Dialog dialog = alert.Create(); dialog.Show(); } } catch { } }
protected override void OnCreate(Bundle savedInstanceState) { CheckInternetConnection(); Stopwatch st = new Stopwatch(); st.Start(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.detailedView); WineBarcode = Intent.GetStringExtra("WineBarcode"); storeid = Intent.GetIntExtra("storeid", 1); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemDetailsResponse myData = new ItemDetailsResponse(); ItemReviewResponse SkuRating = new ItemReviewResponse(); this.Title = "Wine Details"; commentsview = FindViewById <ListView>(Resource.Id.listView2); TextView WineName = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields WineName.Focusable = false; TextView WineProducer = FindViewById <TextView>(Resource.Id.txtProducer); WineProducer.Focusable = false; TextView Vintage = FindViewById <TextView>(Resource.Id.txtVintage); Vintage.Focusable = false; TextView WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription); WineDescription.Focusable = false; RatingBar AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating); AvgRating.Focusable = false; TextView ErrorDescription = FindViewById <TextView>(Resource.Id.Error); ErrorDescription.Focusable = false; ErrorDescription.Visibility = ViewStates.Invisible; TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5); try { DownloadAsync(this, System.EventArgs.Empty, WineBarcode); myData = svc.GetItemDetails(WineBarcode, storeid).Result; SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; ReviewArray = SkuRating.Reviews.ToList(); comments = new reviewAdapter(this, ReviewArray); if (comments.Count == 0) { ErrorDescription.Text = SkuRating.ErrorDescription; ErrorDescription.Visibility = ViewStates.Visible; //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); //aler.SetTitle("No Reviews"); //aler.SetMessage("Be the first one to Review"); //aler.SetNegativeButton("Ok", delegate { }); //Dialog dialog = aler.Create(); //dialog.Show(); } else { commentsview.Adapter = comments; } setListViewHeightBasedOnChildren1(commentsview); WineName.Text = myData.ItemDetails.Name; WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; Vintage.Text = myData.ItemDetails.Vintage.ToString(); if (myData.ItemDetails.Producer == null || myData.ItemDetails.Producer == "") { WineProducer.Text = "Not Available"; } else { WineProducer.Text = myData.ItemDetails.Producer; } if (myData.ItemDetails.Description == null || myData.ItemDetails.Description == "") { WineDescription.Text = "Not Available"; } else { WineDescription.Text = myData.ItemDetails.Description; } AvgRating.Rating = (float)myData.ItemDetails.AverageRating; Review edit = new Review() { Barcode = WineBarcode, RatingText = "", PlantFinal = storeid.ToString() }; var tempReview = ReviewArray.Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId())); if (tempReview != null) { edit.RatingText = tempReview.RatingText; } ReviewPopup editPopup = new ReviewPopup(this, edit); RatingBar RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput); //Taking rating stars input RatingInput.RatingBarChange += editPopup.CreatePopup; var metrics = Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage); BitmapFactory.Options options = new BitmapFactory.Options { InJustDecodeBounds = false, OutHeight = 75, OutWidth = 75 }; ProgressIndicator.Hide(); LoggingClass.LogInfo("Entered into detail view" + WineBarcode, screenid); Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Sorry"); alert.SetMessage("We're under maintainence"); alert.SetNegativeButton("Ok", delegate { }); Dialog dialog = alert.Create(); dialog.Show(); } //downloadButton = FindViewById<Button>(Resource.Id.Download); //try //{ // //downloadButton.Enabled = true; // downloadButton.Click += downloadAsync; // //downloadButton.Enabled = false; //} //catch (Exception e) { } st.Stop(); LoggingClass.LogTime("Detail activity", st.Elapsed.TotalSeconds.ToString()); TokenModel devInfo = new TokenModel(); var activityManager = (ActivityManager)this.GetSystemService(Context.ActivityService); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memInfo); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Avail {0} - {1} MB", memInfo.AvailMem, memInfo.AvailMem / 1024 / 1024); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Low {0}", memInfo.LowMemory); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Total {0} - {1} MB", memInfo.TotalMem, memInfo.TotalMem / 1024 / 1024); devInfo.AvailableMainMemory = memInfo.AvailMem; devInfo.IsLowMainMemory = memInfo.LowMemory; devInfo.TotalMainMemory = memInfo.TotalMem; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.detailedView); wineid = Intent.GetIntExtra("WineID", 123); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemDetailsResponse myData = new ItemDetailsResponse(); ItemReviewResponse SkuRating = new ItemReviewResponse(); this.Title = "Wine Details"; var commentsView = FindViewById <ListView>(Resource.Id.listView2); TextView WineName = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields WineName.Focusable = false; TextView WineProducer = FindViewById <TextView>(Resource.Id.txtProducer); WineProducer.Focusable = false; TextView Vintage = FindViewById <TextView>(Resource.Id.txtVintage); Vintage.Focusable = false; TextView WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription); WineDescription.Focusable = false; RatingBar AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating); AvgRating.Focusable = false; TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5); try { downloadAsync(this, System.EventArgs.Empty, wineid); myData = svc.GetItemDetails(wineid).Result; SkuRating = svc.GetItemReviewsByWineID(wineid).Result; reviewAdapter comments = new reviewAdapter(this, SkuRating.Reviews.ToList()); commentsView.Adapter = comments; setListViewHeightBasedOnChildren1(commentsView); WineName.Text = myData.ItemDetails.Name; WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; Vintage.Text = myData.ItemDetails.Vintage.ToString(); WineProducer.Text = myData.ItemDetails.Producer; WineDescription.Text = myData.ItemDetails.Description; AvgRating.Rating = (float)myData.ItemDetails.AverageRating; Review edit = new Review(); edit.WineId = wineid; ReviewPopup editPopup = new ReviewPopup(this, edit); RatingBar RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput);//Taking rating stars input RatingInput.RatingBarChange += editPopup.CreatePopup; var metrics = Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); //imgWine = FindViewById<ImageView>(Resource.Id.imgWine12); HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage); //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); //string path = pppd.CreateDirectoryForPictures(); //var filePath = System.IO.Path.Combine(path + "/" + wineid + ".jpg"); //if (System.IO.File.Exists(filePath)) //{ // Bitmap imageBitmap = BitmapFactory.DecodeFile(filePath); // imgWine.SetImageBitmap(imageBitmap); //} //else //{ // Bitmap imageBitmap = BlobWrapper.Bottleimages(wineid); // imgWine.SetImageBitmap(imageBitmap); //} //imgWine.LayoutParameters = new RelativeLayout.LayoutParams(1100, 1100); BitmapFactory.Options options = new BitmapFactory.Options { InJustDecodeBounds = false, OutHeight = 75, OutWidth = 75 }; ProgressIndicator.Hide(); Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options); } catch (Exception ex) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Sorry"); alert.SetMessage("We're under maintainence"); alert.SetNegativeButton("Ok", delegate { }); Dialog dialog = alert.Create(); dialog.Show(); } //downloadButton = FindViewById<Button>(Resource.Id.Download); //try //{ // //downloadButton.Enabled = true; // downloadButton.Click += downloadAsync; // //downloadButton.Enabled = false; //} //catch (Exception e) { } }