protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.CrueltyTypes);

            _loadingDialog = DialogManager.ShowLoadingDialog(this, "Retrieving Cruelty Types");

            _crueltySpotCategoriesList = FindViewById<ListView>(Resource.Id.CrueltyTypes);
            _crueltySpotCategoriesList.ItemClick += (sender, e) =>
            {
                var crueltySpotCategory = _crueltySpotCategories[e.Position];
                //var intent = new Intent(this, typeof(ReportCrueltyFragment));
                var intent = new Intent(this, typeof(IntroActivity));
                intent.PutExtra("tab", "report");
                var crueltyType = new CrueltyType();
                crueltyType.Id = crueltySpotCategory.ObjectId;
                crueltyType.Name = crueltySpotCategory.Name;
				CrueltyReport _crueltyReport = ((AfaApplication)ApplicationContext).CrueltyReport; 
                _crueltyReport.CrueltyType = crueltyType;
               
                StartActivity(intent);
            };

            var crueltySpotCategoriesService = new CrueltySpotCategoriesService();

            var crueltySpotCategories = await crueltySpotCategoriesService.GetAllAsync();
            RunOnUiThread(() =>
                {
                    _crueltySpotCategories = crueltySpotCategories;
                    _crueltySpotCategoriesList.Adapter = new CrueltyTypesAdapter(this, _crueltySpotCategories);
                    _loadingDialog.Hide();
                });

			/*SetContentView (Resource.Layout.Test);
			var textView = FindViewById<TextView> (Resource.Id.textView1);
			var query = new ParseQuery<CrueltySpotCategory> ();
			var result = await query.FindAsync ();
			var output = "";
			foreach (var crueltySpotCategory in result) {
				output += "Name: " + crueltySpotCategory.Name;
				output += "\n";
				output += "Description: " + crueltySpotCategory.Description;
				output += "\n";
				output += "Icon: " + crueltySpotCategory.IconName;
				output += "\n";
			}

			RunOnUiThread (() => {
				textView.Text = output;
			});*/
            
        }
示例#2
0
		protected override async  void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView (Resource.Layout.Legend);

			CheckBox closestFilterCheckbox = FindViewById<CheckBox>(Resource.Id.chooseClosest);
			Boolean filterClosest = UserPreferencesHelper.getClosestSpotsFilter ();
			closestFilterCheckbox.Checked = filterClosest;

			closestFilterCheckbox.Click += (sender, args) => {

				if (closestFilterCheckbox.Checked) {
					UserPreferencesHelper.setClosestSpotsFilter (true);
				} else {
					UserPreferencesHelper.setClosestSpotsFilter (false);
				}
			};


			_loadingDialog = LoadingDialogManager.ShowLoadingDialog (this);

			_crueltySpotCategoriesList = FindViewById<ListView> (Resource.Id.Legend);

			var crueltySpotCategoriesService = new CrueltySpotCategoriesService ();
			_crueltySpotCategories = await crueltySpotCategoriesService.GetAllAsync ();

			RunOnUiThread (() => {
				_loadingDialog.Dismiss ();
				_crueltySpotCategoriesList.Adapter = new LegendAdapter (this, _crueltySpotCategories);
				

			});               


			List<String> categories = UserPreferencesHelper.GetFilterCategories ();
			if (categories.Count () == 0) {
				foreach (CrueltySpotCategory category in _crueltySpotCategories) {
					categories.Add (category.ObjectId);
				}
				UserPreferencesHelper.SaveFilterCategories (categories);
			}



		}