protected async override void OnStart() { bitopiApplication.CurrentActivity = "Approval Detail Activity"; base.OnStart(); var progressDialog = ProgressDialog.Show(this, null, "", true); repo = new ApprovalRepository(); List <ApprovalDetailsModel> aprovalList = await repo.GetPOApprovalDetails(bitopiApplication.User.UserCode, bitopiApplication.ApprovalRoleType, bitopiApplication.ApprovalType); _approvalList.Clear(); aprovalList.ForEach(s => _approvalList.Add(s)); _approvalListAdapter = new ApprovalDetalisListAdapter(_approvalList, lvApprovalDetailList, this); lvApprovalDetailList.SetAdapter(_approvalListAdapter); _approvalListAdapter.NotifyDataSetChanged(); _chkApproveAll.Click += (s, e) => { _approvalList.ForEach(t => t.isApproved = _chkApproveAll.Checked); _approvalListAdapter.SetData(_approvalList); _approvalListAdapter.NotifyDataSetChanged(); }; lvApprovalDetailList.SetGroupIndicator(null); progressDialog.Dismiss(); }
public override bool OnCreateOptionsMenu(IMenu menu) { MenuInflater.Inflate(Resource.Menu.optionmenu, menu); menuitem = menu.FindItem(Resource.Id.action_search); var test = new SearchView(this); menuitem.SetActionView(test); var searchView = MenuItemCompat.GetActionView(menuitem); int searchImgId = Resources.GetIdentifier("android:id/search_button", null, null); ImageView v = (ImageView)searchView.FindViewById(searchImgId); //v.SetImageResource(Resource.Drawable.abc_ic_search); _searchView = searchView.JavaCast <SearchView>(); setSearchIcons(_searchView); _searchView.QueryTextChange += (s, e) => { var searchFor = e.NewText.ToLower(); if (!String.IsNullOrEmpty(searchFor)) { //Console.System.Diagnostics.Debug.WriteLine("searchFor:" + searchFor); // find matches, IndexOf means look for the input anywhere in the items // but it isn't case-sensitive by default! var matches = (from i in _approvalList where i.POID.ToLower().Contains(searchFor) select i).ToList(); //foreach (var match in matches) { //matchList.Add (match); //} ApprovalDetailList list = new ApprovalDetailList(this); matches.ForEach(model => list.Add(model)); _approvalListAdapter.SetData(list); _approvalListAdapter.NotifyDataSetChanged(); //if (_searchListView.Visibility == ViewStates.Gone && _searchView.Iconified == false) //{ // //_searchListView.Visibility = ViewStates.Visible; // _searchView.Iconified = true; //} } else { _approvalListAdapter.SetData(_approvalList); _approvalListAdapter.NotifyDataSetChanged(); } }; _searchView.SetOnQueryTextFocusChangeListener(new CustomSearchViewOnFocusChangeListenter(this)); _searchView.SetOnSearchClickListener(new CustomSearchviewclicklistener(rltitle)); _searchView.SetOnCloseListener(new CustomSearchViewOnCloseListenter(rltitle, _approvalListAdapter, _approvalList)); return(base.OnCreateOptionsMenu(menu)); }
protected override void OnCreate(Bundle savedInstanceState) { builder = new Android.App.AlertDialog.Builder(this); builder.SetMessage("Hello, World!"); builder.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ }); base.OnCreate(savedInstanceState); _approvalList = new ApprovalDetailList(this); _approvalType = (ApprovalType)(Convert.ToInt16(Intent.GetStringExtra("ApprovalType"))); _approvalRoleType = (ApprovalRoleType)(Convert.ToInt16(Intent.GetStringExtra("ApprovalRoleType"))); SupportRequestWindowFeature(WindowCompat.FeatureActionBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetCustomView(Resource.Layout.custom_actionbar); rltitle = FindViewById <RelativeLayout>(Resource.Id.rltitle); SetContentView(Resource.Layout.ApprovalDetailList); lvApprovalDetailList = FindViewById <AnimatedExpandableListView>(Resource.Id.lvApprovalsDetails); _chkApproveAll = FindViewById <CheckBox>(Resource.Id.chkSelectAll); rlMsg = FindViewById <RelativeLayout>(Resource.Id.rlMsg); rlapprovalDetail = FindViewById <RelativeLayout>(Resource.Id.rlapprovalDetail); if (bitopiApplication.ApprovalRoleType == ApprovalRoleType.Recommend) { (FindViewById <Button>(Resource.Id.btnApproveAll)).Text = "RECOMMEND SELECTED"; (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Text = "NOT RECOMMEND SELECTED"; } else { (FindViewById <Button>(Resource.Id.btnApproveAll)).Text = "APPROVE SELECTED"; (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Text = "NOT APPROVE SELECTED"; } (FindViewById <Button>(Resource.Id.btnApproveAll)).Click += (s, e) => { builder.SetMessage("Do you want to " + (bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve ? "Approve" : "Recommend ") + _approvalList.Where(t => t.isApproved == true).Count() + " Approval"); builder.SetPositiveButton("OK", (sender, evnt) => { var progressDialog = ProgressDialog.Show(this, null, "", true); _approvalList.SaveSelected((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve ? "Approved" : "Recommended"), (numberOfSuccessFullOperation) => { progressDialog.Dismiss(); var tempApprovalList = _approvalList.Where(t => t.isDeleted == false).ToList(); _approvalList = new ApprovalDetailList(this); tempApprovalList.ForEach(st => _approvalList.Add(st)); _approvalListAdapter.SetData(_approvalList); _approvalListAdapter.NotifyDataSetChanged(); Toast.MakeText(this, "Total " + numberOfSuccessFullOperation + " Approval has been " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Approved" : "Recommended"), ToastLength.Long).Show(); if (numberOfSuccessFullOperation > 0 && _approvalList.Count == 0) { rlMsg.Visibility = ViewStates.Visible; rlapprovalDetail.Visibility = ViewStates.Gone; } }); /* do something on OK click */ }); builder.Create().Show(); }; (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Click += (s, e) => { builder.SetMessage("Do you want to " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Reject" : "Not Recommend ") + _approvalList.Where(t => t.isApproved == true).Count() + " Approval"); builder.SetPositiveButton("OK", (sender, evnt) => { var progressDialog = ProgressDialog.Show(this, null, "", true); _approvalList.SaveSelected((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Rejected" : "NotRecommend", (numberOfSuccessFullOperation) => { progressDialog.Dismiss(); var tempApprovalList = _approvalList.Where(t => t.isDeleted == false).ToList(); _approvalList = new ApprovalDetailList(this); tempApprovalList.ForEach(st => _approvalList.Add(st)); _approvalListAdapter.SetData(_approvalList); _approvalListAdapter.NotifyDataSetChanged(); Toast.MakeText(this, "Total " + numberOfSuccessFullOperation + " Approval has been " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Rejected" : "Not Recommended"), ToastLength.Long).Show(); if (numberOfSuccessFullOperation > 0 && _approvalList.Count == 0) { rlMsg.Visibility = ViewStates.Visible; rlapprovalDetail.Visibility = ViewStates.Gone; } }); }); builder.Create().Show(); }; RLleft_drawer = FindViewById <RelativeLayout>(Resource.Id.RLleft_drawer); mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Visibility = ViewStates.Visible; FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Click += (s, e) => { if (mDrawerLayout.IsDrawerOpen(RLleft_drawer)) { mDrawerLayout.CloseDrawer(RLleft_drawer); } else { mDrawerLayout.OpenDrawer(RLleft_drawer); } }; //base.LoadDrawerView(); }