protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); uid = Convert.ToInt32(CurrentUser.getUserId()); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Tasting); try { ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemReviewResponse uidreviews = new ItemReviewResponse(); // ItemRatingResponse irr = svc.GetItemReviewUID(uid).Result; uidreviews = svc.GetItemReviewUID(uid).Result; //if (uidreviews.Reviews.Count == 0) //{ // SetContentView(Resource.Layout.Dummy); //} List <Review> myArr1; myArr1 = uidreviews.Reviews.ToList(); var wineList = FindViewById <ListView>(Resource.Id.listView1); // myArr1 = SampleData1(); Review edit = new Review(); ReviewPopup editPopup = new ReviewPopup(this, edit); MyReviewAdapter adapter = new MyReviewAdapter(this, myArr1); //if (adapter.Count == 0) //{ // TextView infoText = FindViewById<TextView>(Resource.Id.txtInfo); // infoText.Text = "You haven't reviewed anything"; //} //adapter.Edit_Click += editPopup.EditPopup; wineList.Adapter = adapter; // wineList.ItemClick += listView_ItemClick; wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args) { int WineID = myArr1[args.Position].WineId; var intent = new Intent(this, typeof(detailViewActivity)); intent.PutExtra("WineID", WineID); StartActivity(intent); }; ProgressIndicator.Hide(); } catch (Exception exe) { AlertDialog.Builder aler = new AlertDialog.Builder(this); aler.SetTitle("Sorry"); aler.SetMessage("We're under maintainence"); aler.SetNegativeButton("Ok", delegate { }); Dialog dialog = aler.Create(); dialog.Show(); } }
public void RefreshParent() { ServiceWrapper svc = new ServiceWrapper(); var uidreviews = svc.GetItemReviewUID(uid).Result; ListView wineList = FindViewById <ListView>(Resource.Id.listView1); Review edit = new Review(); ReviewPopup editPopup = new ReviewPopup(this, edit); MyReviewAdapter adapter = new MyReviewAdapter(this, uidreviews.Reviews.ToList()); //adapter.Edit_Click += editPopup.EditPopup; wineList.Adapter = adapter; adapter.NotifyDataSetChanged(); }
public void RefreshParent() { ServiceWrapper svc = new ServiceWrapper(); var uidreviews = svc.GetItemReviewUID(uid).Result; ListView wineList = FindViewById <ListView>(Resource.Id.listView1); Review edit = new Review(); ReviewPopup editPopup = new ReviewPopup(this, edit); MyReviewAdapter adapter = new MyReviewAdapter(this, uidreviews.Reviews.ToList()); //adapter.Edit_Click += editPopup.EditPopup; int c = uidreviews.Reviews.Count; if (c == 0) { SetContentView(Resource.Layout.ReviewEmpty); txtName = FindViewById <TextView>(Resource.Id.textView1); Imag = FindViewById <ImageView>(Resource.Id.imageView1); } wineList.Adapter = adapter; adapter.NotifyDataSetChanged(); }
protected override void OnCreate(Bundle savedInstanceState) { AndHUD.Shared.Dismiss(); 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(); // myData = new ItemDetailsResponse(); //ItemReviewResponse SkuRating = new ItemReviewResponse(); //this.Title = "Wine Details"; commentsview = FindViewById <ListView>(Resource.Id.listView2); WineName = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields WineName.Focusable = false; WineProducer = FindViewById <TextView>(Resource.Id.txtProducer); WineProducer.Focusable = false; Vintage = FindViewById <TextView>(Resource.Id.txtVintage); Vintage.Focusable = false; WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription); WineDescription.Focusable = false; AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating); AvgRating.Focusable = false; ErrorDescription = FindViewById <TextView>(Resource.Id.Error); ErrorDescription.Focusable = false; ErrorDescription.Visibility = ViewStates.Gone; TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5); WineBarcode = Intent.GetStringExtra("WineBarcode"); storeid = Intent.GetIntExtra("storeid", 1); Review edit = new Review() { Barcode = WineBarcode, RatingText = "", PlantFinal = storeid.ToString() }; ItemReviewResponse SkuRating = new ItemReviewResponse(); ServiceWrapper svc = new ServiceWrapper(); SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; var tempReview = SkuRating.Reviews.ToList().Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId())); if (tempReview != null) { edit.RatingText = tempReview.RatingText; } editPopup = new ReviewPopup(this, edit); RatingBar RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput);//Taking rating stars input RatingInput.RatingBarChange += editPopup.CreatePopup; Internal_ViewDidLoad(); st.Stop(); AndHUD.Shared.Dismiss(); LoggingClass.LogTime("Detail activity", st.Elapsed.TotalSeconds.ToString()); }
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; }
public void PerformItemClick(object sender, EventArgs e, Review edit) { ReviewPopup editPopup = new ReviewPopup(myContext, edit); editPopup.EditPopup(sender, e); }
protected override void OnCreate(Bundle bundle) { Stopwatch st = new Stopwatch(); st.Start(); base.OnCreate(bundle); uid = Convert.ToInt32(CurrentUser.getUserId()); try { ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemReviewResponse uidreviews = new ItemReviewResponse(); uidreviews = svc.GetItemReviewUID(uid).Result; List <Review> myArr1; myArr1 = uidreviews.Reviews.ToList(); int c = uidreviews.Reviews.Count; if (c == 0) { var data = svc.GetMyTastingsList(uid).Result; SetContentView(Resource.Layout.ReviewEmpty); txtName = FindViewById <TextView>(Resource.Id.textView1); if (data.TastingList.Count != 0) { txtName.Text = "You have tasted " + data.TastingList.Count + " wines.\n We would love to hear your feedback."; } else { txtName.Text = "Please taste and then review."; } Imag = FindViewById <ImageView>(Resource.Id.imageView1); var TaskA = new System.Threading.Tasks.Task(() => { Imag.SetImageResource(Resource.Drawable.ReviewIns); }); TaskA.Start(); } else { SetContentView(Resource.Layout.MyReviews); var wineList = FindViewById <ListView>(Resource.Id.listView1); Review edit = new Review(); ReviewPopup editPopup = new ReviewPopup(this, edit); MyReviewAdapter adapter = new MyReviewAdapter(this, myArr1); wineList.Adapter = adapter; wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args) { string WineBarcode = myArr1[args.Position].Barcode; int storeID = Convert.ToInt32(myArr1[args.Position].PlantFinal); LoggingClass.LogInfoEx("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine details From ReviewAct", screenid); ProgressIndicator.Show(this); //AndHUD.Shared.Show(this, "Loading...", Convert.ToInt32(MaskType.Clear)); var intent = new Intent(this, typeof(DetailViewActivity)); intent.PutExtra("WineBarcode", WineBarcode); intent.PutExtra("storeid", storeID); StartActivity(intent); }; LoggingClass.LogInfo("Entered into My Review", screenid); } ProgressIndicator.Hide(); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AndHUD.Shared.Dismiss(); ProgressIndicator.Hide(); AlertDialog.Builder aler = new AlertDialog.Builder(this); aler.SetTitle("Sorry"); aler.SetMessage("We're under maintainence"); aler.SetNegativeButton("Ok", delegate { }); Dialog dialog = aler.Create(); dialog.Show(); } st.Stop(); LoggingClass.LogTime("Reviewactivity", st.Elapsed.TotalSeconds.ToString()); }
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) { } }