private void SetMealInformationForUpdating() { if (meal != null) { FindViewById <TextView>(Resource.Id.foodName).Text = meal.Name; FindViewById <TextView>(Resource.Id.comments).Text = meal.Comments; FindViewById <RatingBar>(Resource.Id.ratingBar).Rating = meal.Rate; FindViewById <Button>(Resource.Id.saveBtn).Text = "Update"; FindViewById <Button>(Resource.Id.regCreateDate).Text = meal.CreateDate.ToString("yyyy-MM-dd"); choose_option(FindViewById <Button>(opt[meal.Type - 1]), null); if (!string.IsNullOrWhiteSpace(meal.ImageName)) { FFImageLoading.Views.ImageViewAsync imageView = FindViewById <FFImageLoading.Views.ImageViewAsync>(Resource.Id.myImageView); ImageService.Instance .LoadFile(System.IO.Path.Combine(PageRegisterFragment.documentsDirectory, meal.ImageName)) .DownSample(width: 100, height: 100) .LoadingPlaceholder("loading.png", FFImageLoading.Work.ImageSource.CompiledResource) .ErrorPlaceholder("error.png", FFImageLoading.Work.ImageSource.CompiledResource) .Into(imageView); FindViewById <TextView>(Resource.Id.myImageViewText).Text = ""; } } }
private async Task SearchCards(string param) { var newLayout = new ScrollView(this); var myGrid = new GridLayout(this); myGrid.ColumnCount = 4; var x = await APICaller.SearchCards(param); //a.Text = x.cards.FirstOrDefault().name.ToString(); foreach (var card in x.cards) { var newImage = new FFImageLoading.Views.ImageViewAsync(this); ImageService.Instance.LoadUrl(card.imageUrl).DownSample(width: 150).Into(newImage); myGrid.AddView(newImage); } newLayout.AddView(myGrid); SetContentView(newLayout); }
protected void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e) { ListView listView = sender as ListView; listView.Focusable = true; listView.RequestFocusFromTouch(); for (int i = 0; i < listView.ChildCount; i++) { listView.GetChildAt(i).SetBackgroundColor(Color.Transparent); } e.View.SetBackgroundColor(Color.Orange); meal = list[e.Position]; // custom dialog if (dialog == null) { dialog = new Dialog(view.Context); } dialog.SetContentView(Resource.Layout.ViewInformation); dialog.FindViewById <TextView>(Resource.Id.viewComments).Text = meal.Comments; dialog.FindViewById <TextView>(Resource.Id.viewFoodName).Text = meal.Name; dialog.FindViewById <RatingBar>(Resource.Id.viewRatingBar).Rating = meal.Rate; dialog.FindViewById <TextView>(Resource.Id.viewMealType).Text = meal.CreateDate.ToString("yyyy-MM-dd") + " " + MyUtil.GetType(meal); if (!string.IsNullOrWhiteSpace(meal.ImageName)) { FFImageLoading.Views.ImageViewAsync imageView = dialog.FindViewById <FFImageLoading.Views.ImageViewAsync>(Resource.Id.viewImageView); ImageService.Instance .LoadFile(System.IO.Path.Combine(PageRegisterFragment.documentsDirectory, meal.ImageName)) .DownSampleInDip(width: 250) .LoadingPlaceholder("loading.png", FFImageLoading.Work.ImageSource.CompiledResource) .ErrorPlaceholder("error.png", FFImageLoading.Work.ImageSource.CompiledResource) .Into(imageView); } dialog.FindViewById <Button>(Resource.Id.goModifyBtn).Click += GoModifyPage; dialog.FindViewById <Button>(Resource.Id.deleteBtn).Click += DeleteCurrentItem; dialog.CancelEvent += closeDialog; dialog.Show(); }
protected void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e, List <PickedMeal> list) { ListView listView = sender as ListView; for (int i = 0; i < listView.ChildCount; i++) { listView.GetChildAt(i).SetBackgroundColor(Color.Transparent); } e.View.SetBackgroundColor(Color.LightGray); meal = list[e.Position]; // custom dialog if (dialog == null) { dialog = new Dialog(view.Context, Resource.Style.Dialog); } dialog.SetContentView(Resource.Layout.ViewInformation); dialog.FindViewById <TextView>(Resource.Id.viewComments).Text = meal.Comments; dialog.FindViewById <TextView>(Resource.Id.viewFoodName).Text = meal.Name; dialog.FindViewById <RatingBar>(Resource.Id.viewRatingBar).Rating = meal.Rate; dialog.FindViewById <TextView>(Resource.Id.viewMealType).Text = meal.CreateDate.ToString("yyyy-MM-dd") + " / " + MyUtil.GetType(meal); FFImageLoading.Views.ImageViewAsync imageView = dialog.FindViewById <FFImageLoading.Views.ImageViewAsync>(Resource.Id.viewImageView); if (!string.IsNullOrWhiteSpace(meal.ImageName)) { ImageService.Instance .LoadFile(System.IO.Path.Combine(PageRegisterFragment.documentsDirectory, meal.ImageName)) .DownSampleInDip(width: 250) .LoadingPlaceholder("loading.png", FFImageLoading.Work.ImageSource.CompiledResource) .ErrorPlaceholder("error.png", FFImageLoading.Work.ImageSource.CompiledResource) .Into(imageView); } else { ImageService.Instance.LoadCompiledResource("noImage.png").Into(imageView); } dialog.FindViewById <LinearLayout>(Resource.Id.firstLineInViewInformation).LayoutParameters = new TableRow.LayoutParams(LinearLayout.LayoutParams.MatchParent, 0); dialog.CancelEvent += closeDialog; dialog.Show(); }
private async Task GetCardsFromDB() { var newLayout = new ScrollView(this); var myGrid = new GridLayout(this); myGrid.ColumnCount = 4; var db = new SQLiteConnection(DataHelper.databasePath); var myCards = db.Table <DataHelper.myCards.Card>().ToList(); foreach (var card in myCards) { var newImage = new FFImageLoading.Views.ImageViewAsync(this); ImageService.Instance.LoadUrl(card.imageUrl).DownSample(width: 150).Into(newImage); myGrid.AddView(newImage); } newLayout.AddView(myGrid); SetContentView(newLayout); }
public override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (resultCode == Result.Ok) { FFImageLoading.Views.ImageViewAsync imageView = FindViewById <FFImageLoading.Views.ImageViewAsync>(Resource.Id.myImageView); uri = data.Data; imagePath = UriHelper.GetPathFromUri(Context, data.Data); ImageService.Instance .LoadFile(imagePath) .DownSample(width: 100) .LoadingPlaceholder("loading.png", FFImageLoading.Work.ImageSource.CompiledResource) .ErrorPlaceholder("error.png", FFImageLoading.Work.ImageSource.CompiledResource) .Into(imageView); FindViewById <TextView>(Resource.Id.myImageViewText).Text = ""; } }
public ConvertZipImage(Android.Net.Uri uri_icon, FFImageLoading.Views.ImageViewAsync Icon, Context context) { this.uri_icon = uri_icon; this.Icon = Icon; this.context = context; }
public override View GetView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater inflater = LayoutInflater.From(globalView.Context); view = (View)inflater.Inflate(Resource.Layout.MainListLayout, null, false); } if (this.items.Count == 1 && items[0].Name == MyUtil.NO_DATA) { LayoutInflater inflater = LayoutInflater.From(view.Context); View layout = (View)inflater.Inflate(Resource.Layout.CustomListLayout, null, false); view.FindViewById <TextView>(Resource.Id.listName).Text = "No data."; view.FindViewById <ImageView>(Resource.Id.listImage).SetImageURI(null); return(view); } else { var item = items[position]; if (isSelected[position] == true) { view.SetBackgroundColor(Color.LightGray); } else { view.SetBackgroundColor(Color.Transparent); } view.FindViewById <TextView>(Resource.Id.listName).Text = item.Name; view.FindViewById <RatingBar>(Resource.Id.mainRatingBar).Rating = item.Rate; if (type) { view.FindViewById <TextView>(Resource.Id.recentDate).Text = item.CreateDate.ToString("yyyy-MM-dd"); } else { view.FindViewById <TextView>(Resource.Id.recentDate).Text = item.Count + " times"; } if (!string.IsNullOrWhiteSpace(item.ImageName)) { FFImageLoading.Views.ImageViewAsync imageView = view.FindViewById <FFImageLoading.Views.ImageViewAsync>(Resource.Id.listImage); //imageView.SetImageBitmap(MyUtil.GetThumbnailBitmap(item.ImageName, false)); ImageService.Instance .LoadFile(System.IO.Path.Combine(PageRegisterFragment.documentsDirectory, item.ImageName)) .DownSample(width: 100) .LoadingPlaceholder("loading.png", FFImageLoading.Work.ImageSource.CompiledResource) .ErrorPlaceholder("error.png", FFImageLoading.Work.ImageSource.CompiledResource) .Into(imageView); } return(view); } }