void ListView_OnItemLongClick (object sender, AdapterView.ItemLongClickEventArgs e) { LocalBox clickedItem = foundLocalBoxes [e.Position]; LayoutInflater inflater = (LayoutInflater)Activity.GetSystemService (Context.LayoutInflaterService); View popupView; popupView = inflater.Inflate (Resource.Layout.custom_popup_root, null); PopupWindow popupWindow = new PopupWindow (popupView, e.View.Width, e.View.Height); //Hide popup window when clicking outside its view popupWindow.Focusable = true; popupWindow.Update (); popupWindow.SetBackgroundDrawable(new BitmapDrawable()); popupWindow.ShowAsDropDown (e.View, 0, - e.View.Height); ImageButton buttonDelete = (ImageButton) popupView.FindViewById(Resource.Id.button_popup_root_delete); buttonDelete.Click += delegate { popupWindow.Dismiss(); var alertDialogConfirmDelete = new Android.App.AlertDialog.Builder (Activity); alertDialogConfirmDelete.SetTitle("Waarschuwing"); alertDialogConfirmDelete.SetMessage("Weet u zeker dat u deze Pleiobox wilt verwijderen? \nDeze actie is niet terug te draaien."); alertDialogConfirmDelete.SetPositiveButton ("Verwijderen", async delegate { try{ DataLayer.Instance.DeleteLocalBox(clickedItem.Id); ResetUIToBeginState(true); UpdateLocalBoxes(); List<LocalBox> registeredLocalBoxes = await DataLayer.Instance.GetLocalBoxes (); if (registeredLocalBoxes.Count == 0) { HomeActivity homeActivity = (HomeActivity)Activity; homeActivity.ShowLoginDialog(); } //Reset logo //imageViewLogo.SetImageResource (Resource.Drawable.beeldmerk_belastingdienst); }catch (Exception ex){ Insights.Report(ex); Toast.MakeText (Android.App.Application.Context, "Het verwijderen van de Pleiobox is mislukt", ToastLength.Short).Show (); } }); alertDialogConfirmDelete.SetNegativeButton ("Annuleren", delegate { alertDialogConfirmDelete.Dispose(); }); alertDialogConfirmDelete.Create ().Show (); }; }
private void Show() { if (cachedDataContext != null && DataContext == null) bindingContext.DataContext = cachedDataContext; popup = new PopupWindow( bindingContext.BindingInflate(templateId, null), ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, true); popup.SetBackgroundDrawable(new BitmapDrawable()); // This is needed, see http://stackoverflow.com/a/3122696 popup.DismissEvent += delegate { HandleDismiss(); }; popup.AnimationStyle = Android.Resource.Style.AnimationTranslucent; popup.ShowAtLocation(this, GravityFlags.NoGravity, 0, 0); if (SoftInput) ShowSoftInput(); dissmissing = false; }
private void InitPopupWindow() { LayoutInflater inflater = LayoutInflater.From(Activity); //var popView = inflater.inflate(R.layout.popupwindow_content, null); var popView = inflater.Inflate(Resource.Layout.GuardianPopupWindowLayout,null); var ll_bindGuardian = popView.FindViewById<LinearLayout> (Resource.Id.ll_bindGuardian); var ll_applyGuardian = popView.FindViewById<LinearLayout> (Resource.Id.ll_ApplyGuardian); //guardianPopupWindow = new PopupWindow (popView,Android.Widget.LinearLayout.LayoutParams.WrapContent,Android.Widget.LinearLayout.LayoutParams.WrapContent); guardianPopupWindow = new PopupWindow (popView,600,290); var m = Resources.DisplayMetrics.Density; guardianPopupWindow.OutsideTouchable = true; guardianPopupWindow.Focusable = true; guardianPopupWindow.SetBackgroundDrawable(new ColorDrawable()); guardianPopupWindow.AnimationStyle = Resource.Style.AnimationPreview; guardianPopupWindow.ShowAsDropDown(ll_actionBar,-30,1,GravityFlags.Right|GravityFlags.Top); guardianPopupWindow.DismissEvent += (sender, e) => { BackgroundAlpha(1f); }; ll_bindGuardian.Click+= (sender, e) => { //绑定监护人 guardianPopupWindow.Dismiss(); Activity.StartActivity(typeof(BindGuardianActivity)); }; ll_applyGuardian.Click += (sender, e) => { //监护人申请 guardianPopupWindow.Dismiss(); Activity.StartActivity(typeof(GuardianApplyActivity)); }; }
void ListView_OnItemLongClick (object sender, AdapterView.ItemLongClickEventArgs e) { LayoutInflater inflater = (LayoutInflater)Activity.GetSystemService (Context.LayoutInflaterService); View popupView; TreeNode selectedItem = foundTreeNodeChildren [e.Position]; int numberOfDirectoriesOpened = ExplorerFragment.openedDirectories.Count; string currentDirectoryName = ExplorerFragment.openedDirectories [numberOfDirectoriesOpened - 1]; if (selectedItem.IsDirectory == true) { //Directory clicked - so open folder popup layout if (!currentDirectoryName.Equals ("/")) { popupView = inflater.Inflate (Resource.Layout.custom_popup_folder_subfolder, null); ClickHandlersFolderSubFolderPopupMenu (popupView, selectedItem); } else { popupView = inflater.Inflate (Resource.Layout.custom_popup_folder_root, null); } } else { //File clicked - so open file popup layout if (openedFolderIsShare || favoriteFolderOpened) { popupView = inflater.Inflate (Resource.Layout.custom_popup_file_share, null); } else if (openedFolderIsUnencrypted) { popupView = inflater.Inflate (Resource.Layout.custom_popup_file_unencrypted, null); } else { popupView = inflater.Inflate (Resource.Layout.custom_popup_file_encrypted, null); } ClickHandlersFilePopupMenu (popupView, selectedItem); } popupWindow = new PopupWindow (popupView, e.View.Width, e.View.Height); //Hide popup window when clicking outside its view popupWindow.Focusable = true; popupWindow.Update (); popupWindow.SetBackgroundDrawable (new BitmapDrawable ()); //Menu alleen tonen als het niet list item "Lokale favorieten" betreft if (selectedItem.Type == null) {//Directory selected so show menu (alleen als het niet een share van een ander is) if (currentDirectoryName.Equals ("/")) { if (!selectedItem.IsShare) { popupWindow.ShowAsDropDown (e.View, 0, -e.View.Height); } } else { if (openedFolderIsShare == false) { popupWindow.ShowAsDropDown (e.View, 0, -e.View.Height); } } } else if (!selectedItem.Type.Equals ("favorite")) {//File selected so show menu popupWindow.ShowAsDropDown (e.View, 0, -e.View.Height); } }