コード例 #1
0
        public QuickAction(Context context, QuickActionLayout orientation)
        {
            _context = context;
            _window = new PopupWindow(context);
            _childPos = 0;

            _window.TouchIntercepted += HandleTouchIntercepted;
            _windowManager = context.GetSystemService(Context.WindowService).JavaCast<IWindowManager>();

            _orientation = orientation;
            _inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);

            SetRootViewId(orientation == QuickActionLayout.Horizontal ? Resource.Layout.popup_horizontal : Resource.Layout.popup_vertical);
        }
コード例 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button popMenu = FindViewById<Button>(Resource.Id.popupMenuBtn);
            Button popWindow = FindViewById<Button>(Resource.Id.popupWindowBtn);

           
			
            popMenu.Click += delegate
            {
                    PopupMenu menu = new PopupMenu (this, popMenu);

                    // with Android 3 need to use MenuInfater to inflate the menu
                    //menu.MenuInflater.Inflate (Resource.Menu.popup_menu, menu.Menu);

                    // with Android 4 Inflate can be called directly on the menu
                    menu.Inflate (Resource.Menu.popup_menu);

                    menu.MenuItemClick += (s1, arg1) => {
                            Console.WriteLine ("{0} selected", arg1.Item.TitleFormatted);
                        };

                    // Android 4 now has the DismissEvent
                    menu.DismissEvent += (s2, arg2) => {
                            Console.WriteLine ("menu dismissed"); 
                        };

                    menu.Show ();
            };

            popWindow.Click += delegate
                {
                    LayoutInflater inflater = (LayoutInflater) this.GetSystemService(Context.LayoutInflaterService); 

                    PopupWindow pw = new PopupWindow(inflater.Inflate(Resource.Layout.popup_example, null, false),200,250, true);

                    pw.ShowAtLocation(this.FindViewById(Resource.Id.main), GravityFlags.Center, 0, 0);
                    Button closePopup = (Button)pw.ContentView.FindViewById(Resource.Id.closePopup);
                    closePopup.Click += delegate {
                            pw.Dismiss();
                    };
                };
        }
コード例 #3
0
ファイル: UndoBar.cs プロジェクト: fatelord/chgk
		public UndoBar (Context context, string text, View parentView)
		{
			_parentView = parentView;

			var view = (context.GetSystemService (Context.LayoutInflaterService) as LayoutInflater).Inflate (Resource.Layout.undo_bar, null);

			var undoButton = view.FindViewById (Resource.Id.undo_button);
			undoButton.Click += OnUndoClick;

			var titleTextView = view.FindViewById<TextView> (Resource.Id.undo_message);
			titleTextView.Text = text;

			_popup = new PopupWindow (view, ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, false);
            _popup.AnimationStyle = Resource.Style.popup_fade_animation;            
		}
コード例 #4
0
ファイル: HelpPopUp.cs プロジェクト: mdanz92/teco.SkillStore
		private void InitializeUi(int viewResource, string msg)
		{
			_window = new PopupWindow(_context);

			var displayMetrics = _context.Resources.DisplayMetrics;
			_displaySize = new Point();
			_displaySize.X = displayMetrics.WidthPixels;
			_displaySize.Y = displayMetrics.HeightPixels;


			SetContentView(viewResource);

			_upImageView = _view.FindViewById<RelativeLayout>(Resource.Id.ArrowUp);
			_downImageView = _view.FindViewById<RelativeLayout>(Resource.Id.ArrowDown);

			_helpTextView = _view.FindViewById<TextView>(Resource.Id.Message);
			_helpTextView.MovementMethod = ScrollingMovementMethod.Instance;
			_helpTextView.Selected = true;
			_helpTextView.Text = msg;
		}
コード例 #5
0
      public override bool OnOptionsItemSelected(IMenuItem item)
      {
         if (item == _aboutUsMenu)
         {
            Display display = WindowManager.DefaultDisplay;
            Android.Util.DisplayMetrics metrics = new Android.Util.DisplayMetrics();
            display.GetMetrics(metrics);
            int width = (int)Math.Min(display.Width * 0.8, 360 * metrics.Density);
            int height = (int)Math.Min(display.Height * 0.8, 480 * metrics.Density);

            PopupWindow aboutWindow = new PopupWindow(LayoutInflater.Inflate(Resource.Layout.about_us, null, false), width, height);
            TextView appVersionText = aboutWindow.ContentView.FindViewById<TextView>(Resource.Id.AboutUsVersionTextView);
            appVersionText.Text = String.Format("{0}: {1}",
               Resources.GetString(Resource.String.application_version),
               this.PackageManager.GetPackageInfo(PackageName, Android.Content.PM.PackageInfoFlags.Activities).VersionName);

            Button closeButton = aboutWindow.ContentView.FindViewById<Button>(Resource.Id.AboutUsCloseButton);
            closeButton.Click += delegate
            {
               aboutWindow.Dismiss();
            };

            TextView aboutUsNoteTextView =
               aboutWindow.ContentView.FindViewById<TextView>(Resource.Id.AboutUsModuleInfoTextView);
            //Emgu.CV.Util.VectorOfOclPlatformInfo oclInfo = Emgu.CV.OclInvoke.GetPlatformInfo();
            
            String txt = String.Format("Has OpenCL: {0}", CvInvoke.HaveOpenCL);

            if (CvInvoke.HaveOpenCL)
            {
               txt = String.Format("{0}{1}Use OpenCL: {2}{3}{4}{5}",
                  txt, System.Environment.NewLine,
                  CvInvoke.UseOpenCL, System.Environment.NewLine,
                  CvInvoke.OclGetPlatformsSummary(), System.Environment.NewLine);
            }
            txt = String.Format("{0}{1}Has Cuda: {2}", txt, System.Environment.NewLine, CudaInvoke.HasCuda);
            

            aboutUsNoteTextView.Text = txt;

            aboutWindow.ShowAtLocation(this.Window.DecorView, GravityFlags.Center, 0, 0);
         }
         else if (item == _settingsMenu)
         {
            Intent settingsIntent = new Intent(this, typeof(SettingActivity));
            StartActivity(settingsIntent);
         }

         return base.OnOptionsItemSelected(item);
      }
        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 { };
            }
        }
コード例 #7
0
		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 ();
			};
		}
コード例 #8
0
		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));
			};
		}
コード例 #9
0
 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;
 }
コード例 #10
0
 private void HandleDismiss()
 {
     if (popup == null)
         return;
     cachedDataContext = DataContext;
     bindingContext.DataContext = null;
     popup = null;
     if (!dissmissing)
     {
         isVisible = false;
         OnIsVisibleChanged(EventArgs.Empty);
         OnDissmissed(EventArgs.Empty);
     }
 }
コード例 #11
0
		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);
			}
		}