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.AllTotems); //Action bar InitializeActionBar(SupportActionBar); title = ActionBarTitle; query = ActionBarQuery; search = ActionBarSearch; back = ActionBarBack; totemList = _appController.Totems; totemAdapter = new TotemAdapter(this, totemList); allTotemListView = FindViewById <ListView> (Resource.Id.all_totem_list); allTotemListView.Adapter = totemAdapter; allTotemListView.FastScrollEnabled = true; title.Text = "Totems"; query.Hint = "Zoek totem"; //hide keyboard when scrolling through list allTotemListView.SetOnTouchListener(new MyOnTouchListener(this, query)); LiveSearch(); _appController.detailMode = AppController.DetailMode.NORMAL; allTotemListView.ItemClick += ShowDetail; search.Visibility = ViewStates.Visible; search.Click += (sender, e) => ToggleSearch(); //hide keybaord when enter is pressed query.EditorAction += (sender, e) => { if (e.ActionId == ImeAction.Search) { KeyboardHelper.HideKeyboard(this); } else { e.Handled = false; } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Totems); //Action bar InitializeActionBar(SupportActionBar); title = ActionBarTitle; back = ActionBarBack; int selected = Intent.GetIntExtra("selected", 0); totemList = _appController.TotemEigenschapDict.Keys.ToList(); var freqs = _appController.TotemEigenschapDict.Values.ToArray(); totemAdapter = new TotemAdapter(this, totemList, freqs, selected); totemListView = FindViewById <ListView> (Resource.Id.totem_list); totemListView.Adapter = totemAdapter; totemListView.ItemClick += ShowDetail; title.Text = "Totems"; }