示例#1
0
        private void showCommentButtonHandler(View view, List <string> jump)
        {
            ImageButton showCommentsButton = view.FindViewById <ImageButton>(Resource.Id.showCommentsForJump);

            if (!hasComments(jump))
            {
                showCommentsButton.Enabled = false;
                var disabledColor = new Color(ContextCompat.GetColor(context, Resource.Color.colorPrimarySemi));
                showCommentsButton.SetBackgroundColor(disabledColor);
            }
            else
            {
                showCommentsButton.Enabled = true;
                showCommentsButton.Click  += ((sender, eventArgs) =>
                {
                    JumpCommentsFragment fragment = new JumpCommentsFragment(jump, this.context);
                    var ft = context.SupportFragmentManager.BeginTransaction();
                    ft.SetTransition(FragmentTransaction.TransitFragmentFade);
                    Fragment prev = context.SupportFragmentManager.FindFragmentByTag("comments");
                    if (prev != null)
                    {
                        ft.Remove(prev);
                    }
                    ft.AddToBackStack(null);
                    fragment.Show(ft, "comments");
                });
            }
        }
示例#2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View   view           = inflater.Inflate(Resource.Layout.NewJumpRequestDialog, container, false);
            Button jumpDoneButton = view.FindViewById <Button>(Resource.Id.jumpDoneButton);

            jumpDoneButton.Enabled = false;
            GridView gridView = view.FindViewById <GridView>(Resource.Id.formationsGridview);

            gridView.Adapter    = new FormationsGridViewAdapter(formations, this.Activity);
            gridView.ChoiceMode = ChoiceMode.MultipleModal;
            gridView.SetMultiChoiceModeListener(new MultiChoiceModeListener());
            gridView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                string formation = formations[e.Position];
                if (jumpList.Contains(formation))
                {
                    jumpList.Remove(formation);
                    if (jumpList.Count == 0)
                    {
                        jumpDoneButton.Enabled = false;
                    }
                    styleUncheckedCell(e.View);
                }
                else
                {
                    jumpList.Add(formation);
                    jumpDoneButton.Enabled = true;
                    styleCheckedCell(e.View);
                }
                loadJumpSequenceText(jumpDoneButton);
            };
            jumpDoneButton.Click += delegate
            {
                JumpCommentsFragment fragment = new JumpCommentsFragment(jumpList, this.Activity);
                var ft = this.Activity.SupportFragmentManager.BeginTransaction();
                ft.SetTransition(FragmentTransaction.TransitFragmentFade);
                Fragment prev = this.Activity.SupportFragmentManager.FindFragmentByTag("comments");
                if (prev != null)
                {
                    ft.Remove(prev);
                }
                ft.AddToBackStack(null);
                Dismiss();
                fragment.Show(ft, "comments");
            };
            return(view);
        }