void achievementsListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { GC.Collect(); isItemClicked = true; if (!_badgePopupWindow.IsShowing && _subcategoriesListView.Visibility == ViewStates.Gone && _categoriesListView.Visibility == ViewStates.Gone) { int iID = 0; int jID = 0; _vibe.Vibrate(50); for (int i = 0; i < AppInfo._achievesInfo.CategoryArray.Count(); i++) { for (int j = 0; j < AppInfo._achievesInfo.CategoryArray[i].Projects.Count(); j++) { for (int k = 0; k < AppInfo._achievesInfo.CategoryArray[i].Projects[j].Achievements.Count(); k++) { if (AppInfo._achievesInfo.CategoryArray[i].Projects[j].Achievements[k].ApiName == _achievementsList[(int)e.Id].AchieveApiName) { achieve = AppInfo._achievesInfo.CategoryArray[i].Projects[j].Achievements[k]; iID = i; jID = j; } } } } LayoutInflater inflater = (LayoutInflater)this.GetSystemService(LayoutInflaterService); ViewGroup relativeAgedSummary = new RelativeLayout(this); View layout = inflater.Inflate(Resource.Layout.badgewindowactivitylayout, relativeAgedSummary); ImageView badgeImage = (ImageView)layout.FindViewById(Resource.Id.badgewin_BadgeImageView); ImageView badgeImageShape = (ImageView)layout.FindViewById(Resource.Id.badgewin_BadgeImageViewShadow); ImageView badgeSheet = (ImageView)layout.FindViewById(Resource.Id.BadgeSheetImageView); TextView badgeName = (TextView)layout.FindViewById(Resource.Id.badgewin_badgeTextView); TextView categoryNameProjectName = (TextView)layout.FindViewById(Resource.Id.badgewin_categ_projectTextView); TextView badgeHowWonderDescr = (TextView)layout.FindViewById(Resource.Id.badgewin_wonderdescrTextView); TextView badgeHowDescr = (TextView)layout.FindViewById(Resource.Id.badgewin_howwonderTextView); TextView badgeDetails = (TextView)layout.FindViewById(Resource.Id.badgewin_detailsTextView); if (!AppInfo.IsLocaleRu) { badgeHowDescr.Text = "Wonder how this Badge was earned?"; } //badgewin_howwonderTextView ImageButton badgeReadyButton = (ImageButton)layout.FindViewById(Resource.Id.badgewin_CloseImageButton); ImageButton badgeReadyButtonfake = (ImageButton)layout.FindViewById(Resource.Id.badgewin_CloseImageButtonFake); //Button badgeInactiveBackgroundButton = (Button)layout.FindViewById(Resource.Id.badgewin_inactiveButton); //badgeInactiveBackgroundButton.Click += new EventHandler(badgeInactiveBackgroundButton_Click); badgeName.Text = achieve.DisplayName; //using (var bitmap = BitmapFactory.DecodeFile(@"/data/data/ru.hintsolutions.itsbeta/cache/pictures/" + "achive" + achieve.ApiName + ".PNG")) //{ // badgeImage.SetImageBitmap(bitmap); //} using (var d = Drawable.CreateFromPath(@"/data/data/ru.hintsolutions.itsbeta/cache/pictures/" + "achive" + achieve.ApiName + ".PNG")) { badgeImage.SetImageDrawable(d); } //badgeImage.SetScaleType(ImageView.ScaleType.FitStart); //badgeImageShape.SetImageResource(Resource.Drawable.Paper_BadgeShape); categoryNameProjectName.Text = AppInfo._achievesInfo.CategoryArray[iID].DisplayName + ", " + AppInfo._achievesInfo.CategoryArray[iID].Projects[jID].DisplayName; badgeDetails.SetText(Android.Text.Html.FromHtml(achieve.Details), TextView.BufferType.Normal); badgeHowWonderDescr.SetText(Android.Text.Html.FromHtml(achieve.Description), TextView.BufferType.Spannable); badgeHowWonderDescr.Append("\n"); badgeHowWonderDescr.Append(Android.Text.Html.FromHtml(achieve.Advertisments)); badgeHowWonderDescr.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; categoryNameProjectName.SetTypeface(_font, TypefaceStyle.Normal); badgeHowWonderDescr.SetTypeface(_font, TypefaceStyle.Normal); badgeHowDescr.SetTypeface(_font, TypefaceStyle.Normal); badgeDetails.SetTypeface(_font, TypefaceStyle.Normal); badgeName.SetTypeface(_font, TypefaceStyle.Normal); //badgeHowWonderDescr.MovementMethod. LinearLayout bonusPaperListLinearLayout = (LinearLayout)layout.FindViewById(Resource.Id.bonuspaperlist_linearLayout); // bonusPaperListLinearLayout.RemoveAllViews(); if (achieve.Bonuses.Count() == 0) { bonusPaperListLinearLayout.Visibility = ViewStates.Gone; } if (achieve.Bonuses.Count() == 1) { var bonus = achieve.Bonuses.First(); LayoutInflater layoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View bonusView = layoutInflater.Inflate(Resource.Layout.bonusonlistrowlayout, null); ImageView bonusLineImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_GreenBonusImageView); ImageView discountLineImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_BlueBonusImageView); ImageView giftLineImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_VioletBonusImageView); ImageView bonusDescrBackgroundImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_greendescbackgroundImageView); ImageView discountDescrBackgroundImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_bluedescbackgroundImageView); ImageView giftDescrBackgroundImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_violetdescbackgroundImageView); TextView bonusName = (TextView)bonusView.FindViewById(Resource.Id.badgewin_bonusTextView); TextView bonusDescr = (TextView)bonusView.FindViewById(Resource.Id.badgewin_bonusdescrTextView); bonusDescr.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; bonusLineImage.Visibility = ViewStates.Invisible; discountLineImage.Visibility = ViewStates.Invisible; giftLineImage.Visibility = ViewStates.Invisible; bonusDescrBackgroundImage.Visibility = ViewStates.Invisible; discountDescrBackgroundImage.Visibility = ViewStates.Invisible; giftDescrBackgroundImage.Visibility = ViewStates.Invisible; bonusDescr.Visibility = ViewStates.Invisible; bonusName.Visibility = ViewStates.Invisible; bonusName.SetTypeface(_font, TypefaceStyle.Normal); bonusDescr.SetTypeface(_font, TypefaceStyle.Normal); if (bonus.Type == "discount") { bonusLineImage.Visibility = ViewStates.Invisible; discountLineImage.Visibility = ViewStates.Visible; giftLineImage.Visibility = ViewStates.Invisible; bonusPaperListLinearLayout.SetBackgroundColor(new Color(201, 238, 255, 89)); bonusDescr.Visibility = ViewStates.Visible; bonusName.Visibility = ViewStates.Visible; bonusName.Text = "Скидка"; if (!AppInfo.IsLocaleRu) { bonusName.Text = "Discount"; } bonusDescr.SetText(Android.Text.Html.FromHtml(bonus.Description), TextView.BufferType.Spannable); bonusPaperListLinearLayout.AddView(bonusView); } if (bonus.Type == "bonus") { bonusLineImage.Visibility = ViewStates.Visible; discountLineImage.Visibility = ViewStates.Invisible; giftLineImage.Visibility = ViewStates.Invisible; bonusPaperListLinearLayout.SetBackgroundColor(new Color(189, 255, 185, 127)); bonusDescr.Visibility = ViewStates.Visible; bonusName.Visibility = ViewStates.Visible; bonusName.Text = "Бонус"; if (!AppInfo.IsLocaleRu) { bonusName.Text = "Bonus"; } bonusDescr.SetText(Android.Text.Html.FromHtml(bonus.Description), TextView.BufferType.Spannable); bonusPaperListLinearLayout.AddView(bonusView); } if (bonus.Type == "present") { bonusLineImage.Visibility = ViewStates.Invisible; discountLineImage.Visibility = ViewStates.Invisible; giftLineImage.Visibility = ViewStates.Visible; bonusPaperListLinearLayout.SetBackgroundColor(new Color(255, 185, 245, 127)); bonusDescr.Visibility = ViewStates.Visible; bonusName.Visibility = ViewStates.Visible; bonusName.Text = "Подарок"; if (!AppInfo.IsLocaleRu) { bonusName.Text = "Present"; } bonusDescr.SetText(Android.Text.Html.FromHtml(bonus.Description), TextView.BufferType.Spannable); bonusPaperListLinearLayout.AddView(bonusView); } } if (achieve.Bonuses.Count() > 1) { foreach (var bonus in achieve.Bonuses) { LayoutInflater layoutInflater = (LayoutInflater)BaseContext.GetSystemService(LayoutInflaterService); View bonusView = layoutInflater.Inflate(Resource.Layout.bonusonlistrowlayout, null); ImageView bonusLineImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_GreenBonusImageView); ImageView discountLineImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_BlueBonusImageView); ImageView giftLineImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_VioletBonusImageView); ImageView bonusDescrBackgroundImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_greendescbackgroundImageView); ImageView discountDescrBackgroundImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_bluedescbackgroundImageView); ImageView giftDescrBackgroundImage = (ImageView)bonusView.FindViewById(Resource.Id.badgewin_violetdescbackgroundImageView); TextView bonusName = (TextView)bonusView.FindViewById(Resource.Id.badgewin_bonusTextView); TextView bonusDescr = (TextView)bonusView.FindViewById(Resource.Id.badgewin_bonusdescrTextView); bonusName.SetTypeface(_font, TypefaceStyle.Normal); bonusDescr.SetTypeface(_font, TypefaceStyle.Normal); bonusDescr.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; bonusLineImage.Visibility = ViewStates.Invisible; discountLineImage.Visibility = ViewStates.Invisible; giftLineImage.Visibility = ViewStates.Invisible; bonusDescrBackgroundImage.Visibility = ViewStates.Invisible; discountDescrBackgroundImage.Visibility = ViewStates.Invisible; giftDescrBackgroundImage.Visibility = ViewStates.Invisible; bonusDescr.Visibility = ViewStates.Invisible; bonusName.Visibility = ViewStates.Invisible; if (bonus.Type == "discount") { bonusLineImage.Visibility = ViewStates.Invisible; discountLineImage.Visibility = ViewStates.Visible; giftLineImage.Visibility = ViewStates.Invisible; bonusDescrBackgroundImage.Visibility = ViewStates.Invisible; discountDescrBackgroundImage.Visibility = ViewStates.Visible; giftDescrBackgroundImage.Visibility = ViewStates.Invisible; bonusDescr.Visibility = ViewStates.Visible; bonusName.Visibility = ViewStates.Visible; bonusName.Text = "Скидка"; if (!AppInfo.IsLocaleRu) { bonusName.Text = "Discount"; } bonusDescr.SetText(Android.Text.Html.FromHtml(bonus.Description), TextView.BufferType.Spannable); bonusPaperListLinearLayout.AddView(bonusView); } if (bonus.Type == "bonus") { bonusLineImage.Visibility = ViewStates.Visible; discountLineImage.Visibility = ViewStates.Invisible; giftLineImage.Visibility = ViewStates.Invisible; bonusDescrBackgroundImage.Visibility = ViewStates.Visible; discountDescrBackgroundImage.Visibility = ViewStates.Invisible; giftDescrBackgroundImage.Visibility = ViewStates.Invisible; bonusDescr.Visibility = ViewStates.Visible; bonusName.Visibility = ViewStates.Visible; bonusName.Text = "Бонус"; if (!AppInfo.IsLocaleRu) { bonusName.Text = "Bonus"; } bonusDescr.SetText(Android.Text.Html.FromHtml(bonus.Description), TextView.BufferType.Spannable); bonusPaperListLinearLayout.AddView(bonusView); } if (bonus.Type == "present") { bonusLineImage.Visibility = ViewStates.Invisible; discountLineImage.Visibility = ViewStates.Invisible; giftLineImage.Visibility = ViewStates.Visible; bonusDescrBackgroundImage.Visibility = ViewStates.Invisible; discountDescrBackgroundImage.Visibility = ViewStates.Invisible; giftDescrBackgroundImage.Visibility = ViewStates.Visible; bonusDescr.Visibility = ViewStates.Visible; bonusName.Visibility = ViewStates.Visible; bonusName.Text = "Подарок"; if (!AppInfo.IsLocaleRu) { bonusName.Text = "Present"; } bonusDescr.SetText(Android.Text.Html.FromHtml(bonus.Description), TextView.BufferType.Spannable); bonusPaperListLinearLayout.AddView(bonusView); } } } _badgePopupWindow = new PopupWindow(layout, LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); _badgePopupWindow.ShowAsDropDown(FindViewById<TextView>(Resource.Id.secaondscr_faketextView), 0, 0); badgeReadyButton.Click += delegate { _vibe.Vibrate(50); badgeReadyButtonfake.StartAnimation(_buttonClickAnimation); _badgePopupWindow.Dismiss(); }; badgeSheet.Click += delegate{ }; badgeImage.Click += delegate { }; } }
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) { 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 (); }; }
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); } }