public override void ViewDidAppear(bool animated) { base.ViewDidAppear (animated); currProfiel = _appController.CurrentProfiel; IsProfileNull = (currProfiel == null); btnReturn.TouchUpInside+= btnReturnTouchUpInside; btnMore.TouchUpInside+= btnMoreTouchUpInside; btnSearch.TouchUpInside+= btnSearchTouchUpInside; txtSearch.EditingChanged+= TxtSearchValueChangedHandler; btnVind.TouchUpInside += btnVindTouchUpInside; _appController.UpdateCounter += updateCounter; _appController.NavigationController.GotoTotemResultEvent += gotoResultListHandler; string ser; if (IsProfileNull) ser = userDefs.StringForKey ("eigenschappen"); else ser = _appController.GetSerFromProfile (currProfiel.name); if (ser != null) { _appController.Eigenschappen = JsonSerializer.DeserializeFromString <List<Eigenschap>> (ser); (tblEigenschappen.Source as EigenschappenTableViewSource).Eigenschappen = _appController.Eigenschappen; } tblEigenschappen.ReloadSections (new NSIndexSet (0), UITableViewRowAnimation.None); tblEigenschappen.ScrollRectToVisible (new CGRect(0,0,1,1), false); _appController.FireUpdateEvent (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.AllTotems); //if else that prevents crash when app is killed if (_appController.CurrentProfiel == null) { var i = new Intent(this, typeof(MainActivity)); StartActivity(i); Finish(); } else { //Action bar InitializeActionBar(SupportActionBar); title = ActionBarTitle; close = ActionBarClose; back = ActionBarBack; delete = ActionBarDelete; //single toast for entire activity mToast = Toast.MakeText(this, "", ToastLength.Short); profile = _appController.CurrentProfiel; totemList = _appController.GetTotemsFromProfiel(profile.name); totemAdapter = new TotemAdapter(this, totemList); allTotemListView = FindViewById<ListView>(Resource.Id.all_totem_list); allTotemListView.Adapter = totemAdapter; allTotemListView.ItemClick += ShowDetail; allTotemListView.ItemLongClick += DeleteTotem; title.Text = "Totems voor " + profile.name; noTotems = FindViewById<TextView>(Resource.Id.empty_totem); close.Click += HideDeleteTotems; delete.Click += ShowDeleteTotems; if (totemList.Count == 0) { noTotems.Visibility = ViewStates.Visible; delete.Visibility = ViewStates.Gone; } else { delete.Visibility = ViewStates.Visible; } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.AllEigenschappen); //Action bar InitializeActionBar (SupportActionBar); title = ActionBarTitle; query = ActionBarQuery; search = ActionBarSearch; back = ActionBarBack; mToastShort = Toast.MakeText (this, "", ToastLength.Short); mToastLong = Toast.MakeText (this, "", ToastLength.Long); currProfiel = _appController.CurrentProfiel; IsProfileNull = (currProfiel == null); eigenschappenList = _appController.Eigenschappen; //listener to pass to EigenschapAdapter containing context mListener = new MyOnCheckBoxClickListener (this); eigenschapAdapter = new EigenschapAdapter (this, _appController.Eigenschappen, mListener); allEigenschappenListView = FindViewById<ListView> (Resource.Id.all_eigenschappen_list); allEigenschappenListView.Adapter = eigenschapAdapter; title.Text = IsProfileNull ? "Eigenschappen" : "Selectie"; query.Hint = "Zoek eigenschap"; //hide keyboard when scrolling through list allEigenschappenListView.SetOnTouchListener(new MyOnTouchListener(this, query)); //initialize progress dialog used when calculating totemlist progress = new ProgressDialog(this); progress.SetMessage("Totems zoeken..."); progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetCancelable(false); LiveSearch (); sharedPrefs = GetSharedPreferences("data", FileCreationMode.Private); var vind = FindViewById<LinearLayout> (Resource.Id.vind); vind.Click += VindTotem; bottomBar = FindViewById<RelativeLayout> (Resource.Id.bottomBar); search.Visibility = ViewStates.Visible; search.Click += (sender, e) => ToggleSearch (); //hide keyboard when enter is pressed query.EditorAction += (sender, e) => { if (e.ActionId == ImeAction.Search) KeyboardHelper.HideKeyboard(this); else e.Handled = false; }; }