//hides keyboard when checkbox is clicked public void OnCheckboxClicked() { Context context; mContext.TryGetTarget(out context); KeyboardHelper.HideKeyboard(context); }
//hides keyboard when dialog is dismissed public void OnDismiss(IDialogInterface dialogInterface) { Context context = null; mContext.TryGetTarget(out context); KeyboardHelper.HideKeyboard(context); }
//get DetailActivity of the totem that is clicked //ID is passed as parameter void ShowDetail(object sender, AdapterView.ItemClickEventArgs e) { int pos = e.Position; var item = totemAdapter.GetItemAtPosition(pos); KeyboardHelper.HideKeyboard(this); _appController.TotemSelected(item.nid); }
//hides the search bar void HideSearch() { back.Visibility = ViewStates.Visible; title.Visibility = ViewStates.Visible; query.Visibility = ViewStates.Gone; KeyboardHelper.HideKeyboard(this, query); totemAdapter.UpdateData(_appController.Totems); totemAdapter.NotifyDataSetChanged(); }
//hides the search bar void HideSearch() { back.Visibility = ViewStates.Visible; title.Visibility = ViewStates.Visible; query.Visibility = ViewStates.Gone; search.SetImageResource(Resource.Drawable.ic_search_white_24dp); KeyboardHelper.HideKeyboard(this, query); eigenschapAdapter.UpdateData(_appController.Eigenschappen); eigenschapAdapter.NotifyDataSetChanged(); query.Text = ""; fullList = true; if (menu != null) { UpdateOptionsMenu(); } }
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.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; } }; }