public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { row = LayoutInflater.From(kontekst).Inflate(Resource.Layout.ListRow, null, false); } TextView Name = row.FindViewById <TextView> (Resource.Id.ROW_Nazwa); TextView Typ = row.FindViewById <TextView> (Resource.Id.ROW_Typ); ImageView Image = row.FindViewById <ImageView> (Resource.Id.ROW_Obrazek); switch (lista[position].Typ) { case 0: Image.SetImageResource(Resource.Drawable.IkonaPrzepisu_danie); break; case 1: Image.SetImageResource(Resource.Drawable.IkonaPrzepisu_weget); break; case 2: Image.SetImageResource(Resource.Drawable.IkonaPrzepisu_zupa); break; case 3: Image.SetImageResource(Resource.Drawable.IkonaPrzepisu_deser); break; case 4: Image.SetImageResource(Resource.Drawable.IkonaPrzepisu_napoj); break; default: Image.SetImageResource(Resource.Drawable.IkonaPrzepisu_danie); break; } Name.Text = lista [position].Nazwa; Typ.Text = Baza.getDataBase().getRecipeType(lista [position].Typ); return(row); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Przepis); id = Intent.GetIntExtra("Id", -1); if (id == -1) { Finish(); } else { przepis = Baza.getDataBase().getBaseAdapter() [id]; } TextView Title = FindViewById <TextView> (Resource.Id.P_title); TextView Igridience = FindViewById <TextView> (Resource.Id.P_skladniki); TextView Recipe = FindViewById <TextView> (Resource.Id.P_przepis); Title.Text = przepis.Nazwa; Igridience.Text = przepis.Skladniki; Recipe.Text = przepis.Przepis; RecImage = FindViewById <ImageView> (Resource.Id.P_obrazek); ThreadPool.QueueUserWorkItem(o => LoadImage()); RecImage.LongClick += delegate { Intent pobierzObrazek = new Intent(); pobierzObrazek.SetType("image/*"); pobierzObrazek.SetAction(Intent.ActionGetContent); this.StartActivityForResult(Intent.CreateChooser(pobierzObrazek, GetString(Resource.String.P_chooseImage)), 0); }; Button DeleteBut = FindViewById <Button> (Resource.Id.P_deleteRecipe); DeleteBut.Click += delegate { FragmentTransaction trans = FragmentManager.BeginTransaction(); dialogDelete addRecipe = new dialogDelete(przepis.Id); addRecipe.Show(trans, "deleteRecipe"); }; }
public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var widok = inflater.Inflate(Resource.Layout.dialogDelete, container, false); Button ok = widok.FindViewById <Button> (Resource.Id.DD_ok); Button cancel = widok.FindViewById <Button> (Resource.Id.DD_cancel); ok.Click += delegate { Baza.getDataBase().usunPrzepis(id); this.Activity.Finish(); }; cancel.Click += delegate { this.Dismiss(); }; return(widok); }
protected override void OnDestroy() { base.OnDestroy(); Baza.getDataBase().wylaczBaze(); GC.Collect(); }