//Stopwatch st; protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { //st.Start(); base.OnActivityResult(requestCode, resultCode, data); LoggingClass.LogInfo("Entered into ProfilePictureGallery", screenid); if (resultCode == Result.Ok) { string Path = GetRealPathFromURI(data.Data); try { Bitmap propic = BitmapFactory.DecodeFile(Path); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string dir_path = pppd.CreateDirectoryForPictures(); dir_path = dir_path + "/" + Convert.ToInt32(CurrentUser.getUserId()) + ".jpg"; ProfileActivity pa = new ProfileActivity(); Bitmap resized = pa.Resize(propic, 400, 400); var filePath = System.IO.Path.Combine(dir_path); var stream = new FileStream(filePath, FileMode.Create); resized.Compress(Bitmap.CompressFormat.Jpeg, 100, stream); stream.Close(); pppd.UploadProfilePic(filePath); Intent intent = new Intent(this, typeof(TabActivity)); StartActivity(intent); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } } //st.Stop(); //LoggingClass.LogTime("profile pic gall time", st.Elapsed.TotalSeconds.ToString()); }
public static Bitmap Bottleimages(int wineid) { Bitmap imageBitmap; ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); Path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); if (wineImages.Contains(wineid)) { return((Bitmap)wineImages[wineid]); } var filePath = System.IO.Path.Combine(Path + "/" + wineid + ".jpg"); if (System.IO.File.Exists(filePath)) { imageBitmap = BitmapFactory.DecodeFile(filePath); wineImages.Add(wineid, imageBitmap); } else { var uri = new Uri(ServiceURL + "bottleimages/" + wineid + ".jpg"); imageBitmap = GetImageBitmapFromUrl(uri.ToString()); wineImages.Add(wineid, imageBitmap); } //Canvas canvas = new Canvas(imageBitmap); //canvas.DrawColor(Color.White); //canvas.DrawBitmap(imageBitmap, 0, 0, null); return(imageBitmap); }
public static Bitmap Bottleimages(string WineBarcode, int storeid) { Bitmap imageBitmap = null; ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); Path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); if (wineImages.Contains(WineBarcode)) { return((Bitmap)wineImages[WineBarcode]); } var filePath = System.IO.Path.Combine(Path + "/" + WineBarcode); if (System.IO.File.Exists(filePath)) { imageBitmap = BitmapFactory.DecodeFile(filePath); wineImages.Add(WineBarcode, imageBitmap); } else if (storeid == 1) { var uri = new Uri(ServiceURL + "barcodepp/" + WineBarcode); //LoggingClass.LogInfo(" WineImage is dosent Existing Download"+ WineBarcode + "Wall", screenid);/ imageBitmap = GetImageBitmapFromUrl(uri.ToString()); wineImages.Add(WineBarcode, imageBitmap); } else if (storeid == 2) { var uri = new Uri(ServiceURL + "barcodepp/" + WineBarcode); //LoggingClass.LogInfo(" WineImage is dosent Existing Download" + WineBarcode + " PP", screenid); imageBitmap = GetImageBitmapFromUrl(uri.ToString()); wineImages.Add(WineBarcode, imageBitmap); } else { var uri = new Uri(ServiceURL + "barcodepp/" + WineBarcode); //LoggingClass.LogInfo(" WineImage is dosent Existing Download" + WineBarcode + " PP", screenid); imageBitmap = GetImageBitmapFromUrl(uri.ToString()); wineImages.Add(WineBarcode, imageBitmap); } return(imageBitmap); }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (resultCode == Result.Ok) { //var imageView = // FindViewById<ImageView>(Resource.Id.imageView1); //imageView.SetImageURI(data.Data); // new FileInfo(path).Directory.FullName string Path = GetRealPathFromURI(data.Data); Bitmap propic = BitmapFactory.DecodeFile(Path); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string dir_path = pppd.CreateDirectoryForPictures(); dir_path = dir_path + "/" + Convert.ToInt32(CurrentUser.getUserId()) + ".jpg"; ProfileActivity pa = new ProfileActivity(); Bitmap resized = pa.Resize(propic, 450, 450); try { var filePath = System.IO.Path.Combine(dir_path); var stream = new FileStream(filePath, FileMode.Create); resized.Compress(Bitmap.CompressFormat.Jpeg, 100, stream); stream.Close(); Toast.MakeText(this, "Thank you,We will update your profile picture as soon as possible", ToastLength.Short).Show(); Toast.MakeText(this, "Please touch anywhere to exit this dialog.", ToastLength.Short).Show(); pppd.UploadProfilePic(filePath); } catch (Exception ex) { } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Profile); try { ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); int userId = Convert.ToInt32(CurrentUser.getUserId()); ServiceWrapper sw = new ServiceWrapper(); var output = sw.GetCustomerDetails(userId).Result; ImageView propicimage = FindViewById <ImageView>(Resource.Id.propicview); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = System.IO.Path.Combine(path + "/" + userId + ".jpg"); if (System.IO.File.Exists(filePath)) { Bitmap imageBitmap = BitmapFactory.DecodeFile(filePath); if (imageBitmap == null) { propicimage.SetImageResource(Resource.Drawable.user1); //propicimage.SetImageBitmap(imageBitmap); } else { propicimage.SetImageBitmap(imageBitmap); } } else { Bitmap imageBitmap = BlobWrapper.ProfileImages(userId); if (imageBitmap == null) { propicimage.SetImageResource(Resource.Drawable.user1); } else { propicimage.SetImageBitmap(imageBitmap); } } ImageButton changepropic = FindViewById <ImageButton>(Resource.Id.btnChangePropic); //changepropic.SetImageResource(Resource.Drawable.dpreplacer); //changepropic.SetScaleType(ImageView.ScaleType.CenterCrop); changepropic.Click += delegate { Intent intent = new Intent(this, typeof(ProfilePicturePickDialog)); StartActivity(intent); }; //Button Btnlogout = FindViewById<Button>(Resource.Id.button1); //Btnlogout.Click += delegate //{ // Intent intent = new Intent(this, typeof(LoginActivity)); // StartActivity(intent); //}; EditText Firstname = FindViewById <EditText>(Resource.Id.txtFirstName); Firstname.Text = output.customer.FirstName; EditText Lastname = FindViewById <EditText>(Resource.Id.txtLastName); Lastname.Text = output.customer.LastName; EditText Mobilenumber = FindViewById <EditText>(Resource.Id.txtMobileNumber); string phno1 = output.customer.PhoneNumber; string phno2 = output.customer.Phone2; if (phno1 != null) { Mobilenumber.Text = phno1; } else { Mobilenumber.Text = phno2; } EditText Email = FindViewById <EditText>(Resource.Id.txtEmail); Email.Text = output.customer.Email; EditText Address = FindViewById <EditText>(Resource.Id.txtAddress); string Addres2 = output.customer.Address2; string Addres1 = output.customer.Address1; Address.Text = string.Concat(Addres1, Addres2); EditText City = FindViewById <EditText>(Resource.Id.txtCity); City.Text = output.customer.City; EditText State = FindViewById <EditText>(Resource.Id.txtState); State.Text = output.customer.State; Button updatebtn = FindViewById <Button>(Resource.Id.UpdateButton); //updatebtn.SetScaleType(ImageView.ScaleType.CenterCrop); updatebtn.Click += async delegate { Customer customer = new Customer(); customer.FirstName = Firstname.Text; customer.LastName = Lastname.Text; customer.PhoneNumber = Mobilenumber.Text; customer.Address1 = Address.Text; customer.Email = Email.Text; customer.CustomerID = userId; customer.State = State.Text; customer.City = City.Text; var x = await sw.UpdateCustomer(customer); if (x == 1) { Toast.MakeText(this, "Thank you your profile is Updated", ToastLength.Short).Show(); } }; } 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(); } ProgressIndicator.Hide(); }
public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (myItems.Count == 0) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.EmptyTaste, null, false); TextView te = row.FindViewById <TextView>(Resource.Id.textView123a); } else { if (row == null) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyTastingView, null, false); } TextView txtName = row.FindViewById <TextView>(Resource.Id.SkuName); TextView txtYear = row.FindViewById <TextView>(Resource.Id.Vintage); //TextView txtDescription = row.FindViewById<TextView>(Resource.Id.TastingNotes); TextView txtDate = row.FindViewById <TextView>(Resource.Id.Date); TextView txtPrice = row.FindViewById <TextView>(Resource.Id.Price); ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imageButton4); ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2); //RatingBar rb = row.FindViewById<RatingBar>(Resource.Id.AvgRating); heartImg.SetImageResource(Resource.Drawable.heart_empty); txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 11); txtPrice.SetTextSize(Android.Util.ComplexUnitType.Dip, 11); txtName.Text = myItems[position].Name; txtYear.Text = myItems[position].Vintage.ToString(); if (txtYear.Text == null || txtYear.Text == "0") { txtYear.Text = ""; } else { txtYear.Text = myItems[position].Vintage.ToString(); } //txtDescription.Text = myItems[position].Description; txtDate.Text = "Tasted on :" + myItems[position].TastingDate.ToString("yyyy/MM/dd"); //txtPrice.Text = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState); txtPrice.Text = myItems[position].PlantFinal.ToString(); if (txtPrice.Text == "1") { txtPrice.Text = "Tasted at :" + " Wall"; } else if (txtPrice.Text == "2") { txtPrice.Text = "Tasted at :" + " Pt.Pleasant Beach"; } //rb.Rating = (float)myItems[position].AverageRating; //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = System.IO.Path.Combine(path + "/" + myItems[position].Barcode + ".jpg"); bool count = Convert.ToBoolean(myItems[position].IsLike); if (count == true) { heartImg.SetImageResource(Resource.Drawable.heart_full); } else { heartImg.SetImageResource(Resource.Drawable.heart_empty); } heartImg.Tag = position; if (convertView == null) { heartImg.Click += async delegate { int actualPosition = Convert.ToInt32(heartImg.Tag); bool x; if (count == false) { heartImg.SetImageResource(Resource.Drawable.heart_full); x = true; count = true; } else { heartImg.SetImageResource(Resource.Drawable.heart_empty); x = false; count = false; } SKULike like = new SKULike(); like.UserID = Convert.ToInt32(CurrentUser.getUserId()); like.SKU = Convert.ToInt32(myItems[actualPosition].SKU); like.Liked = x; myItems[actualPosition].IsLike = x; like.BarCode = myItems[actualPosition].Barcode; ServiceWrapper sw = new ServiceWrapper(); await sw.InsertUpdateLike(like); }; } Bitmap imageBitmap; //if (System.IO.File.Exists(filePath)) //{ // imageBitmap = BitmapFactory.DecodeFile(filePath); // wineimage.SetImageBitmap(imageBitmap); //} string url = myItems[position].SmallImageUrl; if (url == null) { url = myItems[position].Barcode + ".jpg"; } imageBitmap = BlobWrapper.Bottleimages(url, myItems[position].PlantFinal); if (imageBitmap == null) { wineimage.SetImageResource(Resource.Drawable.bottle); } else { wineimage.SetImageBitmap(imageBitmap); } //wineimage.SetScaleType(ImageView.ScaleType.CenterCrop); txtName.Focusable = false; txtYear.Focusable = false; //txtDescription.Focusable = false; txtDate.Focusable = false; txtPrice.Focusable = false; wineimage.Focusable = false; wineimage.FocusableInTouchMode = false; wineimage.Clickable = true; } LoggingClass.LogInfo("Entered into My tastings Adapter", screenid); return(row); }
public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (myItems.Count == 0) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.ReviewEmpty, null, false); TextView txtName = row.FindViewById <TextView>(Resource.Id.textView1); ImageView Imag = row.FindViewById <ImageView>(Resource.Id.imageView1); } else { if (row == null) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyReviewsCell, null, false); } TextView txtName = row.FindViewById <TextView>(Resource.Id.textView64); TextView txtYear = row.FindViewById <TextView>(Resource.Id.textView65); TextView txtDescription = row.FindViewById <TextView>(Resource.Id.textView66); TextView txtDate = row.FindViewById <TextView>(Resource.Id.textView67); ImageButton edit = row.FindViewById <ImageButton>(Resource.Id.imageButton3); ImageButton delete = row.FindViewById <ImageButton>(Resource.Id.imageButton4); ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2); var metrics = myContext.Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); RatingBar rb = row.FindViewById <RatingBar>(Resource.Id.rating); ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imageButton44); heartImg.SetImageResource(Resource.Drawable.heart_empty); edit.Focusable = false; edit.Clickable = true; delete.Focusable = false; delete.Clickable = true; wineimage.Focusable = false; wineimage.FocusableInTouchMode = false; wineimage.Clickable = true; wineimage.Click += (sender, args) => Console.WriteLine("ImageButton {0} clicked", position); txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12); txtName.Text = myItems[position].Name; txtYear.Text = myItems[position].Vintage; if (txtYear.Text == null || txtYear.Text == "0") { txtYear.Text = ""; } else { txtYear.Text = myItems[position].Vintage; } txtDescription.Text = myItems[position].RatingText; txtDate.Text = myItems[position].Date.ToString("yyyy/MM/dd"); rb.Rating = (float)myItems[position].RatingStars; ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); var filePath = System.IO.Path.Combine(path + "/" + myItems[position].Barcode + ".jpg"); bool count = Convert.ToBoolean(myItems[position].Liked); if (count == true) { heartImg.SetImageResource(Resource.Drawable.heart_full); } else { heartImg.SetImageResource(Resource.Drawable.heart_empty); } heartImg.Tag = position; edit.Tag = position; delete.Tag = position; if (convertView == null) { edit.Click += (sender, args) => { int tempPosition = Convert.ToInt32(edit.Tag); string WineBarcode = myItems[tempPosition].Barcode; Review _review = new Review(); _review.Barcode = WineBarcode; _review.RatingStars = myItems[tempPosition].RatingStars; _review.RatingText = myItems[tempPosition].RatingText; _review.PlantFinal = myItems[tempPosition].PlantFinal; LoggingClass.LogInfo("clicked on edit an item---->" + WineBarcode + "----->" + _review.RatingStars + "---->" + _review.RatingText, screenid); PerformItemClick(sender, args, _review); }; delete.Click += (sender, args) => { int tempPositio1n = Convert.ToInt32(edit.Tag); string WineBarcode = myItems[tempPositio1n].Barcode; Review _review = new Review(); _review.Barcode = WineBarcode; LoggingClass.LogInfo("clicked on delete item--->" + WineBarcode, screenid); PerformdeleteClick(sender, args, _review); }; heartImg.Click += delegate { int actualPosition = Convert.ToInt32(heartImg.Tag); bool x; if (count == false) { heartImg.SetImageResource(Resource.Drawable.heart_full); x = true; count = true; } else { heartImg.SetImageResource(Resource.Drawable.heart_empty); x = false; count = false; } var TaskA = new System.Threading.Tasks.Task(async() => { SKULike like = new SKULike(); like.UserID = Convert.ToInt32(CurrentUser.getUserId()); like.SKU = Convert.ToInt32(myItems[actualPosition].SKU); like.Liked = x; like.BarCode = myItems[actualPosition].Barcode; ServiceWrapper sw = new ServiceWrapper(); await sw.InsertUpdateLike(like); }); TaskA.Start(); }; } Bitmap imageBitmap; string url = myItems[position].SmallImageURL; if (url == null || url == "") { url = myItems[position].Barcode + ".jpg"; } imageBitmap = BlobWrapper.Bottleimages(url, Convert.ToInt32(myItems[position].PlantFinal)); if (imageBitmap == null) { wineimage.SetImageResource(Resource.Drawable.bottle); } else { wineimage.SetImageBitmap(imageBitmap); } txtName.Focusable = false; txtYear.Focusable = false; txtDescription.Focusable = false; txtDate.Focusable = false; } LoggingClass.LogInfo("Entered into My Review Adapter", screenid); return(row); }
public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (myItems.Count == 0) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.ReviewEmpty, null, false); TextView txtName = row.FindViewById <TextView>(Resource.Id.textView1); ImageView Imag = row.FindViewById <ImageView>(Resource.Id.imageView1); // AlertDialog.Builder aler = new AlertDialog.Builder(myContext); ////aler.SetTitle("No Reviews Avalilable"); //aler.SetMessage("Sorry you haven't Reviewed our wines"); //aler.SetNegativeButton("Ok", delegate { }); //LoggingClass.LogInfo("Clicked on Secaucus", screenid); //Dialog dialog = aler.Create(); //dialog.Show(); } else { if (row == null) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyReviewsCell, null, false); //else // return convertView; TextView txtName = row.FindViewById <TextView>(Resource.Id.textView64); TextView txtYear = row.FindViewById <TextView>(Resource.Id.textView65); TextView txtDescription = row.FindViewById <TextView>(Resource.Id.textView66); TextView txtDate = row.FindViewById <TextView>(Resource.Id.textView67); //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice); ImageButton edit = row.FindViewById <ImageButton>(Resource.Id.imageButton3); ImageButton delete = row.FindViewById <ImageButton>(Resource.Id.imageButton4); ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2); var metrics = myContext.Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); RatingBar rb = row.FindViewById <RatingBar>(Resource.Id.rating); ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imageButton44); heartImg.SetImageResource(Resource.Drawable.Heart_emp); //edit.SetScaleType(ImageView.ScaleType.Center); //delete.SetScaleType(ImageView.ScaleType.Center); //edit.SetImageResource(Resource.Drawable.edit); //delete.SetImageResource(Resource.Drawable.delete); edit.Focusable = false; //edit.FocusableInTouchMode = false; edit.Clickable = true; delete.Focusable = false; //delete.FocusableInTouchMode = false; delete.Clickable = true; wineimage.Focusable = false; wineimage.FocusableInTouchMode = false; wineimage.Clickable = true; //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice); //ImageView imgWine = row.FindViewById<ImageView>(Resource.Id.imgWine); //edit.SetTag(1, 5757); edit.Click += (sender, args) => { string WineBarcode = myItems[position].Barcode; Review _review = new Review(); _review.Barcode = WineBarcode; _review.RatingStars = myItems[position].RatingStars; _review.RatingText = myItems[position].RatingText; _review.PlantFinal = myItems[position].PlantFinal; LoggingClass.LogInfo("clicked on edit an item---->" + WineBarcode + "----->" + _review.RatingStars + "---->" + _review.RatingText, screenid); PerformItemClick(sender, args, _review); }; //delete.Click += Delete_Click; delete.Click += (sender, args) => { string WineBarcode = myItems[position].Barcode; Review _review = new Review(); _review.Barcode = WineBarcode; LoggingClass.LogInfo("clicked on delete item--->" + WineBarcode, screenid); PerformdeleteClick(sender, args, _review); }; wineimage.Click += (sender, args) => Console.WriteLine("ImageButton {0} clicked", position); txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12); txtName.Text = myItems[position].Name; // txtName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; // txtPrice.Text= myItems[position]. txtYear.Text = myItems[position].Vintage; txtDescription.Text = myItems[position].RatingText; //txtDescription.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; txtDate.Text = myItems[position].Date.ToString("dd/MM/yyyy"); rb.Rating = myItems[position].RatingStars; //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = System.IO.Path.Combine(path + "/" + myItems[position].Barcode + ".jpg"); bool count = Convert.ToBoolean(myItems[position].Liked); if (count == true) { heartImg.SetImageResource(Resource.Drawable.HeartFull); } else { heartImg.SetImageResource(Resource.Drawable.Heart_emp); } heartImg.Tag = position; if (convertView == null) { heartImg.Click += async delegate { int actualPosition = Convert.ToInt32(heartImg.Tag); bool x; if (count == false) { heartImg.SetImageResource(Resource.Drawable.HeartFull); LoggingClass.LogInfoEx("Liked an item------>" + myItems[position].Barcode, screenid); x = true; count = true; } else { heartImg.SetImageResource(Resource.Drawable.Heart_emp); LoggingClass.LogInfoEx("UnLiked an item" + "----->" + myItems[position].Barcode, screenid); x = false; count = false; } SKULike like = new SKULike(); like.UserID = Convert.ToInt32(CurrentUser.getUserId()); like.SKU = Convert.ToInt32(myItems[actualPosition].SKU); like.Liked = x; //myItems[actualPosition].IsLike = x; like.BarCode = myItems[actualPosition].Barcode; LoggingClass.LogInfo("Liked an item", screenid); ServiceWrapper sw = new ServiceWrapper(); await sw.InsertUpdateLike(like); }; } Bitmap imageBitmap; if (System.IO.File.Exists(filePath)) { imageBitmap = BitmapFactory.DecodeFile(filePath); wineimage.SetImageBitmap(imageBitmap); } else { imageBitmap = BlobWrapper.Bottleimages(myItems[position].Barcode, Convert.ToInt32(myItems[position].PlantFinal)); wineimage.SetImageBitmap(imageBitmap); } //wineimage.SetImageBitmap(imageBitmap); //wineimage.SetImageResource(Resource.Drawable.wine7); wineimage.SetScaleType(ImageView.ScaleType.CenterCrop); txtName.Focusable = false; txtYear.Focusable = false; txtDescription.Focusable = false; txtDate.Focusable = false; } } LoggingClass.LogInfo("Entered into My Review Adapter", screenid); return(row); }
public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyReviewsCell, null, false); } //else // return convertView; TextView txtName = row.FindViewById <TextView>(Resource.Id.textView64); TextView txtYear = row.FindViewById <TextView>(Resource.Id.textView65); TextView txtDescription = row.FindViewById <TextView>(Resource.Id.textView66); TextView txtDate = row.FindViewById <TextView>(Resource.Id.textView67); //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice); ImageButton edit = row.FindViewById <ImageButton>(Resource.Id.imageButton3); ImageButton delete = row.FindViewById <ImageButton>(Resource.Id.imageButton4); ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2); RatingBar rb = row.FindViewById <RatingBar>(Resource.Id.rating); //edit.SetScaleType(ImageView.ScaleType.Center); //delete.SetScaleType(ImageView.ScaleType.Center); //edit.SetImageResource(Resource.Drawable.edit); //delete.SetImageResource(Resource.Drawable.delete); edit.Focusable = false; //edit.FocusableInTouchMode = false; edit.Clickable = true; delete.Focusable = false; //delete.FocusableInTouchMode = false; delete.Clickable = true; wineimage.Focusable = false; wineimage.FocusableInTouchMode = false; wineimage.Clickable = true; //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice); //ImageView imgWine = row.FindViewById<ImageView>(Resource.Id.imgWine); //edit.SetTag(1, 5757); edit.Click += (sender, args) => { int WineId = myItems[position].WineId; Review _review = new Review(); _review.WineId = WineId; _review.RatingStars = myItems[position].RatingStars; _review.RatingText = myItems[position].RatingText; PerformItemClick(sender, args, _review); }; //delete.Click += Delete_Click; delete.Click += (sender, args) => { int WineId = myItems[position].WineId; Review _review = new Review(); _review.WineId = WineId; PerformdeleteClick(sender, args, _review); }; wineimage.Click += (sender, args) => Console.WriteLine("ImageButton {0} clicked", position); txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12); txtName.Text = myItems[position].Name; // txtName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; // txtPrice.Text= myItems[position]. txtYear.Text = myItems[position].Vintage; txtDescription.Text = myItems[position].RatingText; txtDescription.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; txtDate.Text = myItems[position].Date.ToString("dd/MM/yyyy"); rb.Rating = myItems[position].RatingStars; //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = System.IO.Path.Combine(path + "/" + myItems[position].WineId + ".jpg"); Bitmap imageBitmap; if (System.IO.File.Exists(filePath)) { imageBitmap = BitmapFactory.DecodeFile(filePath); wineimage.SetImageBitmap(imageBitmap); } else { imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId); wineimage.SetImageBitmap(imageBitmap); } //wineimage.SetImageBitmap(imageBitmap); //wineimage.SetImageResource(Resource.Drawable.wine7); wineimage.SetScaleType(ImageView.ScaleType.CenterCrop); txtName.Focusable = false; txtYear.Focusable = false; txtDescription.Focusable = false; txtDate.Focusable = false; return(row); }
public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyFavorite, null, false); } else { return(row); } TextView Name = row.FindViewById <TextView>(Resource.Id.txtNamefav); TextView Vintage = row.FindViewById <TextView>(Resource.Id.txtVintagefav); ImageView Wine = row.FindViewById <ImageView>(Resource.Id.imgWinefav); TextView Price = row.FindViewById <TextView>(Resource.Id.txtPricefav); RatingBar Avgrating = row.FindViewById <RatingBar>(Resource.Id.rtbProductRatingfav); // ImageView place = row.FindViewById<ImageView>(Resource.Id.placeholdefavr); ImageView Heart = row.FindViewById <ImageView>(Resource.Id.imgHeartfav); //String str = "lokesh"; Name.Text = myItems[position].Name; Name.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; Price.Text = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState); Avgrating.Rating = (float)myItems[position].AverageRating; Vintage.Text = myItems[position].Vintage.ToString(); Heart.SetImageResource(Resource.Drawable.heart_empty); var heartLP = new RelativeLayout.LayoutParams(80, 80); var metrics = myContext.Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); heartLP.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2; Heart.LayoutParameters = heartLP; bool count = Convert.ToBoolean(myItems[position].IsLike); if (count == true) { Heart.SetImageResource(Resource.Drawable.heart_full); } else { Heart.SetImageResource(Resource.Drawable.heart_empty); } Heart.Click += async delegate { bool x; if (count == false) { Heart.SetImageResource(Resource.Drawable.heart_full); x = true; count = true; } else { Heart.SetImageResource(Resource.Drawable.heart_empty); x = false; count = false; } SKULike like = new SKULike(); like.UserID = Convert.ToInt32(CurrentUser.getUserId()); like.SKU = Convert.ToInt32(myItems[position].SKU); like.Liked = x; ServiceWrapper sw = new ServiceWrapper(); like.WineId = myItems[position].WineId; await sw.InsertUpdateLike(like); }; //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId); // place.SetImageResource(Resource.Drawable.placeholder); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = System.IO.Path.Combine(path + "/" + myItems[position].WineId + ".jpg"); Bitmap imageBitmap; if (System.IO.File.Exists(filePath)) { imageBitmap = BitmapFactory.DecodeFile(filePath); Wine.SetImageBitmap(imageBitmap); } else { imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId); Wine.SetImageBitmap(imageBitmap); } //Wine.SetImageBitmap(imageBitmap); var place1 = new RelativeLayout.LayoutParams(520, 520); // var place = new RelativeLayout.LayoutParams(520, 620); place1.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 430; Wine.LayoutParameters = place1; var place2 = new RelativeLayout.LayoutParams(520, 520); place2.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 430; // place.LayoutParameters = place2; //imgPlaceHolder.LayoutParameters = new RelativeLayout.LayoutParams(520, 520); //imgWine.LayoutParameters = new RelativeLayout.LayoutParams(520, 520); Name.Focusable = false; Vintage.Focusable = false; Price.Focusable = false; Wine.Focusable = false; NotifyDataSetChanged(); return(row); }
public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyTastingView, null, false); //else // return convertView; if (myItems.Count == 0) { AlertDialog.Builder aler = new AlertDialog.Builder(myContext); //aler.SetTitle("No Reviews Avalilable"); aler.SetMessage("Sorry you haven't Tasted our wines"); aler.SetNegativeButton("Ok", delegate { }); LoggingClass.LogInfo("Clicked on Secaucus", screenid); Dialog dialog = aler.Create(); dialog.Show(); } else { TextView txtName = row.FindViewById <TextView>(Resource.Id.SkuName); TextView txtYear = row.FindViewById <TextView>(Resource.Id.Vintage); TextView txtDescription = row.FindViewById <TextView>(Resource.Id.TastingNotes); TextView txtDate = row.FindViewById <TextView>(Resource.Id.Date); TextView txtPrice = row.FindViewById <TextView>(Resource.Id.Price); ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imageButton4); ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2); RatingBar rb = row.FindViewById <RatingBar>(Resource.Id.AvgRating); heartImg.SetImageResource(Resource.Drawable.Heart_emp); txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12); txtName.Text = myItems[position].Name; txtName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; txtYear.Text = myItems[position].Vintage.ToString(); txtDescription.Text = myItems[position].Description; txtDate.Text = myItems[position].TastingDate.ToString(); txtPrice.Text = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState); rb.Rating = (float)myItems[position].AverageRating; //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = System.IO.Path.Combine(path + "/" + myItems[position].Barcode + ".jpg"); bool count = Convert.ToBoolean(myItems[position].IsLike); if (count == true) { heartImg.SetImageResource(Resource.Drawable.HeartFull); } else { heartImg.SetImageResource(Resource.Drawable.Heart_emp); } heartImg.Tag = position; if (convertView == null) { heartImg.Click += async delegate { int actualPosition = Convert.ToInt32(heartImg.Tag); bool x; if (count == false) { heartImg.SetImageResource(Resource.Drawable.HeartFull); LoggingClass.LogInfoEx("Liked an item------>" + myItems[position].Barcode, screenid); x = true; count = true; } else { heartImg.SetImageResource(Resource.Drawable.Heart_emp); LoggingClass.LogInfoEx("UnLiked an item" + "----->" + myItems[position].Barcode, screenid); x = false; count = false; } SKULike like = new SKULike(); like.UserID = Convert.ToInt32(CurrentUser.getUserId()); like.SKU = Convert.ToInt32(myItems[actualPosition].SKU); like.Liked = x; myItems[actualPosition].IsLike = x; like.BarCode = myItems[actualPosition].Barcode; LoggingClass.LogInfo("Liked an item", screenid); ServiceWrapper sw = new ServiceWrapper(); await sw.InsertUpdateLike(like); }; } Bitmap imageBitmap; if (System.IO.File.Exists(filePath)) { imageBitmap = BitmapFactory.DecodeFile(filePath); wineimage.SetImageBitmap(imageBitmap); } else { imageBitmap = BlobWrapper.Bottleimages(myItems[position].Barcode, myItems[position].Vintage); wineimage.SetImageBitmap(imageBitmap); } wineimage.SetScaleType(ImageView.ScaleType.CenterCrop); txtName.Focusable = false; txtYear.Focusable = false; txtDescription.Focusable = false; txtDate.Focusable = false; } } LoggingClass.LogInfo("Entered into My tastings Adapter", screenid); return(row); }
public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyTastingView, null, false); } else { return(convertView); } TextView txtName = row.FindViewById <TextView>(Resource.Id.SkuName); TextView txtYear = row.FindViewById <TextView>(Resource.Id.Vintage); TextView txtDescription = row.FindViewById <TextView>(Resource.Id.TastingNotes); TextView txtDate = row.FindViewById <TextView>(Resource.Id.Date); TextView txtPrice = row.FindViewById <TextView>(Resource.Id.Price); ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2); RatingBar rb = row.FindViewById <RatingBar>(Resource.Id.AvgRating); txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12); txtName.Text = myItems[position].Name; txtName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; txtYear.Text = myItems[position].Vintage.ToString(); txtDescription.Text = myItems[position].Description; txtDate.Text = myItems[position].TastingDate.ToString(); txtPrice.Text = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState); rb.Rating = (float)myItems[position].AverageRating; //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId); ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); string path = pppd.CreateDirectoryForPictures(); //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = System.IO.Path.Combine(path + "/" + myItems[position].WineId + ".jpg"); Bitmap imageBitmap; if (System.IO.File.Exists(filePath)) { imageBitmap = BitmapFactory.DecodeFile(filePath); wineimage.SetImageBitmap(imageBitmap); } else { imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId); wineimage.SetImageBitmap(imageBitmap); } wineimage.SetScaleType(ImageView.ScaleType.CenterCrop); txtName.Focusable = false; txtYear.Focusable = false; txtDescription.Focusable = false; txtDate.Focusable = false; return(row); }